* [PATCH -next] staging: ks7010: Macros with complex values @ 2021-02-11 9:22 Fatih Yildirim 2021-02-11 10:02 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Fatih Yildirim @ 2021-02-11 9:22 UTC (permalink / raw) To: gregkh, gustavo; +Cc: Fatih Yildirim, devel, linux-kernel Fix for checkpatch.pl warning: Macros with complex values should be enclosed in parentheses. Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> --- drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h index 39138191a556..c62a494ed6bb 100644 --- a/drivers/staging/ks7010/ks_hostif.h +++ b/drivers/staging/ks7010/ks_hostif.h @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { #define TX_RATE_FIXED 5 /* 11b rate */ -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ /* 11g rate */ -#define TX_RATE_6M (u8)(60 / 5) /* 11g basic rate */ -#define TX_RATE_12M (u8)(120 / 5) /* 11g basic rate */ -#define TX_RATE_24M (u8)(240 / 5) /* 11g basic rate */ -#define TX_RATE_9M (u8)(90 / 5) -#define TX_RATE_18M (u8)(180 / 5) -#define TX_RATE_36M (u8)(360 / 5) -#define TX_RATE_48M (u8)(480 / 5) -#define TX_RATE_54M (u8)(540 / 5) +#define TX_RATE_6M ((u8)(60 / 5)) /* 11g basic rate */ +#define TX_RATE_12M ((u8)(120 / 5)) /* 11g basic rate */ +#define TX_RATE_24M ((u8)(240 / 5)) /* 11g basic rate */ +#define TX_RATE_9M ((u8)(90 / 5)) +#define TX_RATE_18M ((u8)(180 / 5)) +#define TX_RATE_36M ((u8)(360 / 5)) +#define TX_RATE_48M ((u8)(480 / 5)) +#define TX_RATE_54M ((u8)(540 / 5)) static inline bool is_11b_rate(u8 rate) { -- 2.20.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 9:22 [PATCH -next] staging: ks7010: Macros with complex values Fatih Yildirim @ 2021-02-11 10:02 ` Greg KH 2021-02-11 10:57 ` Fatih YILDIRIM 0 siblings, 1 reply; 7+ messages in thread From: Greg KH @ 2021-02-11 10:02 UTC (permalink / raw) To: Fatih Yildirim; +Cc: gustavo, devel, linux-kernel On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > Fix for checkpatch.pl warning: > Macros with complex values should be enclosed in parentheses. > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > --- > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > 1 file changed, 12 insertions(+), 12 deletions(-) > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > index 39138191a556..c62a494ed6bb 100644 > --- a/drivers/staging/ks7010/ks_hostif.h > +++ b/drivers/staging/ks7010/ks_hostif.h > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > #define TX_RATE_FIXED 5 > > /* 11b rate */ > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ But these are not "complex macros" that need an extra () added to them, right? Checkpatch is a hint, it's not a code parser and can not always know what is happening. With your knowledge of C, does this look like something that needs to be "fixed"? thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 10:02 ` Greg KH @ 2021-02-11 10:57 ` Fatih YILDIRIM 2021-02-11 11:10 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Fatih YILDIRIM @ 2021-02-11 10:57 UTC (permalink / raw) To: Greg KH; +Cc: gustavo, devel, linux-kernel On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote: > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > > Fix for checkpatch.pl warning: > > Macros with complex values should be enclosed in parentheses. > > > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > > --- > > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > > index 39138191a556..c62a494ed6bb 100644 > > --- a/drivers/staging/ks7010/ks_hostif.h > > +++ b/drivers/staging/ks7010/ks_hostif.h > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > > #define TX_RATE_FIXED 5 > > > > /* 11b rate */ > > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ > > But these are not "complex macros" that need an extra () added to them, > right? > > Checkpatch is a hint, it's not a code parser and can not always know > what is happening. With your knowledge of C, does this look like > something that needs to be "fixed"? > > thanks, > > greg k-h Hi Greg, Thanks for your reply. Actually, I'm following the Eudyptula Challenge and I'm at task 10. Task is to find and fix a coding style in linux-next/drivers/staging. I've checked many files with checkpatch.pl but they are almost fine :) I found this one and prepared a patch for it. Thanks in advance for your comments and advice. Thanks, Fatih ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 10:57 ` Fatih YILDIRIM @ 2021-02-11 11:10 ` Greg KH 2021-02-11 12:23 ` Fatih Yildirim 0 siblings, 1 reply; 7+ messages in thread From: Greg KH @ 2021-02-11 11:10 UTC (permalink / raw) To: Fatih YILDIRIM; +Cc: devel, linux-kernel, gustavo On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote: > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote: > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > > > Fix for checkpatch.pl warning: > > > Macros with complex values should be enclosed in parentheses. > > > > > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > > > --- > > > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > > > index 39138191a556..c62a494ed6bb 100644 > > > --- a/drivers/staging/ks7010/ks_hostif.h > > > +++ b/drivers/staging/ks7010/ks_hostif.h > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > > > #define TX_RATE_FIXED 5 > > > > > > /* 11b rate */ > > > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > > > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > > > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > > > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > > > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > > > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > > > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > > > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ > > > > But these are not "complex macros" that need an extra () added to them, > > right? > > > > Checkpatch is a hint, it's not a code parser and can not always know > > what is happening. With your knowledge of C, does this look like > > something that needs to be "fixed"? > > > > thanks, > > > > greg k-h > > Hi Greg, > > Thanks for your reply. > Actually, I'm following the Eudyptula Challenge and I'm at task 10. First rule of that challenge is that you are not allowed to talk about it in public :) That being said, you didn't answer any of my questions above :( greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 11:10 ` Greg KH @ 2021-02-11 12:23 ` Fatih Yildirim 2021-02-11 12:52 ` Greg KH 0 siblings, 1 reply; 7+ messages in thread From: Fatih Yildirim @ 2021-02-11 12:23 UTC (permalink / raw) To: Greg KH; +Cc: devel, linux-kernel, gustavo On Thu, Feb 11, 2021 at 12:10:44PM +0100, Greg KH wrote: > On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote: > > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote: > > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > > > > Fix for checkpatch.pl warning: > > > > Macros with complex values should be enclosed in parentheses. > > > > > > > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > > > > --- > > > > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > > > > index 39138191a556..c62a494ed6bb 100644 > > > > --- a/drivers/staging/ks7010/ks_hostif.h > > > > +++ b/drivers/staging/ks7010/ks_hostif.h > > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > > > > #define TX_RATE_FIXED 5 > > > > > > > > /* 11b rate */ > > > > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > > > > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > > > > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > > > > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > > > > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > > > > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > > > > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > > > > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ > > > > > > But these are not "complex macros" that need an extra () added to them, > > > right? > > > > > > Checkpatch is a hint, it's not a code parser and can not always know > > > what is happening. With your knowledge of C, does this look like > > > something that needs to be "fixed"? > > > > > > thanks, > > > > > > greg k-h > > > > Hi Greg, > > > > Thanks for your reply. > > Actually, I'm following the Eudyptula Challenge and I'm at task 10. > > First rule of that challenge is that you are not allowed to talk about > it in public :) > > That being said, you didn't answer any of my questions above :( > > greg k-h Ohh no, missed the rule. Sorry for that, I feel rookie :) You are right, they are not complex macros. Besides that, type cast operator doesn't have the highest precedence. So, I think we can use enclosing paranthesis. Thanks, Fatih ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 12:23 ` Fatih Yildirim @ 2021-02-11 12:52 ` Greg KH 2021-02-11 13:29 ` Fatih YILDIRIM 0 siblings, 1 reply; 7+ messages in thread From: Greg KH @ 2021-02-11 12:52 UTC (permalink / raw) To: Fatih Yildirim; +Cc: devel, linux-kernel, gustavo On Thu, Feb 11, 2021 at 03:23:24PM +0300, Fatih Yildirim wrote: > On Thu, Feb 11, 2021 at 12:10:44PM +0100, Greg KH wrote: > > On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote: > > > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote: > > > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > > > > > Fix for checkpatch.pl warning: > > > > > Macros with complex values should be enclosed in parentheses. > > > > > > > > > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > > > > > --- > > > > > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > > > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > > > > > index 39138191a556..c62a494ed6bb 100644 > > > > > --- a/drivers/staging/ks7010/ks_hostif.h > > > > > +++ b/drivers/staging/ks7010/ks_hostif.h > > > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > > > > > #define TX_RATE_FIXED 5 > > > > > > > > > > /* 11b rate */ > > > > > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > > > > > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > > > > > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > > > > > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > > > > > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > > > > > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > > > > > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > > > > > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ > > > > > > > > But these are not "complex macros" that need an extra () added to them, > > > > right? > > > > > > > > Checkpatch is a hint, it's not a code parser and can not always know > > > > what is happening. With your knowledge of C, does this look like > > > > something that needs to be "fixed"? > > > > > > > > thanks, > > > > > > > > greg k-h > > > > > > Hi Greg, > > > > > > Thanks for your reply. > > > Actually, I'm following the Eudyptula Challenge and I'm at task 10. > > > > First rule of that challenge is that you are not allowed to talk about > > it in public :) > > > > That being said, you didn't answer any of my questions above :( > > > > greg k-h > > Ohh no, missed the rule. Sorry for that, I feel rookie :) > You are right, they are not complex macros. > Besides that, type cast operator doesn't have the highest precedence. > So, I think we can use enclosing paranthesis. I don't think they are needed, see how these are used please. thanks, greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH -next] staging: ks7010: Macros with complex values 2021-02-11 12:52 ` Greg KH @ 2021-02-11 13:29 ` Fatih YILDIRIM 0 siblings, 0 replies; 7+ messages in thread From: Fatih YILDIRIM @ 2021-02-11 13:29 UTC (permalink / raw) To: Greg KH; +Cc: devel, linux-kernel, gustavo Ok, thanks! On Thu, Feb 11, 2021 at 3:52 PM Greg KH <gregkh@linuxfoundation.org> wrote: > > On Thu, Feb 11, 2021 at 03:23:24PM +0300, Fatih Yildirim wrote: > > On Thu, Feb 11, 2021 at 12:10:44PM +0100, Greg KH wrote: > > > On Thu, Feb 11, 2021 at 01:57:04PM +0300, Fatih YILDIRIM wrote: > > > > On Thu, Feb 11, 2021 at 11:02:51AM +0100, Greg KH wrote: > > > > > On Thu, Feb 11, 2021 at 12:22:39PM +0300, Fatih Yildirim wrote: > > > > > > Fix for checkpatch.pl warning: > > > > > > Macros with complex values should be enclosed in parentheses. > > > > > > > > > > > > Signed-off-by: Fatih Yildirim <yildirim.fatih@gmail.com> > > > > > > --- > > > > > > drivers/staging/ks7010/ks_hostif.h | 24 ++++++++++++------------ > > > > > > 1 file changed, 12 insertions(+), 12 deletions(-) > > > > > > > > > > > > diff --git a/drivers/staging/ks7010/ks_hostif.h b/drivers/staging/ks7010/ks_hostif.h > > > > > > index 39138191a556..c62a494ed6bb 100644 > > > > > > --- a/drivers/staging/ks7010/ks_hostif.h > > > > > > +++ b/drivers/staging/ks7010/ks_hostif.h > > > > > > @@ -498,20 +498,20 @@ struct hostif_mic_failure_request { > > > > > > #define TX_RATE_FIXED 5 > > > > > > > > > > > > /* 11b rate */ > > > > > > -#define TX_RATE_1M (u8)(10 / 5) /* 11b 11g basic rate */ > > > > > > -#define TX_RATE_2M (u8)(20 / 5) /* 11b 11g basic rate */ > > > > > > -#define TX_RATE_5M (u8)(55 / 5) /* 11g basic rate */ > > > > > > -#define TX_RATE_11M (u8)(110 / 5) /* 11g basic rate */ > > > > > > +#define TX_RATE_1M ((u8)(10 / 5)) /* 11b 11g basic rate */ > > > > > > +#define TX_RATE_2M ((u8)(20 / 5)) /* 11b 11g basic rate */ > > > > > > +#define TX_RATE_5M ((u8)(55 / 5)) /* 11g basic rate */ > > > > > > +#define TX_RATE_11M ((u8)(110 / 5)) /* 11g basic rate */ > > > > > > > > > > But these are not "complex macros" that need an extra () added to them, > > > > > right? > > > > > > > > > > Checkpatch is a hint, it's not a code parser and can not always know > > > > > what is happening. With your knowledge of C, does this look like > > > > > something that needs to be "fixed"? > > > > > > > > > > thanks, > > > > > > > > > > greg k-h > > > > > > > > Hi Greg, > > > > > > > > Thanks for your reply. > > > > Actually, I'm following the Eudyptula Challenge and I'm at task 10. > > > > > > First rule of that challenge is that you are not allowed to talk about > > > it in public :) > > > > > > That being said, you didn't answer any of my questions above :( > > > > > > greg k-h > > > > Ohh no, missed the rule. Sorry for that, I feel rookie :) > > You are right, they are not complex macros. > > Besides that, type cast operator doesn't have the highest precedence. > > So, I think we can use enclosing paranthesis. > > I don't think they are needed, see how these are used please. > > thanks, > > greg k-h ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2021-02-11 13:44 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-02-11 9:22 [PATCH -next] staging: ks7010: Macros with complex values Fatih Yildirim 2021-02-11 10:02 ` Greg KH 2021-02-11 10:57 ` Fatih YILDIRIM 2021-02-11 11:10 ` Greg KH 2021-02-11 12:23 ` Fatih Yildirim 2021-02-11 12:52 ` Greg KH 2021-02-11 13:29 ` Fatih YILDIRIM
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox