Skip to contentSkip to conversation

i2c_gpio: keep probe resident for hotplugged devices.

PATCH In review Ben Dooks 2 participants 2 messages Jun 25, 2008 – Jun 28, 2008 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Ben Dooks

author
#1 lore raw

PATCH 1/1 i2c_gpio: keep probe resident for hotplugged devices.

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.

drivers/i2c/busses/i2c-gpio.c +3 -2
@@ -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);
 
Signature · 4 lines
_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw

Hi Ben,

Quoted 27 lines · Ben Dooks

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.

drivers/i2c/busses/i2c-gpio.c +2 -1
@@ -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),
 };
 

drivers/i2c/busses/i2c-gpio.c static int __init i2c_gpio_init(void) · line 210

Quoted 8 lines
drivers/i2c/busses/i2c-gpio.c +1 -1
@@ -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,

Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c