[patch 2.6.25-rc1 2/3] gpiolib: i2c/spi drivers handler rmmod better

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: David Brownell
Date: Sunday, February 10, 2008 - 5:22 pm

From: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>

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>
---
 drivers/gpio/mcp23s08.c |    1 +
 drivers/gpio/pca953x.c  |    1 +
 drivers/gpio/pcf857x.c  |    1 +
 3 files changed, 3 insertions(+)

--- g26.orig/drivers/gpio/mcp23s08.c	2008-02-10 16:06:30.000000000 -0800
+++ g26/drivers/gpio/mcp23s08.c	2008-02-10 16:09:52.000000000 -0800
@@ -239,6 +239,7 @@ static int mcp23s08_probe(struct spi_dev
 	mcp->chip.base = pdata->base;
 	mcp->chip.ngpio = 8;
 	mcp->chip.can_sleep = 1;
+	mcp->chip.owner = THIS_MODULE;
 
 	spi_set_drvdata(spi, mcp);
 
--- g26.orig/drivers/gpio/pca953x.c	2008-02-10 16:06:30.000000000 -0800
+++ g26/drivers/gpio/pca953x.c	2008-02-10 16:09:52.000000000 -0800
@@ -188,6 +188,7 @@ static void pca953x_setup_gpio(struct pc
 	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)
--- g26.orig/drivers/gpio/pcf857x.c	2008-02-10 16:06:30.000000000 -0800
+++ g26/drivers/gpio/pcf857x.c	2008-02-10 16:09:52.000000000 -0800
@@ -159,6 +159,7 @@ static int pcf857x_probe(struct i2c_clie
 
 	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

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 2.6.25-rc1 2/3] gpiolib: i2c/spi drivers handler rm ..., David Brownell, (Sun Feb 10, 5:22 pm)