Commit f4beed1e authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: gadget: f_acm: use CDC defines

Use the new CDC control-line and serial-state defines.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://lore.kernel.org/r/20220725075841.1187-7-johan@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 07526706
...@@ -57,18 +57,8 @@ struct f_acm { ...@@ -57,18 +57,8 @@ struct f_acm {
/* SetControlLineState request -- CDC 1.1 section 6.2.14 (INPUT) */ /* SetControlLineState request -- CDC 1.1 section 6.2.14 (INPUT) */
u16 port_handshake_bits; u16 port_handshake_bits;
#define ACM_CTRL_RTS (1 << 1) /* unused with full duplex */
#define ACM_CTRL_DTR (1 << 0) /* host is ready for data r/w */
/* SerialState notification -- CDC 1.1 section 6.3.5 (OUTPUT) */ /* SerialState notification -- CDC 1.1 section 6.3.5 (OUTPUT) */
u16 serial_state; u16 serial_state;
#define ACM_CTRL_OVERRUN (1 << 6)
#define ACM_CTRL_PARITY (1 << 5)
#define ACM_CTRL_FRAMING (1 << 4)
#define ACM_CTRL_RI (1 << 3)
#define ACM_CTRL_BRK (1 << 2)
#define ACM_CTRL_DSR (1 << 1)
#define ACM_CTRL_DCD (1 << 0)
}; };
static inline struct f_acm *func_to_acm(struct usb_function *f) static inline struct f_acm *func_to_acm(struct usb_function *f)
...@@ -387,7 +377,7 @@ static int acm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl) ...@@ -387,7 +377,7 @@ static int acm_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
value = 0; value = 0;
/* FIXME we should not allow data to flow until the /* FIXME we should not allow data to flow until the
* host sets the ACM_CTRL_DTR bit; and when it clears * host sets the USB_CDC_CTRL_DTR bit; and when it clears
* that bit, we should return to that no-flow state. * that bit, we should return to that no-flow state.
*/ */
acm->port_handshake_bits = w_value; acm->port_handshake_bits = w_value;
...@@ -585,7 +575,7 @@ static void acm_connect(struct gserial *port) ...@@ -585,7 +575,7 @@ static void acm_connect(struct gserial *port)
{ {
struct f_acm *acm = port_to_acm(port); struct f_acm *acm = port_to_acm(port);
acm->serial_state |= ACM_CTRL_DSR | ACM_CTRL_DCD; acm->serial_state |= USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_DCD;
acm_notify_serial_state(acm); acm_notify_serial_state(acm);
} }
...@@ -593,7 +583,7 @@ static void acm_disconnect(struct gserial *port) ...@@ -593,7 +583,7 @@ static void acm_disconnect(struct gserial *port)
{ {
struct f_acm *acm = port_to_acm(port); struct f_acm *acm = port_to_acm(port);
acm->serial_state &= ~(ACM_CTRL_DSR | ACM_CTRL_DCD); acm->serial_state &= ~(USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_DCD);
acm_notify_serial_state(acm); acm_notify_serial_state(acm);
} }
...@@ -603,9 +593,9 @@ static int acm_send_break(struct gserial *port, int duration) ...@@ -603,9 +593,9 @@ static int acm_send_break(struct gserial *port, int duration)
u16 state; u16 state;
state = acm->serial_state; state = acm->serial_state;
state &= ~ACM_CTRL_BRK; state &= ~USB_CDC_SERIAL_STATE_BREAK;
if (duration) if (duration)
state |= ACM_CTRL_BRK; state |= USB_CDC_SERIAL_STATE_BREAK;
acm->serial_state = state; acm->serial_state = state;
return acm_notify_serial_state(acm); return acm_notify_serial_state(acm);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment