All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Gene Chen <gene.chen.richtek@gmail.com>,
	pavel@ucw.cz, robh+dt@kernel.org, matthias.bgg@gmail.com
Cc: dmurphy@ti.com, linux-leds@vger.kernel.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	gene_chen@richtek.com, Wilma.Wu@mediatek.com,
	shufan_lee@richtek.com, cy_huang@richtek.com,
	benjamin.chao@mediatek.com
Subject: Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Date: Thu, 19 Nov 2020 23:29:36 +0100	[thread overview]
Message-ID: <3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com> (raw)
In-Reply-To: <1605696462-391-2-git-send-email-gene.chen.richtek@gmail.com>

Hi Gene,

On 11/18/20 11:47 AM, Gene Chen wrote:
> From: Gene Chen <gene_chen@richtek.com>
> 
> Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.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.

> +}
> +
> +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.

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

WARNING: multiple messages have this Message-ID (diff)
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Gene Chen <gene.chen.richtek@gmail.com>,
	pavel@ucw.cz, robh+dt@kernel.org, matthias.bgg@gmail.com
Cc: gene_chen@richtek.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, cy_huang@richtek.com,
	benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org,
	dmurphy@ti.com, linux-leds@vger.kernel.org,
	Wilma.Wu@mediatek.com, linux-arm-kernel@lists.infradead.org,
	shufan_lee@richtek.com
Subject: Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Date: Thu, 19 Nov 2020 23:29:36 +0100	[thread overview]
Message-ID: <3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com> (raw)
In-Reply-To: <1605696462-391-2-git-send-email-gene.chen.richtek@gmail.com>

Hi Gene,

On 11/18/20 11:47 AM, Gene Chen wrote:
> From: Gene Chen <gene_chen@richtek.com>
> 
> Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.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.

> +}
> +
> +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.

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

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

WARNING: multiple messages have this Message-ID (diff)
From: Jacek Anaszewski <jacek.anaszewski@gmail.com>
To: Gene Chen <gene.chen.richtek@gmail.com>,
	pavel@ucw.cz, robh+dt@kernel.org, matthias.bgg@gmail.com
Cc: gene_chen@richtek.com, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, cy_huang@richtek.com,
	benjamin.chao@mediatek.com, linux-mediatek@lists.infradead.org,
	dmurphy@ti.com, linux-leds@vger.kernel.org,
	Wilma.Wu@mediatek.com, linux-arm-kernel@lists.infradead.org,
	shufan_lee@richtek.com
Subject: Re: [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
Date: Thu, 19 Nov 2020 23:29:36 +0100	[thread overview]
Message-ID: <3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com> (raw)
In-Reply-To: <1605696462-391-2-git-send-email-gene.chen.richtek@gmail.com>

Hi Gene,

On 11/18/20 11:47 AM, Gene Chen wrote:
> From: Gene Chen <gene_chen@richtek.com>
> 
> Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH
> 
> Signed-off-by: Gene Chen <gene_chen@richtek.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.

> +}
> +
> +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.

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

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-11-19 22:30 UTC|newest]

Thread overview: 85+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-18 10:47 [PATCH v7 0/5] leds: mt6360: Add LED driver for MT6360 Gene Chen
2020-11-18 10:47 ` Gene Chen
2020-11-18 10:47 ` Gene Chen
2020-11-18 10:47 ` [PATCH v7 1/5] leds: flash: Add flash registration with undefined CONFIG_LEDS_CLASS_FLASH Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 13:32   ` kernel test robot
2020-11-18 13:32     ` kernel test robot
2020-11-18 13:32     ` kernel test robot
2020-11-18 13:32     ` kernel test robot
2020-11-19 22:29   ` Jacek Anaszewski [this message]
2020-11-19 22:29     ` Jacek Anaszewski
2020-11-19 22:29     ` Jacek Anaszewski
2020-11-23  3:20     ` Gene Chen
2020-11-23  3:20       ` Gene Chen
2020-11-23  3:20       ` Gene Chen
2020-11-23 21:06       ` Jacek Anaszewski
2020-11-23 21:06         ` Jacek Anaszewski
2020-11-23 21:06         ` Jacek Anaszewski
2020-11-24  6:08         ` Gene Chen
2020-11-24  6:08           ` Gene Chen
2020-11-24  6:08           ` Gene Chen
2020-11-24 21:15           ` Jacek Anaszewski
2020-11-24 21:15             ` Jacek Anaszewski
2020-11-24 21:15             ` Jacek Anaszewski
2020-11-18 10:47 ` [PATCH v7 2/5] dt-bindings: leds: Add LED_COLOR_ID_MOONLIGHT definitions Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 21:37   ` Pavel Machek
2020-11-18 21:37     ` Pavel Machek
2020-11-18 21:37     ` Pavel Machek
2020-11-19  2:20     ` Gene Chen
2020-11-19  2:20       ` Gene Chen
2020-11-19  2:20       ` Gene Chen
2020-11-19  7:44       ` Pavel Machek
2020-11-19  7:44         ` Pavel Machek
2020-11-19  7:44         ` Pavel Machek
2020-11-19  7:55         ` Gene Chen
2020-11-19  7:55           ` Gene Chen
2020-11-19  7:55           ` Gene Chen
2020-11-19  8:38           ` Pavel Machek
2020-11-19  8:38             ` Pavel Machek
2020-11-19  8:38             ` Pavel Machek
2020-11-19 21:03     ` Jacek Anaszewski
2020-11-19 21:03       ` Jacek Anaszewski
2020-11-19 21:03       ` Jacek Anaszewski
2020-11-19 21:57       ` Pavel Machek
2020-11-19 21:57         ` Pavel Machek
2020-11-19 21:57         ` Pavel Machek
2020-11-19 22:26         ` Jacek Anaszewski
2020-11-19 22:26           ` Jacek Anaszewski
2020-11-19 22:26           ` Jacek Anaszewski
2020-11-23  3:00           ` Gene Chen
2020-11-23  3:00             ` Gene Chen
2020-11-23  3:00             ` Gene Chen
2020-11-23 20:52             ` Jacek Anaszewski
2020-11-23 20:52               ` Jacek Anaszewski
2020-11-23 20:52               ` Jacek Anaszewski
2020-11-24  7:33               ` Gene Chen
2020-11-24  7:33                 ` Gene Chen
2020-11-24  7:33                 ` Gene Chen
2020-11-24  8:32                 ` Gene Chen
2020-11-24  8:32                   ` Gene Chen
2020-11-24  8:32                   ` Gene Chen
2020-11-24 21:38                 ` Jacek Anaszewski
2020-11-24 21:38                   ` Jacek Anaszewski
2020-11-24 21:38                   ` Jacek Anaszewski
2020-11-18 10:47 ` [PATCH v7 3/5] dt-bindings: leds: common: Increase LED_COLOR_ID_* maximum size Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47 ` [PATCH v7 4/5] dt-bindings: leds: Add bindings for MT6360 LED Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 21:25   ` Rob Herring
2020-11-18 21:25     ` Rob Herring
2020-11-18 21:25     ` Rob Herring
2020-11-19  1:41     ` Gene Chen
2020-11-19  1:41       ` Gene Chen
2020-11-19  1:41       ` Gene Chen
2020-11-18 10:47 ` [PATCH v7 5/5] leds: mt6360: Add LED driver for MT6360 Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-18 10:47   ` Gene Chen
2020-11-19 22:55   ` Jacek Anaszewski
2020-11-19 22:55     ` Jacek Anaszewski
2020-11-19 22:55     ` Jacek Anaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3164b1ed-9e47-88cd-d492-ff5a9243e5ef@gmail.com \
    --to=jacek.anaszewski@gmail.com \
    --cc=Wilma.Wu@mediatek.com \
    --cc=benjamin.chao@mediatek.com \
    --cc=cy_huang@richtek.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dmurphy@ti.com \
    --cc=gene.chen.richtek@gmail.com \
    --cc=gene_chen@richtek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=robh+dt@kernel.org \
    --cc=shufan_lee@richtek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.