[PATCH 04/10] staging: kpc2000: remove lock_card/unlock_card functions

Greg Kroah-Hartman gregkh at linuxfoundation.org
Fri May 17 08:49:39 UTC 2019


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 at daktronics.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/staging/kpc2000/kpc2000/cell_probe.c |  4 ++--
 drivers/staging/kpc2000/kpc2000/core.c       | 10 +++++-----
 drivers/staging/kpc2000/kpc2000/pcie.h       | 14 --------------
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/kpc2000/kpc2000/cell_probe.c b/drivers/staging/kpc2000/kpc2000/cell_probe.c
index 6a2ebdf20113..9289ac98c8c6 100644
--- a/drivers/staging/kpc2000/kpc2000/cell_probe.c
+++ b/drivers/staging/kpc2000/kpc2000/cell_probe.c
@@ -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;
 }
diff --git a/drivers/staging/kpc2000/kpc2000/core.c b/drivers/staging/kpc2000/kpc2000/core.c
index 343db829e157..0d46d7e7d2cc 100644
--- a/drivers/staging/kpc2000/kpc2000/core.c
+++ b/drivers/staging/kpc2000/kpc2000/core.c
@@ -334,7 +334,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);
@@ -482,7 +482,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:
@@ -506,7 +506,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;
 }
@@ -520,7 +520,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);
@@ -539,7 +539,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);
 }
 
diff --git a/drivers/staging/kpc2000/kpc2000/pcie.h b/drivers/staging/kpc2000/kpc2000/pcie.h
index 056f2a393de1..e204f12632dc 100644
--- a/drivers/staging/kpc2000/kpc2000/pcie.h
+++ b/drivers/staging/kpc2000/kpc2000/pcie.h
@@ -90,18 +90,4 @@ void  kp2000_remove_cores(struct kp2000_device *pcard);
 // 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 */
-- 
2.21.0



More information about the devel mailing list