2020-08-25 15:48:48

by Xu, Yanfei

[permalink] [raw]
Subject: [PATCH] USB: integrate macro definitions into include/linux/usb.h

From: Yanfei Xu <[email protected]>

include/linux/usb.h also contains 'Hard limit' and 'Arbitrary limit'
macro definitions in it, hence we can integrate these from config.c
into include/linux/usb.h

Signed-off-by: Yanfei Xu <[email protected]>
---
drivers/usb/core/config.c | 3 ---
include/linux/usb.h | 3 +++
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index 562a730befda..58c5d946cd86 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -14,9 +14,6 @@
#include "usb.h"


-#define USB_MAXALTSETTING 128 /* Hard limit */
-
-#define USB_MAXCONFIG 8 /* Arbitrary limit */


static inline const char *plural(int n)
diff --git a/include/linux/usb.h b/include/linux/usb.h
index 20c555db4621..d0a117cfc6bd 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -275,9 +275,12 @@ void usb_put_intf(struct usb_interface *intf);

/* Hard limit */
#define USB_MAXENDPOINTS 30
+#define USB_MAXALTSETTING 128
+
/* this maximum is arbitrary */
#define USB_MAXINTERFACES 32
#define USB_MAXIADS (USB_MAXINTERFACES/2)
+#define USB_MAXCONFIG 8

/*
* USB Resume Timer: Every Host controller driver should drive the resume
--
2.18.2


2020-08-28 07:51:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] USB: integrate macro definitions into include/linux/usb.h

On Tue, Aug 25, 2020 at 11:44:21PM +0800, [email protected] wrote:
> From: Yanfei Xu <[email protected]>
>
> include/linux/usb.h also contains 'Hard limit' and 'Arbitrary limit'
> macro definitions in it, hence we can integrate these from config.c
> into include/linux/usb.h

Why? No one uses these values outside of this .c file, so why put a
value in a global .h file?

Who else wants to use these values? If something else needs it, then
sure, it could be moved, but until then, there's nothing wrong with the
existing code as-is from what I can tell.

thanks,

greg k-h

2020-08-30 05:25:43

by Xu, Yanfei

[permalink] [raw]
Subject: Re: [PATCH] USB: integrate macro definitions into include/linux/usb.h

I just think it is a clear up to make these macros get togather
which have the samilar attributes. That's why :)

Thanks,
Yanfei

On 8/28/20 3:48 PM, Greg KH wrote:
> On Tue, Aug 25, 2020 at 11:44:21PM +0800, [email protected] wrote:
>> From: Yanfei Xu <[email protected]>
>>
>> include/linux/usb.h also contains 'Hard limit' and 'Arbitrary limit'
>> macro definitions in it, hence we can integrate these from config.c
>> into include/linux/usb.h
>
> Why? No one uses these values outside of this .c file, so why put a
> value in a global .h file?
>
> Who else wants to use these values? If something else needs it, then
> sure, it could be moved, but until then, there's nothing wrong with the
> existing code as-is from what I can tell.
>
> thanks,
>
> greg k-h
>