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

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

 



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.

---

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
+endif
 obj-$(CONFIG_LEDS_BLINKM)		+= leds-blinkm.o
 
 # LED SPI Drivers


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