All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [KJ] [PATCH] unified spinlock initialization
@ 2005-01-20 15:36 Matthew Wilcox
  2005-01-20 15:36 ` Amit Gud
                   ` (14 more replies)
  0 siblings, 15 replies; 22+ messages in thread
From: Matthew Wilcox @ 2005-01-20 15:36 UTC (permalink / raw)
  To: kernel-janitors

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

On Thu, Jan 20, 2005 at 08:56:18PM +0530, Amit Gud wrote:
> Unify the spinlock initialization as far as possible.

Why would you want to replace a statically initialised spinlock with
one that's initialised at runtime?

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
@ 2005-01-20 15:36 ` Amit Gud
  2005-01-20 15:38 ` Amit Gud
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-20 15:36 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/arch/um/drivers/net_kern.c	2005-01-19 11:19:23.000000000 +0530
+++ linux-2.6.10/arch/um/drivers/net_kern.c	2005-01-20 20:28:31.000000000 +0530
@@ -30,7 +30,7 @@
 #include "irq_user.h"
 #include "irq_kern.h"
 
-static spinlock_t opened_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t opened_lock;
 LIST_HEAD(opened);
 
 static int uml_net_rx(struct net_device *dev)
@@ -286,7 +286,7 @@ void uml_net_user_timer_expire(unsigned 
 #endif
 }
 
