Message ID | 20190408212648.2407234-4-arnd@arndb.de |
---|---|
State | Accepted |
Commit | 46b83629dede262315aa82179d105581f11763b6 |
Headers | show |
Series | [01/12] s390: remove -fno-strength-reduce flag | expand |
On Mon, Apr 08, 2019 at 11:26:17PM +0200, Arnd Bergmann wrote: > clang produces a harmless warning for each use for the qeth_adp_supported > macro: > > drivers/s390/net/qeth_l2_main.c:559:31: warning: implicit conversion from enumeration type 'enum qeth_ipa_setadp_cmd' to > different enumeration type 'enum qeth_ipa_funcs' [-Wenum-conversion] > if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) > ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/s390/net/qeth_core.h:179:41: note: expanded from macro 'qeth_adp_supported' > qeth_is_ipa_supported(&c->options.adp, f) > ~~~~~~~~~~~~~~~~~~~~~ ^ > > Add a version of this macro that uses the correct types, and > remove the unused qeth_adp_enabled() macro that has the same > problem. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> I wonder if it is better to just change the func parameter to type long. I guess it's better to keep the type safety to make sure values aren't unintentionally mixed but the body of the functions is the same so does the type actually matter? Regardless, this change does fix the warning so: Reviewed-by: Nathan Chancellor <natechancellor@gmail.com> > --- > drivers/s390/net/qeth_core.h | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h > index c851cf6e01c4..d603dfea97ab 100644 > --- a/drivers/s390/net/qeth_core.h > +++ b/drivers/s390/net/qeth_core.h > @@ -163,6 +163,12 @@ struct qeth_vnicc_info { > bool rx_bcast_enabled; > }; > > +static inline int qeth_is_adp_supported(struct qeth_ipa_info *ipa, > + enum qeth_ipa_setadp_cmd func) > +{ > + return (ipa->supported_funcs & func); > +} > + > static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa, > enum qeth_ipa_funcs func) > { > @@ -176,9 +182,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, > } > > #define qeth_adp_supported(c, f) \ > - qeth_is_ipa_supported(&c->options.adp, f) > -#define qeth_adp_enabled(c, f) \ > - qeth_is_ipa_enabled(&c->options.adp, f) > + qeth_is_adp_supported(&c->options.adp, f) > #define qeth_is_supported(c, f) \ > qeth_is_ipa_supported(&c->options.ipa4, f) > #define qeth_is_enabled(c, f) \ > -- > 2.20.0 >
On Tue, Apr 9, 2019 at 12:16 AM Nathan Chancellor <natechancellor@gmail.com> wrote: > > On Mon, Apr 08, 2019 at 11:26:17PM +0200, Arnd Bergmann wrote: > > clang produces a harmless warning for each use for the qeth_adp_supported > > macro: > > > > drivers/s390/net/qeth_l2_main.c:559:31: warning: implicit conversion from enumeration type 'enum qeth_ipa_setadp_cmd' to > > different enumeration type 'enum qeth_ipa_funcs' [-Wenum-conversion] > > if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) > > ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > drivers/s390/net/qeth_core.h:179:41: note: expanded from macro 'qeth_adp_supported' > > qeth_is_ipa_supported(&c->options.adp, f) > > ~~~~~~~~~~~~~~~~~~~~~ ^ > > > > Add a version of this macro that uses the correct types, and > > remove the unused qeth_adp_enabled() macro that has the same > > problem. > > > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> > > I wonder if it is better to just change the func parameter to type long. > I guess it's better to keep the type safety to make sure values aren't > unintentionally mixed but the body of the functions is the same so does > the type actually matter? I think using the right enum type makes most sense here, as this seems to be something that is easy to confuse. Arnd
On Mon, 8 Apr 2019 23:26:17 +0200 Arnd Bergmann <arnd@arndb.de> wrote: > clang produces a harmless warning for each use for the qeth_adp_supported > macro: > > drivers/s390/net/qeth_l2_main.c:559:31: warning: implicit conversion from enumeration type 'enum qeth_ipa_setadp_cmd' to > different enumeration type 'enum qeth_ipa_funcs' [-Wenum-conversion] > if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) > ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ > drivers/s390/net/qeth_core.h:179:41: note: expanded from macro 'qeth_adp_supported' > qeth_is_ipa_supported(&c->options.adp, f) > ~~~~~~~~~~~~~~~~~~~~~ ^ > > Add a version of this macro that uses the correct types, and > remove the unused qeth_adp_enabled() macro that has the same > problem. > > Signed-off-by: Arnd Bergmann <arnd@arndb.de> I have added this to our internal tree for Julian to pick up. -- blue skies, Martin. "Reality continues to ruin my life." - Calvin.
diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index c851cf6e01c4..d603dfea97ab 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -163,6 +163,12 @@ struct qeth_vnicc_info { bool rx_bcast_enabled; }; +static inline int qeth_is_adp_supported(struct qeth_ipa_info *ipa, + enum qeth_ipa_setadp_cmd func) +{ + return (ipa->supported_funcs & func); +} + static inline int qeth_is_ipa_supported(struct qeth_ipa_info *ipa, enum qeth_ipa_funcs func) { @@ -176,9 +182,7 @@ static inline int qeth_is_ipa_enabled(struct qeth_ipa_info *ipa, } #define qeth_adp_supported(c, f) \ - qeth_is_ipa_supported(&c->options.adp, f) -#define qeth_adp_enabled(c, f) \ - qeth_is_ipa_enabled(&c->options.adp, f) + qeth_is_adp_supported(&c->options.adp, f) #define qeth_is_supported(c, f) \ qeth_is_ipa_supported(&c->options.ipa4, f) #define qeth_is_enabled(c, f) \
clang produces a harmless warning for each use for the qeth_adp_supported macro: drivers/s390/net/qeth_l2_main.c:559:31: warning: implicit conversion from enumeration type 'enum qeth_ipa_setadp_cmd' to different enumeration type 'enum qeth_ipa_funcs' [-Wenum-conversion] if (qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/s390/net/qeth_core.h:179:41: note: expanded from macro 'qeth_adp_supported' qeth_is_ipa_supported(&c->options.adp, f) ~~~~~~~~~~~~~~~~~~~~~ ^ Add a version of this macro that uses the correct types, and remove the unused qeth_adp_enabled() macro that has the same problem. Signed-off-by: Arnd Bergmann <arnd@arndb.de> --- drivers/s390/net/qeth_core.h | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.20.0