aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-ixp4xx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/busses/i2c-ixp4xx.c')
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index cc652c350814..e422d8b2d4d6 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -35,8 +35,6 @@
35 35
36#include <asm/hardware.h> /* Pick up IXP4xx-specific bits */ 36#include <asm/hardware.h> /* Pick up IXP4xx-specific bits */
37 37
38static struct device_driver ixp4xx_i2c_driver;
39
40static inline int ixp4xx_scl_pin(void *data) 38static inline int ixp4xx_scl_pin(void *data)
41{ 39{
42 return ((struct ixp4xx_i2c_pins*)data)->scl_pin; 40 return ((struct ixp4xx_i2c_pins*)data)->scl_pin;
@@ -87,12 +85,11 @@ struct ixp4xx_i2c_data {
87 struct i2c_algo_bit_data algo_data; 85 struct i2c_algo_bit_data algo_data;
88}; 86};
89 87
90static int ixp4xx_i2c_remove(struct device *dev) 88static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
91{ 89{
92 struct platform_device *plat_dev = to_platform_device(dev); 90 struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev);
93 struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
94 91
95 dev_set_drvdata(&plat_dev->dev, NULL); 92 platform_set_drvdata(plat_dev, NULL);
96 93
97 i2c_bit_del_bus(&drv_data->adapter); 94 i2c_bit_del_bus(&drv_data->adapter);
98 95
@@ -101,10 +98,9 @@ static int ixp4xx_i2c_remove(struct device *dev)
101 return 0; 98 return 0;
102} 99}
103 100
104static int ixp4xx_i2c_probe(struct device *dev) 101static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
105{ 102{
106 int err; 103 int err;
107 struct platform_device *plat_dev = to_platform_device(dev);
108 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; 104 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
109 struct ixp4xx_i2c_data *drv_data = 105 struct ixp4xx_i2c_data *drv_data =
110 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); 106 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
@@ -130,7 +126,7 @@ static int ixp4xx_i2c_probe(struct device *dev)
130 drv_data->algo_data.timeout = 100; 126 drv_data->algo_data.timeout = 100;
131 127
132 drv_data->adapter.id = I2C_HW_B_IXP4XX; 128 drv_data->adapter.id = I2C_HW_B_IXP4XX;
133 strlcpy(drv_data->adapter.name, ixp4xx_i2c_driver.name, 129 strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
134 I2C_NAME_SIZE); 130 I2C_NAME_SIZE);
135 drv_data->adapter.algo_data = &drv_data->algo_data; 131 drv_data->adapter.algo_data = &drv_data->algo_data;
136 132
@@ -142,33 +138,34 @@ static int ixp4xx_i2c_probe(struct device *dev)
142 gpio_line_set(gpio->sda_pin, 0); 138 gpio_line_set(gpio->sda_pin, 0);
143 139
144 if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) { 140 if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) {
145 printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id); 141 printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id);
146 142
147 kfree(drv_data); 143 kfree(drv_data);
148 return err; 144 return err;
149 } 145 }
150 146
151 dev_set_drvdata(&plat_dev->dev, drv_data); 147 platform_set_drvdata(plat_dev, drv_data);
152 148
153 return 0; 149 return 0;
154} 150}
155 151
156static struct device_driver ixp4xx_i2c_driver = { 152static struct platform_driver ixp4xx_i2c_driver = {
157 .owner = THIS_MODULE,
158 .name = "IXP4XX-I2C",
159 .bus = &platform_bus_type,
160 .probe = ixp4xx_i2c_probe, 153 .probe = ixp4xx_i2c_probe,
161 .remove = ixp4xx_i2c_remove, 154 .remove = ixp4xx_i2c_remove,
155 .driver = {
156 .name = "IXP4XX-I2C",
157 .owner = THIS_MODULE,
158 },
162}; 159};
163 160
164static int __init ixp4xx_i2c_init(void) 161static int __init ixp4xx_i2c_init(void)
165{ 162{
166 return driver_register(&ixp4xx_i2c_driver); 163 return platform_driver_register(&ixp4xx_i2c_driver);
167} 164}
168 165
169static void __exit ixp4xx_i2c_exit(void) 166static void __exit ixp4xx_i2c_exit(void)
170{ 167{
171 driver_unregister(&ixp4xx_i2c_driver); 168 platform_driver_unregister(&ixp4xx_i2c_driver);
172} 169}
173 170
174module_init(ixp4xx_i2c_init); 171module_init(ixp4xx_i2c_init);