linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] spi/spi: don't release the spi device twice
@ 2010-11-22 13:35 Sebastian Andrzej Siewior
       [not found] ` <20101122133503.GA25553-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2010-11-22 13:35 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w, David Brownell

While rmmoding pxa2xx_spi I hit:

|BUG: unable to handle kernel paging request at 6b6b6b9b
|IP: [<c115bf61>] device_del+0x11/0x140
|Call Trace:
| [<c115c09b>] ? device_unregister+0xb/0x20
| [<c118fe33>] ? spi_unregister_master+0x93/0xc0
| [<f806c554>] ? pxa2xx_spi_remove+0x84/0xc0 [pxa2xx_spi]

According to my debug printks, the loop

| dummy = device_for_each_child(master->dev.parent, &master->dev,
| 		__unregister);

calls __unregister for all childs of spi devicee (spidev in my case) and
the spi device itself. So calling device_unregister() for the device
itself leads to trouble.
This seems to be comming from  3486008 aka ("spi: free children in
spi_unregister_master, not siblings") so therefore I cc stable for v36.

Cc: <stable-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> # .36.x
Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
This is on v2.6.37-rc1. Unless this got fixed somewhere else in the
meantime it is still there.

 drivers/spi/spi.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 709c836..3c8ff6f 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -586,7 +586,6 @@ void spi_unregister_master(struct spi_master *master)
 
 	dummy = device_for_each_child(master->dev.parent, &master->dev,
 					__unregister);
-	device_unregister(&master->dev);
 }
 EXPORT_SYMBOL_GPL(spi_unregister_master);
 
-- 
1.7.3.2


------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev

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

* Re: spi/spi: don't release the spi device twice
       [not found] ` <20101122133503.GA25553-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
@ 2010-11-23  0:43   ` David Lamparter
       [not found]     ` <20101123004301.GA1034746-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: David Lamparter @ 2010-11-23  0:43 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Brownell

On Mon, Nov 22, 2010 at 01:35:03PM -0000, Sebastian Andrzej Siewior wrote:
> According to my debug printks, the loop
> 
> | dummy = device_for_each_child(master->dev.parent, &master->dev,
> | 		__unregister);
> 
> calls __unregister for all childs of spi devicee (spidev in my case) and
> the spi device itself. So calling device_unregister() for the device
> itself leads to trouble.
> This seems to be comming from  3486008 aka ("spi: free children in
> spi_unregister_master, not siblings") so therefore I cc stable for v36.

This code is the old code, before patch 3486008 which you're citing.
3486008 does:

-       dummy = device_for_each_child(master->dev.parent, &master->dev,
-                                       __unregister);
+       dummy = device_for_each_child(&master->dev, NULL, __unregister);

Considering that this patch is in 2.6.36 (and 36.1), you seem to have
mixed up your sources. Please make sure your checkout is current and
unbroken...

> This is on v2.6.37-rc1. Unless this got fixed somewhere else in the
> meantime it is still there.

"Mu."

> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -586,7 +586,6 @@ void spi_unregister_master(struct spi_master *master)
>  
>  	dummy = device_for_each_child(master->dev.parent, &master->dev,
>  					__unregister);
> -	device_unregister(&master->dev);
>  }

This patch does, consequently, not apply on 2.6.37-rc, since the code
doesn't look like that anymore after 3486008...


-David


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* Re: spi/spi: don't release the spi device twice
       [not found]     ` <20101123004301.GA1034746-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
@ 2010-11-23 10:33       ` Sebastian Andrzej Siewior
       [not found]         ` <4CEB985F.90805-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2010-11-23 10:33 UTC (permalink / raw)
  To: David Lamparter
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Brownell

David Lamparter wrote:
> This code is the old code, before patch 3486008 which you're citing.
> 3486008 does:
> 
> -       dummy = device_for_each_child(master->dev.parent, &master->dev,
> -                                       __unregister);
> +       dummy = device_for_each_child(&master->dev, NULL, __unregister);
> 
> Considering that this patch is in 2.6.36 (and 36.1), you seem to have
> mixed up your sources. Please make sure your checkout is current and
> unbroken...
Hmmm.
# git describe --long
v2.6.37-rc3-0-g3561d43

After looking at spi_unregister_master() in drivers/spi/spi.c, I see:

      dummy = device_for_each_child(master->dev.parent, &master->dev,
                      __unregister);
      device_unregister(&master->dev);
  }

This change got back in by:

commit 2b9603a0d7e395fb844af90fba71448bc8019077
Author: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Date:   Mon Aug 2 15:52:15 2010 +0800

     spi: enable spi_board_info to be registered after spi_master

which is v2.6.37-rc1~2^2~4. So I probably mixed up you with Feng.

This thread starts at
http://www.mail-archive.com/spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org/msg05437.html

>David

Sebastian

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* Re: spi/spi: don't release the spi device twice
       [not found]         ` <4CEB985F.90805-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
