aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/devices.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-07-21 16:48:45 -0400
committerKevin Hilman <khilman@ti.com>2011-09-15 19:35:46 -0400
commit3528c58eb9e818b7821501afa2916eb12131994a (patch)
tree078de60ef5e54b7028220c5cc58c93fe84d8e6b6 /arch/arm/mach-omap2/devices.c
parenta2a28ad9969616fa6d7b243ecf334dc6983992cf (diff)
OMAP: omap_device: when building return platform_device instead of omap_device
All of the device init and device driver interaction with omap_device is done using platform_device pointers. To make this more explicit, have omap_device return a platform_device pointer instead of an omap_device pointer. All current users of the omap_device pointer were only using it to get at the platform_device pointer or struct device pointer, so fixing all of the users was trivial. This also makes it more difficult for device init code to directly access members of struct omap_device, and allows for easier changing of omap_device internals. Cc: Paul Walmsley <paul@pwsan.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/devices.c')
-rw-r--r--arch/arm/mach-omap2/devices.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1077ad663f93..10adf66be7ba 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -44,7 +44,7 @@ static int __init omap3_l3_init(void)
44{ 44{
45 int l; 45 int l;
46 struct omap_hwmod *oh; 46 struct omap_hwmod *oh;
47 struct omap_device *od; 47 struct platform_device *pdev;
48 char oh_name[L3_MODULES_MAX_LEN]; 48 char oh_name[L3_MODULES_MAX_LEN];
49 49
50 /* 50 /*
@@ -61,12 +61,12 @@ static int __init omap3_l3_init(void)
61 if (!oh) 61 if (!oh)
62 pr_err("could not look up %s\n", oh_name); 62 pr_err("could not look up %s\n", oh_name);
63 63
64 od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, 64 pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
65 NULL, 0, 0); 65 NULL, 0, 0);
66 66
67 WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); 67 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
68 68
69 return IS_ERR(od) ? PTR_ERR(od) : 0; 69 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
70} 70}
71postcore_initcall(omap3_l3_init); 71postcore_initcall(omap3_l3_init);
72 72
@@ -74,7 +74,7 @@ static int __init omap4_l3_init(void)
74{ 74{
75 int l, i; 75 int l, i;
76 struct omap_hwmod *oh[3]; 76 struct omap_hwmod *oh[3];
77 struct omap_device *od; 77 struct platform_device *pdev;
78 char oh_name[L3_MODULES_MAX_LEN]; 78 char oh_name[L3_MODULES_MAX_LEN];
79 79
80 /* 80 /*
@@ -92,12 +92,12 @@ static int __init omap4_l3_init(void)
92 pr_err("could not look up %s\n", oh_name); 92 pr_err("could not look up %s\n", oh_name);
93 } 93 }
94 94
95 od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, 95 pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
96 0, NULL, 0, 0); 96 0, NULL, 0, 0);
97 97
98 WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); 98 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
99 99
100 return IS_ERR(od) ? PTR_ERR(od) : 0; 100 return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
101} 101}
102postcore_initcall(omap4_l3_init); 102postcore_initcall(omap4_l3_init);
103 103
@@ -232,7 +232,7 @@ struct omap_device_pm_latency omap_keyboard_latency[] = {
232int __init omap4_keyboard_init(struct omap4_keypad_platform_data 232int __init omap4_keyboard_init(struct omap4_keypad_platform_data
233 *sdp4430_keypad_data, struct omap_board_data *bdata) 233 *sdp4430_keypad_data, struct omap_board_data *bdata)
234{ 234{
235 struct omap_device *od; 235 struct platform_device *pdev;
236 struct omap_hwmod *oh; 236 struct omap_hwmod *oh;
237 struct omap4_keypad_platform_data *keypad_data; 237 struct omap4_keypad_platform_data *keypad_data;
238 unsigned int id = -1; 238 unsigned int id = -1;
@@ -247,15 +247,15 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
247 247
248 keypad_data = sdp4430_keypad_data; 248 keypad_data = sdp4430_keypad_data;
249 249
250 od = omap_device_build(name, id, oh, keypad_data, 250 pdev = omap_device_build(name, id, oh, keypad_data,
251 sizeof(struct omap4_keypad_platform_data), 251 sizeof(struct omap4_keypad_platform_data),
252 omap_keyboard_latency, 252 omap_keyboard_latency,
253 ARRAY_SIZE(omap_keyboard_latency), 0); 253 ARRAY_SIZE(omap_keyboard_latency), 0);
254 254
255 if (IS_ERR(od)) { 255 if (IS_ERR(pdev)) {
256 WARN(1, "Can't build omap_device for %s:%s.\n", 256 WARN(1, "Can't build omap_device for %s:%s.\n",
257 name, oh->name); 257 name, oh->name);
258 return PTR_ERR(od); 258 return PTR_ERR(pdev);
259 } 259 }
260 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); 260 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
261 261
@@ -274,7 +274,7 @@ static struct omap_device_pm_latency mbox_latencies[] = {
274static inline void omap_init_mbox(void) 274static inline void omap_init_mbox(void)
275{ 275{
276 struct omap_hwmod *oh; 276 struct omap_hwmod *oh;
277 struct omap_device *od; 277 struct platform_device *pdev;
278 278
279 oh = omap_hwmod_lookup("mailbox"); 279 oh = omap_hwmod_lookup("mailbox");
280 if (!oh) { 280 if (!oh) {
@@ -282,10 +282,10 @@ static inline void omap_init_mbox(void)
282 return; 282 return;
283 } 283 }
284 284
285 od = omap_device_build("omap-mailbox", -1, oh, NULL, 0, 285 pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
286 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); 286 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
287 WARN(IS_ERR(od), "%s: could not build device, err %ld\n", 287 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
288 __func__, PTR_ERR(od)); 288 __func__, PTR_ERR(pdev));
289} 289}
290#else 290#else
291static inline void omap_init_mbox(void) { } 291static inline void omap_init_mbox(void) { }
@@ -344,7 +344,7 @@ struct omap_device_pm_latency omap_mcspi_latency[] = {
344 344
345static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) 345static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
346{ 346{
347 struct omap_device *od; 347 struct platform_device *pdev;
348 char *name = "omap2_mcspi"; 348 char *name = "omap2_mcspi";
349 struct omap2_mcspi_platform_config *pdata; 349 struct omap2_mcspi_platform_config *pdata;
350 static int spi_num; 350 static int spi_num;
@@ -371,10 +371,10 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
371 } 371 }
372 372
373 spi_num++; 373 spi_num++;
374 od = omap_device_build(name, spi_num, oh, pdata, 374 pdev = omap_device_build(name, spi_num, oh, pdata,
375 sizeof(*pdata), omap_mcspi_latency, 375 sizeof(*pdata), omap_mcspi_latency,
376 ARRAY_SIZE(omap_mcspi_latency), 0); 376 ARRAY_SIZE(omap_mcspi_latency), 0);
377 WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n", 377 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
378 name, oh->name); 378 name, oh->name);
379 kfree(pdata); 379 kfree(pdata);
380 return 0; 380 return 0;
@@ -709,7 +709,7 @@ static struct omap_device_pm_latency omap_wdt_latency[] = {
709static int __init omap_init_wdt(void) 709static int __init omap_init_wdt(void)
710{ 710{
711 int id = -1; 711 int id = -1;
712 struct omap_device *od; 712 struct platform_device *pdev;
713 struct omap_hwmod *oh; 713 struct omap_hwmod *oh;
714 char *oh_name = "wd_timer2"; 714 char *oh_name = "wd_timer2";
715 char *dev_name = "omap_wdt"; 715 char *dev_name = "omap_wdt";
@@ -723,10 +723,10 @@ static int __init omap_init_wdt(void)
723 return -EINVAL; 723 return -EINVAL;
724 } 724 }
725 725
726 od = omap_device_build(dev_name, id, oh, NULL, 0, 726 pdev = omap_device_build(dev_name, id, oh, NULL, 0,
727 omap_wdt_latency, 727 omap_wdt_latency,
728 ARRAY_SIZE(omap_wdt_latency), 0); 728 ARRAY_SIZE(omap_wdt_latency), 0);
729 WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n", 729 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
730 dev_name, oh->name); 730 dev_name, oh->name);
731 return 0; 731 return 0;
732} 732}