Re: I2C-virtual and locking?
From: Greg KH
Date: Fri Mar 17 2006 - 18:06:30 EST
On Fri, Mar 17, 2006 at 03:16:58PM -0600, Kumar Gala wrote:
> On Mar 17, 2006, at 12:54 PM, Kumar Gala wrote:
> >I'm looking at porting the i2c-virtual code from 2.4 to 2.6. One
> >thing I'm not clear on is the use of i2c_add_adapter_nolock() by
> >the old code. The only reference I can find related to this is:
> >I can't think of a reason why locking would be in issue when adding
> >or removing of a virtual adapter. Anyone have an additional ides
> >on this?
> Ok, so I figured out why the _nolock() versions exist. In
> i2c_driver_register we take the core_list lock. Eventually we will
> call i2c_probe() which should call driver->attach_adapter(). For a
> virtual bus the driver's attach_adapter() will end up calling
> i2c_virt_create_adapter() which will end up calling i2c_add_adapter()
> which will never get the core_list lock.
> So should we integrate the concept of virtual adapters into the i2c
> core and have it such that i2c_virt_create_adapter()/
> i2c_virt_remove_adapter() expects the caller to have the core_list
> lock already?
Possibly. Jean, what do you think?
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/