linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* spi_set_drvdata() handling in spidev_probe()
@ 2009-10-13  6:32 Mike Frysinger
       [not found] ` <8bd0f97a0910122332y321138ak8294e5f152064344-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-10-13  6:32 UTC (permalink / raw)
  To: Wolfgang Ocker, David Brownell
  Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

i was browsing the change history of spidev when i noticed the change:
aaacf4bb51b243875b203e6ff73b5047636b4efa spi: avoid spidev crash when
device is removed

which seems to be due to this change:
3d81252ddb10f63ae4db713d9b32faabe641b850 device create: spi: convert
device_create to device_create_drvdata

getting an incomplete revert with this change:
a9b12619f7b6f19c871437ec24a088787a04b1de device create: misc: convert
device_create_drvdata to device_create

my point being is that the original code was doing the
spi_set_drvdata() while holding the device_list_lock mutex while the
new one is not.  shouldnt the code be changed back to the state
previous to 3d81252d ?
-mike

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference

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

* Re: spi_set_drvdata() handling in spidev_probe()
       [not found] ` <8bd0f97a0910122332y321138ak8294e5f152064344-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-12-11  2:25   ` David Brownell
       [not found]     ` <200912101825.21244.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2009-12-11  2:25 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Monday 12 October 2009, Mike Frysinger wrote:
> i was browsing the change history of spidev when i noticed the change:
> aaacf4bb51b243875b203e6ff73b5047636b4efa spi: avoid spidev crash when
> device is removed
> 
> which seems to be due to this change:
> 3d81252ddb10f63ae4db713d9b32faabe641b850 device create: spi: convert
> device_create to device_create_drvdata
> 
> getting an incomplete revert with this change:
> a9b12619f7b6f19c871437ec24a088787a04b1de device create: misc: convert
> device_create_drvdata to device_create

More accurately:  not a revert, but a name change.


> my point being is that the original code was doing the
> spi_set_drvdata() while holding the device_list_lock mutex while the
> new one is not.  shouldnt the code be changed back to the state
> previous to 3d81252d ?

Yes, that particular assignment should be mutex-protected.

The original patch shouldn't really have removed it; the
change to the device_create() signature was addressing a
slightly different race.

- Dave


> -mike
> 
> 



------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

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

* Re: spi_set_drvdata() handling in spidev_probe()
       [not found]     ` <200912101825.21244.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2009-12-11  2:32       ` Mike Frysinger
       [not found]         ` <8bd0f97a0912101832g1398f6dbld984d55bbf37f4ee-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2009-12-11  2:32 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thu, Dec 10, 2009 at 21:25, David Brownell wrote:
> On Monday 12 October 2009, Mike Frysinger wrote:
>> i was browsing the change history of spidev when i noticed the change:
>> aaacf4bb51b243875b203e6ff73b5047636b4efa spi: avoid spidev crash when
>> device is removed
>>
>> which seems to be due to this change:
>> 3d81252ddb10f63ae4db713d9b32faabe641b850 device create: spi: convert
>> device_create to device_create_drvdata
>>
>> getting an incomplete revert with this change:
>> a9b12619f7b6f19c871437ec24a088787a04b1de device create: misc: convert
>> device_create_drvdata to device_create
>
> More accurately:  not a revert, but a name change.
>
>
>> my point being is that the original code was doing the
>> spi_set_drvdata() while holding the device_list_lock mutex while the
>> new one is not.  shouldnt the code be changed back to the state
>> previous to 3d81252d ?
>
> Yes, that particular assignment should be mutex-protected.
>
> The original patch shouldn't really have removed it; the
> change to the device_create() signature was addressing a
> slightly different race.

should i send a patch, or you going to fix it up ?  i would simply
restore the mutex code like it was before ...
-mike

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
spi-devel-general mailing list
spi-devel-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spi-devel-general

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

* Re: spi_set_drvdata() handling in spidev_probe()
       [not found]         ` <8bd0f97a0912101832g1398f6dbld984d55bbf37f4ee-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2009-12-11  3:03           ` David Brownell
  0 siblings, 0 replies; 4+ messages in thread
From: David Brownell @ 2009-12-11  3:03 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Thursday 10 December 2009, Mike Frysinger wrote:
> >
> > Yes, that particular assignment should be mutex-protected.
> >
> > The original patch shouldn't really have removed it; the
> > change to the device_create() signature was addressing a
> > slightly different race.
> 
> should i send a patch, or you going to fix it up ?  i would simply
> restore the mutex code like it was before ...

send a patch.

------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev

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

end of thread, other threads:[~2009-12-11  3:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-13  6:32 spi_set_drvdata() handling in spidev_probe() Mike Frysinger
     [not found] ` <8bd0f97a0910122332y321138ak8294e5f152064344-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-11  2:25   ` David Brownell
     [not found]     ` <200912101825.21244.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2009-12-11  2:32       ` Mike Frysinger
     [not found]         ` <8bd0f97a0912101832g1398f6dbld984d55bbf37f4ee-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-11  3:03           ` David Brownell

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).