@ 2010-11-23 14:24           ` Feng Tang
  2010-11-23 14:59             ` [PATCH v2] " Sebastian Andrzej Siewior
  0 siblings, 1 reply; 8+ messages in thread
From: Feng Tang @ 2010-11-23 14:24 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Brownell, David Lamparter

Hi Sebastian,

On Tue, 23 Nov 2010 18:33:03 +0800
Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org> wrote:

> David Lamparter wrote:
> > This code is the old code, before patch 3486008 which you're citing.
> > 3486008 does:
> > 
> > -       dummy = device_for_each_child(master->dev.parent,
> > &master->dev,
> > -                                       __unregister);
> > +       dummy = device_for_each_child(&master->dev, NULL,
> > __unregister);
> > 
> > Considering that this patch is in 2.6.36 (and 36.1), you seem to
> > have mixed up your sources. Please make sure your checkout is
> > current and unbroken...
> Hmmm.
> # git describe --long
> v2.6.37-rc3-0-g3561d43
> 
> After looking at spi_unregister_master() in drivers/spi/spi.c, I see:
> 
>       dummy = device_for_each_child(master->dev.parent, &master->dev,
>                       __unregister);
>       device_unregister(&master->dev);
>   }
> 
> This change got back in by:
> 
> commit 2b9603a0d7e395fb844af90fba71448bc8019077
> Author: Feng Tang <feng.tang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
> Date:   Mon Aug 2 15:52:15 2010 +0800
> 
>      spi: enable spi_board_info to be registered after spi_master
> 
> which is v2.6.37-rc1~2^2~4. So I probably mixed up you with Feng.
> 
> This thread starts at
> http://www.mail-archive.com/spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org/msg05437.html
> 
I checked my original patch which didn't touch the logic of spi_unregister_master() as
-----------------------------------------
@@ -568,6 +592,10 @@  void spi_unregister_master(struct spi_master *master)
 {
 	int dummy;
 
+	mutex_lock(&board_lock);
+	list_del(&master->list);
+	mutex_unlock(&board_lock);
+
 	dummy = device_for_each_child(master->dev.parent, &master->dev,
 					__unregister);
 	device_unregister(&master->dev);
-----------------------------------------

So this should be a merge problem, which corrupt the commit from David's commit
3486008 "spi: free children in spi_unregister_master, not siblings"

Thanks,
Feng

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* [PATCH v2] spi/spi: don't release the spi device twice
  2010-11-23 14:24           ` Feng Tang
@ 2010-11-23 14:59             ` Sebastian Andrzej Siewior
       [not found]               ` <20101123145910.GA23880-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2010-11-23 14:59 UTC (permalink / raw)
  To: Feng Tang
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Brownell, David Lamparter

This was fixed by David Lamparter in v2.6.36-rc5 3486008
("spi: free children in spi_unregister_master, not siblings") and broken
again in v2.6.37-rc1~2^2~4 during the merge of 2b9603a0 ("spi: enable
spi_board_info to be registered after spi_master").

Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
---
Okay, Feng. So here is the merge fixup.

 drivers/spi/spi.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 709c836..b02d0cb 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -584,8 +584,7 @@ void spi_unregister_master(struct spi_master *master)
 	list_del(&master->list);
 	mutex_unlock(&board_lock);
 
-	dummy = device_for_each_child(master->dev.parent, &master->dev,
-					__unregister);
+	dummy = device_for_each_child(&master->dev, NULL, __unregister);
 	device_unregister(&master->dev);
 }
 EXPORT_SYMBOL_GPL(spi_unregister_master);
-- 
1.7.3.2

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* Re: [PATCH v2] spi/spi: don't release the spi device twice
       [not found]               ` <20101123145910.GA23880-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
@ 2010-11-23 16:45                 ` David Lamparter
       [not found]                   ` <20101123164520.GA1384937-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
  2010-12-09 16:06                 ` [v2] " Sebastian Andrzej Siewior
  1 sibling, 1 reply; 8+ messages in thread
From: David Lamparter @ 2010-11-23 16:45 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: David Brownell, dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Lamparter

> This was fixed by David Lamparter in v2.6.36-rc5 3486008
> ("spi: free children in spi_unregister_master, not siblings") and broken
> again in v2.6.37-rc1~2^2~4 during the merge of 2b9603a0 ("spi: enable
> spi_board_info to be registered after spi_master").
> 
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> ---
> -	dummy = device_for_each_child(master->dev.parent, &master->dev,
> -					__unregister);
> +	dummy = device_for_each_child(&master->dev, NULL, __unregister);

Signed-off-by: David Lamparter <equinox-cEeocvCgqOOsTnJN9+BGXg@public.gmane.org>

very simple merge/rebase/forward-port breakage...
Feng, can you check 2b9603a0 for whether anything else got broken?


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* Re: [PATCH v2] spi/spi: don't release the spi device twice
       [not found]                   ` <20101123164520.GA1384937-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
@ 2010-11-24  7:59                     ` Feng Tang
  0 siblings, 0 replies; 8+ messages in thread
From: Feng Tang @ 2010-11-24  7:59 UTC (permalink / raw)
  To: David Lamparter
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Sebastian Andrzej Siewior, David Brownell

On Wed, 24 Nov 2010 00:45:20 +0800
David Lamparter <equinox-cEeocvCgqOOsTnJN9+BGXg@public.gmane.org> wrote:

> > This was fixed by David Lamparter in v2.6.36-rc5 3486008
> > ("spi: free children in spi_unregister_master, not siblings") and
> > broken again in v2.6.37-rc1~2^2~4 during the merge of 2b9603a0
> > ("spi: enable spi_board_info to be registered after spi_master").
> > 
> > Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
> > ---
> > -	dummy = device_for_each_child(master->dev.parent,
> > &master->dev,
> > -					__unregister);
> > +	dummy = device_for_each_child(&master->dev, NULL,
> > __unregister);
> 
> Signed-off-by: David Lamparter <equinox-cEeocvCgqOOsTnJN9+BGXg@public.gmane.org>
> 
> very simple merge/rebase/forward-port breakage...
> Feng, can you check 2b9603a0 for whether anything else got broken?
> 

I just checked, all other parts should be ok.

Thanks,
Feng

------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev

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

* Re: [v2] spi/spi: don't release the spi device twice
       [not found]               ` <20101123145910.GA23880-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
  2010-11-23 16:45                 ` David Lamparter
@ 2010-12-09 16:06                 ` Sebastian Andrzej Siewior
  1 sibling, 0 replies; 8+ messages in thread
From: Sebastian Andrzej Siewior @ 2010-12-09 16:06 UTC (permalink / raw)
  To: David Brownell
  Cc: dirk.brandewie-Re5JQEeQqe8AvxtiuMwx3w,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	David Lamparter

* Sebastian Andrzej Siewior | 2010-11-23 14:59:10 [-0000]:

>This was fixed by David Lamparter in v2.6.36-rc5 3486008
>("spi: free children in spi_unregister_master, not siblings") and broken
>again in v2.6.37-rc1~2^2~4 during the merge of 2b9603a0 ("spi: enable
>spi_board_info to be registered after spi_master").
>
>Signed-off-by: Sebastian Andrzej Siewior <bigeasy-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
>---

ping

>
> drivers/spi/spi.c |    3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
>index 709c836..b02d0cb 100644
>--- a/drivers/spi/spi.c
>+++ b/drivers/spi/spi.c
>@@ -584,8 +584,7 @@ void spi_unregister_master(struct spi_master *master)
> 	list_del(&master->list);
> 	mutex_unlock(&board_lock);
> 
>-	dummy = device_for_each_child(master->dev.parent, &master->dev,
>-					__unregister);
>+	dummy = device_for_each_child(&master->dev, NULL, __unregister);
> 	device_unregister(&master->dev);
> }
> EXPORT_SYMBOL_GPL(spi_unregister_master);

------------------------------------------------------------------------------

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

end of thread, other threads:[~2010-12-09 16:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-22 13:35 [PATCH] spi/spi: don't release the spi device twice Sebastian Andrzej Siewior
     [not found] ` <20101122133503.GA25553-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
2010-11-23  0:43   ` David Lamparter
     [not found]     ` <20101123004301.GA1034746-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
2010-11-23 10:33       ` Sebastian Andrzej Siewior
     [not found]         ` <4CEB985F.90805-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>
2010-11-23 14:24           ` Feng Tang
2010-11-23 14:59             ` [PATCH v2] " Sebastian Andrzej Siewior
     [not found]               ` <20101123145910.GA23880-Hfxr4Dq0UpYb1SvskN2V4Q@public.gmane.org>
2010-11-23 16:45                 ` David Lamparter
     [not found]                   ` <20101123164520.GA1384937-sd4rSCkhOesKVZNVnti56SRbHCANfdcW@public.gmane.org>
2010-11-24  7:59                     ` Feng Tang
2010-12-09 16:06                 ` [v2] " Sebastian Andrzej Siewior

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