summaryrefslogtreecommitdiff
path: root/drivers/staging/dgnc
diff options
context:
space:
mode:
authorRoberta Dobrescu <roberta.dobrescu@gmail.com>2014-09-26 23:58:36 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-09-28 22:50:54 -0400
commit9a03d7c8cf8b244c3d66da2ce65c170013eeba56 (patch)
tree84c9f45bee401b9d88ba86dc57240d854b4f3dc3 /drivers/staging/dgnc
parent42c4d46e3858caa04b99dde64ef5a82681179881 (diff)
staging: dgnc: dgnc_mgmt.c: Replace non-standard spinlock's macros
This patch replaces non-standard spinlock's macros. It is done using coccinelle and the following semantic patch: @@ expression x; @@ - DGNC_SPINLOCK_INIT(x) + spin_lock_init(&x) @@ expression x, y; @@ - DGNC_LOCK(x, y) + spin_lock_irqsave(&x, y) @@ expression x, y; @@ - DGNC_UNLOCK(x, y) + spin_unlock_irqrestore(&x, y) @used_by_lock exists@ typedef ulong; symbol lock_flags; position p1, p2; @@ ( ulong lock_flags@p1; | unsigned long lock_flags@p2; ) ... ( spin_lock_irqsave(..., lock_flags) | spin_unlock_irqrestore(..., lock_flags) ) @@ position used_by_lock.p1, used_by_lock.p2; @@ ( - ulong lock_flags@p1; + unsigned long flags; | - unsigned long lock_flags@p2; + unsigned long flags; ) <... - lock_flags + flags ...> Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/dgnc')
-rw-r--r--drivers/staging/dgnc/dgnc_mgmt.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c
index 31e9f45d971e..9e45b85717f3 100644
--- a/drivers/staging/dgnc/dgnc_mgmt.c
+++ b/drivers/staging/dgnc/dgnc_mgmt.c
@@ -62,25 +62,25 @@ static int dgnc_mgmt_in_use[MAXMGMTDEVICES];
*/
int dgnc_mgmt_open(struct inode *inode, struct file *file)
{
- unsigned long lock_flags;
+ unsigned long flags;
unsigned int minor = iminor(inode);
- DGNC_LOCK(dgnc_global_lock, lock_flags);
+ spin_lock_irqsave(&dgnc_global_lock, flags);
/* mgmt device */
if (minor < MAXMGMTDEVICES) {
/* Only allow 1 open at a time on mgmt device */
if (dgnc_mgmt_in_use[minor]) {
- DGNC_UNLOCK(dgnc_global_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_global_lock, flags);
return -EBUSY;
}
dgnc_mgmt_in_use[minor]++;
} else {
- DGNC_UNLOCK(dgnc_global_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_global_lock, flags);
return -ENXIO;
}
- DGNC_UNLOCK(dgnc_global_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_global_lock, flags);
return 0;
}
@@ -93,17 +93,17 @@ int dgnc_mgmt_open(struct inode *inode, struct file *file)
*/
int dgnc_mgmt_close(struct inode *inode, struct file *file)
{
- unsigned long lock_flags;
+ unsigned long flags;
unsigned int minor = iminor(inode);
- DGNC_LOCK(dgnc_global_lock, lock_flags);
+ spin_lock_irqsave(&dgnc_global_lock, flags);
/* mgmt device */
if (minor < MAXMGMTDEVICES) {
if (dgnc_mgmt_in_use[minor])
dgnc_mgmt_in_use[minor] = 0;
}
- DGNC_UNLOCK(dgnc_global_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_global_lock, flags);
return 0;
}
@@ -117,7 +117,7 @@ int dgnc_mgmt_close(struct inode *inode, struct file *file)
long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- unsigned long lock_flags;
+ unsigned long flags;
void __user *uarg = (void __user *) arg;
switch (cmd) {
@@ -131,12 +131,12 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
*/
struct digi_dinfo ddi;
- DGNC_LOCK(dgnc_global_lock, lock_flags);
+ spin_lock_irqsave(&dgnc_global_lock, flags);
ddi.dinfo_nboards = dgnc_NumBoards;
sprintf(ddi.dinfo_version, "%s", DG_PART);
- DGNC_UNLOCK(dgnc_global_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_global_lock, flags);
if (copy_to_user(uarg, &ddi, sizeof(ddi)))
return -EFAULT;
@@ -161,7 +161,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
di.info_bdnum = brd;
- DGNC_LOCK(dgnc_Board[brd]->bd_lock, lock_flags);
+ spin_lock_irqsave(&dgnc_Board[brd]->bd_lock, flags);
di.info_bdtype = dgnc_Board[brd]->dpatype;
di.info_bdstate = dgnc_Board[brd]->dpastatus;
@@ -173,7 +173,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
else
di.info_nports = 0;
- DGNC_UNLOCK(dgnc_Board[brd]->bd_lock, lock_flags);
+ spin_unlock_irqrestore(&dgnc_Board[brd]->bd_lock, flags);
if (copy_to_user(uarg, &di, sizeof(di)))
return -EFAULT;
@@ -212,7 +212,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ni.board = board;
ni.channel = channel;
- DGNC_LOCK(ch->ch_lock, lock_flags);
+ spin_lock_irqsave(&ch->ch_lock, flags);
mstat = (ch->ch_mostat | ch->ch_mistat);
@@ -266,7 +266,7 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ni.baud = ch->ch_old_baud;
- DGNC_UNLOCK(ch->ch_lock, lock_flags);
+ spin_unlock_irqrestore(&ch->ch_lock, flags);
if (copy_to_user(uarg, &ni, sizeof(ni)))
return -EFAULT;