All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code
@ 2016-04-13  8:55 Masahiro Yamada
  2016-04-13  8:59 ` Adrian Hunter
  0 siblings, 1 reply; 4+ messages in thread
From: Masahiro Yamada @ 2016-04-13  8:55 UTC (permalink / raw)
  To: linux-mmc; +Cc: Masahiro Yamada, linux-kernel, Adrian Hunter, Ulf Hansson

defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
    defined(CONFIG_MMC_SDHCI_MODULE))

is equivalent to:

defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
    defined(MODULE))

and it can also be written shortly as:

IS_REACHABLE(CONFIG_LEDS_CLASS)

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mmc/host/sdhci.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 6bd3d17..7a4fbe8 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -38,11 +38,6 @@
 #define DBG(f, x...) \
 	pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
 
-#if defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
-	defined(CONFIG_MMC_SDHCI_MODULE))
-#define SDHCI_USE_LEDS_CLASS
-#endif
-
 #define MAX_TUNING_LOOP 40
 
 static unsigned int debug_quirks = 0;
@@ -270,7 +265,7 @@ static void sdhci_deactivate_led(struct sdhci_host *host)
 	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
 }
 
-#ifdef SDHCI_USE_LEDS_CLASS
+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
 static void sdhci_led_control(struct led_classdev *led,
 	enum led_brightness brightness)
 {
@@ -1328,7 +1323,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
 
 	WARN_ON(host->mrq != NULL);
 
-#ifndef SDHCI_USE_LEDS_CLASS
+#if !IS_REACHABLE(CONFIG_LEDS_CLASS)
 	sdhci_activate_led(host);
 #endif
 
@@ -2214,7 +2209,7 @@ static void sdhci_tasklet_finish(unsigned long param)
 	host->cmd = NULL;
 	host->data = NULL;
 
-#ifndef SDHCI_USE_LEDS_CLASS
+#if !IS_REACHABLE(CONFIG_LEDS_CLASS)
 	sdhci_deactivate_led(host);
 #endif
 
@@ -3360,7 +3355,7 @@ int sdhci_add_host(struct sdhci_host *host)
 	sdhci_dumpregs(host);
 #endif
 
-#ifdef SDHCI_USE_LEDS_CLASS
+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
 	snprintf(host->led_name, sizeof(host->led_name),
 		"%s::", mmc_hostname(mmc));
 	host->led.name = host->led_name;
@@ -3390,7 +3385,7 @@ int sdhci_add_host(struct sdhci_host *host)
 
 	return 0;
 
-#ifdef SDHCI_USE_LEDS_CLASS
+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
 reset:
 	sdhci_do_reset(host, SDHCI_RESET_ALL);
 	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
@@ -3430,7 +3425,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
 
 	mmc_remove_host(mmc);
 
-#ifdef SDHCI_USE_LEDS_CLASS
+#if IS_REACHABLE(CONFIG_LEDS_CLASS)
 	led_classdev_unregister(&host->led);
 #endif
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code
  2016-04-13  8:55 [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code Masahiro Yamada
@ 2016-04-13  8:59 ` Adrian Hunter
  2016-04-13  9:09   ` Masahiro Yamada
  2016-04-14  4:26   ` Masahiro Yamada
  0 siblings, 2 replies; 4+ messages in thread
From: Adrian Hunter @ 2016-04-13  8:59 UTC (permalink / raw)
  To: Masahiro Yamada, linux-mmc; +Cc: linux-kernel, Ulf Hansson

On 13/04/16 11:55, Masahiro Yamada wrote:
> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>     defined(CONFIG_MMC_SDHCI_MODULE))
> 
> is equivalent to:
> 
> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>     defined(MODULE))
> 
> and it can also be written shortly as:
> 
> IS_REACHABLE(CONFIG_LEDS_CLASS)
> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

I recently sent a change to the LEDS code:

	http://marc.info/?l=linux-mmc&m=146046055330711

So, if that is accepted, this will need to be changed - there will be only
one place CONFIG_LEDS_CLASS is used then.

