gpiolib: i2c/spi drivers: handle rmmod better
authorGuennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Mon, 28 Apr 2008 09:14:45 +0000 (02:14 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 28 Apr 2008 15:58:34 +0000 (08:58 -0700)
Use the newly introduced owner field in struct gpio_chip to protect the
current (small) set of non-SOC GPIO drivers from being unloaded while any of
their GPIOs are in use.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
[ add mcp23s08 and pcf857x ]
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/gpio/mcp23s08.c
drivers/gpio/pca953x.c
drivers/gpio/pcf857x.c

index bb60e8c1a1f0621e3d06c8292d1007ab3e66c754..7fb5b9d009d4a83a9c58a458464077caad24d6f5 100644 (file)
@@ -239,6 +239,7 @@ static int mcp23s08_probe(struct spi_device *spi)
        mcp->chip.base = pdata->base;
        mcp->chip.ngpio = 8;
        mcp->chip.can_sleep = 1;
+       mcp->chip.owner = THIS_MODULE;
 
        spi_set_drvdata(spi, mcp);
 
index 6e72fd31184d8aa95021f897ee436af3bdd7b833..e0e0af5361083e6cd9483b971ff427cab43dad80 100644 (file)
@@ -189,6 +189,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
        gc->base = chip->gpio_start;
        gc->ngpio = gpios;
        gc->label = chip->client->name;
+       gc->owner = THIS_MODULE;
 }
 
 static int __devinit pca953x_probe(struct i2c_client *client)
index c6b3b53783843cfd21f542dab4b278ba320aebe5..1106aa15ac79ad92d6807aab7a0aa2106e786784 100644 (file)
@@ -159,6 +159,7 @@ static int pcf857x_probe(struct i2c_client *client)
 
        gpio->chip.base = pdata->gpio_base;
        gpio->chip.can_sleep = 1;
+       gpio->chip.owner = THIS_MODULE;
 
        /* NOTE:  the OnSemi jlc1562b is also largely compatible with
         * these parts, notably for output.  It has a low-resolution