netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices
@ 2017-11-15  0:21 Ben Hutchings
  2017-11-15  8:08 ` Bjørn Mork
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2017-11-15  0:21 UTC (permalink / raw)
  To: Enrico Mioso, Bjørn Mork
  Cc: Christian Panton, Christian Panton,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	Oliver Neukum, David S. Miller, Porto Rio, Greg Kroah-Hartman

On Tue, 2017-07-11 at 17:21 +0200, Enrico Mioso wrote:
> From: Enrico Mioso <mrkiko.rs-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> commit 2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6f upstream.
[...]
> --- a/drivers/net/usb/cdc_ncm.c
> +++ b/drivers/net/usb/cdc_ncm.c
> @@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d
>  	u8 *buf;
>  	int len;
>  	int temp;
> +	int err;
> 	u8 iface_no;
> 	struct usb_cdc_parsed_header hdr;
> +	u16 curr_ntb_format;
[...]
> +		err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
> +				      USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
> +				      0, iface_no, &curr_ntb_format, 2);
> +		if (err < 0) {
> +			goto error2;
> +		}
> +
> +		if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
[...]

usbnet_read_cmd() doesn't do any byte-swapping, so it looks like
curr_ntb_format will have little-endian byte order (__le16 not u16). 
The comparison will then need to be done using
le16_to_cpu(curr_ntb_format).

Ben.

-- 
Ben Hutchings
Software Developer, Codethink Ltd.

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices
  2017-11-15  0:21 [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices Ben Hutchings
@ 2017-11-15  8:08 ` Bjørn Mork
  0 siblings, 0 replies; 2+ messages in thread
From: Bjørn Mork @ 2017-11-15  8:08 UTC (permalink / raw)
  To: Ben Hutchings
  Cc: Enrico Mioso, Christian Panton, linux-usb, netdev, Oliver Neukum,
	David S. Miller, Porto Rio, Greg Kroah-Hartman

Ben Hutchings <ben.hutchings@codethink.co.uk> writes:
> On Tue, 2017-07-11 at 17:21 +0200, Enrico Mioso wrote:
>> From: Enrico Mioso <mrkiko.rs@gmail.com>
>> 
>> commit 2b02c20ce0c28974b44e69a2e2f5ddc6a470ad6f upstream.
> [...]
>> --- a/drivers/net/usb/cdc_ncm.c
>> +++ b/drivers/net/usb/cdc_ncm.c
>> @@ -724,8 +724,10 @@ int cdc_ncm_bind_common(struct usbnet *d
>>  	u8 *buf;
>>  	int len;
>>  	int temp;
>> +	int err;
>> 	u8 iface_no;
>> 	struct usb_cdc_parsed_header hdr;
>> +	u16 curr_ntb_format;
> [...]
>> +		err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_FORMAT,
>> +				      USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
>> +				      0, iface_no, &curr_ntb_format, 2);
>> +		if (err < 0) {
>> +			goto error2;
>> +		}
>> +
>> +		if (curr_ntb_format == USB_CDC_NCM_NTB32_FORMAT) {
> [...]
>
> usbnet_read_cmd() doesn't do any byte-swapping, so it looks like
> curr_ntb_format will have little-endian byte order (__le16 not u16). 
> The comparison will then need to be done using
> le16_to_cpu(curr_ntb_format).

Right.  Thanks.  Fix coming up ASAP.

I cannot explain why since we are obviously reading and writing 2 bytes
here, but for some reason I've always thought of this value as 8 bit.


Bjørn

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-11-15  8:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15  0:21 [PATCH 4.4 27/56] cdc_ncm: Set NTB format again after altsetting switch for Huawei devices Ben Hutchings
2017-11-15  8:08 ` Bjørn Mork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).