lkml.org 
[lkml]   [2020]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] usb: replace hardcoded maximum usb string length by definition
On Fri, Jun 12, 2020 at 01:32:47PM +0800, Macpaul Lin wrote:
> Replace hardcoded maximum usb string length (126 bytes) by definition
> "MAX_USB_STRING_LEN".
>
> Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>

...

> diff --git a/include/linux/usb.h b/include/linux/usb.h
> index 9f3c721..df4a9cb 100644
> --- a/include/linux/usb.h
> +++ b/include/linux/usb.h
> @@ -1815,6 +1815,8 @@ static inline int usb_get_ptm_status(struct usb_device *dev, void *data)
> 0, data);
> }
>
> +/* USB String descriptors can contain at most 126 characters. */
> +#define MAX_USB_STRING_LEN 126

This definition belongs in include/uapi/linux/usb/ch9.h (near the
definition of struct usb_string_descriptor) because it is part of the USB
standard rather than specific to the Linux USB stack.

Alan Stern

\
 
 \ /
  Last update: 2020-06-12 16:03    [W:0.096 / U:0.968 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site