lkml.org 
[lkml]   [2011]   [Jun]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCHv5 2/7] HSI: omap_ssi: Introducing OMAP SSI driver
* Carlos Chinea <carlos.chinea@nokia.com> [110610 06:41]:
> --- /dev/null
> +++ b/arch/arm/mach-omap2/ssi.c
> +static struct platform_device ssi_pdev = {
> + .name = "omap_ssi",
> + .id = 0,
> + .num_resources = ARRAY_SIZE(ssi_resources),
> + .resource = ssi_resources,
> + .dev = {
> + .platform_data = &ssi_pdata,
> + },
> +};
> +
> +int __init omap_ssi_config(struct omap_ssi_board_config *ssi_config)
> +{
> + unsigned int port, offset, cawake_gpio;
> + int err;
> +
> + ssi_pdata.num_ports = ssi_config->num_ports;
> + for (port = 0, offset = 7; port < ssi_config->num_ports;
> + port++, offset += 5) {
> + cawake_gpio = ssi_config->cawake_gpio[port];
> + if (!cawake_gpio)
> + continue; /* Nothing to do */
> + err = gpio_request(cawake_gpio, "cawake");
> + if (err < 0)
> + goto rback;
> + gpio_direction_input(cawake_gpio);
> + ssi_resources[offset].start = gpio_to_irq(cawake_gpio);
> + ssi_resources[offset].flags &= ~IORESOURCE_UNSET;
> + ssi_resources[offset].flags |= IORESOURCE_IRQ_HIGHEDGE |
> + IORESOURCE_IRQ_LOWEDGE;
> + }
> +
> + return 0;
> +rback:
> + dev_err(&ssi_pdev.dev, "Request cawake (gpio%d) failed\n", cawake_gpio);
> + while (port > 0)
> + gpio_free(ssi_config->cawake_gpio[--port]);
> +
> + return err;
> +}
> +
> +static int __init ssi_init(void)
> +{
> + return platform_device_register(&ssi_pdev);
> +}
> +subsys_initcall(ssi_init);

Looks like you need something here also to prevent this subsys_initcall
on running on all boards. Maybe have a pointer to ssi_pdev that only
gets initialized after omap_ssi_config?

Then you can have ssi_init fail if no configuration is called:

if (!pdev)
return -ENODEV;

return platform_device_register(pdev);

Regards,

Tony


\
 
 \ /
  Last update: 2011-06-13 15:25    [W:0.153 / U:1.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site