Skip to content

Commit

Permalink
gpiolib: i2c/spi drivers: handle rmmod better
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Guennadi Liakhovetski authored and Linus Torvalds committed Apr 28, 2008
1 parent 438d890 commit d72cbed
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpio/mcp23s08.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/pca953x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions drivers/gpio/pcf857x.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d72cbed

Please sign in to comment.