linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
@ 2012-11-24 13:44 Jonas Gorski
       [not found] ` <1353764690-5961-1-git-send-email-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
       [not found] ` <20121124172801.GC4719@opensource.wolfsonmicro.com>
  0 siblings, 2 replies; 6+ messages in thread
From: Jonas Gorski @ 2012-11-24 13:44 UTC (permalink / raw)
  To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Kevin Cernekee, Mark Brown, stable-u79uwXL29TY76Z2rM5mHXA,
	Maxime Bizon, Florian Fainelli

Transfers often do not have bits_per_words set, so use the spi device's
bits_per_words in this case.

This fixes the driver rejecting valid transfers e.g. generated by
spi_write() or spi_read().

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/spi/spi-bcm63xx.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
index a9f4049..d7c2916 100644
--- a/drivers/spi/spi-bcm63xx.c
+++ b/drivers/spi/spi-bcm63xx.c
@@ -103,7 +103,8 @@ static int bcm63xx_spi_check_transfer(struct spi_device *spi,
 {
 	u8 bits_per_word;
 
-	bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
+	bits_per_word = (t && t->bits_per_word) ?
+			t->bits_per_word : spi->bits_per_word;
 	if (bits_per_word != 8) {
 		dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
 			__func__, bits_per_word);
-- 
1.7.10.4


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

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

* Re: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
       [not found] ` <1353764690-5961-1-git-send-email-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2012-11-24 15:02   ` Florian Fainelli
  0 siblings, 0 replies; 6+ messages in thread
From: Florian Fainelli @ 2012-11-24 15:02 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Mark Brown, Kevin Cernekee, stable-u79uwXL29TY76Z2rM5mHXA,
	Maxime Bizon, spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Le 24/11/2012 14:44, Jonas Gorski a écrit :
> Transfers often do not have bits_per_words set, so use the spi device's
> bits_per_words in this case.
>
> This fixes the driver rejecting valid transfers e.g. generated by
> spi_write() or spi_read().
>
> Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> Signed-off-by: Jonas Gorski <jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

Acked-by: Florian Fainelli <florian-p3rKhJxN3npAfugRpC6u6w@public.gmane.org>

> ---
>   drivers/spi/spi-bcm63xx.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/spi-bcm63xx.c b/drivers/spi/spi-bcm63xx.c
> index a9f4049..d7c2916 100644
> --- a/drivers/spi/spi-bcm63xx.c
> +++ b/drivers/spi/spi-bcm63xx.c
> @@ -103,7 +103,8 @@ static int bcm63xx_spi_check_transfer(struct spi_device *spi,
>   {
>   	u8 bits_per_word;
>
> -	bits_per_word = (t) ? t->bits_per_word : spi->bits_per_word;
> +	bits_per_word = (t && t->bits_per_word) ?
> +			t->bits_per_word : spi->bits_per_word;
>   	if (bits_per_word != 8) {
>   		dev_err(&spi->dev, "%s, unsupported bits_per_word=%d\n",
>   			__func__, bits_per_word);
>


------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

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

* Re: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
       [not found]   ` <20121124172801.GC4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-11-24 17:53     ` Jonas Gorski
       [not found]       ` <20121124180151.GJ4719@opensource.wolfsonmicro.com>
  0 siblings, 1 reply; 6+ messages in thread
From: Jonas Gorski @ 2012-11-24 17:53 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kevin Cernekee, stable-u79uwXL29TY76Z2rM5mHXA, Maxime Bizon,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Florian Fainelli

On 24 November 2012 18:28, Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> wrote:
> On Sat, Nov 24, 2012 at 02:44:50PM +0100, Jonas Gorski wrote:
>> Transfers often do not have bits_per_words set, so use the spi device's
>> bits_per_words in this case.
>>
>> This fixes the driver rejecting valid transfers e.g. generated by
>> spi_write() or spi_read().
>
> This is now done by the SPI core, there's no need for individual drivers
> to do this.

So that will go to stable kernels, too?

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

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

* Re: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
       [not found]         ` <20121124180151.GJ4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2012-11-24 18:19           ` Jonas Gorski
  2012-11-26 13:11             ` Florian Fainelli
  0 siblings, 1 reply; 6+ messages in thread
From: Jonas Gorski @ 2012-11-24 18:19 UTC (permalink / raw)
  To: Mark Brown
  Cc: Kevin Cernekee, stable-u79uwXL29TY76Z2rM5mHXA, Maxime Bizon,
	spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	Florian Fainelli

On 24 November 2012 19:01, Mark Brown
<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org> wrote:
> On Sat, Nov 24, 2012 at 06:53:10PM +0100, Jonas Gorski wrote:
>> On 24 November 2012 18:28, Mark Brown
>
>> > This is now done by the SPI core, there's no need for individual drivers
>> > to do this.
>
>> So that will go to stable kernels, too?
>
> No, I hadn't sent it there.  I'd really expect that anyone using a
> release kernel would've noticed this if there were a problem, it's
> pretty obvious when it goes wrong, and I tend to be extremely
> conservative with changes to stable kernels especially framework ones.

Well, I noticed this particular problem on a 3.6 kernel (3.6.7 to be
exact), so by that definition at least one noticed, unless I don't
count as anyone ;-). So, how can I make this driver less broken for
release kernels? I somewhat doubt the framework change will be picked
up by release kernel maintainers.

------------------------------------------------------------------------------
Monitor your physical, virtual and cloud infrastructure from a single
web console. Get in-depth insight into apps, servers, databases, vmware,
SAP, cloud infrastructure, etc. Download 30-day Free Trial.
Pricing starts from $795 for 25 servers or applications!
http://p.sf.net/sfu/zoho_dev2dev_nov

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

* Re: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
  2012-11-24 18:19           ` Jonas Gorski
@ 2012-11-26 13:11             ` Florian Fainelli
  2012-11-26 13:23               ` Mark Brown
  0 siblings, 1 reply; 6+ messages in thread
From: Florian Fainelli @ 2012-11-26 13:11 UTC (permalink / raw)
  To: Jonas Gorski
  Cc: Mark Brown, spi-devel-general, Grant Likely, Maxime Bizon,
	Kevin Cernekee, stable

On Saturday 24 November 2012 19:19:34 Jonas Gorski wrote:
> On 24 November 2012 19:01, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > On Sat, Nov 24, 2012 at 06:53:10PM +0100, Jonas Gorski wrote:
> >> On 24 November 2012 18:28, Mark Brown
> >
> >> > This is now done by the SPI core, there's no need for individual drivers
> >> > to do this.
> >
> >> So that will go to stable kernels, too?
> >
> > No, I hadn't sent it there.  I'd really expect that anyone using a
> > release kernel would've noticed this if there were a problem, it's
> > pretty obvious when it goes wrong, and I tend to be extremely
> > conservative with changes to stable kernels especially framework ones.
> 
> Well, I noticed this particular problem on a 3.6 kernel (3.6.7 to be
> exact), so by that definition at least one noticed, unless I don't
> count as anyone ;-). So, how can I make this driver less broken for
> release kernels? I somewhat doubt the framework change will be picked
> up by release kernel maintainers.

Considering it is a simple one-liner in spi-bcm63xx and that you don't want to
propagate a framework-level change back to -stable (which makes sense), don't
you want to pick that one?

At least two other users told me about this bug in private conversations.
--
Florian

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

* Re: [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check
  2012-11-26 13:11             ` Florian Fainelli
@ 2012-11-26 13:23               ` Mark Brown
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2012-11-26 13:23 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Jonas Gorski, spi-devel-general, Grant Likely, Maxime Bizon,
	Kevin Cernekee, stable

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

On Mon, Nov 26, 2012 at 02:11:20PM +0100, Florian Fainelli wrote:
> On Saturday 24 November 2012 19:19:34 Jonas Gorski wrote:

> > Well, I noticed this particular problem on a 3.6 kernel (3.6.7 to be
> > exact), so by that definition at least one noticed, unless I don't
> > count as anyone ;-). So, how can I make this driver less broken for
> > release kernels? I somewhat doubt the framework change will be picked
> > up by release kernel maintainers.

> Considering it is a simple one-liner in spi-bcm63xx and that you don't want to
> propagate a framework-level change back to -stable (which makes sense), don't
> you want to pick that one?

> At least two other users told me about this bug in private conversations.

Feel free to submit it for stable but it doesn't seem sensible to apply
it to development kernels, we want to remove this code from individual
drivers not add new copies.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

end of thread, other threads:[~2012-11-26 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-24 13:44 [PATCH 3.7] spi/bcm63xx: fix transfer bits_per_words check Jonas Gorski
     [not found] ` <1353764690-5961-1-git-send-email-jonas.gorski-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-11-24 15:02   ` Florian Fainelli
     [not found] ` <20121124172801.GC4719@opensource.wolfsonmicro.com>
     [not found]   ` <20121124172801.GC4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-24 17:53     ` Jonas Gorski
     [not found]       ` <20121124180151.GJ4719@opensource.wolfsonmicro.com>
     [not found]         ` <20121124180151.GJ4719-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2012-11-24 18:19           ` Jonas Gorski
2012-11-26 13:11             ` Florian Fainelli
2012-11-26 13:23               ` Mark Brown

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