]> nv-tegra.nvidia Code Review - linux-2.6.git/commitdiff
prism54: Convert stats_sem in a mutex
authorMatthias Kaehlcke <matthias@kaehlcke.net>
Fri, 15 Feb 2008 19:56:59 +0000 (20:56 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 29 Feb 2008 20:37:17 +0000 (15:37 -0500)
The semaphore stats_sem is used as mutex, convert it to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Acked-by: Luis R. Rodriguez <mcgrof@winlab.rutgers.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/prism54/isl_ioctl.c
drivers/net/wireless/prism54/islpci_dev.c
drivers/net/wireless/prism54/islpci_dev.h

index df1594ea942cd2c802d3a7dd854a90dc76899644..3fb6a7b54038b5baa584a436e21a1c89411ed4d5 100644 (file)
@@ -165,7 +165,7 @@ prism54_update_stats(struct work_struct *work)
        struct obj_bss bss, *bss2;
        union oid_res_t r;
 
-       down(&priv->stats_sem);
+       mutex_lock(&priv->stats_lock);
 
 /* Noise floor.
  * I'm not sure if the unit is dBm.
@@ -207,7 +207,7 @@ prism54_update_stats(struct work_struct *work)
        mgt_get_request(priv, DOT11_OID_MPDUTXFAILED, 0, NULL, &r);
        priv->local_iwstatistics.discard.retries = r.u;
 
-       up(&priv->stats_sem);
+       mutex_unlock(&priv->stats_lock);
 
        return;
 }
@@ -218,12 +218,12 @@ prism54_get_wireless_stats(struct net_device *ndev)
        islpci_private *priv = netdev_priv(ndev);
 
        /* If the stats are being updated return old data */
-       if (down_trylock(&priv->stats_sem) == 0) {
+       if (mutex_trylock(&priv->stats_lock) == 0) {
                memcpy(&priv->iwstatistics, &priv->local_iwstatistics,
                       sizeof (struct iw_statistics));
                /* They won't be marked updated for the next time */
                priv->local_iwstatistics.qual.updated = 0;
-               up(&priv->stats_sem);
+               mutex_unlock(&priv->stats_lock);
        } else
                priv->iwstatistics.qual.updated = 0;
 
index dbb538ccb4ecc295fa1a451fe00377816bd89297..eb7c1c6bcd8a7564b1216a399b356b054f24babb 100644 (file)
@@ -864,7 +864,7 @@ islpci_setup(struct pci_dev *pdev)
        mutex_init(&priv->mgmt_lock);
        priv->mgmt_received = NULL;
        init_waitqueue_head(&priv->mgmt_wqueue);
-       sema_init(&priv->stats_sem, 1);
+       mutex_init(&priv->stats_lock);
        spin_lock_init(&priv->slock);
 
        /* init state machine with off#1 state */
index b03a2ab0009b40db682aa2a406f187902835eb63..85ddf89967aff62b42434ad01167f08cebb92ae5 100644 (file)
@@ -88,7 +88,7 @@ typedef struct {
 
        /* Take care of the wireless stats */
        struct work_struct stats_work;
-       struct semaphore stats_sem;
+       struct mutex stats_lock;
        /* remember when we last updated the stats */
        unsigned long stats_timestamp;
        /* The first is accessed under semaphore locking.