[PATCH 1/2] hwmon: add generic GPIO fan driver

Simon Guinot
2010-10-20T07:59:31Z

Hi Guenter,

On Tue, Oct 19, 2010 at 05:50:26PM -0700, Guenter Roeck wrote:
> Hi Simon,
>
> On Tue, 2010-10-19 at 20:19 -0400, Simon Guinot wrote:
> > Hi Guenter,
> >
> > On Tue, Oct 19, 2010 at 03:03:45PM -0700, Guenter Roeck wrote:
> > > Hi Simon,
> > >
> > > one more comment ...
> > >
> > > On Sun, 2010-10-17 at 11:50 -0400, Simon Guinot wrote:
> > > [ ... ]
> > > > +static int __devinit
> > > > +fan_alarm_init(struct gpio_fan_data *fan_data, struct gpio_fan_alarm *alarm)
> > > > +{
> > >
> > > __devinit and __devexit can cause problems if this driver is built into
> > > the kernel, but the underlying i2c master driver is built as module.
> >
> > I am not sure I understand this. Are you talking about a I2C GPIO
> > expander ? or about the hwmon registration process ?
>
> Not related to I2C specifically, since you don't use I2C. No idea why I
> mentioned I2C, really. Probably because I had I2C in my mind.

gpio-fan could use I2C implicitly if the GPIOs are provided by a GPIO
I2C expander.

>
> Anyway, there are gpio drivers which can be loaded and unloaded. GPIO
> pin(s) on one of those could point to the gpio-fan driver. If gpio-fan
> is built into the kernel, but the underlying gpio driver is built as
> module, loading the gpio driver might cause the gpio-fan probe function
> to be called - but that function no longer exists if it is tagged as
> __devinit.

IMHO, the gpio-fan probe function will be called anyway if a "gpio-fan"
platform device is available. If the needed GPIOs are not registered at
this time, gpio_request() will fail and the gpio-fan probe function will
exit.

Later, even if the GPIOs are registered (via gpiochip_add()), this will
not trigger a gpio-fan probe.

>
> Browsing through the gpio code, it seems the problem doesn't really
> exist, since the above scenario does not happen (unless I am missing
> something, of course). Also, other drivers using gpio calls also use
> __devinit and __devexit. So just ignore what I said.

Ok.

Thanks,

Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20101020/62a4f0e4/attachment.sig>