diff options
Diffstat (limited to 'drivers/staging/dgnc/dgnc_mgmt.c')
-rw-r--r-- | drivers/staging/dgnc/dgnc_mgmt.c | 55 |
1 files changed, 16 insertions, 39 deletions
diff --git a/drivers/staging/dgnc/dgnc_mgmt.c b/drivers/staging/dgnc/dgnc_mgmt.c index c5b425bf669..5544a8e7f4b 100644 --- a/drivers/staging/dgnc/dgnc_mgmt.c +++ b/drivers/staging/dgnc/dgnc_mgmt.c @@ -62,29 +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); - DPR_MGMT(("dgnc_mgmt_open start.\n")); - - 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); - - DPR_MGMT(("dgnc_mgmt_open finish.\n")); + spin_unlock_irqrestore(&dgnc_global_lock, flags); return 0; } @@ -97,21 +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); - DPR_MGMT(("dgnc_mgmt_close start.\n")); - - 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); - - DPR_MGMT(("dgnc_mgmt_close finish.\n")); + spin_unlock_irqrestore(&dgnc_global_lock, flags); return 0; } @@ -125,11 +117,9 @@ 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; - DPR_MGMT(("dgnc_mgmt_ioctl start.\n")); - switch (cmd) { case DIGI_GETDD: @@ -141,15 +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); - - DPR_MGMT(("DIGI_GETDD returning numboards: %d version: %s\n", - ddi.dinfo_nboards, ddi.dinfo_version)); + spin_unlock_irqrestore(&dgnc_global_lock, flags); if (copy_to_user(uarg, &ddi, sizeof(ddi))) return -EFAULT; @@ -166,8 +153,6 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) if (copy_from_user(&brd, uarg, sizeof(int))) return -EFAULT; - DPR_MGMT(("DIGI_GETBD asking about board: %d\n", brd)); - if ((brd < 0) || (brd > dgnc_NumBoards) || (dgnc_NumBoards == 0)) return -ENODEV; @@ -176,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; @@ -188,10 +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); - - DPR_MGMT(("DIGI_GETBD returning type: %x state: %x ports: %x size: %x\n", - di.info_bdtype, di.info_bdstate, di.info_nports, di.info_physsize)); + spin_unlock_irqrestore(&dgnc_Board[brd]->bd_lock, flags); if (copy_to_user(uarg, &di, sizeof(di))) return -EFAULT; @@ -203,16 +185,13 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct channel_t *ch; struct ni_info ni; - uchar mstat = 0; + unsigned char mstat = 0; uint board = 0; uint channel = 0; if (copy_from_user(&ni, uarg, sizeof(ni))) return -EFAULT; - DPR_MGMT(("DIGI_GETBD asking about board: %d channel: %d\n", - ni.board, ni.channel)); - board = ni.board; channel = ni.channel; @@ -233,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); @@ -287,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; @@ -298,7 +277,5 @@ long dgnc_mgmt_ioctl(struct file *file, unsigned int cmd, unsigned long arg) } - DPR_MGMT(("dgnc_mgmt_ioctl finish.\n")); - return 0; } |