diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/i2c/busses/i2c-ixp2000.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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-ixp2000.c')
-rw-r--r-- | drivers/i2c/busses/i2c-ixp2000.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index 64552a376f2d..cef024a7d048 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -86,12 +86,11 @@ struct ixp2000_i2c_data { | |||
86 | struct i2c_algo_bit_data algo_data; | 86 | struct i2c_algo_bit_data algo_data; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | static int ixp2000_i2c_remove(struct device *dev) | 89 | static int ixp2000_i2c_remove(struct platform_device *plat_dev) |
90 | { | 90 | { |
91 | struct platform_device *plat_dev = to_platform_device(dev); | 91 | struct ixp2000_i2c_data *drv_data = platform_get_drvdata(plat_dev); |
92 | struct ixp2000_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev); | ||
93 | 92 | ||
94 | dev_set_drvdata(&plat_dev->dev, NULL); | 93 | platform_set_drvdata(plat_dev, NULL); |
95 | 94 | ||
96 | i2c_bit_del_bus(&drv_data->adapter); | 95 | i2c_bit_del_bus(&drv_data->adapter); |
97 | 96 | ||
@@ -100,10 +99,9 @@ static int ixp2000_i2c_remove(struct device *dev) | |||
100 | return 0; | 99 | return 0; |
101 | } | 100 | } |
102 | 101 | ||
103 | static int ixp2000_i2c_probe(struct device *dev) | 102 | static int ixp2000_i2c_probe(struct platform_device *plat_dev) |
104 | { | 103 | { |
105 | int err; | 104 | int err; |
106 | struct platform_device *plat_dev = to_platform_device(dev); | ||
107 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; | 105 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; |
108 | struct ixp2000_i2c_data *drv_data = | 106 | struct ixp2000_i2c_data *drv_data = |
109 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); | 107 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); |
@@ -139,27 +137,28 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
139 | return err; | 137 | return err; |
140 | } | 138 | } |
141 | 139 | ||
142 | dev_set_drvdata(&plat_dev->dev, drv_data); | 140 | platform_set_drvdata(plat_dev, drv_data); |
143 | 141 | ||
144 | return 0; | 142 | return 0; |
145 | } | 143 | } |
146 | 144 | ||
147 | static struct device_driver ixp2000_i2c_driver = { | 145 | static struct platform_driver ixp2000_i2c_driver = { |
148 | .owner = THIS_MODULE, | ||
149 | .name = "IXP2000-I2C", | ||
150 | .bus = &platform_bus_type, | ||
151 | .probe = ixp2000_i2c_probe, | 146 | .probe = ixp2000_i2c_probe, |
152 | .remove = ixp2000_i2c_remove, | 147 | .remove = ixp2000_i2c_remove, |
148 | .driver = { | ||
149 | .name = "IXP2000-I2C", | ||
150 | .owner = THIS_MODULE, | ||
151 | }, | ||
153 | }; | 152 | }; |
154 | 153 | ||
155 | static int __init ixp2000_i2c_init(void) | 154 | static int __init ixp2000_i2c_init(void) |
156 | { | 155 | { |
157 | return driver_register(&ixp2000_i2c_driver); | 156 | return platform_driver_register(&ixp2000_i2c_driver); |
158 | } | 157 | } |
159 | 158 | ||
160 | static void __exit ixp2000_i2c_exit(void) | 159 | static void __exit ixp2000_i2c_exit(void) |
161 | { | 160 | { |
162 | driver_unregister(&ixp2000_i2c_driver); | 161 | platform_driver_unregister(&ixp2000_i2c_driver); |
163 | } | 162 | } |
164 | 163 | ||
165 | module_init(ixp2000_i2c_init); | 164 | module_init(ixp2000_i2c_init); |