> ---
> 
>  drivers/mmc/host/sdhci.c | 17 ++++++-----------
>  1 file changed, 6 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 6bd3d17..7a4fbe8 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -38,11 +38,6 @@
>  #define DBG(f, x...) \
>  	pr_debug(DRIVER_NAME " [%s()]: " f, __func__,## x)
>  
> -#if defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
> -	defined(CONFIG_MMC_SDHCI_MODULE))
> -#define SDHCI_USE_LEDS_CLASS
> -#endif
> -
>  #define MAX_TUNING_LOOP 40
>  
>  static unsigned int debug_quirks = 0;
> @@ -270,7 +265,7 @@ static void sdhci_deactivate_led(struct sdhci_host *host)
>  	sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL);
>  }
>  
> -#ifdef SDHCI_USE_LEDS_CLASS
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
>  static void sdhci_led_control(struct led_classdev *led,
>  	enum led_brightness brightness)
>  {
> @@ -1328,7 +1323,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
>  
>  	WARN_ON(host->mrq != NULL);
>  
> -#ifndef SDHCI_USE_LEDS_CLASS
> +#if !IS_REACHABLE(CONFIG_LEDS_CLASS)
>  	sdhci_activate_led(host);
>  #endif
>  
> @@ -2214,7 +2209,7 @@ static void sdhci_tasklet_finish(unsigned long param)
>  	host->cmd = NULL;
>  	host->data = NULL;
>  
> -#ifndef SDHCI_USE_LEDS_CLASS
> +#if !IS_REACHABLE(CONFIG_LEDS_CLASS)
>  	sdhci_deactivate_led(host);
>  #endif
>  
> @@ -3360,7 +3355,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  	sdhci_dumpregs(host);
>  #endif
>  
> -#ifdef SDHCI_USE_LEDS_CLASS
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
>  	snprintf(host->led_name, sizeof(host->led_name),
>  		"%s::", mmc_hostname(mmc));
>  	host->led.name = host->led_name;
> @@ -3390,7 +3385,7 @@ int sdhci_add_host(struct sdhci_host *host)
>  
>  	return 0;
>  
> -#ifdef SDHCI_USE_LEDS_CLASS
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
>  reset:
>  	sdhci_do_reset(host, SDHCI_RESET_ALL);
>  	sdhci_writel(host, 0, SDHCI_INT_ENABLE);
> @@ -3430,7 +3425,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
>  
>  	mmc_remove_host(mmc);
>  
> -#ifdef SDHCI_USE_LEDS_CLASS
> +#if IS_REACHABLE(CONFIG_LEDS_CLASS)
>  	led_classdev_unregister(&host->led);
>  #endif
>  
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code
  2016-04-13  8:59 ` Adrian Hunter
@ 2016-04-13  9:09   ` Masahiro Yamada
  2016-04-14  4:26   ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2016-04-13  9:09 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc, Linux Kernel Mailing List, Ulf Hansson

2016-04-13 17:59 GMT+09:00 Adrian Hunter <adrian.hunter@intel.com>:
> On 13/04/16 11:55, Masahiro Yamada wrote:
>> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>>     defined(CONFIG_MMC_SDHCI_MODULE))
>>
>> is equivalent to:
>>
>> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>>     defined(MODULE))
>>
>> and it can also be written shortly as:
>>
>> IS_REACHABLE(CONFIG_LEDS_CLASS)
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> I recently sent a change to the LEDS code:
>
>         http://marc.info/?l=linux-mmc&m=146046055330711
>
> So, if that is accepted, this will need to be changed - there will be only
> one place CONFIG_LEDS_CLASS is used then.
>

OK.

If yours is accepted, i will rebase this patch on top of yours.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code
  2016-04-13  8:59 ` Adrian Hunter
  2016-04-13  9:09   ` Masahiro Yamada
@ 2016-04-14  4:26   ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2016-04-14  4:26 UTC (permalink / raw)
  To: Adrian Hunter; +Cc: linux-mmc, Linux Kernel Mailing List, Ulf Hansson

Hi.


2016-04-13 17:59 GMT+09:00 Adrian Hunter <adrian.hunter@intel.com>:
> On 13/04/16 11:55, Masahiro Yamada wrote:
>> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>>     defined(CONFIG_MMC_SDHCI_MODULE))
>>
>> is equivalent to:
>>
>> defined(CONFIG_LEDS_CLASS) || (defined(CONFIG_LEDS_CLASS_MODULE) && \
>>     defined(MODULE))
>>
>> and it can also be written shortly as:
>>
>> IS_REACHABLE(CONFIG_LEDS_CLASS)
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>
> I recently sent a change to the LEDS code:
>
>         http://marc.info/?l=linux-mmc&m=146046055330711
>
> So, if that is accepted, this will need to be changed - there will be only
> one place CONFIG_LEDS_CLASS is used then.
>


Your patch was applied, so I've sent v2 of this patch
based on the next branch.


-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-14  4:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-13  8:55 [PATCH] mmc: sdhci: use IS_REACHABLE(CONFIG_LEDS_CLASS) to enable LED code Masahiro Yamada
2016-04-13  8:59 ` Adrian Hunter
2016-04-13  9:09   ` Masahiro Yamada
2016-04-14  4:26   ` Masahiro Yamada

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.