diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-ixp2000.c')
-rw-r--r-- | drivers/i2c/busses/i2c-ixp2000.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/i2c/busses/i2c-ixp2000.c b/drivers/i2c/busses/i2c-ixp2000.c index 64552a376f2d..cd6f45d186ab 100644 --- a/drivers/i2c/busses/i2c-ixp2000.c +++ b/drivers/i2c/busses/i2c-ixp2000.c | |||
@@ -36,8 +36,6 @@ | |||
36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ | 36 | #include <asm/hardware.h> /* Pick up IXP2000-specific bits */ |
37 | #include <asm/arch/gpio.h> | 37 | #include <asm/arch/gpio.h> |
38 | 38 | ||
39 | static struct device_driver ixp2000_i2c_driver; | ||
40 | |||
41 | static inline int ixp2000_scl_pin(void *data) | 39 | static inline int ixp2000_scl_pin(void *data) |
42 | { | 40 | { |
43 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; | 41 | return ((struct ixp2000_i2c_pins*)data)->scl_pin; |
@@ -86,12 +84,11 @@ struct ixp2000_i2c_data { | |||
86 | struct i2c_algo_bit_data algo_data; | 84 | struct i2c_algo_bit_data algo_data; |
87 | }; | 85 | }; |
88 | 86 | ||
89 | static int ixp2000_i2c_remove(struct device *dev) | 87 | static int ixp2000_i2c_remove(struct platform_device *plat_dev) |
90 | { | 88 | { |
91 | struct platform_device *plat_dev = to_platform_device(dev); | 89 | 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 | 90 | ||
94 | dev_set_drvdata(&plat_dev->dev, NULL); | 91 | platform_set_drvdata(plat_dev, NULL); |
95 | 92 | ||
96 | i2c_bit_del_bus(&drv_data->adapter); | 93 | i2c_bit_del_bus(&drv_data->adapter); |
97 | 94 | ||
@@ -100,10 +97,9 @@ static int ixp2000_i2c_remove(struct device *dev) | |||
100 | return 0; | 97 | return 0; |
101 | } | 98 | } |
102 | 99 | ||
103 | static int ixp2000_i2c_probe(struct device *dev) | 100 | static int ixp2000_i2c_probe(struct platform_device *plat_dev) |
104 | { | 101 | { |
105 | int err; | 102 | int err; |
106 | struct platform_device *plat_dev = to_platform_device(dev); | ||
107 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; | 103 | struct ixp2000_i2c_pins *gpio = plat_dev->dev.platform_data; |
108 | struct ixp2000_i2c_data *drv_data = | 104 | struct ixp2000_i2c_data *drv_data = |
109 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); | 105 | kzalloc(sizeof(struct ixp2000_i2c_data), GFP_KERNEL); |
@@ -122,7 +118,7 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
122 | drv_data->algo_data.timeout = 100; | 118 | drv_data->algo_data.timeout = 100; |
123 | 119 | ||
124 | drv_data->adapter.id = I2C_HW_B_IXP2000, | 120 | drv_data->adapter.id = I2C_HW_B_IXP2000, |
125 | strlcpy(drv_data->adapter.name, ixp2000_i2c_driver.name, | 121 | strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name, |
126 | I2C_NAME_SIZE); | 122 | I2C_NAME_SIZE); |
127 | drv_data->adapter.algo_data = &drv_data->algo_data, | 123 | drv_data->adapter.algo_data = &drv_data->algo_data, |
128 | 124 | ||
@@ -134,32 +130,33 @@ static int ixp2000_i2c_probe(struct device *dev) | |||
134 | gpio_line_set(gpio->sda_pin, 0); | 130 | gpio_line_set(gpio->sda_pin, 0); |
135 | 131 | ||
136 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { | 132 | if ((err = i2c_bit_add_bus(&drv_data->adapter)) != 0) { |
137 | dev_err(dev, "Could not install, error %d\n", err); | 133 | dev_err(&plat_dev->dev, "Could not install, error %d\n", err); |
138 | kfree(drv_data); | 134 | kfree(drv_data); |
139 | return err; | 135 | return err; |
140 | } | 136 | } |
141 | 137 | ||
142 | dev_set_drvdata(&plat_dev->dev, drv_data); | 138 | platform_set_drvdata(plat_dev, drv_data); |
143 | 139 | ||
144 | return 0; | 140 | return 0; |
145 | } | 141 | } |
146 | 142 | ||
147 | static struct device_driver ixp2000_i2c_driver = { | 143 | 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, | 144 | .probe = ixp2000_i2c_probe, |
152 | .remove = ixp2000_i2c_remove, | 145 | .remove = ixp2000_i2c_remove, |
146 | .driver = { | ||
147 | .name = "IXP2000-I2C", | ||
148 | .owner = THIS_MODULE, | ||
149 | }, | ||
153 | }; | 150 | }; |
154 | 151 | ||
155 | static int __init ixp2000_i2c_init(void) | 152 | static int __init ixp2000_i2c_init(void) |
156 | { | 153 | { |
157 | return driver_register(&ixp2000_i2c_driver); | 154 | return platform_driver_register(&ixp2000_i2c_driver); |
158 | } | 155 | } |
159 | 156 | ||
160 | static void __exit ixp2000_i2c_exit(void) | 157 | static void __exit ixp2000_i2c_exit(void) |
161 | { | 158 | { |
162 | driver_unregister(&ixp2000_i2c_driver); | 159 | platform_driver_unregister(&ixp2000_i2c_driver); |
163 | } | 160 | } |
164 | 161 | ||
165 | module_init(ixp2000_i2c_init); | 162 | module_init(ixp2000_i2c_init); |