aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-ixp4xx.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/i2c/busses/i2c-ixp4xx.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff)
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually remove the use of the device_driver function pointer methods for platform device drivers. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk> Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-ixp4xx.c')
-rw-r--r--drivers/i2c/busses/i2c-ixp4xx.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-ixp4xx.c b/drivers/i2c/busses/i2c-ixp4xx.c
index cc652c350814..aa36855fa995 100644
--- a/drivers/i2c/busses/i2c-ixp4xx.c
+++ b/drivers/i2c/busses/i2c-ixp4xx.c
@@ -87,12 +87,11 @@ struct ixp4xx_i2c_data {
87 struct i2c_algo_bit_data algo_data; 87 struct i2c_algo_bit_data algo_data;
88}; 88};
89 89
90static int ixp4xx_i2c_remove(struct device *dev) 90static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
91{ 91{
92 struct platform_device *plat_dev = to_platform_device(dev); 92 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 93
95 dev_set_drvdata(&plat_dev->dev, NULL); 94 platform_set_drvdata(plat_dev, NULL);
96 95
97 i2c_bit_del_bus(&drv_data->adapter); 96 i2c_bit_del_bus(&drv_data->adapter);
98 97
@@ -101,10 +100,9 @@ static int ixp4xx_i2c_remove(struct device *dev)
101 return 0; 100 return 0;
102} 101}
103 102
104static int ixp4xx_i2c_probe(struct device *dev) 103static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
105{ 104{
106 int err; 105 int err;
107 struct platform_device *plat_dev = to_platform_device(dev);
108 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data; 106 struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
109 struct ixp4xx_i2c_data *drv_data = 107 struct ixp4xx_i2c_data *drv_data =
110 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL); 108 kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
@@ -148,27 +146,28 @@ static int ixp4xx_i2c_probe(struct device *dev)
148 return err; 146 return err;
149 } 147 }
150 148
151 dev_set_drvdata(&plat_dev->dev, drv_data); 149 platform_set_drvdata(plat_dev, drv_data);
152 150
153 return 0; 151 return 0;
154} 152}
155 153
156static struct device_driver ixp4xx_i2c_driver = { 154static struct platform_driver ixp4xx_i2c_driver = {
157 .owner = THIS_MODULE,
158 .name = "IXP4XX-I2C",
159 .bus = &platform_bus_type,
160 .probe = ixp4xx_i2c_probe, 155 .probe = ixp4xx_i2c_probe,
161 .remove = ixp4xx_i2c_remove, 156 .remove = ixp4xx_i2c_remove,
157 .driver = {
158 .name = "IXP4XX-I2C",
159 .owner = THIS_MODULE,
160 },
162}; 161};
163 162
164static int __init ixp4xx_i2c_init(void) 163static int __init ixp4xx_i2c_init(void)
165{ 164{
166 return driver_register(&ixp4xx_i2c_driver); 165 return platform_driver_register(&ixp4xx_i2c_driver);
167} 166}
168 167
169static void __exit ixp4xx_i2c_exit(void) 168static void __exit ixp4xx_i2c_exit(void)
170{ 169{
171 driver_unregister(&ixp4xx_i2c_driver); 170 platform_driver_unregister(&ixp4xx_i2c_driver);
172} 171}
173 172
174module_init(ixp4xx_i2c_init); 173module_init(ixp4xx_i2c_init);