diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-gpio.c')
-rw-r--r-- | drivers/i2c/busses/i2c-gpio.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c index e62d2d93862..f3fa4332bbd 100644 --- a/drivers/i2c/busses/i2c-gpio.c +++ b/drivers/i2c/busses/i2c-gpio.c @@ -85,7 +85,7 @@ static int i2c_gpio_getscl(void *data) return gpio_get_value(pdata->scl_pin); } -static int __devinit of_i2c_gpio_probe(struct device_node *np, +static int of_i2c_gpio_probe(struct device_node *np, struct i2c_gpio_platform_data *pdata) { u32 reg; @@ -117,7 +117,7 @@ static int __devinit of_i2c_gpio_probe(struct device_node *np, return 0; } -static int __devinit i2c_gpio_probe(struct platform_device *pdev) +static int i2c_gpio_probe(struct platform_device *pdev) { struct i2c_gpio_private_data *priv; struct i2c_gpio_platform_data *pdata; @@ -184,7 +184,11 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev) bit_data->data = pdata; adap->owner = THIS_MODULE; - snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); + if (pdev->dev.of_node) + strlcpy(adap->name, dev_name(&pdev->dev), sizeof(adap->name)); + else + snprintf(adap->name, sizeof(adap->name), "i2c-gpio%d", pdev->id); + adap->algo_data = bit_data; adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adap->dev.parent = &pdev->dev; @@ -214,7 +218,7 @@ err_request_sda: return ret; } -static int __devexit i2c_gpio_remove(struct platform_device *pdev) +static int i2c_gpio_remove(struct platform_device *pdev) { struct i2c_gpio_private_data *priv; struct i2c_gpio_platform_data *pdata; @@ -247,7 +251,7 @@ static struct platform_driver i2c_gpio_driver = { .of_match_table = of_match_ptr(i2c_gpio_dt_ids), }, .probe = i2c_gpio_probe, - .remove = __devexit_p(i2c_gpio_remove), + .remove = i2c_gpio_remove, }; static int __init i2c_gpio_init(void) |