Re: [PATCH v6 03/10] omap3: Add function to register omap3isp platform device structure
Hi, On Mon, Feb 14, 2011 at 01:21:30PM +0100, Laurent Pinchart wrote: diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index d389756..4cf48ea 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -34,6 +34,8 @@ #include mux.h #include control.h +#include devices.h + #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE) static struct resource cam_resources[] = { @@ -59,8 +61,11 @@ static inline void omap_init_camera(void) { platform_device_register(omap_cam_device); } - -#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) +#else +static inline void omap_init_camera(void) +{ +} +#endif static struct resource omap3isp_resources[] = { { @@ -146,15 +151,12 @@ static struct platform_device omap3isp_device = { .resource = omap3isp_resources, }; -static inline void omap_init_camera(void) -{ - platform_device_register(omap3isp_device); -} -#else -static inline void omap_init_camera(void) +int omap3_init_camera(void *pdata) { + omap3isp_device.dev.platform_data = pdata; + return platform_device_register(omap3isp_device); } -#endif +EXPORT_SYMBOL_GPL(omap3_init_camera); if you EXPORT_SYMBOL_GPL() then also modules can poke with this, right ? isn't it enough to just put an extern int omap3_init_camera(void *); on a header ? BTW, you know the correct type of the platform_data, so why not passing the correct type instead of void * ?? Then, compile will help you if you pass wrong type, right ? diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h new file mode 100644 index 000..12ddb8a --- /dev/null +++ b/arch/arm/mach-omap2/devices.h @@ -0,0 +1,17 @@ +/* + * arch/arm/mach-omap2/devices.h + * + * OMAP2 platform device setup/initialization + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __ARCH_ARM_MACH_OMAP_DEVICES_H +#define __ARCH_ARM_MACH_OMAP_DEVICES_H + +int omap3_init_camera(void *pdata); missing extern ? -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 03/10] omap3: Add function to register omap3isp platform device structure
Hi Felipe, On Monday 14 February 2011 13:34:30 Felipe Balbi wrote: On Mon, Feb 14, 2011 at 01:21:30PM +0100, Laurent Pinchart wrote: diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index d389756..4cf48ea 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -34,6 +34,8 @@ [snip] +int omap3_init_camera(void *pdata) { + omap3isp_device.dev.platform_data = pdata; + return platform_device_register(omap3isp_device); } -#endif +EXPORT_SYMBOL_GPL(omap3_init_camera); if you EXPORT_SYMBOL_GPL() then also modules can poke with this, right ? isn't it enough to just put an extern int omap3_init_camera(void *); on a header ? It wasn't before as board code needed to be compiled as a module, but we've fixed that. I'll remove the EXPORT_SYMBOL_GPL. BTW, you know the correct type of the platform_data, so why not passing the correct type instead of void * ?? Then, compile will help you if you pass wrong type, right ? Agreed. I'll fix that. diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h new file mode 100644 index 000..12ddb8a --- /dev/null +++ b/arch/arm/mach-omap2/devices.h @@ -0,0 +1,17 @@ +/* + * arch/arm/mach-omap2/devices.h + * + * OMAP2 platform device setup/initialization + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __ARCH_ARM_MACH_OMAP_DEVICES_H +#define __ARCH_ARM_MACH_OMAP_DEVICES_H + +int omap3_init_camera(void *pdata); missing extern ? Is that mandatory ? Many (most ?) headers in the kernel don't use the extern keyword when declaring functions. -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 03/10] omap3: Add function to register omap3isp platform device structure
Hi, On Mon, Feb 14, 2011 at 02:07:08PM +0100, Laurent Pinchart wrote: diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h new file mode 100644 index 000..12ddb8a --- /dev/null +++ b/arch/arm/mach-omap2/devices.h @@ -0,0 +1,17 @@ +/* + * arch/arm/mach-omap2/devices.h + * + * OMAP2 platform device setup/initialization + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __ARCH_ARM_MACH_OMAP_DEVICES_H +#define __ARCH_ARM_MACH_OMAP_DEVICES_H + +int omap3_init_camera(void *pdata); missing extern ? Is that mandatory ? Many (most ?) headers in the kernel don't use the extern keyword when declaring functions. maybe not mandatory, worth checking what sparse would say though :-p -- balbi -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v6 03/10] omap3: Add function to register omap3isp platform device structure
On Mon, Feb 14, 2011 at 3:18 PM, Felipe Balbi ba...@ti.com wrote: Hi, Hi On Mon, Feb 14, 2011 at 02:07:08PM +0100, Laurent Pinchart wrote: diff --git a/arch/arm/mach-omap2/devices.h b/arch/arm/mach-omap2/devices.h new file mode 100644 index 000..12ddb8a --- /dev/null +++ b/arch/arm/mach-omap2/devices.h @@ -0,0 +1,17 @@ +/* + * arch/arm/mach-omap2/devices.h + * + * OMAP2 platform device setup/initialization + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + */ + +#ifndef __ARCH_ARM_MACH_OMAP_DEVICES_H +#define __ARCH_ARM_MACH_OMAP_DEVICES_H + +int omap3_init_camera(void *pdata); missing extern ? Is that mandatory ? Many (most ?) headers in the kernel don't use the extern keyword when declaring functions. maybe not mandatory, worth checking what sparse would say though :-p sparse is not complaining. Br, David -- balbi -- -- To unsubscribe from this list: send the line unsubscribe linux-omap in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html