* (arm-)global platform device registration functions @ 2010-12-29 16:25 Uwe Kleine-König 2010-12-29 20:37 ` Andrew Morton 2010-12-30 10:03 ` Arnd Bergmann 0 siblings, 2 replies; 5+ messages in thread From: Uwe Kleine-König @ 2010-12-29 16:25 UTC (permalink / raw) To: linux-arm-kernel Hello, some time ago I started to dynamically allocate platform_devices for arm/plat-mxc. For that purpose I added many functions, see arch/arm/plat-mxc/include/mach/devices-common.h [1]. Now arm/arch-mxs want to do the same, so I wonder if it would be sensible to do something like this more globally (either for arm or better kernel global). Thoughts? Best regards Uwe [1] http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=arch/arm/plat-mxc/include/mach/devices-common.h;hb=HEAD -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 5+ messages in thread
* (arm-)global platform device registration functions 2010-12-29 16:25 (arm-)global platform device registration functions Uwe Kleine-König @ 2010-12-29 20:37 ` Andrew Morton 2010-12-29 21:18 ` Uwe Kleine-König 2010-12-30 10:03 ` Arnd Bergmann 1 sibling, 1 reply; 5+ messages in thread From: Andrew Morton @ 2010-12-29 20:37 UTC (permalink / raw) To: linux-arm-kernel On Wed, 29 Dec 2010 17:25:12 +0100 Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de> wrote: > Hello, > > some time ago I started to dynamically allocate platform_devices for > arm/plat-mxc. For that purpose I added many functions, see > arch/arm/plat-mxc/include/mach/devices-common.h [1]. Now arm/arch-mxs > want to do the same, so I wonder if it would be sensible to do something > like this more globally (either for arm or better kernel global). > Sounds sensible to me, although I don't really understand what you've done - didn't platform_device_alloc() already "dynamically allocate platform_devices"? If you were to implement this common infrastructure, there may be already-existing code which could use it. How would we locate that? ^ permalink raw reply [flat|nested] 5+ messages in thread
* (arm-)global platform device registration functions 2010-12-29 20:37 ` Andrew Morton @ 2010-12-29 21:18 ` Uwe Kleine-König 0 siblings, 0 replies; 5+ messages in thread From: Uwe Kleine-König @ 2010-12-29 21:18 UTC (permalink / raw) To: linux-arm-kernel On Wed, Dec 29, 2010 at 12:37:40PM -0800, Andrew Morton wrote: > On Wed, 29 Dec 2010 17:25:12 +0100 > Uwe Kleine-K__nig <u.kleine-koenig@pengutronix.de> wrote: > > > Hello, > > > > some time ago I started to dynamically allocate platform_devices for > > arm/plat-mxc. For that purpose I added many functions, see > > arch/arm/plat-mxc/include/mach/devices-common.h [1]. Now arm/arch-mxs > > want to do the same, so I wonder if it would be sensible to do something > > like this more globally (either for arm or better kernel global). > > > > Sounds sensible to me, although I don't really understand what you've > done - didn't platform_device_alloc() already "dynamically allocate > platform_devices"? my code is a bit more specialised than platform_device_alloc. Look for example at arch/arm/plat-mxc/devices/platform-fec.c. Calling imx51_add_fec() creates a fec device with the resources needed for i.MX51 and adds platform data. (imx_add_platform_device does the same as platform_device_register_resndata[2]) > If you were to implement this common infrastructure, there may be > already-existing code which could use it. How would we locate that? coccinelle probably could. For imx51_add_fec it could match for a struct platform_device with name = "fec". Best regards Uwe [2] actually platform_device_register_resndata was created by me to substitute imx_add_platform_device, but I need to "fix" the former to handle dma stuff (not merged yet) before imx_add_platform_device can go away. -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 5+ messages in thread
* (arm-)global platform device registration functions 2010-12-29 16:25 (arm-)global platform device registration functions Uwe Kleine-König 2010-12-29 20:37 ` Andrew Morton @ 2010-12-30 10:03 ` Arnd Bergmann 2010-12-30 10:15 ` Uwe Kleine-König 1 sibling, 1 reply; 5+ messages in thread From: Arnd Bergmann @ 2010-12-30 10:03 UTC (permalink / raw) To: linux-arm-kernel On Wednesday 29 December 2010 17:25:12 Uwe Kleine-K?nig wrote: > some time ago I started to dynamically allocate platform_devices for > arm/plat-mxc. For that purpose I added many functions, see > arch/arm/plat-mxc/include/mach/devices-common.h [1]. Now arm/arch-mxs > want to do the same, so I wonder if it would be sensible to do something > like this more globally (either for arm or better kernel global). Adding platform devices dynamically is definitely the right way forward for new platforms, as Greg explained recently. The imx_add_platform_device() function you have defined looks useful for this, and I guess it could be added globally, next to the existing platform_device_register_resndata, platform_device_register_data and platform_device_register_simple functions that we already have doing similar things. I'm not convinced that the various wrappers you have on imx are the best solution, though I have not come up with anything better either ;-) This will also get a lot easier once we have the ability to define devices in using dtc, because that takes care of the resources. Arnd ^ permalink raw reply [flat|nested] 5+ messages in thread
* (arm-)global platform device registration functions 2010-12-30 10:03 ` Arnd Bergmann @ 2010-12-30 10:15 ` Uwe Kleine-König 0 siblings, 0 replies; 5+ messages in thread From: Uwe Kleine-König @ 2010-12-30 10:15 UTC (permalink / raw) To: linux-arm-kernel Hello Arnd, On Thu, Dec 30, 2010 at 11:03:31AM +0100, Arnd Bergmann wrote: > On Wednesday 29 December 2010 17:25:12 Uwe Kleine-K?nig wrote: > > some time ago I started to dynamically allocate platform_devices for > > arm/plat-mxc. For that purpose I added many functions, see > > arch/arm/plat-mxc/include/mach/devices-common.h [1]. Now arm/arch-mxs > > want to do the same, so I wonder if it would be sensible to do something > > like this more globally (either for arm or better kernel global). > > Adding platform devices dynamically is definitely the right way forward > for new platforms, as Greg explained recently. The imx_add_platform_device() > function you have defined looks useful for this, and I guess it could > be added globally, next to the existing platform_device_register_resndata, imx_add_platform_device could be implemented as platform_device_register_resndata(NULL, name, id, res, num_resources, data, size_data) in next[1] the imx variant got support to handle a dmamask. > platform_device_register_data and platform_device_register_simple functions > that we already have doing similar things. > > I'm not convinced that the various wrappers you have on imx are the > best solution, though I have not come up with anything better either ;-) I came up with those because many machines (sharing the same SoC) share the same devices. > This will also get a lot easier once we have the ability to define > devices in using dtc, because that takes care of the resources. Well this is a matter of taste, I'm quite happy with the current approach. [1] http://git.kernel.org/?p=linux/kernel/git/sfr/linux-next.git;a=blob;f=arch/arm/plat-mxc/devices.c;hb=e635401443d9d256a0bfd1ea7864ac56034c6dca -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ | ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-12-30 10:15 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-12-29 16:25 (arm-)global platform device registration functions Uwe Kleine-König 2010-12-29 20:37 ` Andrew Morton 2010-12-29 21:18 ` Uwe Kleine-König 2010-12-30 10:03 ` Arnd Bergmann 2010-12-30 10:15 ` Uwe Kleine-König
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).