mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [Patch RFC 35/37] staging: Bulk convert the semaphore mess
Date: Sun, 26 Jul 2009 08:20:32 -0000	[thread overview]
Message-ID: <20090726081557.935582320@linutronix.de> (raw)
In-Reply-To: <20090726081459.455111897@linutronix.de>

[-- Attachment #1: staging-bulkconvert-the-semaphore-mess.patch --]
[-- Type: text/plain, Size: 11438 bytes --]

init_MUTEX(_LOCKED) and DECLARE_MUTEX are going away. Bulk convert
staging users.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/staging/comedi/drivers/dt9812.c        |    4 ++--
 drivers/staging/comedi/drivers/usbdux.c        |    4 ++--
 drivers/staging/comedi/drivers/usbduxfast.c    |    4 ++--
 drivers/staging/cpc-usb/cpc-usb_drv.c          |    4 ++--
 drivers/staging/frontier/alphatrack.c          |    2 +-
 drivers/staging/frontier/tranzport.c           |    2 +-
 drivers/staging/go7007/go7007-driver.c         |    2 +-
 drivers/staging/go7007/go7007-i2c.c            |    2 +-
 drivers/staging/go7007/go7007-usb.c            |    2 +-
 drivers/staging/go7007/go7007-v4l2.c           |    2 +-
 drivers/staging/go7007/s2250-loader.c          |    2 +-
 drivers/staging/mimio/mimio.c                  |    2 +-
 drivers/staging/octeon/ethernet-mdio.c         |    2 +-
 drivers/staging/otus/wwrap.c                   |    2 +-
 drivers/staging/p9auth/p9auth.c                |    2 +-
 drivers/staging/rspiusb/rspiusb.c              |    2 +-
 drivers/staging/rt2870/common/2870_rtmp_init.c |    6 +++---
 17 files changed, 23 insertions(+), 23 deletions(-)

Index: linux-2.6-tip/drivers/staging/comedi/drivers/dt9812.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/comedi/drivers/dt9812.c
+++ linux-2.6-tip/drivers/staging/comedi/drivers/dt9812.c
@@ -262,7 +262,7 @@ struct dt9812_usb_cmd {
 
 #define DT9812_NUM_SLOTS	16
 
-static DECLARE_MUTEX(dt9812_mutex);
+static DEFINE_SEMAPHORE(dt9812_mutex);
 
 static struct usb_device_id dt9812_table[] = {
 	{USB_DEVICE(0x0867, 0x9812)},
@@ -1121,7 +1121,7 @@ static int __init usb_dt9812_init(void)
 
 	/* Initialize all driver slots */
 	for (i = 0; i < DT9812_NUM_SLOTS; i++) {
-		init_MUTEX(&dt9812[i].mutex);
+		semaphore_init(&dt9812[i].mutex);
 		dt9812[i].serial = 0;
 		dt9812[i].usb = NULL;
 		dt9812[i].comedi = NULL;
Index: linux-2.6-tip/drivers/staging/comedi/drivers/usbdux.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/comedi/drivers/usbdux.c
+++ linux-2.6-tip/drivers/staging/comedi/drivers/usbdux.c
@@ -307,7 +307,7 @@ struct usbduxsub {
  */
 static struct usbduxsub usbduxsub[NUMUSBDUX];
 
-static DECLARE_MUTEX(start_stop_sem);
+static DEFINE_SEMAPHORE(start_stop_sem);
 
 /*
  * Stops the data acquision
@@ -2349,7 +2349,7 @@ static int usbduxsub_probe(struct usb_in
 	dev_dbg(dev, "comedi_: usbdux: "
 		"usbduxsub[%d] is ready to connect to comedi.\n", index);
 
-	init_MUTEX(&(usbduxsub[index].sem));
+	semaphore_init(&(usbduxsub[index].sem));
 	/* save a pointer to the usb device */
 	usbduxsub[index].usbdev = udev;
 
Index: linux-2.6-tip/drivers/staging/comedi/drivers/usbduxfast.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/comedi/drivers/usbduxfast.c
+++ linux-2.6-tip/drivers/staging/comedi/drivers/usbduxfast.c
@@ -201,7 +201,7 @@ struct usbduxfastsub_s {
  */
 static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST];
 
-static DECLARE_MUTEX(start_stop_sem);
+static DEFINE_SEMAPHORE(start_stop_sem);
 
 /*
  * bulk transfers to usbduxfast
@@ -1500,7 +1500,7 @@ static int usbduxfastsub_probe(struct us
 	       "connect to comedi.\n", index);
 #endif
 
-	init_MUTEX(&(usbduxfastsub[index].sem));
+	semaphore_init(&(usbduxfastsub[index].sem));
 	/* save a pointer to the usb device */
 	usbduxfastsub[index].usbdev = udev;
 
Index: linux-2.6-tip/drivers/staging/cpc-usb/cpc-usb_drv.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/cpc-usb/cpc-usb_drv.c
+++ linux-2.6-tip/drivers/staging/cpc-usb/cpc-usb_drv.c
@@ -83,7 +83,7 @@ static CPC_USB_T *CPCUSB_Table[CPC_USB_C
 static unsigned int CPCUsbCnt;
 
 /* prevent races between open() and disconnect() */
-static DECLARE_MUTEX(disconnect_sem);
+static DEFINE_SEMAPHORE(disconnect_sem);
 
 /* local function prototypes */
 static ssize_t cpcusb_read(struct file *file, char *buffer, size_t count,
@@ -903,7 +903,7 @@ static int cpcusb_probe(struct usb_inter
 	memset(chan, 0, sizeof(CPC_CHAN_T));
 	ResetBuffer(chan);
 
-	init_MUTEX(&card->sem);
+	semaphore_init(&card->sem);
 	spin_lock_init(&card->slock);
 
 	card->udev = udev;
Index: linux-2.6-tip/drivers/staging/frontier/alphatrack.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/frontier/alphatrack.c
+++ linux-2.6-tip/drivers/staging/frontier/alphatrack.c
@@ -678,7 +678,7 @@ static int usb_alphatrack_probe(struct u
 		dev_err(&intf->dev, "Out of memory\n");
 		goto exit;
 	}
-	init_MUTEX(&dev->sem);
+	semaphore_init(&dev->sem);
 	dev->intf = intf;
 	init_waitqueue_head(&dev->read_wait);
 	init_waitqueue_head(&dev->write_wait);
Index: linux-2.6-tip/drivers/staging/frontier/tranzport.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/frontier/tranzport.c
+++ linux-2.6-tip/drivers/staging/frontier/tranzport.c
@@ -800,7 +800,7 @@ static int usb_tranzport_probe(struct us
 		dev_err(&intf->dev, "Out of memory\n");
 		goto exit;
 	}
-	init_MUTEX(&dev->sem);
+	semaphore_init(&dev->sem);
 	dev->intf = intf;
 	init_waitqueue_head(&dev->read_wait);
 	init_waitqueue_head(&dev->write_wait);
Index: linux-2.6-tip/drivers/staging/go7007/go7007-driver.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/go7007/go7007-driver.c
+++ linux-2.6-tip/drivers/staging/go7007/go7007-driver.c
@@ -604,7 +604,7 @@ struct go7007 *go7007_alloc(struct go700
 	go->tuner_type = -1;
 	go->channel_number = 0;
 	go->name[0] = 0;
-	init_MUTEX(&go->hw_lock);
+	semaphore_init(&go->hw_lock);
 	init_waitqueue_head(&go->frame_waitq);
 	spin_lock_init(&go->spinlock);
 	go->video_dev = NULL;
Index: linux-2.6-tip/drivers/staging/go7007/go7007-i2c.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/go7007/go7007-i2c.c
+++ linux-2.6-tip/drivers/staging/go7007/go7007-i2c.c
@@ -48,7 +48,7 @@
 
 /* There is only one I2C port on the TW2804 that feeds all four GO7007 VIPs
  * on the Adlink PCI-MPG24, so access is shared between all of them. */
-static DECLARE_MUTEX(adlink_mpg24_i2c_lock);
+static DEFINE_SEMAPHORE(adlink_mpg24_i2c_lock);
 
 static int go7007_i2c_xfer(struct go7007 *go, u16 addr, int read,
 		u16 command, int flags, u8 *data)
Index: linux-2.6-tip/drivers/staging/go7007/go7007-usb.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/go7007/go7007-usb.c
+++ linux-2.6-tip/drivers/staging/go7007/go7007-usb.c
@@ -1065,7 +1065,7 @@ static int go7007_usb_probe(struct usb_i
 	if (board->flags & GO7007_USB_EZUSB_I2C) {
 		memcpy(&go->i2c_adapter, &go7007_usb_adap_templ,
 				sizeof(go7007_usb_adap_templ));
-		init_MUTEX(&usb->i2c_lock);
+		semaphore_init(&usb->i2c_lock);
 		go->i2c_adapter.dev.parent = go->dev;
 		i2c_set_adapdata(&go->i2c_adapter, go);
 		if (i2c_add_adapter(&go->i2c_adapter) < 0) {
Index: linux-2.6-tip/drivers/staging/go7007/go7007-v4l2.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/go7007/go7007-v4l2.c
+++ linux-2.6-tip/drivers/staging/go7007/go7007-v4l2.c
@@ -101,7 +101,7 @@ static int go7007_open(struct file *file
 		return -ENOMEM;
 	++go->ref_count;
 	gofh->go = go;
-	init_MUTEX(&gofh->lock);
+	semaphore_init(&gofh->lock);
 	gofh->buf_count = 0;
 	file->private_data = gofh;
 	return 0;
Index: linux-2.6-tip/drivers/staging/go7007/s2250-loader.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/go7007/s2250-loader.c
+++ linux-2.6-tip/drivers/staging/go7007/s2250-loader.c
@@ -35,7 +35,7 @@ typedef struct device_extension_s {
 #define MAX_DEVICES 256
 
 static pdevice_extension_t s2250_dev_table[MAX_DEVICES];
-static DECLARE_MUTEX(s2250_dev_table_mutex);
+static DEFINE_SEMAPHORE(s2250_dev_table_mutex);
 
 #define to_s2250loader_dev_common(d) container_of(d, device_extension_t, kref)
 static void s2250loader_delete(struct kref *kref)
Index: linux-2.6-tip/drivers/staging/mimio/mimio.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/mimio/mimio.c
+++ linux-2.6-tip/drivers/staging/mimio/mimio.c
@@ -160,7 +160,7 @@ static struct usb_driver mimio_driver = 
 	.id_table = mimio_table,
 };
 
-static DECLARE_MUTEX(disconnect_sem);
+static DEFINE_SEMAPHORE(disconnect_sem);
 
 static void mimio_close(struct input_dev *idev)
 {
Index: linux-2.6-tip/drivers/staging/octeon/ethernet-mdio.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/octeon/ethernet-mdio.c
+++ linux-2.6-tip/drivers/staging/octeon/ethernet-mdio.c
@@ -39,7 +39,7 @@
 
 #include "cvmx-smix-defs.h"
 
-DECLARE_MUTEX(mdio_sem);
+DEFINE_SEMAPHORE(mdio_sem);
 
 /**
  * Perform an MII read. Called by the generic MII routines
Index: linux-2.6-tip/drivers/staging/otus/wwrap.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/otus/wwrap.c
+++ linux-2.6-tip/drivers/staging/otus/wwrap.c
@@ -1066,7 +1066,7 @@ u8_t zfLnxCreateThread(zdev_t *dev)
 
     /* Create Mutex and keventd */
     INIT_WORK(&macp->kevent, kevent);
-    init_MUTEX(&macp->ioctl_sem);
+    semaphore_init(&macp->ioctl_sem);
 
     return 0;
 }
Index: linux-2.6-tip/drivers/staging/p9auth/p9auth.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/p9auth/p9auth.c
+++ linux-2.6-tip/drivers/staging/p9auth/p9auth.c
@@ -388,7 +388,7 @@ static int cap_init_module(void)
 	/* Initialize each device. */
 	for (i = 0; i < cap_nr_devs; i++) {
 		cap_devices[i].node_size = cap_node_size;
-		init_MUTEX(&cap_devices[i].sem);
+		semaphore_init(&cap_devices[i].sem);
 		cap_setup_cdev(&cap_devices[i], i);
 	}
 
Index: linux-2.6-tip/drivers/staging/rspiusb/rspiusb.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/rspiusb/rspiusb.c
+++ linux-2.6-tip/drivers/staging/rspiusb/rspiusb.c
@@ -63,7 +63,7 @@ static int debug;
 #endif
 
 /* prevent races between open() and disconnect() */
-static DECLARE_MUTEX(disconnect_sem);
+static DEFINE_SEMAPHORE(disconnect_sem);
 
 /* Structure to hold all of our device specific stuff */
 struct device_extension {
Index: linux-2.6-tip/drivers/staging/rt2870/common/2870_rtmp_init.c
===================================================================
--- linux-2.6-tip.orig/drivers/staging/rt2870/common/2870_rtmp_init.c
+++ linux-2.6-tip/drivers/staging/rt2870/common/2870_rtmp_init.c
@@ -751,13 +751,13 @@ NDIS_STATUS	 CreateThreads(
 
 	//init_MUTEX(&(pAd->usbdev_semaphore));
 
-	init_MUTEX_LOCKED(&(pAd->mlme_semaphore));
+	semaphore_init_locked(&(pAd->mlme_semaphore));
 	init_completion (&pAd->mlmeComplete);
 
-	init_MUTEX_LOCKED(&(pAd->RTUSBCmd_semaphore));
+	semaphore_init_locked(&(pAd->RTUSBCmd_semaphore));
 	init_completion (&pAd->CmdQComplete);
 
-	init_MUTEX_LOCKED(&(pAd->RTUSBTimer_semaphore));
+	semaphore_init_locked(&(pAd->RTUSBTimer_semaphore));
 	init_completion (&pAd->TimerQComplete);
 
 	// Creat MLME Thread



  parent reply	other threads:[~2009-07-26  8:26 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-26  8:17 [Patch RFC 00/37] Cleanup init_MUTEX[_LOCKED] / DECLARE_MUTEX Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 01/37] semaphore: Add DEFINE_SEMAPHORE, semaphore_init, semaphore_init_locked Thomas Gleixner
2009-07-26 23:04   ` Daniel Walker
2009-07-27 15:25     ` Christoph Hellwig
2009-07-27 15:32       ` Thomas Gleixner
2009-07-27 15:24   ` Christoph Hellwig
2009-07-26  8:17 ` [Patch RFC 02/37] input: keyboard/hil_kbd: semaphore cleanup Thomas Gleixner
2009-07-28  7:36   ` Dmitry Torokhov
2009-07-26  8:17 ` [Patch RFC 03/37] input: misc/hp_sdc_rtc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 04/37] input: mouse/hil_ptr: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 05/37] input: serio/hil_mlc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 06/37] input: serio/hp_sdc: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 07/37] net: 3c527: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 08/37] hamradio: 6pack: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 09/37] hamradio: mkiss: " Thomas Gleixner
2009-07-26  8:17 ` [Patch RFC 10/37] net: ppp_async: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 11/37] parport: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 12/37] ibmphp-hpc: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 13/37] s390: cio/crw: " Thomas Gleixner
2009-07-27 11:45   ` Martin Schwidefsky
2009-07-26  8:18 ` [Patch RFC 14/37] scsi: aacraid " Thomas Gleixner
2009-07-26 20:11   ` James Bottomley
2009-07-26 22:21     ` Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 15/37] bluetooth: Convert hdev->req_lock to mutex Thomas Gleixner
2009-07-26 21:36   ` Marcel Holtmann
2009-07-26 22:04     ` Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 16/37] smbfs: Convert server->sem " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 17/37] hpfs: Convert sbi->hpfs_creation_de " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 18/37] hpfsplus: Convert tree_lock " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 19/37] hfs: " Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 20/37] cifs: convert semaphore " Thomas Gleixner
2009-07-27  1:14   ` Jeff Layton
2009-07-30 21:09   ` Christoph Hellwig
2009-07-30 22:43     ` Steven French
2009-07-26  8:18 ` [Patch RFC 21/37] affs: use semaphore_init instead of init_MUTEX Thomas Gleixner
2009-07-30 21:14   ` Christoph Hellwig
2009-07-26  8:18 ` [Patch RFC 22/37] usb: ftdi-elan: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:18 ` [Patch RFC 23/37] usb: gadgetfs: Convert semaphore to mutex Thomas Gleixner
2009-07-26 22:56   ` Daniel Walker
2009-07-26  8:19 ` [Patch RFC 24/37] xfs: semaphore cleanup Thomas Gleixner
2009-07-27 15:25   ` Christoph Hellwig
2009-07-26  8:19 ` [Patch RFC 25/37] net: wan/cosa.c: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 26/37] irda: semaphore cleanup Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 27/37] mmc: Convert "mutex" to semaphore Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 28/37] dvb: " Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 29/37] infiniband: Make user_mad semaphore a real one Thomas Gleixner
2009-07-27 16:26   ` Roland Dreier
2009-07-27 16:28     ` Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 30/37] drivers/base: Convert dev->sem to mutex Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 31/37] ia64: salinfo: semaphore_init instead of init_MUTEX Thomas Gleixner
2009-07-26  8:19 ` [Patch RFC 32/37] drivers/macintosh/adb: Do not claim that the semaphore is a mutex Thomas Gleixner
2009-07-26  8:20 ` [Patch RFC 33/37] arm: w90x900: convert semaphore to mutex Thomas Gleixner
2009-07-27  3:11   ` Wan ZongShun
2009-07-26  8:20 ` [Patch RFC 34/37] printk: Make console_sem a semaphore not a pseudo mutex Thomas Gleixner
2009-07-26  8:20 ` Thomas Gleixner [this message]
2009-07-26  8:20 ` [Patch RFC 36/37] fs: Convert bd_mount_sem to mutex Thomas Gleixner
2009-07-27 15:26   ` Christoph Hellwig
2009-07-27 15:30     ` Thomas Gleixner
2009-07-27 16:42       ` Daniel Walker
2009-07-26  8:20 ` [Patch RFC 37/37] semaphore: Remove mutex emulation Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090726081557.935582320@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®