staging: kpc2000: remove lock_card/unlock_card functions

We do not need an inline function to "hide" the lock, so just replace
the few calls to these functions with the "real" mutex_lock/unlock()
calls.

Cc: Matt Sickler <Matt.Sickler@daktronics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Greg Kroah-Hartman 2019-05-17 10:49:39 +02:00
parent 92642f385b
commit 276accf2da
3 changed files with 7 additions and 21 deletions

View File

@ -243,7 +243,7 @@ int kuio_irqcontrol(struct uio_info *uioinfo, s32 irq_on)
struct kp2000_device *pcard = kudev->pcard;
u64 mask;
lock_card(pcard);
mutex_lock(&pcard->sem);
mask = readq(pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
if (irq_on){
mask &= ~(1 << (kudev->cte.irq_base_num));
@ -251,7 +251,7 @@ int kuio_irqcontrol(struct uio_info *uioinfo, s32 irq_on)
mask |= (1 << (kudev->cte.irq_base_num));
}
writeq(mask, pcard->sysinfo_regs_base + REG_INTERRUPT_MASK);
unlock_card(pcard);
mutex_unlock(&pcard->sem);
return 0;
}

View File

@ -228,7 +228,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
scnprintf(pcard->name, 16, "kpcard%d", pcard->card_num);
mutex_init(&pcard->sem);
lock_card(pcard);
mutex_lock(&pcard->sem);
pcard->pdev = pdev;
pci_set_drvdata(pdev, pcard);
@ -376,7 +376,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
//}
dev_dbg(&pcard->pdev->dev, "kp2000_pcie_probe() complete!\n");
unlock_card(pcard);
mutex_unlock(&pcard->sem);
return 0;
out11:
@ -400,7 +400,7 @@ static int kp2000_pcie_probe(struct pci_dev *pdev,
out4:
pci_disable_device(pcard->pdev);
out3:
unlock_card(pcard);
mutex_unlock(&pcard->sem);
kfree(pcard);
return err;
}
@ -414,7 +414,7 @@ static void kp2000_pcie_remove(struct pci_dev *pdev)
if (pcard == NULL) return;
lock_card(pcard);
mutex_lock(&pcard->sem);
kp2000_remove_cores(pcard);
mfd_remove_devices(PCARD_TO_DEV(pcard));
misc_deregister(&pcard->miscdev);
@ -433,7 +433,7 @@ static void kp2000_pcie_remove(struct pci_dev *pdev)
}
pci_disable_device(pcard->pdev);
pci_set_drvdata(pdev, NULL);
unlock_card(pcard);
mutex_unlock(&pcard->sem);
kfree(pcard);
}

View File

@ -93,18 +93,4 @@ extern struct file_operations kp2000_fops;
// Define this quick little macro because the expression is used frequently
#define PCARD_TO_DEV(pcard) (&(pcard->pdev->dev))
static inline void
lock_card(struct kp2000_device *pcard)
{
BUG_ON(pcard == NULL);
mutex_lock(&pcard->sem);
}
static inline void
unlock_card(struct kp2000_device *pcard)
{
BUG_ON(pcard == NULL);
mutex_unlock(&pcard->sem);
}
#endif /* KP2000_PCIE_H */