[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAE+NS350vuY1qNwn4_7ow8Z22_DfHrJAnKX1dsFM_WbaHziZiw@mail.gmail.com>
Date: Mon, 23 Nov 2020 11:20:03 +0800
From: Gene Chen <gene.chen.richtek@...il.com>
To: Jacek Anaszewski <jacek.anaszewski@...il.com>
Cc: Pavel Machek <pavel@....cz>, Rob Herring <robh+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
Dan Murphy <dmurphy@...com>,
Linux LED Subsystem <linux-leds@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>,
linux-arm Mailing List <linux-arm-kernel@...ts.infradead.org>,
"moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Gene Chen <gene_chen@...htek.com>, Wilma.Wu@...iatek.com,
shufan_lee@...htek.com, cy_huang@...htek.com,
benjamin.chao@...iatek.com
Subject: Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Jacek Anaszewski <jacek.anaszewski@...il.com> 於 2020年11月20日 週五 上午6:29寫道:
>
> Hi Gene,
>
> On 11/18/20 11:47 AM, Gene Chen wrote:
> > From: Gene Chen <gene_chen@...htek.com>
> >
> > Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
> >
> > Signed-off-by: Gene Chen <gene_chen@...htek.com>
> > ---
> > include/linux/led-class-flash.h | 36 ++++++++++++++++++++++++++++++++++++
> > 1 file changed, 36 insertions(+)
> >
> > diff --git a/include/linux/led-class-flash.h b/include/linux/led-class-flash.h
> > index 21a3358..4f56c28 100644
> > --- a/include/linux/led-class-flash.h
> > +++ b/include/linux/led-class-flash.h
> > @@ -85,6 +85,7 @@ static inline struct led_classdev_flash *lcdev_to_flcdev(
> > return container_of(lcdev, struct led_classdev_flash, led_cdev);
> > }
> >
> > +#if IS_ENABLED(CONFIG_LEDS_CLASS_FLASH)
> > /**
> > * led_classdev_flash_register_ext - register a new object of LED class with
> > * init data and with support for flash LEDs
> > @@ -127,6 +128,41 @@ static inline int devm_led_classdev_flash_register(struct device *parent,
> > void devm_led_classdev_flash_unregister(struct device *parent,
> > struct led_classdev_flash *fled_cdev);
> >
> > +#else
> > +
> > +static inline int led_classdev_flash_register_ext(struct device *parent,
> > + struct led_classdev_flash *fled_cdev,
> > + struct led_init_data *init_data)
> > +{
> > + return -EINVAL;
>
> s/-EINVAL/0/
>
> The goal here is to assure that client will not fail when using no-op.
>
> > +}
> > +
> > +static inline int led_classdev_flash_register(struct device *parent,
> > + struct led_classdev_flash *fled_cdev)
> > +{
> > + return led_classdev_flash_register_ext(parent, fled_cdev, NULL);
> > +}
>
> This function should be placed after #ifdef block because its
> shape is the same for both cases.
>
> > +static inline void led_classdev_flash_unregister(struct led_classdev_flash *fled_cdev) {};
> > +static inline int devm_led_classdev_flash_register_ext(struct device *parent,
> > + struct led_classdev_flash *fled_cdev,
> > + struct led_init_data *init_data)
> > +{
> > + return -EINVAL;
>
> /-EINVAL/0/
>
> Please do the same fix in all no-ops in the led-class-multicolor.h,
> as we've discussed.
>
I think return -EINVAL is correct, because I should register flash
light device if I define FLED in DTS node.
> > +}
> > +
> > +static inline int devm_led_classdev_flash_register(struct device *parent,
> > + struct led_classdev_flash *fled_cdev)
> > +{
> > + return devm_led_classdev_flash_register_ext(parent, fled_cdev, NULL);
> > +}
>
>
> This function should also be placed after #ifdef block.
> Please make the same optimizations in the led-class-multicolor.h as you
> are at it.
>
> > +
> > +void devm_led_classdev_flash_unregister(struct device *parent,
>
> s/void/static inline void/
>
> That's the reason why you got warning from buildbot.
>
ACK
> > + struct led_classdev_flash *fled_cdev)
> > +{};
> > +
> > +#endif /* IS_ENABLED(CONFIG_LEDS_CLASS_FLASH) */
> > +
> > /**
> > * led_set_flash_strobe - setup flash strobe
> > * @fled_cdev: the flash LED to set strobe on
> >
>
> --
> Best regards,
> Jacek Anaszewski
Powered by blists - more mailing lists