public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: I2C-virtual and locking?
       [not found] <6CCFFBB4-CDE0-4DC0-A4D7-A3E7398B2494@kernel.crashing.org>
@ 2006-03-17 21:16 ` Kumar Gala
  2006-03-17 23:08   ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Kumar Gala @ 2006-03-17 21:16 UTC (permalink / raw)
  To: Greg KH, khali; +Cc: lm-sensors, linux kernel mailing list


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:
>
> http://archives.andrew.net.au/lm-sensors/msg31060.html
>
> 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?

- kumar

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: I2C-virtual and locking?
  2006-03-17 21:16 ` I2C-virtual and locking? Kumar Gala
@ 2006-03-17 23:08   ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2006-03-17 23:08 UTC (permalink / raw)
  To: Kumar Gala; +Cc: khali, lm-sensors, linux kernel mailing list

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:
> >
> >http://archives.andrew.net.au/lm-sensors/msg31060.html
> >
> >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?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-03-17 23:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <6CCFFBB4-CDE0-4DC0-A4D7-A3E7398B2494@kernel.crashing.org>
2006-03-17 21:16 ` I2C-virtual and locking? Kumar Gala
2006-03-17 23:08   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox