From patchwork Mon Jul 25 07:58:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 593424 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2443C43334 for ; Mon, 25 Jul 2022 08:00:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233249AbiGYIAR (ORCPT ); Mon, 25 Jul 2022 04:00:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232933AbiGYIAI (ORCPT ); Mon, 25 Jul 2022 04:00:08 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4A5813CD2; Mon, 25 Jul 2022 01:00:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 3743BCE10D1; Mon, 25 Jul 2022 08:00:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ABB9C36AF2; Mon, 25 Jul 2022 08:00:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1658736001; bh=nubT7YyzSn8WkHv349JLvBEMunsHi77aVjSDGDc7v1g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZOfwFpp9tRdA/LNmfLQQDp+aW0/JmHKNUafl/71KHqxxsm4RSp+a+/GY1aonyzqKw 8EDErBXUyTpLFLG09yVWSLjxfZ7k20H3a5KyxcOH93W8XqIqlp928yRwtClbyhDVLv qUFukJUpnMcod7GF3/tTqlVtpiOI46nnJrfhHQDmZeqXWnuYtqqHaHlTgu3Lr+z0wV TBWcdki5F8XTYpGWXaEuhSXsqZPaUZzkvxUJfJRQTGhhzvLzH05x5L4YKONcA5dixz 3dbEBqNc9NQaPn1wB5DpAs3mjrDSYzsrqWhtOEw4DSmqFC+tpLyzDPbapmSjU2FAG2 xZnTm39J3sAPw== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oFt0e-0000K8-5x; Mon, 25 Jul 2022 10:00:12 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Oliver Neukum , Felipe Balbi Cc: Yan Xinyu , linux-staging@lists.linux.dev, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH 4/7] USB: cdc-acm: use CDC serial-state defines Date: Mon, 25 Jul 2022 09:58:38 +0200 Message-Id: <20220725075841.1187-5-johan@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220725075841.1187-1-johan@kernel.org> References: <20220725075841.1187-1-johan@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Use the new CDC serial-state defines. Signed-off-by: Johan Hovold --- drivers/usb/class/cdc-acm.c | 24 ++++++++++++------------ drivers/usb/class/cdc-acm.h | 13 ------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index e2d80b99e074..352df48469b2 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c @@ -311,7 +311,7 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) dev_dbg(&acm->control->dev, "%s - serial state: 0x%x\n", __func__, newctrl); - if (!acm->clocal && (acm->ctrlin & ~newctrl & ACM_CTRL_DCD)) { + if (!acm->clocal && (acm->ctrlin & ~newctrl & USB_CDC_SERIAL_STATE_DCD)) { dev_dbg(&acm->control->dev, "%s - calling hangup\n", __func__); tty_port_tty_hangup(&acm->port, false); @@ -322,25 +322,25 @@ static void acm_process_notification(struct acm *acm, unsigned char *buf) acm->ctrlin = newctrl; acm->oldcount = acm->iocount; - if (difference & ACM_CTRL_DSR) + if (difference & USB_CDC_SERIAL_STATE_DSR) acm->iocount.dsr++; - if (difference & ACM_CTRL_DCD) + if (difference & USB_CDC_SERIAL_STATE_DCD) acm->iocount.dcd++; - if (newctrl & ACM_CTRL_BRK) { + if (newctrl & USB_CDC_SERIAL_STATE_BREAK) { acm->iocount.brk++; tty_insert_flip_char(&acm->port, 0, TTY_BREAK); } - if (newctrl & ACM_CTRL_RI) + if (newctrl & USB_CDC_SERIAL_STATE_RING_SIGNAL) acm->iocount.rng++; - if (newctrl & ACM_CTRL_FRAMING) + if (newctrl & USB_CDC_SERIAL_STATE_FRAMING) acm->iocount.frame++; - if (newctrl & ACM_CTRL_PARITY) + if (newctrl & USB_CDC_SERIAL_STATE_PARITY) acm->iocount.parity++; - if (newctrl & ACM_CTRL_OVERRUN) + if (newctrl & USB_CDC_SERIAL_STATE_OVERRUN) acm->iocount.overrun++; spin_unlock_irqrestore(&acm->read_lock, flags); - if (newctrl & ACM_CTRL_BRK) + if (newctrl & USB_CDC_SERIAL_STATE_BREAK) tty_flip_buffer_push(&acm->port); if (difference) @@ -905,9 +905,9 @@ static int acm_tty_tiocmget(struct tty_struct *tty) return (acm->ctrlout & USB_CDC_CTRL_DTR ? TIOCM_DTR : 0) | (acm->ctrlout & USB_CDC_CTRL_RTS ? TIOCM_RTS : 0) | - (acm->ctrlin & ACM_CTRL_DSR ? TIOCM_DSR : 0) | - (acm->ctrlin & ACM_CTRL_RI ? TIOCM_RI : 0) | - (acm->ctrlin & ACM_CTRL_DCD ? TIOCM_CD : 0) | + (acm->ctrlin & USB_CDC_SERIAL_STATE_DSR ? TIOCM_DSR : 0) | + (acm->ctrlin & USB_CDC_SERIAL_STATE_RING_SIGNAL ? TIOCM_RI : 0) | + (acm->ctrlin & USB_CDC_SERIAL_STATE_DCD ? TIOCM_CD : 0) | TIOCM_CTS; } diff --git a/drivers/usb/class/cdc-acm.h b/drivers/usb/class/cdc-acm.h index da7e8b8aaf28..759ac15631d3 100644 --- a/drivers/usb/class/cdc-acm.h +++ b/drivers/usb/class/cdc-acm.h @@ -22,19 +22,6 @@ #define USB_RT_ACM (USB_TYPE_CLASS | USB_RECIP_INTERFACE) -/* - * Input control lines and line errors. - */ - -#define ACM_CTRL_DCD 0x01 -#define ACM_CTRL_DSR 0x02 -#define ACM_CTRL_BRK 0x04 -#define ACM_CTRL_RI 0x08 - -#define ACM_CTRL_FRAMING 0x10 -#define ACM_CTRL_PARITY 0x20 -#define ACM_CTRL_OVERRUN 0x40 - /* * Internal driver structures. */