diff options
author | Jonathan Corbet <corbet@lwn.net> | 2010-04-22 19:39:34 -0400 |
---|---|---|
committer | Jonathan Corbet <corbet@lwn.net> | 2010-05-07 19:17:37 -0400 |
commit | 7582eb9be85f35271fd2569681a88a5b243e9380 (patch) | |
tree | 84a234364b9e314e7b25800d473e6047da379a56 /drivers/video/via/via_i2c.c | |
parent | 75b035ace904761b8a340b524533a36e37313b29 (diff) |
viafb: Turn GPIO and i2c into proper platform devices
Another step toward making this thing a real multifunction device driver.
Cc: ScottFang@viatech.com.cn
Cc: JosephChan@via.com.tw
Cc: Harald Welte <laforge@gnumonks.org>
Acked-by: Florian Tobias Schandinat <FlorianSchandinat@gmx.de>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'drivers/video/via/via_i2c.c')
-rw-r--r-- | drivers/video/via/via_i2c.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/drivers/video/via/via_i2c.c b/drivers/video/via/via_i2c.c index 116fd3e62934..3ff60b280d88 100644 --- a/drivers/video/via/via_i2c.c +++ b/drivers/video/via/via_i2c.c | |||
@@ -19,6 +19,7 @@ | |||
19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 19 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <linux/platform_device.h> | ||
22 | #include "via-core.h" | 23 | #include "via-core.h" |
23 | #include "via_i2c.h" | 24 | #include "via_i2c.h" |
24 | #include "global.h" | 25 | #include "global.h" |
@@ -185,11 +186,14 @@ static int create_i2c_bus(struct i2c_adapter *adapter, | |||
185 | return i2c_bit_add_bus(adapter); | 186 | return i2c_bit_add_bus(adapter); |
186 | } | 187 | } |
187 | 188 | ||
188 | int viafb_create_i2c_busses(struct viafb_dev *dev, struct via_port_cfg *configs) | 189 | static int viafb_i2c_probe(struct platform_device *platdev) |
189 | { | 190 | { |
190 | int i, ret; | 191 | int i, ret; |
192 | struct via_port_cfg *configs; | ||
193 | |||
194 | i2c_vdev = platdev->dev.platform_data; | ||
195 | configs = i2c_vdev->port_cfg; | ||
191 | 196 | ||
192 | i2c_vdev = dev; | ||
193 | for (i = 0; i < VIAFB_NUM_PORTS; i++) { | 197 | for (i = 0; i < VIAFB_NUM_PORTS; i++) { |
194 | struct via_port_cfg *adap_cfg = configs++; | 198 | struct via_port_cfg *adap_cfg = configs++; |
195 | struct via_i2c_stuff *i2c_stuff = &via_i2c_par[i]; | 199 | struct via_i2c_stuff *i2c_stuff = &via_i2c_par[i]; |
@@ -211,7 +215,7 @@ int viafb_create_i2c_busses(struct viafb_dev *dev, struct via_port_cfg *configs) | |||
211 | return 0; | 215 | return 0; |
212 | } | 216 | } |
213 | 217 | ||
214 | void viafb_delete_i2c_busses(void) | 218 | static int viafb_i2c_remove(struct platform_device *platdev) |
215 | { | 219 | { |
216 | int i; | 220 | int i; |
217 | 221 | ||
@@ -224,4 +228,23 @@ void viafb_delete_i2c_busses(void) | |||
224 | if (i2c_stuff->adapter.algo_data == &i2c_stuff->algo) | 228 | if (i2c_stuff->adapter.algo_data == &i2c_stuff->algo) |
225 | i2c_del_adapter(&i2c_stuff->adapter); | 229 | i2c_del_adapter(&i2c_stuff->adapter); |
226 | } | 230 | } |
231 | return 0; | ||
232 | } | ||
233 | |||
234 | static struct platform_driver via_i2c_driver = { | ||
235 | .driver = { | ||
236 | .name = "viafb-i2c", | ||
237 | }, | ||
238 | .probe = viafb_i2c_probe, | ||
239 | .remove = viafb_i2c_remove, | ||
240 | }; | ||
241 | |||
242 | int viafb_i2c_init(void) | ||
243 | { | ||
244 | return platform_driver_register(&via_i2c_driver); | ||
245 | } | ||
246 | |||
247 | void viafb_i2c_exit(void) | ||
248 | { | ||
249 | platform_driver_unregister(&via_i2c_driver); | ||
227 | } | 250 | } |