-static spinlock_t devices_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t devices_lock;
 static struct list_head devices = LIST_HEAD_INIT(devices);
 
 static int eth_configure(int n, void *init, char *mac,
@@ -371,7 +371,6 @@ static int eth_configure(int n, void *in
 	save = lp->user[0];
 	*lp = ((struct uml_net_private)
 		{ .list  		= LIST_HEAD_INIT(lp->list),
-		  .lock 		= SPIN_LOCK_UNLOCKED,
 		  .dev 			= dev,
 		  .fd 			= -1,
 		  .mac 			= { 0xfe, 0xfd, 0x0, 0x0, 0x0, 0x0},
@@ -387,6 +386,7 @@ static int eth_configure(int n, void *in
 		  .set_mtu 		= transport->user->set_mtu,
 		  .user  		= { save } });
 
+	spin_lock_init(&lp->lock);
 	init_timer(&lp->tl);
 	lp->tl.function = uml_net_user_timer_expire;
 	if (lp->have_mac)
@@ -679,6 +679,8 @@ static int uml_net_init(void)
 	struct in_device *ip;
 	struct in_ifaddr *in;
 
+	spin_lock_init(&opened_lock);
+	spin_lock_init(&devices_lock);
 	mconsole_register_dev(&net_mc);
 	register_inetaddr_notifier(&uml_inetaddr_notifier);
 


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
  2005-01-20 15:36 ` Amit Gud
@ 2005-01-20 15:38 ` Amit Gud
  2005-01-20 15:39 ` Amit Gud
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-20 15:38 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/arch/um/drivers/mconsole_kern.c	2005-01-19 11:19:23.000000000 +0530
+++ linux-2.6.10/arch/um/drivers/mconsole_kern.c	2005-01-20 20:16:58.000000000 +0530
@@ -454,12 +454,14 @@ void mconsole_sysrq(struct mc_request *r
  * active.
  */
 static char *notify_socket = NULL; 
+static spinlock_t notify_spinlock;
 
 int mconsole_init(void)
 {
 	int err, sock;
 	char file[256];
 
+	spin_lock_init(&notify_spinlock);
 	if(umid_file_name("mconsole", file, sizeof(file))) return(-1);
 	snprintf(mconsole_socket_name, sizeof(file), "%s", file);
 
@@ -535,8 +537,6 @@ static int create_proc_mconsole(void)
 	return(0);
 }
 
-static spinlock_t notify_spinlock = SPIN_LOCK_UNLOCKED;
-
 void lock_notify(void)
 {
 	spin_lock(&notify_spinlock);


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
  2005-01-20 15:36 ` Amit Gud
  2005-01-20 15:38 ` Amit Gud
@ 2005-01-20 15:39 ` Amit Gud
  2005-01-20 15:40 ` Amit Gud
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-20 15:39 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/arch/um/drivers/port_kern.c	2005-01-19 11:19:23.000000000 +0530
+++ linux-2.6.10/arch/um/drivers/port_kern.c	2005-01-20 20:18:37.000000000 +0530
@@ -185,11 +185,11 @@ void *port_data(int port_num)
 		  .has_connection 	= 0,
 		  .sem 			= __SEMAPHORE_INITIALIZER(port->sem, 
 								  0),
-		  .lock 		= SPIN_LOCK_UNLOCKED,
 		  .port 	 	= port_num,
 		  .fd  			= fd,
 		  .pending 		= LIST_HEAD_INIT(port->pending),
 		  .connections 		= LIST_HEAD_INIT(port->connections) });
+	spin_lock_init(&port->lock);
 	list_add(&port->list, &ports);
 
  found:


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (2 preceding siblings ...)
  2005-01-20 15:39 ` Amit Gud
@ 2005-01-20 15:40 ` Amit Gud
  2005-01-24 15:28 ` [KJ] [PATCH] unified spinlock initialization drivers/acpi/ec.c Amit Gud
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-20 15:40 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/arch/um/drivers/ubd_kern.c	2005-01-20 20:08:30.000000000 +0530
+++ linux-2.6.10/arch/um/drivers/ubd_kern.c	2005-01-20 20:03:08.000000000 +0530
@@ -54,8 +54,8 @@
 #include "mem.h"
 #include "mem_kern.h"
 
-static spinlock_t ubd_io_lock = SPIN_LOCK_UNLOCKED;
-static spinlock_t ubd_lock = SPIN_LOCK_UNLOCKED;
+static spinlock_t ubd_io_lock;
+static spinlock_t ubd_lock;
 
 static void (*do_ubd)(void);
 
@@ -744,6 +744,9 @@ int ubd_init(void)
 {
         int i;
 
+	spin_lock_init(&ubd_lock);
+	spin_lock_init(&ubd_io_lock);
+
 	devfs_mk_dir("ubd");
 	if (register_blkdev(MAJOR_NR, "ubd"))
 		return -1;


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization drivers/acpi/ec.c
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (3 preceding siblings ...)
  2005-01-20 15:40 ` Amit Gud
@ 2005-01-24 15:28 ` Amit Gud
  2005-01-24 15:30 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-24 15:28 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/drivers/acpi/ec.c	2005-01-19 11:19:24.000000000 +0530
+++ linux-2.6.10/drivers/acpi/ec.c	2005-01-24 15:01:45.000000000 +0530
@@ -599,7 +599,7 @@ acpi_ec_add (
 
 	ec->handle = device->handle;
 	ec->uid = -1;
-	ec->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&ec->lock);
 	strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
 	strcpy(acpi_device_class(device), ACPI_EC_CLASS);
 	acpi_driver_data(device) = ec;
@@ -813,7 +813,7 @@ acpi_ec_ecdt_probe (void)
 	ec_ecdt->status_addr = ecdt_ptr->ec_control;
 	ec_ecdt->data_addr = ecdt_ptr->ec_data;
 	ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit;
-	ec_ecdt->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&ec_ecdt->lock);
 	/* use the GL just to be safe */
 	ec_ecdt->global_lock = TRUE;
 	ec_ecdt->uid = ecdt_ptr->uid;


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (4 preceding siblings ...)
  2005-01-24 15:28 ` [KJ] [PATCH] unified spinlock initialization drivers/acpi/ec.c Amit Gud
@ 2005-01-24 15:30 ` Amit Gud
  2005-01-24 15:41 ` [KJ] [PATCH] unified spinlock initialization drivers/block/DAC960.c Amit Gud
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-24 15:30 UTC (permalink / raw)
  To: kernel-janitors

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


Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/drivers/block/cciss_scsi.c	2005-01-19 11:19:25.000000000 +0530
+++ linux-2.6.10/drivers/block/cciss_scsi.c	2005-01-24 19:33:24.000000000 +0530
@@ -534,7 +534,7 @@ cciss_scsi_setup(int cntl_num)
 	if (shba == NULL)
 		return;
 	shba->scsi_host = NULL;
-	shba->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&shba->lock);
 	shba->registered = 0;
 	if (scsi_cmd_stack_setup(cntl_num, shba) != 0) {
 		kfree(shba);


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization drivers/block/DAC960.c
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (5 preceding siblings ...)
  2005-01-24 15:30 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
@ 2005-01-24 15:41 ` Amit Gud
  2005-01-24 15:42 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-24 15:41 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>


--- vanilla-2.6.10/drivers/block/DAC960.c	2005-01-19 11:19:25.000000000 +0530
+++ linux-2.6.10/drivers/block/DAC960.c	2005-01-24 19:31:13.000000000 +0530
@@ -2738,7 +2738,7 @@ DAC960_DetectController(struct pci_dev *
   }
   init_waitqueue_head(&Controller->CommandWaitQueue);
   init_waitqueue_head(&Controller->HealthStatusWaitQueue);
-  Controller->queue_lock = SPIN_LOCK_UNLOCKED; 
+  spin_lock_init(&Controller->queue_lock); 
   DAC960_AnnounceDriver(Controller);
   /*
     Map the Controller Register Window.


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (6 preceding siblings ...)
  2005-01-24 15:41 ` [KJ] [PATCH] unified spinlock initialization drivers/block/DAC960.c Amit Gud
@ 2005-01-24 15:42 ` Amit Gud
  2005-01-24 15:48 ` Amit Gud
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-24 15:42 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- vanilla-2.6.10/drivers/char/drm/drm_auth.h	2004-10-19 03:25:07.000000000 +0530
+++ linux-2.6.10/drivers/char/drm/drm_auth.h	2005-01-24 20:07:39.000000000 +0530
@@ -174,11 +174,12 @@ int DRM(getmagic)(struct inode *inode, s
 		  unsigned int cmd, unsigned long arg)
 {
 	static drm_magic_t sequence = 0;
-	static spinlock_t  lock	    = SPIN_LOCK_UNLOCKED;
+	static spinlock_t  lock;
 	drm_file_t	   *priv    = filp->private_data;
 	drm_device_t	   *dev	    = priv->dev;
 	drm_auth_t	   auth;
-
+	
+	spin_lock_init(&lock);
 				/* Find unique magic */
 	if (priv->magic) {
 		auth.magic = priv->magic;


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (7 preceding siblings ...)
  2005-01-24 15:42 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
@ 2005-01-24 15:48 ` Amit Gud
  2005-01-24 16:11 ` Randy.Dunlap
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-24 15:48 UTC (permalink / raw)
  To: kernel-janitors

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- vanilla-2.6.10/drivers/char/drm/drm_drv.h	2005-01-19 11:19:25.000000000 +0530
+++ linux-2.6.10/drivers/char/drm/drm_drv.h	2005-01-24 20:09:35.000000000 +0530
@@ -447,7 +447,7 @@ static int DRM(probe)(struct pci_dev *pd
 	dev = &(DRM(device)[DRM(numdevs)]);
 
 	memset( (void *)dev, 0, sizeof(*dev) );
-	dev->count_lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&dev->count_lock);
 	init_timer( &dev->timer );
 	sema_init( &dev->struct_sem, 1 );
 	sema_init( &dev->ctxlist_sem, 1 );


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (8 preceding siblings ...)
  2005-01-24 15:48 ` Amit Gud
@ 2005-01-24 16:11 ` Randy.Dunlap
  2005-01-24 16:25 ` Christophe Lucas
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Randy.Dunlap @ 2005-01-24 16:11 UTC (permalink / raw)
  To: kernel-janitors

Christophe Lucas wrote:
> In: drivers/misc/ibmasm/module.c
> 
> Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
> 
> 
> ------------------------------------------------------------------------
> 
> diff -urbNB linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c linux-2.6.10/drivers/misc/ibmasm/module.c
> --- linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c	2005-01-24 17:08:09.000000000 +0100
> +++ linux-2.6.10/drivers/misc/ibmasm/module.c	2005-01-24 17:18:31.000000000 +0100
> @@ -107,7 +107,7 @@
>  		goto error_remote_queue;
>  	}
>  
> -	sp->lock = SPIN_LOCK_UNLOCKED;
> +	spin_lock_init( &sp->lock );

Please lose those spaces... that's not kernel coding style.

-- 
~Randy
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (9 preceding siblings ...)
  2005-01-24 16:11 ` Randy.Dunlap
@ 2005-01-24 16:25 ` Christophe Lucas
  2005-01-24 16:41 ` Domen Puncer
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Christophe Lucas @ 2005-01-24 16:25 UTC (permalink / raw)
  To: kernel-janitors

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

--===============92655985430799481==
Content-Disposition: inline
Content-Type: multipart/signed; micalg=pgp-sha1;
	protocol="application/pgp-signature"; boundary="Yylu36WmvOXNoKYn"


[-- Attachment #2.1: Type: text/plain, Size: 108 bytes --]

In: drivers/misc/ibmasm/module.c

Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
-- 
Christophe

[-- Attachment #2.2: ibmmasm-module-unified-spinlock.patch --]
[-- Type: text/plain, Size: 539 bytes --]

diff -urbNB linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c linux-2.6.10/drivers/misc/ibmasm/module.c
--- linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c	2005-01-24 17:08:09.000000000 +0100
+++ linux-2.6.10/drivers/misc/ibmasm/module.c	2005-01-24 17:18:31.000000000 +0100
@@ -107,7 +107,7 @@
 		goto error_remote_queue;
 	}
 
-	sp->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init( &sp->lock );
 	INIT_LIST_HEAD(&sp->command_queue);
 
 	result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);

[-- Attachment #3: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (10 preceding siblings ...)
  2005-01-24 16:25 ` Christophe Lucas
@ 2005-01-24 16:41 ` Domen Puncer
  2005-01-25  7:03 ` Christophe Lucas
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Domen Puncer @ 2005-01-24 16:41 UTC (permalink / raw)
  To: kernel-janitors

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

Already done in 2.6.11-rc2, look below for some comments.

On 24/01/05 21:00 +0530, Amit Gud wrote:
> Unify the spinlock initialization as far as possible.
> 
> Do consider applying.
> 
> Signed-off-by: Amit Gud <gud@eth.net>
> 
> --- vanilla-2.6.10/drivers/char/drm/drm_auth.h	2004-10-19 03:25:07.000000000 +0530
> +++ linux-2.6.10/drivers/char/drm/drm_auth.h	2005-01-24 20:07:39.000000000 +0530
> @@ -174,11 +174,12 @@ int DRM(getmagic)(struct inode *inode, s
>  		  unsigned int cmd, unsigned long arg)
>  {
>  	static drm_magic_t sequence = 0;
> -	static spinlock_t  lock	    = SPIN_LOCK_UNLOCKED;
> +	static spinlock_t  lock;
>  	drm_file_t	   *priv    = filp->private_data;
>  	drm_device_t	   *dev	    = priv->dev;
>  	drm_auth_t	   auth;
> -
> +	

You added whitespace.


> +	spin_lock_init(&lock);

This changes behaviour, because of static lock wasn't initialized on
every function run, now it is, which makes it rather useless.

Correct way to do this seems to be what is already in 2.6.11-rc2 in
drm_auth.c:

	static drm_magic_t sequence = 0;
	static DEFINE_SPINLOCK(lock);
	drm_file_t         *priv    = filp->private_data;



	Domen

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (11 preceding siblings ...)
  2005-01-24 16:41 ` Domen Puncer
@ 2005-01-25  7:03 ` Christophe Lucas
  2005-01-25  7:07 ` [KJ] [PATCH] Unified " Christophe Lucas
  2005-01-25 11:33 ` Amit Gud
  14 siblings, 0 replies; 22+ messages in thread
From: Christophe Lucas @ 2005-01-25  7:03 UTC (permalink / raw)
  To: kernel-janitors

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

Randy.Dunlap (rddunlap@osdl.org) wrote:
> Christophe Lucas wrote:
> >In: drivers/misc/ibmasm/module.c
> >
> >Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
> >
> >
> >------------------------------------------------------------------------
> >
> >diff -urbNB linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c 
> >linux-2.6.10/drivers/misc/ibmasm/module.c
> >--- linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c	2005-01-24 
> >17:08:09.000000000 +0100
> >+++ linux-2.6.10/drivers/misc/ibmasm/module.c	2005-01-24 
> >17:18:31.000000000 +0100
> >@@ -107,7 +107,7 @@
> > 		goto error_remote_queue;
> > 	}
> > 
> >-	sp->lock = SPIN_LOCK_UNLOCKED;
> >+	spin_lock_init( &sp->lock );
> 
> Please lose those spaces... that's not kernel coding style.

Hi,

Thanks Randy,
Here is the corrected patch.
In: drivers/misc/ibmasm/module.c

Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>

Have a good day :)
-- 
Christophe

[-- Attachment #2: ibmmasm-module-unified-spinlock.patch --]
[-- Type: text/plain, Size: 525 bytes --]

diff -urbNB linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c linux-2.6.10/drivers/misc/ibmasm/module.c
--- linux-2.6.10-vanilla/drivers/misc/ibmasm/module.c	2005-01-24 17:08:09.000000000 +0100
+++ linux-2.6.10/drivers/misc/ibmasm/module.c	2005-01-24 17:18:31.000000000 +0100
@@ -107,7 +107,7 @@
 		goto error_remote_queue;
 	}
 
-	sp->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&sp->lock);
 	INIT_LIST_HEAD(&sp->command_queue);
 
 	result = request_irq(sp->irq, ibmasm_interrupt_handler, SA_SHIRQ, sp->devname, (void*)sp);

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] Unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (12 preceding siblings ...)
  2005-01-25  7:03 ` Christophe Lucas
@ 2005-01-25  7:07 ` Christophe Lucas
  2005-01-25 11:33 ` Amit Gud
  14 siblings, 0 replies; 22+ messages in thread
From: Christophe Lucas @ 2005-01-25  7:07 UTC (permalink / raw)
  To: kernel-janitors

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

Unified spinlock initialization.

Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>
-- 
Christophe

[-- Attachment #2: skystar2-unified-spinlock.patch --]
[-- Type: text/plain, Size: 443 bytes --]

diff -urB linux-2.6.10-vanilla/drivers/media/dvb/b2c2/skystar2.c linux-2.6.10/drivers/media/dvb/b2c2/skystar2.c
--- linux-2.6.10-vanilla/drivers/media/dvb/b2c2/skystar2.c	2005-01-24 17:07:56.000000000 +0100
+++ linux-2.6.10/drivers/media/dvb/b2c2/skystar2.c	2005-01-24 20:40:35.000000000 +0100
@@ -1979,7 +1979,7 @@
 		ctrl_enable_mac(adapter, 1);
 	}
 
-	adapter->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&adapter->lock);
 
 	return 0;
 }

[-- Attachment #3: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] Unified spinlock initialization
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
                   ` (13 preceding siblings ...)
  2005-01-25  7:07 ` [KJ] [PATCH] Unified " Christophe Lucas
@ 2005-01-25 11:33 ` Amit Gud
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-25 11:33 UTC (permalink / raw)
  To: kernel-janitors

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

Fixed in 2.6.11-rc2

On Tue, 2005-01-25 at 12:37, Christophe Lucas wrote:
> Unified spinlock initialization.
> 
> Signed-off-by: Christophe Lucas <c.lucas@ifrance.com>


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [PATCH] unified spinlock initialization arch/mips/kernel/irq.c
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
@ 2005-01-25 11:46 ` Amit Gud
  2005-01-20 15:38 ` Amit Gud
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-25 11:34 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel, kernel-janitors, gud

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- orig/arch/mips/kernel/irq.c	2005-01-20 20:06:12.000000000 +0530
+++ linux-2.6.11-rc2/arch/mips/kernel/irq.c	2005-01-25 15:29:35.000000000 +0530
@@ -125,7 +125,7 @@ void __init init_IRQ(void)
 		irq_desc[i].action  = NULL;
 		irq_desc[i].depth   = 1;
 		irq_desc[i].handler = &no_irq_type;
-		irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&irq_desc[i].lock);
 	}
 
 	arch_init_irq();


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

* [PATCH] Unified spinlock initialization include/linux/wait.h
  2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
@ 2005-01-25 11:47 ` Amit Gud
  2005-01-20 15:38 ` Amit Gud
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-25 11:35 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, gud

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- orig/include/linux/wait.h	2005-01-20 20:06:42.000000000 +0530
+++ linux-2.6.11-rc2/include/linux/wait.h	2005-01-25 16:41:31.000000000 +0530
@@ -79,7 +79,7 @@ typedef struct __wait_queue_head wait_qu
 
 static inline void init_waitqueue_head(wait_queue_head_t *q)
 {
-	q->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&q->lock);
 	INIT_LIST_HEAD(&q->task_list);
 }
 


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

* [KJ] [PATCH] unified spinlock initialization arch/mips/kernel/irq.c
@ 2005-01-25 11:46 ` Amit Gud
  0 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-25 11:46 UTC (permalink / raw)
  To: ralf; +Cc: linux-kernel, kernel-janitors, gud

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- orig/arch/mips/kernel/irq.c	2005-01-20 20:06:12.000000000 +0530
+++ linux-2.6.11-rc2/arch/mips/kernel/irq.c	2005-01-25 15:29:35.000000000 +0530
@@ -125,7 +125,7 @@ void __init init_IRQ(void)
 		irq_desc[i].action  = NULL;
 		irq_desc[i].depth   = 1;
 		irq_desc[i].handler = &no_irq_type;
-		irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
+		spin_lock_init(&irq_desc[i].lock);
 	}
 
 	arch_init_irq();


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* [KJ] [PATCH] Unified spinlock initialization include/linux/wait.h
@ 2005-01-25 11:47 ` Amit Gud
  0 siblings, 0 replies; 22+ messages in thread
From: Amit Gud @ 2005-01-25 11:47 UTC (permalink / raw)
  To: linux-kernel; +Cc: kernel-janitors, gud

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

Unify the spinlock initialization as far as possible.

Do consider applying.

Signed-off-by: Amit Gud <gud@eth.net>

--- orig/include/linux/wait.h	2005-01-20 20:06:42.000000000 +0530
+++ linux-2.6.11-rc2/include/linux/wait.h	2005-01-25 16:41:31.000000000 +0530
@@ -79,7 +79,7 @@ typedef struct __wait_queue_head wait_qu
 
 static inline void init_waitqueue_head(wait_queue_head_t *q)
 {
-	q->lock = SPIN_LOCK_UNLOCKED;
+	spin_lock_init(&q->lock);
 	INIT_LIST_HEAD(&q->task_list);
 }
 


[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] unified spinlock initialization
  2005-01-25 11:46 ` [KJ] " Amit Gud
@ 2005-01-25 13:43   ` Matthew Wilcox
  -1 siblings, 0 replies; 22+ messages in thread
From: Matthew Wilcox @ 2005-01-25 13:43 UTC (permalink / raw)
  To: Amit Gud; +Cc: ralf, kernel-janitors, linux-kernel, gud

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

On Tue, Jan 25, 2005 at 05:04:21PM +0530, Amit Gud wrote:
> Unify the spinlock initialization as far as possible.
> 
> Do consider applying.

Actually, 'handler' and 'lock' are initialised for you (see
kernel/irq/handle.c) so I think those two lines can just be deleted.
'action' is also initialised to NULL implicitly, so that can go.
I think setting 'status' and 'depth' like that is also unnecessary.

> Signed-off-by: Amit Gud <gud@eth.net>
> 
> --- orig/arch/mips/kernel/irq.c	2005-01-20 20:06:12.000000000 +0530
> +++ linux-2.6.11-rc2/arch/mips/kernel/irq.c	2005-01-25 15:29:35.000000000 +0530
> @@ -125,7 +125,7 @@ void __init init_IRQ(void)
>  		irq_desc[i].action  = NULL;
>  		irq_desc[i].depth   = 1;
>  		irq_desc[i].handler = &no_irq_type;
> -		irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
> +		spin_lock_init(&irq_desc[i].lock);
>  	}
>  
>  	arch_init_irq();
> 

> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors


-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

[-- Attachment #2: Type: text/plain, Size: 167 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

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

* Re: [KJ] [PATCH] unified spinlock initialization arch/mips/kernel/irq.c
@ 2005-01-25 13:43   ` Matthew Wilcox
  0 siblings, 0 replies; 22+ messages in thread
From: Matthew Wilcox @ 2005-01-25 13:43 UTC (permalink / raw)
  To: Amit Gud; +Cc: ralf, kernel-janitors, linux-kernel, gud

On Tue, Jan 25, 2005 at 05:04:21PM +0530, Amit Gud wrote:
> Unify the spinlock initialization as far as possible.
> 
> Do consider applying.

Actually, 'handler' and 'lock' are initialised for you (see
kernel/irq/handle.c) so I think those two lines can just be deleted.
'action' is also initialised to NULL implicitly, so that can go.
I think setting 'status' and 'depth' like that is also unnecessary.

> Signed-off-by: Amit Gud <gud@eth.net>
> 
> --- orig/arch/mips/kernel/irq.c	2005-01-20 20:06:12.000000000 +0530
> +++ linux-2.6.11-rc2/arch/mips/kernel/irq.c	2005-01-25 15:29:35.000000000 +0530
> @@ -125,7 +125,7 @@ void __init init_IRQ(void)
>  		irq_desc[i].action  = NULL;
>  		irq_desc[i].depth   = 1;
>  		irq_desc[i].handler = &no_irq_type;
> -		irq_desc[i].lock = SPIN_LOCK_UNLOCKED;
> +		spin_lock_init(&irq_desc[i].lock);
>  	}
>  
>  	arch_init_irq();
> 

> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors


-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain

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

end of thread, other threads:[~2005-01-25 13:43 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 15:36 [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
2005-01-20 15:36 ` Amit Gud
2005-01-20 15:38 ` Amit Gud
2005-01-20 15:39 ` Amit Gud
2005-01-20 15:40 ` Amit Gud
2005-01-24 15:28 ` [KJ] [PATCH] unified spinlock initialization drivers/acpi/ec.c Amit Gud
2005-01-24 15:30 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
2005-01-24 15:41 ` [KJ] [PATCH] unified spinlock initialization drivers/block/DAC960.c Amit Gud
2005-01-24 15:42 ` [KJ] [PATCH] unified spinlock initialization Amit Gud
2005-01-24 15:48 ` Amit Gud
2005-01-24 16:11 ` Randy.Dunlap
2005-01-24 16:25 ` Christophe Lucas
2005-01-24 16:41 ` Domen Puncer
2005-01-25  7:03 ` Christophe Lucas
2005-01-25  7:07 ` [KJ] [PATCH] Unified " Christophe Lucas
2005-01-25 11:33 ` Amit Gud
  -- strict thread matches above, loose matches on Subject: below --
2005-01-25 11:34 [PATCH] unified spinlock initialization arch/mips/kernel/irq.c Amit Gud
2005-01-25 11:46 ` [KJ] " Amit Gud
2005-01-25 13:43 ` [KJ] [PATCH] unified spinlock initialization Matthew Wilcox
2005-01-25 13:43   ` [KJ] [PATCH] unified spinlock initialization arch/mips/kernel/irq.c Matthew Wilcox
2005-01-25 11:35 [PATCH] Unified spinlock initialization include/linux/wait.h Amit Gud
2005-01-25 11:47 ` [KJ] " Amit Gud

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.