[PATCH 2/6] drivers/base: add bus for System-on-Chip devices

Greg KH gregkh at suse.de
Tue Oct 18 10:38:57 EDT 2011


On Tue, Oct 18, 2011 at 03:15:20PM +0100, Jamie Iles wrote:
> Hi Arnd,
> 
> On Tue, Oct 18, 2011 at 04:05:12PM +0200, Arnd Bergmann wrote:
> > On Tuesday 18 October 2011, Lee Jones wrote:
> > > On 17/10/11 17:18, Greg KH wrote:
> > > > On Mon, Oct 17, 2011 at 12:52:54PM +0100, Lee Jones wrote:
> > > >> +
> > > >> +	bus_unregister(&soc_bus_type);
> > > > 
> > > > What happens if you have more than one SOC device?  I think you just
> > > > oopsed.
> > > 
> > > I think you're right.
> > > 
> > > When to you suggest we unregister the bus?
> > 
> > Do it in the same way as registering it, as a module_exit() function
> > below the initcall that instantiates it. These interfaces usually come
> > in pairs, so if something does not look symmetric, you should better
> > have another look.
> 
> I can't think of a system where it make sense to have this as a loadable 
> module so can't we just register the bus_type and never unregister it 
> like the platform and spi busses for example?
> 
> Also, (and I'm right at the edge of my knowledge here!) wouldn't you 
> also need to add reference counting of the module when 
> creating/destroying a soc device to prevent the module and bus 
> disappearing whilst you had devices with a reference to it?

Yes, that is why your register function should take a module pointer,
like USB, PCI, and other bus functions do.

greg k-h



More information about the linux-arm-kernel mailing list