linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 2.6.22-rc3-git] SPI dynamic busid generation bugfix
@ 2007-06-01 23:12 David Brownell
       [not found] ` <200706011612.19766.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2007-06-01 23:12 UTC (permalink / raw)
  To: Andrew Morton; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Fix SPI dynamic bus ID assignment to start at 2^15-1 rather than
a negative number.  Valid bus ids are supposed to be positive,
and are (now) stored in an 's16' value.

Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>

--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -411,7 +411,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
  */
 int spi_register_master(struct spi_master *master)
 {
-	static atomic_t		dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
+	static atomic_t		dyn_bus_id = ATOMIC_INIT((1<<15) - 1);
 	struct device		*dev = master->cdev.dev;
 	int			status = -ENODEV;
 	int			dynamic = 0;

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [patch 2.6.22-rc3-git] SPI dynamic busid generation bugfix
       [not found] ` <200706011612.19766.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2007-06-01 23:33   ` Andrew Morton
       [not found]     ` <20070601163339.482e2327.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2007-06-01 23:33 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 1 Jun 2007 16:12:19 -0700
David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:

> Fix SPI dynamic bus ID assignment to start at 2^15-1 rather than
> a negative number.  Valid bus ids are supposed to be positive,
> and are (now) stored in an 's16' value.
> 
> Signed-off-by: David Brownell <dbrownell-Rn4VEauK+AKRv+LV9MX5uipxlwaOVQ5f@public.gmane.org>
> 
> --- a/drivers/spi/spi.c
> +++ b/drivers/spi/spi.c
> @@ -411,7 +411,7 @@ EXPORT_SYMBOL_GPL(spi_alloc_master);
>   */
>  int spi_register_master(struct spi_master *master)
>  {
> -	static atomic_t		dyn_bus_id = ATOMIC_INIT((1<<16) - 1);
> +	static atomic_t		dyn_bus_id = ATOMIC_INIT((1<<15) - 1);
>  	struct device		*dev = master->cdev.dev;
>  	int			status = -ENODEV;
>  	int			dynamic = 0;

Is this going to underflow then malfunction after 32k modprobe+rmmods?

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [patch 2.6.22-rc3-git] SPI dynamic busid generation bugfix
       [not found]     ` <20070601163339.482e2327.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
@ 2007-06-01 23:46       ` David Brownell
       [not found]         ` <200706011646.12340.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: David Brownell @ 2007-06-01 23:46 UTC (permalink / raw)
  To: Andrew Morton; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Friday 01 June 2007, Andrew Morton wrote:
> 
> Is this going to underflow then malfunction after 32k modprobe+rmmods?

Yes.  A better fix will be needed, for the crazy people amongst us.
Dynamic busids are quite uncommon though, so that's not pressing.

- Dave




-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

* Re: [patch 2.6.22-rc3-git] SPI dynamic busid generation bugfix
       [not found]         ` <200706011646.12340.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
@ 2007-06-01 23:53           ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2007-06-01 23:53 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, 1 Jun 2007 16:46:12 -0700
David Brownell <david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org> wrote:

> On Friday 01 June 2007, Andrew Morton wrote:
> > 
> > Is this going to underflow then malfunction after 32k modprobe+rmmods?
> 
> Yes.  A better fix will be needed, for the crazy people amongst us.
> Dynamic busids are quite uncommon though, so that's not pressing.

lib/idr.c can be used for this.  There are patches in Greg's driver
tree which make it better-suited.

The give-me-a-unique-integer thing is so common that we really should
have a wrapper around idr which does just that.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/

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

end of thread, other threads:[~2007-06-01 23:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-01 23:12 [patch 2.6.22-rc3-git] SPI dynamic busid generation bugfix David Brownell
     [not found] ` <200706011612.19766.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-06-01 23:33   ` Andrew Morton
     [not found]     ` <20070601163339.482e2327.akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
2007-06-01 23:46       ` David Brownell
     [not found]         ` <200706011646.12340.david-b-yBeKhBN/0LDR7s880joybQ@public.gmane.org>
2007-06-01 23:53           ` Andrew Morton

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