Re: [PATCH v2 1/8] thermal: Provide stub for thermal_of_cooling_device_register() function

From: Lukasz Majewski
Date: Thu Jan 15 2015 - 03:43:18 EST


Hi Eduardo,

> On Wed, Jan 14, 2015 at 04:01:06PM +0100, Lukasz Majewski wrote:
> > Hi Eduardo,
> >
> > > On Fri, Jan 02, 2015 at 02:54:28PM -0400, Eduardo Valentin wrote:
> > > > On Mon, Dec 22, 2014 at 05:27:41PM +0100, Lukasz Majewski wrote:
> > > > > Odroid U3 fan can work without being registered as OF cooling
> > > > > device (with CONFIG_THERMAL_OF disabled).
> > > > > In this situation it can be controlled via PWM entry at
> > > > > /sys/class/hwmon/hwmon0/pwm1.
> > > > >
> > > > > Therefore, the thermal_of_cooling_device_register() function
> > > > > needs a stub to allow clean compilation.
> > > > >
> > > > > Signed-off-by: Lukasz Majewski <l.majewski@xxxxxxxxxxx>
> > > >
> > > > Acked-by: Eduardo Valentin <edubezval@xxxxxxxxx>
> > >
> > > Sorry, too fast,
> > >
> > > This is actually
> > > Nacked-by: Eduardo Valentin <edubezval@xxxxxxxxx>
> > >
> > > :-)
> > >
> > > I get this error:
> > > drivers/thermal/thermal_core.c:1210:1: error: redefinition of
> > > âthermal_of_cooling_device_registerâ
> > > thermal_of_cooling_device_register(struct device_node *np,
> > > ^
> > > In file included from drivers/thermal/thermal_core.c:34:0:
> > > include/linux/thermal.h:321:1: note: previous definition of
> > > âthermal_of_cooling_device_registerâ was here
> > > thermal_of_cooling_device_register(struct device_node *np,
> > > ^
> > >
> > >
> > > We provide the function in thermal core even if CONFIG_THERMAL_OF
> > > is not set.
> >
> > Unfortunately the PWM fan subsystem can work perfectly fine without
> > CONFIG_THERMAL.
> >
>
> Now I understand what you are trying to do.
>
> > I think that it would be enough to make something like this in
> > the ./include/linux/thermal.h:
> >
> > #ifdef CONFIG_THERMAL
> Well, I think it should be the opposite here:
>
> #ifndef CONFIG_THERMAL
>
> that is, if no config thermal, then you provide the stub not the other
> way around.

This seems like a better solution :-).

Thanks.

>
> > static inline struct thermal_cooling_device *
> > thermal_of_cooling_device_register(struct
> > device_node *np, char *type, void *devdata,
> > const struct
> > thermal_cooling_device_ops *ops) {
> > return NULL;
> > }
> > #else
> > [ already present declaration of
> > thermal_of_cooling_device_register() ]
> > #endif /* CONFIG_THERMAL */
>
>
> >
> >
> >
> > > >
> > > > > ---
> > > > > Changes for v2:
> > > > > - None
> > > > > ---
> > > > > include/linux/thermal.h | 14 +++++++++++---
> > > > > 1 file changed, 11 insertions(+), 3 deletions(-)
> > > > >
> > > > > diff --git a/include/linux/thermal.h b/include/linux/thermal.h
> > > > > index 2de3d9e..871123c 100644
> > > > > --- a/include/linux/thermal.h
> > > > > +++ b/include/linux/thermal.h
> > > > > @@ -328,6 +328,10 @@ thermal_zone_of_sensor_register(struct
> > > > > device *dev, int id, void *data, const struct
> > > > > thermal_zone_of_device_ops *ops); void
> > > > > thermal_zone_of_sensor_unregister(struct device *dev, struct
> > > > > thermal_zone_device *tz); +struct thermal_cooling_device *
> > > > > +thermal_of_cooling_device_register(struct device_node *np,
> > > > > + char *type, void *devdata,
> > > > > + const struct
> > > > > thermal_cooling_device_ops *); #else
> > > > > static inline struct thermal_zone_device *
> > > > > thermal_zone_of_sensor_register(struct device *dev, int id,
> > > > > void *data, @@ -342,6 +346,13 @@ void
> > > > > thermal_zone_of_sensor_unregister(struct device *dev, {
> > > > > }
> > > > >
> > > > > +static inline struct thermal_cooling_device *
> > > > > +thermal_of_cooling_device_register(struct device_node *np,
> > > > > + char *type, void *devdata,
> > > > > + const struct
> > > > > thermal_cooling_device_ops *ops) +{
> > > > > + return NULL;
> > > > > +}
> > > > > #endif
> > > > > struct thermal_zone_device
> > > > > *thermal_zone_device_register(const char *, int, int, void *,
> > > > > struct thermal_zone_device_ops *, @@ -357,9 +368,6 @@ void
> > > > > thermal_zone_device_update(struct thermal_zone_device *);
> > > > > struct thermal_cooling_device
> > > > > *thermal_cooling_device_register(char *, void *, const struct
> > > > > thermal_cooling_device_ops *); -struct thermal_cooling_device
> > > > > * -thermal_of_cooling_device_register(struct device_node *np,
> > > > > char *, void *,
> > > > > - const struct
> > > > > thermal_cooling_device_ops *); void
> > > > > thermal_cooling_device_unregister(struct
> > > > > thermal_cooling_device *); struct thermal_zone_device
> > > > > *thermal_zone_get_zone_by_name(const char *name); int
> > > > > thermal_zone_get_temp(struct thermal_zone_device *tz, unsigned
> > > > > long *temp); -- 2.0.0.rc2
> > > > >
> > >
> > >
> >
> >
> >
> > --
> > Best regards,
> >
> > Lukasz Majewski
> >
> > Samsung R&D Institute Poland (SRPOL) | Linux Platform Group



--
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/