Commit d4ccd08c authored by Arjan van de Ven's avatar Arjan van de Ven Committed by David S. Miller

[IRDA] sem2mutex: drivers/net/irda

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.
Signed-off-by: default avatarArjan van de Ven <arjan@infradead.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 15333061
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/mutex.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
#include <net/irda/irda_device.h> #include <net/irda/irda_device.h>
...@@ -338,7 +339,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop) ...@@ -338,7 +339,7 @@ static inline void irtty_stop_receiver(struct tty_struct *tty, int stop)
/*****************************************************************/ /*****************************************************************/
/* serialize ldisc open/close with sir_dev */ /* serialize ldisc open/close with sir_dev */
static DECLARE_MUTEX(irtty_sem); static DEFINE_MUTEX(irtty_mutex);
/* notifier from sir_dev when irda% device gets opened (ifup) */ /* notifier from sir_dev when irda% device gets opened (ifup) */
...@@ -348,11 +349,11 @@ static int irtty_start_dev(struct sir_dev *dev) ...@@ -348,11 +349,11 @@ static int irtty_start_dev(struct sir_dev *dev)
struct tty_struct *tty; struct tty_struct *tty;
/* serialize with ldisc open/close */ /* serialize with ldisc open/close */
down(&irtty_sem); mutex_lock(&irtty_mutex);
priv = dev->priv; priv = dev->priv;
if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) {
up(&irtty_sem); mutex_unlock(&irtty_mutex);
return -ESTALE; return -ESTALE;
} }
...@@ -363,7 +364,7 @@ static int irtty_start_dev(struct sir_dev *dev) ...@@ -363,7 +364,7 @@ static int irtty_start_dev(struct sir_dev *dev)
/* Make sure we can receive more data */ /* Make sure we can receive more data */
irtty_stop_receiver(tty, FALSE); irtty_stop_receiver(tty, FALSE);
up(&irtty_sem); mutex_unlock(&irtty_mutex);
return 0; return 0;
} }
...@@ -375,11 +376,11 @@ static int irtty_stop_dev(struct sir_dev *dev) ...@@ -375,11 +376,11 @@ static int irtty_stop_dev(struct sir_dev *dev)
struct tty_struct *tty; struct tty_struct *tty;
/* serialize with ldisc open/close */ /* serialize with ldisc open/close */
down(&irtty_sem); mutex_lock(&irtty_mutex);
priv = dev->priv; priv = dev->priv;
if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) { if (unlikely(!priv || priv->magic!=IRTTY_MAGIC)) {
up(&irtty_sem); mutex_unlock(&irtty_mutex);
return -ESTALE; return -ESTALE;
} }
...@@ -390,7 +391,7 @@ static int irtty_stop_dev(struct sir_dev *dev) ...@@ -390,7 +391,7 @@ static int irtty_stop_dev(struct sir_dev *dev)
if (tty->driver->stop) if (tty->driver->stop)
tty->driver->stop(tty); tty->driver->stop(tty);
up(&irtty_sem); mutex_unlock(&irtty_mutex);
return 0; return 0;
} }
...@@ -514,13 +515,13 @@ static int irtty_open(struct tty_struct *tty) ...@@ -514,13 +515,13 @@ static int irtty_open(struct tty_struct *tty)
priv->dev = dev; priv->dev = dev;
/* serialize with start_dev - in case we were racing with ifup */ /* serialize with start_dev - in case we were racing with ifup */
down(&irtty_sem); mutex_lock(&irtty_mutex);
dev->priv = priv; dev->priv = priv;
tty->disc_data = priv; tty->disc_data = priv;
tty->receive_room = 65536; tty->receive_room = 65536;
up(&irtty_sem); mutex_unlock(&irtty_mutex);
IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name); IRDA_DEBUG(0, "%s - %s: irda line discipline opened\n", __FUNCTION__, tty->name);
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp_lock.h> #include <linux/smp_lock.h>
#include <linux/kmod.h> #include <linux/kmod.h>
#include <linux/mutex.h>
#include <net/irda/irda.h> #include <net/irda/irda.h>
...@@ -28,7 +29,7 @@ ...@@ -28,7 +29,7 @@
*/ */
static LIST_HEAD(dongle_list); /* list of registered dongle drivers */ static LIST_HEAD(dongle_list); /* list of registered dongle drivers */
static DECLARE_MUTEX(dongle_list_lock); /* protects the list */ static DEFINE_MUTEX(dongle_list_lock); /* protects the list */
int irda_register_dongle(struct dongle_driver *new) int irda_register_dongle(struct dongle_driver *new)
{ {
...@@ -38,25 +39,25 @@ int irda_register_dongle(struct dongle_driver *new) ...@@ -38,25 +39,25 @@ int irda_register_dongle(struct dongle_driver *new)
IRDA_DEBUG(0, "%s : registering dongle \"%s\" (%d).\n", IRDA_DEBUG(0, "%s : registering dongle \"%s\" (%d).\n",
__FUNCTION__, new->driver_name, new->type); __FUNCTION__, new->driver_name, new->type);
down(&dongle_list_lock); mutex_lock(&dongle_list_lock);
list_for_each(entry, &dongle_list) { list_for_each(entry, &dongle_list) {
drv = list_entry(entry, struct dongle_driver, dongle_list); drv = list_entry(entry, struct dongle_driver, dongle_list);
if (new->type == drv->type) { if (new->type == drv->type) {
up(&dongle_list_lock); mutex_unlock(&dongle_list_lock);
return -EEXIST; return -EEXIST;
} }
} }
list_add(&new->dongle_list, &dongle_list); list_add(&new->dongle_list, &dongle_list);
up(&dongle_list_lock); mutex_unlock(&dongle_list_lock);
return 0; return 0;
} }
EXPORT_SYMBOL(irda_register_dongle); EXPORT_SYMBOL(irda_register_dongle);
int irda_unregister_dongle(struct dongle_driver *drv) int irda_unregister_dongle(struct dongle_driver *drv)
{ {
down(&dongle_list_lock); mutex_lock(&dongle_list_lock);
list_del(&drv->dongle_list); list_del(&drv->dongle_list);
up(&dongle_list_lock); mutex_unlock(&dongle_list_lock);
return 0; return 0;
} }
EXPORT_SYMBOL(irda_unregister_dongle); EXPORT_SYMBOL(irda_unregister_dongle);
...@@ -75,7 +76,7 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type) ...@@ -75,7 +76,7 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
return -EBUSY; return -EBUSY;
/* serialize access to the list of registered dongles */ /* serialize access to the list of registered dongles */
down(&dongle_list_lock); mutex_lock(&dongle_list_lock);
list_for_each(entry, &dongle_list) { list_for_each(entry, &dongle_list) {
drv = list_entry(entry, struct dongle_driver, dongle_list); drv = list_entry(entry, struct dongle_driver, dongle_list);
...@@ -109,14 +110,14 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type) ...@@ -109,14 +110,14 @@ int sirdev_get_dongle(struct sir_dev *dev, IRDA_DONGLE type)
if (!drv->open || (err=drv->open(dev))!=0) if (!drv->open || (err=drv->open(dev))!=0)
goto out_reject; /* failed to open driver */ goto out_reject; /* failed to open driver */
up(&dongle_list_lock); mutex_unlock(&dongle_list_lock);
return 0; return 0;
out_reject: out_reject:
dev->dongle_drv = NULL; dev->dongle_drv = NULL;
module_put(drv->owner); module_put(drv->owner);
out_unlock: out_unlock:
up(&dongle_list_lock); mutex_unlock(&dongle_list_lock);
return err; return err;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment