On Tuesday, August 06, 2013 10:50 AM, Bryan Wu wrote: > On Mon, Aug 5, 2013 at 6:37 PM, Jingoo Han <jg1.han@xxxxxxxxxxx> wrote: > > On Friday, August 02, 2013 3:53 PM, Joe Perches wrote: > >> On Fri, 2013-08-02 at 08:54 +0900, Jingoo Han wrote: > >> > On Friday, August 02, 2013 7:24 AM, Bryan Wu wrote: > >> > > On Wed, Jul 31, 2013 at 11:03 PM, Jingoo Han <jg1.han@xxxxxxxxxxx> wrote: > >> > > > Don't mix different enum types to fix the following sparse warnings. > >> > > > > >> > > > drivers/leds/leds-lm355x.c:180:49: warning: mixing different enum types > >> > > > drivers/leds/leds-lm355x.c:180:49: int enum lm355x_tx2 versus > >> > > > drivers/leds/leds-lm355x.c:180:49: int enum lm355x_ntc > >> > > > drivers/leds/leds-lm355x.c:191:49: warning: mixing different enum types > >> > > > drivers/leds/leds-lm355x.c:191:49: int enum lm355x_tx2 versus > >> > > > drivers/leds/leds-lm355x.c:191:49: int enum lm355x_ntc > >> > >> > > Although there are some warning from sparse, changing a beautiful one > >> > > line code into multiple lines code looks not good to me. Is there any > >> > > better way to solve this issue. > >> > > >> > +CC Joe Perches, > >> > > >> > Hi Joe Perches, > >> > >> Hello. > >> > >> > Do you know any better way to fix sparse warnings, without changing a one > >> > line into multiple lines? > >> > >> sparse warnings are ignorable. > >> Ignore warnings when you know better than the tool. > >> > >> > Maybe if 'enum' is changed to '#define', it will not make the sparse > >> > warnings. But, it requires many code changes. > >> > >> That works but loses some type checking. > >> > >> Maybe you could add something like this > >> to the Makefile to make sparse not report > >> enum mismatches. > > > > Hi Joe Perches, > > > > I really appreciate your answer. > > It is very helpful. :-) > > > > I think that it is better to ignore these warnings > > without any code changes. > > > > Bryan, how about you? > > > >> > >> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile > >> index ac28977..d15716c 100644 > >> --- a/drivers/leds/Makefile > >> +++ b/drivers/leds/Makefile > >> @@ -52,6 +52,9 @@ obj-$(CONFIG_LEDS_ASIC3) += leds-asic3.o > >> obj-$(CONFIG_LEDS_RENESAS_TPU) += leds-renesas-tpu.o > >> obj-$(CONFIG_LEDS_MAX8997) += leds-max8997.o > >> obj-$(CONFIG_LEDS_LM355x) += leds-lm355x.o > >> +ifdef CONFIG_LEDS_LM355x > >> +CHECKFLAGS += -Wno-enum-mismatch > > I'm not sure about this. So if we turn on CONFIG_LEDS_LM355x, we will > ignore enum mismatch warning with sparse for other source code as well > as this leds-lm355x.c, right? Then we will miss to check other files's > enum mismatching? I tested it just now. When we turn on CONFIG_LEDS_LM355x, 'CHECKFLAGS += -Wno-enum-mismatch' also affects other files. So, we miss to check other files's enum mismatching. Best regards, Jingoo Han > > >> +endif > >> obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o > >> -- To unsubscribe from this list: send the line "unsubscribe linux-leds" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html