Re: [PATCH] leds: lm355x: Fix sparse warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2013-08-05 at 18:50 -0700, 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?
> >
> > Best regards,
> > Jingoo Han
> >
> >>
> >> ---
> >>
> >> 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?

Yup.

I didn't say it was perfect, I said "something like". ;)

Right now there's no generic Makefile ability to have
per-file CHECKFLAGS.

Maybe you could add one if it appeals to you.

Otherwise, it's a trivial sparse warning, ignore it.

--
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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux