提交 d72cbed0 编写于 作者: G Guennadi Liakhovetski 提交者: Linus Torvalds

gpiolib: i2c/spi drivers: handle rmmod better

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: NGuennadi Liakhovetski <g.liakhovetski@pengutronix.de>
[ add mcp23s08 and pcf857x ]
Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 438d8908
...@@ -239,6 +239,7 @@ static int mcp23s08_probe(struct spi_device *spi) ...@@ -239,6 +239,7 @@ static int mcp23s08_probe(struct spi_device *spi)
mcp->chip.base = pdata->base; mcp->chip.base = pdata->base;
mcp->chip.ngpio = 8; mcp->chip.ngpio = 8;
mcp->chip.can_sleep = 1; mcp->chip.can_sleep = 1;
mcp->chip.owner = THIS_MODULE;
spi_set_drvdata(spi, mcp); spi_set_drvdata(spi, mcp);
......
...@@ -189,6 +189,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios) ...@@ -189,6 +189,7 @@ static void pca953x_setup_gpio(struct pca953x_chip *chip, int gpios)
gc->base = chip->gpio_start; gc->base = chip->gpio_start;
gc->ngpio = gpios; gc->ngpio = gpios;
gc->label = chip->client->name; gc->label = chip->client->name;
gc->owner = THIS_MODULE;
} }
static int __devinit pca953x_probe(struct i2c_client *client) static int __devinit pca953x_probe(struct i2c_client *client)
......
...@@ -159,6 +159,7 @@ static int pcf857x_probe(struct i2c_client *client) ...@@ -159,6 +159,7 @@ static int pcf857x_probe(struct i2c_client *client)
gpio->chip.base = pdata->gpio_base; gpio->chip.base = pdata->gpio_base;
gpio->chip.can_sleep = 1; gpio->chip.can_sleep = 1;
gpio->chip.owner = THIS_MODULE;
/* NOTE: the OnSemi jlc1562b is also largely compatible with /* NOTE: the OnSemi jlc1562b is also largely compatible with
* these parts, notably for output. It has a low-resolution * these parts, notably for output. It has a low-resolution
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册