coresight: Remove atomic type from refcnt
[sfrench/cifs-2.6.git] / drivers / hwtracing / coresight / coresight-tmc-etf.c
index 2a7e516052a29cff55c34dde36420f6127f4a5a8..f3281c958a57087c89ac2bbce13dc96ce8c718bf 100644 (file)
@@ -206,7 +206,7 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
         * touched.
         */
        if (local_read(&csdev->mode) == CS_MODE_SYSFS) {
-               atomic_inc(&csdev->refcnt);
+               csdev->refcnt++;
                goto out;
        }
 
@@ -229,7 +229,7 @@ static int tmc_enable_etf_sink_sysfs(struct coresight_device *csdev)
        ret = tmc_etb_enable_hw(drvdata);
        if (!ret) {
                local_set(&csdev->mode, CS_MODE_SYSFS);
-               atomic_inc(&csdev->refcnt);
+               csdev->refcnt++;
        } else {
                /* Free up the buffer if we failed to enable */
                used = false;
@@ -284,7 +284,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
                 * use for this session.
                 */
                if (drvdata->pid == pid) {
-                       atomic_inc(&csdev->refcnt);
+                       csdev->refcnt++;
                        break;
                }
 
@@ -293,7 +293,7 @@ static int tmc_enable_etf_sink_perf(struct coresight_device *csdev, void *data)
                        /* Associate with monitored process. */
                        drvdata->pid = pid;
                        local_set(&csdev->mode, CS_MODE_PERF);
-                       atomic_inc(&csdev->refcnt);
+                       csdev->refcnt++;
                }
        } while (0);
        spin_unlock_irqrestore(&drvdata->spinlock, flags);
@@ -338,7 +338,8 @@ static int tmc_disable_etf_sink(struct coresight_device *csdev)
                return -EBUSY;
        }
 
-       if (atomic_dec_return(&csdev->refcnt)) {
+       csdev->refcnt--;
+       if (csdev->refcnt) {
                spin_unlock_irqrestore(&drvdata->spinlock, flags);
                return -EBUSY;
        }
@@ -371,7 +372,7 @@ static int tmc_enable_etf_link(struct coresight_device *csdev,
                return -EBUSY;
        }
 
-       if (atomic_read(&csdev->refcnt) == 0) {
+       if (csdev->refcnt == 0) {
                ret = tmc_etf_enable_hw(drvdata);
                if (!ret) {
                        local_set(&csdev->mode, CS_MODE_SYSFS);
@@ -379,7 +380,7 @@ static int tmc_enable_etf_link(struct coresight_device *csdev,
                }
        }
        if (!ret)
-               atomic_inc(&csdev->refcnt);
+               csdev->refcnt++;
        spin_unlock_irqrestore(&drvdata->spinlock, flags);
 
        if (first_enable)
@@ -401,7 +402,8 @@ static void tmc_disable_etf_link(struct coresight_device *csdev,
                return;
        }
 
-       if (atomic_dec_return(&csdev->refcnt) == 0) {
+       csdev->refcnt--;
+       if (csdev->refcnt == 0) {
                tmc_etf_disable_hw(drvdata);
                local_set(&csdev->mode, CS_MODE_DISABLED);
                last_disable = true;
@@ -489,7 +491,7 @@ static unsigned long tmc_update_etf_buffer(struct coresight_device *csdev,
        spin_lock_irqsave(&drvdata->spinlock, flags);
 
        /* Don't do anything if another tracer is using this sink */
-       if (atomic_read(&csdev->refcnt) != 1)
+       if (csdev->refcnt != 1)
                goto out;
 
        CS_UNLOCK(drvdata->base);