From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932624AbcGOLDS (ORCPT ); Fri, 15 Jul 2016 07:03:18 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:33647 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932505AbcGOLDP (ORCPT ); Fri, 15 Jul 2016 07:03:15 -0400 Date: Fri, 15 Jul 2016 13:03:17 +0200 From: Johan Hovold To: Mathieu OTHACEHE Cc: johan@kernel.org, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 06/36] usb: serial: ti_usb_3410_5052: Do not use __uX types Message-ID: <20160715110317.GE8809@localhost> References: <1463042948-12205-1-git-send-email-m.othacehe@gmail.com> <1463042948-12205-7-git-send-email-m.othacehe@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1463042948-12205-7-git-send-email-m.othacehe@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, May 12, 2016 at 10:48:38AM +0200, Mathieu OTHACEHE wrote: > __uX types should only be used for user-space interactions. > > Signed-off-by: Mathieu OTHACEHE > --- > drivers/usb/serial/ti_usb_3410_5052.c | 66 ++++++++++++++++++----------------- > 1 file changed, 34 insertions(+), 32 deletions(-) > > diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c > index af4e145..164e07b 100644 > --- a/drivers/usb/serial/ti_usb_3410_5052.c > +++ b/drivers/usb/serial/ti_usb_3410_5052.c > @@ -179,23 +179,23 @@ > > /* Config struct */ > struct ti_uart_config { > - __u16 wBaudRate; > - __u16 wFlags; > - __u8 bDataBits; > - __u8 bParity; > - __u8 bStopBits; > + __be16 wBaudRate; > + __be16 wFlags; While I have nothing against replacing the __u, this makes me worried. How, if at all, is the endianess of these fields handled in the code? Ok, I see now it's using cpu_to_be16s after writing host-endian data into it. Could you clean that to use cpu_to_be16 instead (you may need to update an error message too)? Note that the wBaudRate assignment was still using __u16 after this patch. > + u8 bDataBits; > + u8 bParity; > + u8 bStopBits; > char cXon; > char cXoff; > - __u8 bUartMode; > + u8 bUartMode; > } __packed; > static int ti_write_byte(struct usb_serial_port *port, > - struct ti_device *tdev, unsigned long addr, > - __u8 mask, __u8 byte) > + struct ti_device *tdev, unsigned long addr, > + u8 mask, u8 byte) > { > int status; > unsigned int size; > @@ -1659,10 +1661,10 @@ static int ti_do_download(struct usb_device *dev, int pipe, > int len; > > for (pos = sizeof(struct ti_firmware_header); pos < size; pos++) > - cs = (__u8)(cs + buffer[pos]); > + cs = (u8)(cs + buffer[pos]); > > header = (struct ti_firmware_header *)buffer; > - header->wLength = cpu_to_le16((__u16)(size > + header->wLength = cpu_to_le16((u16)(size > - sizeof(struct ti_firmware_header))); Cast not needed. Thanks, Johan