static void omap_init_gpu(void) { struct omap_hwmod *oh; struct omap_device *od; int max_omap_gpu_hwmod_name_len = 16; char oh_name[max_omap_gpu_hwmod_name_len]; int l; struct gpu_platform_data *pdata; char *name = "pvrsrvkm"; l = snprintf(oh_name, max_omap_gpu_hwmod_name_len, "gpu"); WARN(l >= max_omap_gpu_hwmod_name_len, "String buffer overflow in GPU device setup\n"); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("omap_init_gpu: Could not look up %s\n", oh_name); return; } pdata = kzalloc(sizeof(struct gpu_platform_data), GFP_KERNEL); if (!pdata) { pr_err("omap_init_gpu: Platform data memory allocation failed\n"); return; } pdata->device_scale = omap_device_scale; pdata->device_enable = omap_device_enable; pdata->device_idle = omap_device_idle; pdata->device_shutdown = omap_device_shutdown; pdata->ovfreqs = 0; if (cpu_is_omap446x()) pdata->ovfreqs = 1; od = omap_device_build(name, 0, oh, pdata, sizeof(struct gpu_platform_data), omap_gpu_latency, ARRAY_SIZE(omap_gpu_latency), 0); WARN(IS_ERR(od), "Could not build omap_device for %s %s\n", name, oh_name); kfree(pdata); platform_device_register(&omap_omaplfb_device); }
/* One time initializations */ static int __init omap2_system_dma_init_dev(struct omap_hwmod *oh, void *unused) { struct platform_device *pdev; struct omap_system_dma_plat_info p; struct omap_dma_dev_attr *d; struct resource *mem; char *name = "omap_dma_system"; p = dma_plat_info; p.dma_attr = (struct omap_dma_dev_attr *)oh->dev_attr; p.errata = configure_dma_errata(); pdev = omap_device_build(name, 0, oh, &p, sizeof(p)); if (IS_ERR(pdev)) { pr_err("%s: Can't build omap_device for %s:%s.\n", __func__, name, oh->name); return PTR_ERR(pdev); } omap_dma_dev_info.res = pdev->resource; omap_dma_dev_info.num_res = pdev->num_resources; mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "%s: no mem resource\n", __func__); return -EINVAL; } dma_base = ioremap(mem->start, resource_size(mem)); if (!dma_base) { dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); return -ENOMEM; } d = oh->dev_attr; if (cpu_is_omap34xx() && (omap_type() != OMAP2_DEVICE_TYPE_GP)) d->dev_caps |= HS_CHANNELS_RESERVED; /* Check the capabilities register for descriptor loading feature */ if (dma_read(CAPS_0, 0) & DMA_HAS_DESCRIPTOR_CAPS) dma_common_ch_end = CCDN; else dma_common_ch_end = CCFN; return 0; }
static int __init init(void) { int i, ret; struct omap_hwmod *oh; struct omap_device_pm_latency *ohl = rpres_latency; int ohl_cnt = ARRAY_SIZE(rpres_latency); struct omap_device *od; struct device *dev; struct platform_device *pdev; for (i = 0; i < ARRAY_SIZE(rpres_data); i++) { oh = omap_hwmod_lookup(rpres_data[i].oh_name); if (!oh) { pr_err("No hdmod for %s\n", rpres_data[i].name); continue; } rpres_data[i].oh = oh; if (rpres_data[i].get_dev) { dev = rpres_data[i].get_dev(); if (!dev) { pr_err("No dev for %s\n", rpres_data[i].name); continue; } pdev = to_platform_device(dev); ret = platform_device_add_data(pdev, &rpres_data[i], sizeof(struct rpres_platform_data)); if (ret) { pr_err("Error pdev add for %s\n", rpres_data[i].name); continue; } od = to_omap_device(pdev); od->pm_lats = ohl; od->pm_lats_cnt = ohl_cnt; } else { od = omap_device_build("rpres", i, oh, &rpres_data[i], sizeof(struct rpres_platform_data), ohl, ohl_cnt, false); if (IS_ERR(od)) pr_err("Error building device for %s\n", rpres_data[i].name); } } return 0; }
static void omap_init_dmic(void) { struct omap_hwmod *oh; struct omap_device *od; oh = omap_hwmod_lookup("dmic"); if (!oh) { printk(KERN_ERR "Could not look up dmic hw_mod\n"); return; } od = omap_device_build("omap-dmic-dai", -1, oh, NULL, 0, omap_dmic_latency, ARRAY_SIZE(omap_dmic_latency), 0); if (IS_ERR(od)) printk(KERN_ERR "Could not build omap_device for omap-dmic-dai\n"); }
static int _init_omap_device(char *name) { struct omap_hwmod *oh; struct platform_device *pdev; oh = omap_hwmod_lookup(name); if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", __func__, name)) return -ENODEV; pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n", __func__, name)) return -ENODEV; return 0; }
void __init omap2_init_mmc(struct omap_mmc_platform_data *mmc_data, int ctrl_nr) { struct omap_hwmod *oh; struct omap_device *od; struct omap_device_pm_latency *ohl; char oh_name[MAX_OMAP_MMC_HWMOD_NAME_LEN]; char *name; int l; int ohl_cnt = 0; if (cpu_is_omap2420()) { name = "mmci-omap"; } else { name = "mmci-omap-hs"; ohl = omap_hsmmc_latency; ohl_cnt = ARRAY_SIZE(omap_hsmmc_latency); } l = snprintf(oh_name, MAX_OMAP_MMC_HWMOD_NAME_LEN, "mmc%d", ctrl_nr); WARN(l >= MAX_OMAP_MMC_HWMOD_NAME_LEN, "String buffer overflow in MMC%d device setup\n", ctrl_nr); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); return; } mmc_data->dev_attr = oh->dev_attr; #ifdef CONFIG_OMAP_PM mmc_data->set_min_bus_tput = omap_pm_set_min_bus_tput; #endif omap2_mmc_mux(mmc_data, ctrl_nr - 1); od = omap_device_build(name, ctrl_nr - 1, oh, mmc_data, sizeof(struct omap_mmc_platform_data), ohl, ohl_cnt, false); WARN(IS_ERR(od), "Could not build omap_device for %s %s\n", name, oh_name); /* * return device handle to board setup code * required to populate for regulator framework structure */ mmc_data->dev = &od->pdev.dev; }
static int __init omap_init_hdq(void) { int id = -1; struct platform_device *pdev; struct omap_hwmod *oh; char *oh_name = "hdq1w"; char *devname = "omap_hdq"; oh = omap_hwmod_lookup(oh_name); if (!oh) return 0; pdev = omap_device_build(devname, id, oh, NULL, 0); WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", devname, oh->name); return 0; }
static void __init omap_init_hdmi_audio(void) { struct omap_hwmod *oh; struct platform_device *pdev; oh = omap_hwmod_lookup("dss_hdmi"); if (!oh) { printk(KERN_ERR "Could not look up dss_hdmi hw_mod\n"); return; } pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0, NULL, 0, 0); WARN(IS_ERR(pdev), "Can't build omap_device for omap-hdmi-audio-dai.\n"); platform_device_register(&omap_hdmi_audio); }
/* static int _init_omap_device(struct omap_hwmod *oh, void *user) */ static int _init_omap_device(char *name, struct device **new_dev) { struct omap_hwmod *oh; struct omap_device *od; oh = omap_hwmod_lookup(name); if (WARN(!oh, "%s: could not find omap_hwmod for %s\n", __func__, name)) return -ENODEV; od = 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", __func__, name)) return -ENODEV; *new_dev = &od->pdev.dev; return 0; }
static int omap4_init_keypad(struct omap_hwmod *oh, void *user) { struct omap_device *od; struct omap4_keypad_platform_data *sdp4430_keypad_data; unsigned int id = -1; char *name = "omap-keypad"; keyboard_mux_init(); sdp4430_keypad_data = user; od = omap_device_build(name, id, oh, sdp4430_keypad_data, sizeof(struct omap4_keypad_platform_data), omap_keyboard_latency, ARRAY_SIZE(omap_keyboard_latency), 0); WARN(IS_ERR(od), "Could not build omap_device for %s %s\n", name, oh->name); return 0; }
static int __init omap_init_drm(void) { struct omap_hwmod *oh = NULL; struct platform_device *pdev; /* lookup and populate the DMM information, if present - OMAP4+ */ oh = omap_hwmod_lookup("dmm"); if (oh) { pdev = omap_device_build(oh->name, -1, oh, NULL, 0, NULL, 0, false); WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", oh->name); } return platform_device_register(&omap_drm_device); }
static void omap_init_mcasp(void) { struct omap_hwmod *oh; struct omap_device *od; char *oh_name = "omap-mcasp-dai"; char *dev_name = "omap-mcasp-dai"; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("%s: could not look up %s\n", __func__, oh_name); return; } od = omap_device_build(dev_name, -1, oh, NULL, 0, omap_mcasp_latency, ARRAY_SIZE(omap_mcasp_latency), 0); WARN(IS_ERR(od), "could not build omap_device for %s:%s\n", oh_name, dev_name); }
void __init am33xx_gpu_init(void) { int id = -1; struct platform_device *pdev; struct omap_hwmod *oh; char *oh_name = "gfx"; char *dev_name = "pvrsrvkm"; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not find %s hwmod data\n", oh_name); return; } pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0); WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); }
void am33xx_d_can_init(unsigned int instance) { struct omap_hwmod *oh; struct platform_device *pdev; char oh_name[L3_MODULES_MAX_LEN]; /* Copy string name to oh_name buffer */ snprintf(oh_name, L3_MODULES_MAX_LEN, "d_can%d", instance); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("could not find %s hwmod data\n", oh_name); return; } pdev = omap_device_build("d_can", instance, oh, &am33xx_dcan_info, sizeof(am33xx_dcan_info), NULL, 0, 0); if (IS_ERR(pdev)) pr_err("could not build omap_device for %s\n", oh_name); }
/* HSI device registration */ static int __init omap_hsi_register(struct omap_hwmod *oh, void *user) { struct omap_device *od; struct hsi_platform_data *pdata = &omap_hsi_platform_data; if (!oh) { pr_err("Could not look up %s omap_hwmod\n", OMAP_HSI_HWMOD_NAME); return -EEXIST; } od = omap_device_build(OMAP_HSI_PLATFORM_DEVICE_DRIVER_NAME, 0, oh, pdata, sizeof(*pdata), omap_hsi_latency, ARRAY_SIZE(omap_hsi_latency), false); WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n", OMAP_HSI_PLATFORM_DEVICE_DRIVER_NAME, oh->name); pr_info("HSI: device registered as omap_hwmod: %s\n", oh->name); return 0; }
static int omap_mcspi_init(struct omap_hwmod *oh, void *unused) { struct omap_device *od; char *name = "omap2_mcspi"; struct omap2_mcspi_platform_config *pdata; static int spi_num; struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr; pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); if (!pdata) { pr_err("Memory allocation for McSPI device failed\n"); return -ENOMEM; } pdata->num_cs = mcspi_attrib->num_chipselect; pdata->force_cs_mode = mcspi_attrib->force_cs_mode; pdata->mode = mcspi_attrib->mode; pdata->dma_mode = mcspi_attrib->dma_mode; pdata->fifo_depth = mcspi_attrib->fifo_depth; switch (oh->class->rev) { case OMAP2_MCSPI_REV: case OMAP3_MCSPI_REV: pdata->regs_offset = 0; break; case OMAP4_MCSPI_REV: pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET; break; default: pr_err("Invalid McSPI Revision value\n"); return -EINVAL; } spi_num++; od = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata), omap_mcspi_latency, ARRAY_SIZE(omap_mcspi_latency), 0); WARN(IS_ERR(od), "Can't build omap_device for %s:%s\n", name, oh->name); kfree(pdata); return 0; }
int __init am33xx_register_tsc(struct tsc_data *pdata) { int id = -1; struct platform_device *pdev; struct omap_hwmod *oh; char *oh_name = "adc_tsc"; char *dev_name = "tsc"; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up TSC%d hwmod\n", id); return -ENODEV; } pdev = omap_device_build(dev_name, id, oh, pdata, sizeof(struct tsc_data), NULL, 0, 0); WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", dev_name, oh->name); return 0; }
static inline void __init omap_init_mbox(void) { struct omap_hwmod *oh; struct platform_device *pdev; struct omap_mbox_pdata *pdata; oh = omap_hwmod_lookup("mailbox"); if (!oh) { pr_err("%s: unable to find hwmod\n", __func__); return; } if (!oh->dev_attr) { pr_err("%s: hwmod doesn't have valid attrs\n", __func__); return; } pdata = (struct omap_mbox_pdata *)oh->dev_attr; pdev = omap_device_build("omap-mailbox", -1, oh, pdata, sizeof(*pdata)); WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n", __func__, PTR_ERR(pdev)); }
void __init omap_dmm_init(void) { struct omap_hwmod *oh = NULL; struct omap_device *od = NULL; oh = omap_hwmod_lookup(dmm_data.oh_name); if (!oh) return; dmm_data.base = omap_hwmod_get_mpu_rt_va(oh); dmm_data.irq = oh->mpu_irqs[0].irq; od = omap_device_build(dmm_data.oh_name, -1, oh, &dmm_data, sizeof(dmm_data), omap_dmm_latency, ARRAY_SIZE(omap_dmm_latency), false); /* register tiler platform device to go along with the dmm device */ if (platform_device_register(&omap_tiler_device) < 0) printk(KERN_ERR "Unable to register OMAP Tiler device\n"); return; }
static inline int omap2_i2c_add_bus(int bus_id) { int l; struct omap_hwmod *oh; struct omap_device *od; char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; struct omap_i2c_bus_platform_data *pdata; omap2_i2c_mux_pins(bus_id); l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id); WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN, "String buffer overflow in I2C%d device setup\n", bus_id); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); return -EEXIST; } pdata = &i2c_pdata[bus_id - 1]; /* * When waiting for completion of a i2c transfer, we need to * set a wake up latency constraint for the MPU. This is to * ensure quick enough wakeup from idle, when transfer * completes. * Only omap3 has support for constraints */ if (cpu_is_omap34xx() || cpu_is_omap44xx()) pdata->needs_wakeup_latency = true; pdata->device_reset = omap2_i2c_reset; od = omap_device_build(name, bus_id, oh, pdata, sizeof(struct omap_i2c_bus_platform_data), omap_i2c_latency, ARRAY_SIZE(omap_i2c_latency), 0); WARN(IS_ERR(od), "Could not build omap_device for %s\n", name); return PTR_ERR(od); }
static int __init omap_init_wdt(void) { int id = -1; struct platform_device *pdev; struct omap_hwmod *oh; char *oh_name = "wd_timer2"; char *dev_name = "omap_wdt"; if (!cpu_class_is_omap2()) return 0; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up wd_timer%d hwmod\n", id); return -EINVAL; } pdev = omap_device_build(dev_name, id, oh, NULL, 0, NULL, 0, 0); WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", dev_name, oh->name); return 0; }
int __init am335x_register_mcasp(struct snd_platform_data *pdata, int ctrl_nr) { int l; struct omap_hwmod *oh; struct platform_device *pdev; char oh_name[12]; char *dev_name = "davinci-mcasp"; l = snprintf(oh_name, 12, "mcasp%d", ctrl_nr); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("could not look up %s\n", oh_name); return -ENODEV; } pdev = omap_device_build(dev_name, ctrl_nr, oh, pdata, sizeof(struct snd_platform_data), NULL, 0, 0); WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n", dev_name, oh->name); return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; }
/* HSI device registration */ static int __init omap_hsi_register(struct omap_hwmod *oh, void *user) { struct platform_device *od; struct hsi_platform_data *pdata = &omap_hsi_platform_data; int i, port, err; if (!oh) { pr_err("Could not look up %s omap_hwmod\n", OMAP_HSI_HWMOD_NAME); return -EEXIST; } omap_hsi_platform_data.errata = omap_hsi_configure_errata(); oh->mux = omap_hsi_fill_default_pads(pdata); for (i = 0; i < pdata->num_ports; i++) { port = pdata->ctx->pctx[i].port_number - 1; err = omap_hwmod_pad_route_irq(oh, i, port); if (err < 0) { pr_err("%s: Could not route the IO PAD wakeup event on IRQ %d for the port %d, error = %d\n", __func__, oh->mpu_irqs[i].irq, port + 1, err); return err; } } od = omap_device_build(OMAP_HSI_PLATFORM_DEVICE_DRIVER_NAME, 0, oh, pdata, sizeof(*pdata), omap_hsi_latency, ARRAY_SIZE(omap_hsi_latency), false); WARN(IS_ERR(od), "Can't build omap_device for %s:%s.\n", OMAP_HSI_PLATFORM_DEVICE_DRIVER_NAME, oh->name); /* DONOT auto-disable me while going to suspend */ omap_device_disable_idle_on_suspend(od); pr_info("HSI: device registered as omap_hwmod: %s\n", oh->name); return 0; }
static inline int omap2_i2c_add_bus(int bus_id) { int l; struct omap_hwmod *oh; struct platform_device *pdev; char oh_name[MAX_OMAP_I2C_HWMOD_NAME_LEN]; struct omap_i2c_bus_platform_data *pdata; struct omap_i2c_dev_attr *dev_attr; omap2_i2c_mux_pins(bus_id); l = snprintf(oh_name, MAX_OMAP_I2C_HWMOD_NAME_LEN, "i2c%d", bus_id); WARN(l >= MAX_OMAP_I2C_HWMOD_NAME_LEN, "String buffer overflow in I2C%d device setup\n", bus_id); oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); return -EEXIST; } pdata = &i2c_pdata[bus_id - 1]; /* * pass the hwmod class's CPU-specific knowledge of I2C IP revision in * use, and functionality implementation flags, up to the OMAP I2C * driver via platform data */ pdata->rev = oh->class->rev; dev_attr = (struct omap_i2c_dev_attr *)oh->dev_attr; pdata->flags = dev_attr->flags; pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(struct omap_i2c_bus_platform_data), NULL, 0, 0); WARN(IS_ERR(pdev), "Could not build omap_device for %s\n", name); return PTR_RET(pdev); }
static void omap_init_aess(void) { struct omap_hwmod *oh; struct omap_device *od; struct twl6040_code_data *pdata; oh = omap_hwmod_lookup("aess"); if (!oh) printk (KERN_ERR "Could not look up aess hw_mod\n"); pdata->device_enable = omap_device_enable; pdata->device_idle = omap_device_idle; pdata->device_shutdown = omap_device_shutdown; od = omap_device_build("omap-aess", -1, oh, pdata, sizeof(struct omap_aess_platform_data), omap_aess_latency, ARRAY_SIZE(omap_aess_latency), 0); if (od <= 0) printk(KERN_ERR "Could not build omap_device for omap-aess\n"); }
int __init omap_init_gpmc(struct gpmc_devices_info *pdata, int pdata_len) { struct omap_hwmod *oh; struct platform_device *pdev; char *name = "omap-gpmc"; char *oh_name = "gpmc"; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up %s\n", oh_name); return -ENODEV; } pdev = omap_device_build(name, -1, oh, pdata, pdata_len, NULL, 0, 0); if (IS_ERR(pdev)) { WARN(1, "Can't build omap_device for %s:%s.\n", name, oh->name); return PTR_ERR(pdev); } return 0; }
int __init am33xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata) { int id = 0; struct platform_device *pdev; struct omap_hwmod *oh; char *oh_name = "lcdc"; char *dev_name = "da8xx_lcdc"; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up LCD%d hwmod\n", id); return -ENODEV; } pdev = omap_device_build(dev_name, id, oh, pdata, sizeof(struct da8xx_lcdc_platform_data), NULL, 0, 0); if (IS_ERR(pdev)) { WARN(1, "Can't build omap_device for %s:%s.\n", dev_name, oh->name); return PTR_ERR(pdev); } return 0; }
static int __init omap3_l3_init(void) { int l; struct omap_hwmod *oh; struct platform_device *pdev; char oh_name[L3_MODULES_MAX_LEN]; if (!(cpu_is_omap34xx())) return -ENODEV; l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main"); oh = omap_hwmod_lookup(oh_name); if (!oh) pr_err("could not look up %s\n", oh_name); pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0, NULL, 0, 0); WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name); return IS_ERR(pdev) ? PTR_ERR(pdev) : 0; }
static int temp_sensor_dev_init(struct omap_hwmod *oh, void *user) { struct omap_temp_sensor_pdata *temp_sensor_pdata; struct omap_device *od; static int i; int ret = 0; temp_sensor_pdata = kzalloc(sizeof(struct omap_temp_sensor_pdata), GFP_KERNEL); if (!temp_sensor_pdata) { pr_err ("%s: Unable to allocate memory for %s.Error!\n", __func__, oh->name); return -ENOMEM; } temp_sensor_pdata->offset = OMAP4_CTRL_MODULE_CORE_TEMP_SENSOR; temp_sensor_pdata->name = "omap_temp_sensor"; od = omap_device_build(temp_sensor_pdata->name, i, oh, temp_sensor_pdata, sizeof(*temp_sensor_pdata), omap_temp_sensor_latency, ARRAY_SIZE(omap_temp_sensor_latency), 0); if (IS_ERR(od)) { pr_warning("%s: Could not build omap_device for %s: %s.\n\n", __func__, temp_sensor_pdata->name, oh->name); ret = -EINVAL; goto done; } i++; done: kfree(temp_sensor_pdata); return ret; }
static int __init omap_init_wdt(void) { int id = -1; struct omap_device *od; struct omap_hwmod *oh; char *oh_name = "wd_timer2"; char *dev_name = "omap_wdt"; if (!cpu_class_is_omap2()) return 0; oh = omap_hwmod_lookup(oh_name); if (!oh) { pr_err("Could not look up wd_timer%d hwmod\n", id); return -EINVAL; } od = omap_device_build(dev_name, id, oh, NULL, 0, omap_wdt_latency, ARRAY_SIZE(omap_wdt_latency), 0); WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n", dev_name, oh->name); return 0; }