Message ID | 20201104064703.15123-14-himadrispandya@gmail.com |
---|---|
State | New |
Headers | show |
Series | usb: serial: avoid using usb_control_msg() directly | expand |
On Wed, Nov 04, 2020 at 12:17:01PM +0530, Himadri Pandya wrote: > The new usb_control_msg_send() nicely wraps usb_control_msg() with proper > error check. Hence use the wrapper instead of calling usb_control_msg() > directly. > > Signed-off-by: Himadri Pandya <himadrispandya@gmail.com> > --- > drivers/usb/serial/iuu_phoenix.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c > index b4ba79123d9d..dfbcdcec94e7 100644 > --- a/drivers/usb/serial/iuu_phoenix.c > +++ b/drivers/usb/serial/iuu_phoenix.c > @@ -968,9 +968,8 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) > priv->poll = 0; > > #define SOUP(a, b, c, d) do { \ > - result = usb_control_msg(port->serial->dev, \ > - usb_sndctrlpipe(port->serial->dev, 0), \ > - b, a, c, d, NULL, 0, 1000); \ > + result = usb_control_msg_send(port->serial->dev, 0, b, a, c, d, NULL,\ > + 0, 1000, GFP_KERNEL); \ No need to for this either even if the result was used for anything else but logging (since there's no data stage). > dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x %d\n", a, b, c, d, result); } while (0) > > /* This is not UART related but IUU USB driver related or something */ Please drop. Johan
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index b4ba79123d9d..dfbcdcec94e7 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c @@ -968,9 +968,8 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) priv->poll = 0; #define SOUP(a, b, c, d) do { \ - result = usb_control_msg(port->serial->dev, \ - usb_sndctrlpipe(port->serial->dev, 0), \ - b, a, c, d, NULL, 0, 1000); \ + result = usb_control_msg_send(port->serial->dev, 0, b, a, c, d, NULL,\ + 0, 1000, GFP_KERNEL); \ dev_dbg(dev, "0x%x:0x%x:0x%x:0x%x %d\n", a, b, c, d, result); } while (0) /* This is not UART related but IUU USB driver related or something */
The new usb_control_msg_send() nicely wraps usb_control_msg() with proper error check. Hence use the wrapper instead of calling usb_control_msg() directly. Signed-off-by: Himadri Pandya <himadrispandya@gmail.com> --- drivers/usb/serial/iuu_phoenix.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)