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

From: David Brownell
Date: Sun Feb 10 2008 - 19:23:33 EST


From: Guennadi Liakhovetski <g.liakhovetski@xxxxxxxxxxxxxx>

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@xxxxxxxxxxxxxx>
[ add mcp23s08 and pcf857x ]
Signed-off-by: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
---
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

--
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/