All of lore.kernel.org
 help / color / mirror / Atom feed
* [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table
@ 2014-07-25  3:14 Axel Lin
  2014-07-25  4:29 ` [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab Guenter Roeck
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Axel Lin @ 2014-07-25  3:14 UTC (permalink / raw)
  To: lm-sensors

Use of_match_ptr and proper #ifdef CONFIG_OF guard for of_device_id table.
Also makes of_pwm_fan_match const.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/hwmon/pwm-fan.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/hwmon/pwm-fan.c b/drivers/hwmon/pwm-fan.c
index d2507a6..5354c36 100644
--- a/drivers/hwmon/pwm-fan.c
+++ b/drivers/hwmon/pwm-fan.c
@@ -170,10 +170,12 @@ static int pwm_fan_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(pwm_fan_pm, pwm_fan_suspend, pwm_fan_resume);
 
-static struct of_device_id of_pwm_fan_match[] = {
+#ifdef CONFIG_OF
+static const struct of_device_id of_pwm_fan_match[] = {
 	{ .compatible = "pwm-fan", },
 	{},
 };
+#endif
 
 static struct platform_driver pwm_fan_driver = {
 	.probe		= pwm_fan_probe,
@@ -181,7 +183,7 @@ static struct platform_driver pwm_fan_driver = {
 	.driver	= {
 		.name		= "pwm-fan",
 		.pm		= &pwm_fan_pm,
-		.of_match_table	= of_pwm_fan_match,
+		.of_match_table	= of_match_ptr(of_pwm_fan_match),
 	},
 };
 
-- 
1.9.1




_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab
  2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
@ 2014-07-25  4:29 ` Guenter Roeck
  2014-07-25  4:46 ` Axel Lin
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-07-25  4:29 UTC (permalink / raw)
  To: lm-sensors

On 07/24/2014 08:14 PM, Axel Lin wrote:
> Use of_match_ptr and proper #ifdef CONFIG_OF guard for of_device_id table.
> Also makes of_pwm_fan_match const.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>

The driver won't instantiate if OF is not configured.
Given that, I'd rather keep the code as is, because it does compile
without CONFIG_OF, so the ifdef is not really technically necessary.

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab
  2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
  2014-07-25  4:29 ` [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab Guenter Roeck
@ 2014-07-25  4:46 ` Axel Lin
  2014-07-25  4:56 ` Guenter Roeck
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Axel Lin @ 2014-07-25  4:46 UTC (permalink / raw)
  To: lm-sensors

2014-07-25 12:29 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
> On 07/24/2014 08:14 PM, Axel Lin wrote:
>>
>> Use of_match_ptr and proper #ifdef CONFIG_OF guard for of_device_id table.
>> Also makes of_pwm_fan_match const.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>
>
> The driver won't instantiate if OF is not configured.
You are right.
Then how about adding OF dependency to config SENSORS_PWM_FAN?

Thanks,
Axel

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab
  2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
  2014-07-25  4:29 ` [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab Guenter Roeck
  2014-07-25  4:46 ` Axel Lin
@ 2014-07-25  4:56 ` Guenter Roeck
  2014-07-25  7:50 ` Jean Delvare
  2014-07-25 14:05 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-07-25  4:56 UTC (permalink / raw)
  To: lm-sensors

On 07/24/2014 09:46 PM, Axel Lin wrote:
> 2014-07-25 12:29 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
>> On 07/24/2014 08:14 PM, Axel Lin wrote:
>>>
>>> Use of_match_ptr and proper #ifdef CONFIG_OF guard for of_device_id table.
>>> Also makes of_pwm_fan_match const.
>>>
>>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>>
>>
>> The driver won't instantiate if OF is not configured.
> You are right.
> Then how about adding OF dependency to config SENSORS_PWM_FAN?
>

Then it won't compile with allmodconfig on x86. I prefer to be able
to compile it. So we would have to add COMPILE_TEST as secondary
dependency, and things would get more and more complex.
Not really sure if I want to go along that route.

Jean, any thoughts ?

Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab
  2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
                   ` (2 preceding siblings ...)
  2014-07-25  4:56 ` Guenter Roeck
@ 2014-07-25  7:50 ` Jean Delvare
  2014-07-25 14:05 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Jean Delvare @ 2014-07-25  7:50 UTC (permalink / raw)
  To: lm-sensors

Hi Guenter, Axel,

On Thu, 24 Jul 2014 21:56:00 -0700, Guenter Roeck wrote:
> On 07/24/2014 09:46 PM, Axel Lin wrote:
> > 2014-07-25 12:29 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
> >> The driver won't instantiate if OF is not configured.
> > You are right.
> > Then how about adding OF dependency to config SENSORS_PWM_FAN?
> 
> Then it won't compile with allmodconfig on x86. I prefer to be able
> to compile it. So we would have to add COMPILE_TEST as secondary
> dependency, and things would get more and more complex.
> Not really sure if I want to go along that route.
> 
> Jean, any thoughts ?

depends on OF || COMPILE_TEST

is good and not complex at all, just do that :) Note that you can put
this on a line on its own, this is the recommended way to keep
functional (build-time) dependencies and run-time dependencies clearly
separated.

FWIW I have been speaking loudly in various occasions in favor of
generalizing the use of run-time dependencies in combination with
COMPILE_TEST. So I would be very happy if the hwmon subsystem goes down
that road too.

-- 
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

* Re: [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab
  2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
                   ` (3 preceding siblings ...)
  2014-07-25  7:50 ` Jean Delvare
@ 2014-07-25 14:05 ` Guenter Roeck
  4 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2014-07-25 14:05 UTC (permalink / raw)
  To: lm-sensors

On 07/25/2014 12:50 AM, Jean Delvare wrote:
> Hi Guenter, Axel,
>
> On Thu, 24 Jul 2014 21:56:00 -0700, Guenter Roeck wrote:
>> On 07/24/2014 09:46 PM, Axel Lin wrote:
>>> 2014-07-25 12:29 GMT+08:00 Guenter Roeck <linux@roeck-us.net>:
>>>> The driver won't instantiate if OF is not configured.
>>> You are right.
>>> Then how about adding OF dependency to config SENSORS_PWM_FAN?
>>
>> Then it won't compile with allmodconfig on x86. I prefer to be able
>> to compile it. So we would have to add COMPILE_TEST as secondary
>> dependency, and things would get more and more complex.
>> Not really sure if I want to go along that route.
>>
>> Jean, any thoughts ?
>
> depends on OF || COMPILE_TEST
>
> is good and not complex at all, just do that :) Note that you can put
> this on a line on its own, this is the recommended way to keep
> functional (build-time) dependencies and run-time dependencies clearly
> separated.
>
Ok. Axel, please send a patch.

Thanks,
Guenter


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

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

end of thread, other threads:[~2014-07-25 14:05 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25  3:14 [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id table Axel Lin
2014-07-25  4:29 ` [lm-sensors] [PATCH 2/2] hwmon: (pwm-fan) Add proper #ifdef CONFIG_OF guard for of_device_id tab Guenter Roeck
2014-07-25  4:46 ` Axel Lin
2014-07-25  4:56 ` Guenter Roeck
2014-07-25  7:50 ` Jean Delvare
2014-07-25 14:05 ` Guenter Roeck

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.