lkml.org 
[lkml]   [2011]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 2/6] drivers/base: add bus for System-on-Chip devices
Date
On Tuesday 18 October 2011, Lee Jones wrote:
> >> +struct device *soc_device_register(struct soc_device_attribute *soc_dev_attr)
> >> +{
> >> + struct soc_device *soc_dev;
> >> + static atomic_t soc_device_num = ATOMIC_INIT(0);
> >
> > No, please don't do this, use the proper kernel interface to dynamically
> > handle numbering devices (hint, if you unload a SOC device, you will
> > never reclaim that device number, which isn't that nice.)
>
> Again, some help would really be appreciated here. I searched the kernel
> last time you mentioned numbering, but this is all I came up with.

I guess the correct interface to use here would be an "ida", see
linux/idr.h. However, I'm not convinced that's actually worth the
extra space for maintaining it here.

An SoC pretty much has the following properties:

* gets probed very early at boot time,
* can never go away, and
* there is only one of them in the system.

The only reason I even asked for the devices to be enumerated is that
there is the possibility that some device will need to have more than
one and we should design every stable user interface in a way that never
changes in a user visible way.

IMHO, we could also remove the soc_device_unregister() function entirely
and add a comment along the lines of
/*
* If you really need to add hot-pluggable soc_devices, add a
* soc_device_unregister function and turn the number generation
* into an IDA.
*/
Arnd


\
 
 \ /
  Last update: 2011-10-18 16:17    [from the cache]
©2003-2011 Jasper Spaans