[i2c] [patch 1/1] i2c_gpio: keep probe resident for hotplugged devices.
Jean Delvare
khali at linux-fr.org
Sat Jun 28 11:40:11 CEST 2008
Hi Ben,
On Wed, 25 Jun 2008 15:59:44 +0100, Ben Dooks wrote:
> Change the i2c_gpio driver to use platform_driver_register()
> instead of platform_driver_probe() to ensure that is can
> attach to any devices that may be loaded after it has initialised.
>
> Signed-off-by: Ben Dooks <ben-linux at fluff.org>
>
> --- linux-2.6.26-rc5-quilt1.orig/drivers/i2c/busses/i2c-gpio.c 2008-06-11 00:17:08.000000000 +0100
> +++ linux-2.6.26-rc5-quilt1/drivers/i2c/busses/i2c-gpio.c 2008-06-11 00:18:00.000000000 +0100
> @@ -77,7 +77,7 @@ static int i2c_gpio_getscl(void *data)
> return gpio_get_value(pdata->scl_pin);
> }
>
> -static int __init i2c_gpio_probe(struct platform_device *pdev)
> +static int __devinit i2c_gpio_probe(struct platform_device *pdev)
> {
> struct i2c_gpio_platform_data *pdata;
> struct i2c_algo_bit_data *bit_data;
> @@ -196,6 +196,7 @@ static struct platform_driver i2c_gpio_d
> .name = "i2c-gpio",
> .owner = THIS_MODULE,
> },
> + .probe = i2c_gpio_probe,
> .remove = __exit_p(i2c_gpio_remove),
> };
>
> @@ -203,7 +204,7 @@ static int __init i2c_gpio_init(void)
> {
> int ret;
>
> - ret = platform_driver_probe(&i2c_gpio_driver, i2c_gpio_probe);
> + ret = platform_driver_register(&i2c_gpio_driver);
> if (ret)
> printk(KERN_ERR "i2c-gpio: probe failed: %d\n", ret);
>
>
This patch looks incomplete to me. If the device can be hot-plugged, I
guess it can be hot-unplugged as well? Then i2c_gpio_remove should be
__devexit, not __exit.
Thanks,
--
Jean Delvare
More information about the i2c
mailing list