Commit 3528c58e authored by Kevin Hilman's avatar Kevin Hilman

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: default avatarKevin Hilman <khilman@ti.com>
parent a2a28ad9
...@@ -44,7 +44,7 @@ static int __init omap3_l3_init(void) ...@@ -44,7 +44,7 @@ static int __init omap3_l3_init(void)
{ {
int l; int l;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
char oh_name[L3_MODULES_MAX_LEN]; char oh_name[L3_MODULES_MAX_LEN];
/* /*
...@@ -61,12 +61,12 @@ static int __init omap3_l3_init(void) ...@@ -61,12 +61,12 @@ static int __init omap3_l3_init(void)
if (!oh) if (!oh)
pr_err("could not look up %s\n", oh_name); pr_err("could not look up %s\n", oh_name);
od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
NULL, 0, 0); NULL, 0, 0);
WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
return IS_ERR(od) ? PTR_ERR(od) : 0; return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
} }
postcore_initcall(omap3_l3_init); postcore_initcall(omap3_l3_init);
...@@ -74,7 +74,7 @@ static int __init omap4_l3_init(void) ...@@ -74,7 +74,7 @@ static int __init omap4_l3_init(void)
{ {
int l, i; int l, i;
struct omap_hwmod *oh[3]; struct omap_hwmod *oh[3];
struct omap_device *od; struct platform_device *pdev;
char oh_name[L3_MODULES_MAX_LEN]; char oh_name[L3_MODULES_MAX_LEN];
/* /*
...@@ -92,12 +92,12 @@ static int __init omap4_l3_init(void) ...@@ -92,12 +92,12 @@ static int __init omap4_l3_init(void)
pr_err("could not look up %s\n", oh_name); pr_err("could not look up %s\n", oh_name);
} }
od = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL,
0, NULL, 0, 0); 0, NULL, 0, 0);
WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name); WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
return IS_ERR(od) ? PTR_ERR(od) : 0; return IS_ERR(pdev) ? PTR_ERR(pdev) : 0;
} }
postcore_initcall(omap4_l3_init); postcore_initcall(omap4_l3_init);
...@@ -232,7 +232,7 @@ struct omap_device_pm_latency omap_keyboard_latency[] = { ...@@ -232,7 +232,7 @@ struct omap_device_pm_latency omap_keyboard_latency[] = {
int __init omap4_keyboard_init(struct omap4_keypad_platform_data int __init omap4_keyboard_init(struct omap4_keypad_platform_data
*sdp4430_keypad_data, struct omap_board_data *bdata) *sdp4430_keypad_data, struct omap_board_data *bdata)
{ {
struct omap_device *od; struct platform_device *pdev;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap4_keypad_platform_data *keypad_data; struct omap4_keypad_platform_data *keypad_data;
unsigned int id = -1; unsigned int id = -1;
...@@ -247,15 +247,15 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data ...@@ -247,15 +247,15 @@ int __init omap4_keyboard_init(struct omap4_keypad_platform_data
keypad_data = sdp4430_keypad_data; keypad_data = sdp4430_keypad_data;
od = omap_device_build(name, id, oh, keypad_data, pdev = omap_device_build(name, id, oh, keypad_data,
sizeof(struct omap4_keypad_platform_data), sizeof(struct omap4_keypad_platform_data),
omap_keyboard_latency, omap_keyboard_latency,
ARRAY_SIZE(omap_keyboard_latency), 0); ARRAY_SIZE(omap_keyboard_latency), 0);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
WARN(1, "Can't build omap_device for %s:%s.\n", WARN(1, "Can't build omap_device for %s:%s.\n",
name, oh->name); name, oh->name);
return PTR_ERR(od); return PTR_ERR(pdev);
} }
oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt); oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
...@@ -274,7 +274,7 @@ static struct omap_device_pm_latency mbox_latencies[] = { ...@@ -274,7 +274,7 @@ static struct omap_device_pm_latency mbox_latencies[] = {
static inline void omap_init_mbox(void) static inline void omap_init_mbox(void)
{ {
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
oh = omap_hwmod_lookup("mailbox"); oh = omap_hwmod_lookup("mailbox");
if (!oh) { if (!oh) {
...@@ -282,10 +282,10 @@ static inline void omap_init_mbox(void) ...@@ -282,10 +282,10 @@ static inline void omap_init_mbox(void)
return; return;
} }
od = omap_device_build("omap-mailbox", -1, oh, NULL, 0, pdev = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
mbox_latencies, ARRAY_SIZE(mbox_latencies), 0); mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
WARN(IS_ERR(od), "%s: could not build device, err %ld\n", WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
__func__, PTR_ERR(od)); __func__, PTR_ERR(pdev));
} }
#else #else
static inline void omap_init_mbox(void) { } static inline void omap_init_mbox(void) { }
...@@ -344,7 +344,7 @@ struct omap_device_pm_latency omap_mcspi_latency[] = { ...@@ -344,7 +344,7 @@ struct omap_device_pm_latency omap_mcspi_latency[] = {
static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
{ {
struct omap_device *od; struct platform_device *pdev;
char *name = "omap2_mcspi"; char *name = "omap2_mcspi";
struct omap2_mcspi_platform_config *pdata; struct omap2_mcspi_platform_config *pdata;
static int spi_num; static int spi_num;
...@@ -371,10 +371,10 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) ...@@ -371,10 +371,10 @@ static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
} }
spi_num++; spi_num++;
od = omap_device_build(name, spi_num, oh, pdata, pdev = omap_device_build(name, spi_num, oh, pdata,
sizeof(*pdata), omap_mcspi_latency, sizeof(*pdata), omap_mcspi_latency,
ARRAY_SIZE(omap_mcspi_latency), 0); ARRAY_SIZE(omap_mcspi_latency), 0);
WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n", WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
name, oh->name); name, oh->name);
kfree(pdata); kfree(pdata);
return 0; return 0;
...@@ -709,7 +709,7 @@ static struct omap_device_pm_latency omap_wdt_latency[] = { ...@@ -709,7 +709,7 @@ static struct omap_device_pm_latency omap_wdt_latency[] = {
static int __init omap_init_wdt(void) static int __init omap_init_wdt(void)
{ {
int id = -1; int id = -1;
struct omap_device *od; struct platform_device *pdev;
struct omap_hwmod *oh; struct omap_hwmod *oh;
char *oh_name = "wd_timer2"; char *oh_name = "wd_timer2";
char *dev_name = "omap_wdt"; char *dev_name = "omap_wdt";
...@@ -723,10 +723,10 @@ static int __init omap_init_wdt(void) ...@@ -723,10 +723,10 @@ static int __init omap_init_wdt(void)
return -EINVAL; return -EINVAL;
} }
od = omap_device_build(dev_name, id, oh, NULL, 0, pdev = omap_device_build(dev_name, id, oh, NULL, 0,
omap_wdt_latency, omap_wdt_latency,
ARRAY_SIZE(omap_wdt_latency), 0); ARRAY_SIZE(omap_wdt_latency), 0);
WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n", WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
dev_name, oh->name); dev_name, oh->name);
return 0; return 0;
} }
......
...@@ -78,7 +78,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) ...@@ -78,7 +78,7 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
{ {
int r = 0; int r = 0;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
int i, oh_count; int i, oh_count;
struct omap_display_platform_data pdata; struct omap_display_platform_data pdata;
const struct omap_dss_hwmod_data *curr_dss_hwmod; const struct omap_dss_hwmod_data *curr_dss_hwmod;
...@@ -108,13 +108,13 @@ int __init omap_display_init(struct omap_dss_board_info *board_data) ...@@ -108,13 +108,13 @@ int __init omap_display_init(struct omap_dss_board_info *board_data)
return -ENODEV; return -ENODEV;
} }
od = omap_device_build(curr_dss_hwmod[i].dev_name, pdev = omap_device_build(curr_dss_hwmod[i].dev_name,
curr_dss_hwmod[i].id, oh, &pdata, curr_dss_hwmod[i].id, oh, &pdata,
sizeof(struct omap_display_platform_data), sizeof(struct omap_display_platform_data),
omap_dss_latency, omap_dss_latency,
ARRAY_SIZE(omap_dss_latency), 0); ARRAY_SIZE(omap_dss_latency), 0);
if (WARN((IS_ERR(od)), "Could not build omap_device for %s\n", if (WARN((IS_ERR(pdev)), "Could not build omap_device for %s\n",
curr_dss_hwmod[i].oh_name)) curr_dss_hwmod[i].oh_name))
return -ENODEV; return -ENODEV;
} }
......
...@@ -228,7 +228,7 @@ static u32 configure_dma_errata(void) ...@@ -228,7 +228,7 @@ static u32 configure_dma_errata(void)
/* One time initializations */ /* One time initializations */
static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
{ {
struct omap_device *od; struct platform_device *pdev;
struct omap_system_dma_plat_info *p; struct omap_system_dma_plat_info *p;
struct resource *mem; struct resource *mem;
char *name = "omap_dma_system"; char *name = "omap_dma_system";
...@@ -258,23 +258,23 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) ...@@ -258,23 +258,23 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
p->errata = configure_dma_errata(); p->errata = configure_dma_errata();
od = omap_device_build(name, 0, oh, p, sizeof(*p), pdev = omap_device_build(name, 0, oh, p, sizeof(*p),
omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0); omap2_dma_latency, ARRAY_SIZE(omap2_dma_latency), 0);
kfree(p); kfree(p);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
pr_err("%s: Can't build omap_device for %s:%s.\n", pr_err("%s: Can't build omap_device for %s:%s.\n",
__func__, name, oh->name); __func__, name, oh->name);
return PTR_ERR(od); return PTR_ERR(pdev);
} }
mem = platform_get_resource(&od->pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!mem) { if (!mem) {
dev_err(&od->pdev.dev, "%s: no mem resource\n", __func__); dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
return -EINVAL; return -EINVAL;
} }
dma_base = ioremap(mem->start, resource_size(mem)); dma_base = ioremap(mem->start, resource_size(mem));
if (!dma_base) { if (!dma_base) {
dev_err(&od->pdev.dev, "%s: ioremap fail\n", __func__); dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
...@@ -283,7 +283,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) ...@@ -283,7 +283,7 @@ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused)
(d->lch_count), GFP_KERNEL); (d->lch_count), GFP_KERNEL);
if (!d->chan) { if (!d->chan) {
dev_err(&od->pdev.dev, "%s: kzalloc fail\n", __func__); dev_err(&pdev->dev, "%s: kzalloc fail\n", __func__);
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
......
...@@ -34,7 +34,7 @@ static struct omap_device_pm_latency omap_gpio_latency[] = { ...@@ -34,7 +34,7 @@ static struct omap_device_pm_latency omap_gpio_latency[] = {
static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
{ {
struct omap_device *od; struct platform_device *pdev;
struct omap_gpio_platform_data *pdata; struct omap_gpio_platform_data *pdata;
struct omap_gpio_dev_attr *dev_attr; struct omap_gpio_dev_attr *dev_attr;
char *name = "omap_gpio"; char *name = "omap_gpio";
...@@ -107,16 +107,16 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused) ...@@ -107,16 +107,16 @@ static int omap2_gpio_dev_init(struct omap_hwmod *oh, void *unused)
return -EINVAL; return -EINVAL;
} }
od = omap_device_build(name, id - 1, oh, pdata, pdev = omap_device_build(name, id - 1, oh, pdata,
sizeof(*pdata), omap_gpio_latency, sizeof(*pdata), omap_gpio_latency,
ARRAY_SIZE(omap_gpio_latency), ARRAY_SIZE(omap_gpio_latency),
false); false);
kfree(pdata); kfree(pdata);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
WARN(1, "Can't build omap_device for %s:%s.\n", WARN(1, "Can't build omap_device for %s:%s.\n",
name, oh->name); name, oh->name);
return PTR_ERR(od); return PTR_ERR(pdev);
} }
omap_device_disable_idle_on_suspend(od); omap_device_disable_idle_on_suspend(od);
......
...@@ -430,7 +430,7 @@ static struct omap_device_pm_latency omap_hsmmc_latency[] = { ...@@ -430,7 +430,7 @@ static struct omap_device_pm_latency omap_hsmmc_latency[] = {
void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
{ {
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
struct omap_device_pm_latency *ohl; struct omap_device_pm_latency *ohl;
char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN];
struct omap_mmc_platform_data *mmc_data; struct omap_mmc_platform_data *mmc_data;
...@@ -471,9 +471,9 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) ...@@ -471,9 +471,9 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
mmc_data->controller_flags = mmc_dev_attr->flags; mmc_data->controller_flags = mmc_dev_attr->flags;
} }
od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, pdev = omap_device_build(name, ctrl_nr - 1, oh, mmc_data,
sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name);
kfree(mmc_data->slots[0].name); kfree(mmc_data->slots[0].name);
goto done; goto done;
...@@ -482,7 +482,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr) ...@@ -482,7 +482,7 @@ void __init omap_init_hsmmc(struct omap2_hsmmc_info *hsmmcinfo, int ctrl_nr)
* return device handle to board setup code * return device handle to board setup code
* required to populate for regulator framework structure * required to populate for regulator framework structure
*/ */
hsmmcinfo->dev = &od->pdev.dev; hsmmcinfo->dev = &pdev->dev;
done: done:
kfree(mmc_data); kfree(mmc_data);
......
...@@ -35,7 +35,7 @@ int __init hwspinlocks_init(void) ...@@ -35,7 +35,7 @@ int __init hwspinlocks_init(void)
{ {
int retval = 0; int retval = 0;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
const char *oh_name = "spinlock"; const char *oh_name = "spinlock";
const char *dev_name = "omap_hwspinlock"; const char *dev_name = "omap_hwspinlock";
...@@ -48,13 +48,13 @@ int __init hwspinlocks_init(void) ...@@ -48,13 +48,13 @@ int __init hwspinlocks_init(void)
if (oh == NULL) if (oh == NULL)
return -EINVAL; return -EINVAL;
od = omap_device_build(dev_name, 0, oh, NULL, 0, pdev = omap_device_build(dev_name, 0, oh, NULL, 0,
omap_spinlock_latency, omap_spinlock_latency,
ARRAY_SIZE(omap_spinlock_latency), false); ARRAY_SIZE(omap_spinlock_latency), false);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
pr_err("Can't build omap_device for %s:%s\n", dev_name, pr_err("Can't build omap_device for %s:%s\n", dev_name,
oh_name); oh_name);
retval = PTR_ERR(od); retval = PTR_ERR(pdev);
} }
return retval; return retval;
......
...@@ -116,7 +116,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) ...@@ -116,7 +116,7 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
char *name = "omap-mcbsp"; char *name = "omap-mcbsp";
struct omap_hwmod *oh_device[2]; struct omap_hwmod *oh_device[2];
struct omap_mcbsp_platform_data *pdata = NULL; struct omap_mcbsp_platform_data *pdata = NULL;
struct omap_device *od; struct platform_device *pdev;
sscanf(oh->name, "mcbsp%d", &id); sscanf(oh->name, "mcbsp%d", &id);
...@@ -144,14 +144,14 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused) ...@@ -144,14 +144,14 @@ static int omap_init_mcbsp(struct omap_hwmod *oh, void *unused)
(struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone); (struct omap_mcbsp_dev_attr *)(oh->dev_attr))->sidetone);
count++; count++;
} }
od = omap_device_build_ss(name, id, oh_device, count, pdata, pdev = omap_device_build_ss(name, id, oh_device, count, pdata,
sizeof(*pdata), omap2_mcbsp_latency, sizeof(*pdata), omap2_mcbsp_latency,
ARRAY_SIZE(omap2_mcbsp_latency), false); ARRAY_SIZE(omap2_mcbsp_latency), false);
kfree(pdata); kfree(pdata);
if (IS_ERR(od)) { if (IS_ERR(pdev)) {
pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, pr_err("%s: Can't build omap_device for %s:%s.\n", __func__,
name, oh->name); name, oh->name);
return PTR_ERR(od); return PTR_ERR(pdev);
} }
omap_mcbsp_count++; omap_mcbsp_count++;
return 0; return 0;
......
...@@ -60,19 +60,19 @@ EXPORT_SYMBOL(omap4_get_dsp_device); ...@@ -60,19 +60,19 @@ EXPORT_SYMBOL(omap4_get_dsp_device);
static int _init_omap_device(char *name, struct device **new_dev) static int _init_omap_device(char *name, struct device **new_dev)
{ {
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
oh = omap_hwmod_lookup(name); oh = omap_hwmod_lookup(name);
if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", if (WARN(!oh, "%s: could not find omap_hwmod for %s\n",
__func__, name)) __func__, name))
return -ENODEV; return -ENODEV;
od = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false);
if (WARN(IS_ERR(od), "%s: could not build omap_device for %s\n", if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n",
__func__, name)) __func__, name))
return -ENODEV; return -ENODEV;
*new_dev = &od->pdev.dev; *new_dev = &pdev->dev;
return 0; return 0;
} }
......
...@@ -711,7 +711,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) ...@@ -711,7 +711,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
{ {
struct omap_uart_state *uart; struct omap_uart_state *uart;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
void *pdata = NULL; void *pdata = NULL;
u32 pdata_size = 0; u32 pdata_size = 0;
char *name; char *name;
...@@ -799,10 +799,10 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) ...@@ -799,10 +799,10 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
if (WARN_ON(!oh)) if (WARN_ON(!oh))
return; return;
od = omap_device_build(name, uart->num, oh, pdata, pdata_size, pdev = omap_device_build(name, uart->num, oh, pdata, pdata_size,
omap_uart_latency, omap_uart_latency,
ARRAY_SIZE(omap_uart_latency), false); ARRAY_SIZE(omap_uart_latency), false);
WARN(IS_ERR(od), "Could not build omap_device for %s: %s.\n", WARN(IS_ERR(pdev), "Could not build omap_device for %s: %s.\n",
name, oh->name); name, oh->name);
omap_device_disable_idle_on_suspend(od); omap_device_disable_idle_on_suspend(od);
...@@ -812,7 +812,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) ...@@ -812,7 +812,7 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
uart->regshift = 2; uart->regshift = 2;
uart->mapbase = oh->slaves[0]->addr->pa_start; uart->mapbase = oh->slaves[0]->addr->pa_start;
uart->membase = omap_hwmod_get_mpu_rt_va(oh); uart->membase = omap_hwmod_get_mpu_rt_va(oh);
uart->pdev = &od->pdev; uart->pdev = pdev;
oh->dev_attr = uart; oh->dev_attr = uart;
...@@ -846,8 +846,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata) ...@@ -846,8 +846,8 @@ void __init omap_serial_init_port(struct omap_board_data *bdata)
if ((cpu_is_omap34xx() && uart->padconf) || if ((cpu_is_omap34xx() && uart->padconf) ||
(uart->wk_en && uart->wk_mask)) { (uart->wk_en && uart->wk_mask)) {
device_init_wakeup(&od->pdev.dev, true); device_init_wakeup(&pdev->dev, true);
DEV_CREATE_FILE(&od->pdev.dev, &dev_attr_sleep_timeout); DEV_CREATE_FILE(&pdev->dev, &dev_attr_sleep_timeout);
} }
/* Enable the MDR1 errata for OMAP3 */ /* Enable the MDR1 errata for OMAP3 */
......
...@@ -80,7 +80,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data, ...@@ -80,7 +80,7 @@ static void __init sr_set_nvalues(struct omap_volt_data *volt_data,
static int sr_dev_init(struct omap_hwmod *oh, void *user) static int sr_dev_init(struct omap_hwmod *oh, void *user)
{ {
struct omap_sr_data *sr_data; struct omap_sr_data *sr_data;
struct omap_device *od; struct platform_device *pdev;
struct omap_volt_data *volt_data; struct omap_volt_data *volt_data;
char *name = "smartreflex"; char *name = "smartreflex";
static int i; static int i;
...@@ -120,10 +120,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user) ...@@ -120,10 +120,10 @@ static int sr_dev_init(struct omap_hwmod *oh, void *user)
sr_data->enable_on_init = sr_enable_on_init; sr_data->enable_on_init = sr_enable_on_init;
od = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data), pdev = omap_device_build(name, i, oh, sr_data, sizeof(*sr_data),
omap_sr_latency, omap_sr_latency,
ARRAY_SIZE(omap_sr_latency), 0); ARRAY_SIZE(omap_sr_latency), 0);
if (IS_ERR(od)) if (IS_ERR(pdev))
pr_warning("%s: Could not build omap_device for %s: %s.\n\n", pr_warning("%s: Could not build omap_device for %s: %s.\n\n",
__func__, name, oh->name); __func__, name, oh->name);
exit: exit:
......
...@@ -135,7 +135,7 @@ static inline int omap2_i2c_add_bus(int bus_id) ...@@ -135,7 +135,7 @@ static inline int omap2_i2c_add_bus(int bus_id)
{ {
int l; int l;
struct omap_hwmod *oh; struct omap_hwmod *oh;
struct omap_device *od; struct platform_device *pdev;
char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN];
struct omap_i2c_bus_platform_data *pdata; struct omap_i2c_bus_platform_data *pdata;
...@@ -160,12 +160,12 @@ static inline int omap2_i2c_add_bus(int bus_id) ...@@ -160,12 +160,12 @@ static inline int omap2_i2c_add_bus(int bus_id)
*/ */
if (cpu_is_omap34xx()) if (cpu_is_omap34xx())
pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat; pdata->set_mpu_wkup_lat = omap_pm_set_max_mpu_wakeup_lat_compat;
od = omap_device_build(name, bus_id, oh, pdata, pdev = omap_device_build(name, bus_id, oh, pdata,
sizeof(struct omap_i2c_bus_platform_data), sizeof(struct omap_i2c_bus_platform_data),
omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0);
WARN(IS_ERR(od), "Could not build omap_device for %s\n", name); WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name);
return PTR_ERR(od); return PTR_ERR(pdev);
} }
#else #else
static inline int omap2_i2c_add_bus(int bus_id) static inline int omap2_i2c_add_bus(int bus_id)
......
...@@ -88,13 +88,13 @@ int omap_device_shutdown(struct platform_device *pdev); ...@@ -88,13 +88,13 @@ int omap_device_shutdown(struct platform_device *pdev);
/* Core code interface */ /* Core code interface */
struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
struct omap_hwmod *oh, void *pdata, struct omap_hwmod *oh, void *pdata,
int pdata_len, int pdata_len,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
int pm_lats_cnt, int is_early_device); int pm_lats_cnt, int is_early_device);
struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
struct omap_hwmod **oh, int oh_cnt, struct omap_hwmod **oh, int oh_cnt,
void *pdata, int pdata_len, void *pdata, int pdata_len,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
......
...@@ -405,7 +405,7 @@ static int omap_device_fill_resources(struct omap_device *od, ...@@ -405,7 +405,7 @@ static int omap_device_fill_resources(struct omap_device *od,
* information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise, * information. Returns ERR_PTR(-EINVAL) if @oh is NULL; otherwise,
* passes along the return value of omap_device_build_ss(). * passes along the return value of omap_device_build_ss().
*/ */
struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, struct platform_device *omap_device_build(const char *pdev_name, int pdev_id,
struct omap_hwmod *oh, void *pdata, struct omap_hwmod *oh, void *pdata,
int pdata_len, int pdata_len,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
...@@ -438,7 +438,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id, ...@@ -438,7 +438,7 @@ struct omap_device *omap_device_build(const char *pdev_name, int pdev_id,
* platform_device record. Returns an ERR_PTR() on error, or passes * platform_device record. Returns an ERR_PTR() on error, or passes
* along the return value of omap_device_register(). * along the return value of omap_device_register().
*/ */
struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, struct platform_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
struct omap_hwmod **ohs, int oh_cnt, struct omap_hwmod **ohs, int oh_cnt,
void *pdata, int pdata_len, void *pdata, int pdata_len,
struct omap_device_pm_latency *pm_lats, struct omap_device_pm_latency *pm_lats,
...@@ -513,7 +513,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id, ...@@ -513,7 +513,7 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
if (ret) if (ret)
goto odbs_exit4; goto odbs_exit4;
return od; return &od->pdev;
odbs_exit4: odbs_exit4:
kfree(res); kfree(res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment