On Thu, Mar 12 2015 at 14:49 -0600, Andy Gross wrote:
On Thu, Mar 12, 2015 at 01:38:28PM -0600, Lina Iyer wrote:

<snip>

 static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
 {
        struct regmap_field *field = lock->priv;
        u32 lock_owner;
        int ret;
+       u32 proc_id;

-       ret = regmap_field_write(field, QCOM_MUTEX_APPS_PROC_ID);
+       proc_id = hwspin_lock_get_id(lock) == QCOM_CPUIDLE_LOCK ?
+                       QCOM_MUTEX_CPUIDLE_OFFSET + smp_processor_id():
+                       QCOM_MUTEX_APPS_PROC_ID;
+
+       ret = regmap_field_write(field, proc_id);

I think I'd rather have a qcom specific function and EXPORT_SYMBOL that to deal
with this special case.

I was going back and forth between a function and inlining this here.
But Stephen just made a good point that this is needed for unlock as
well. A function would be good.


        if (ret)
                return ret;

@@ -42,7 +49,7 @@ static int qcom_hwspinlock_trylock(struct hwspinlock *lock)
        if (ret)
                return ret;

-       return lock_owner == QCOM_MUTEX_APPS_PROC_ID;
+       return lock_owner == proc_id;
 }

 static void qcom_hwspinlock_unlock(struct hwspinlock *lock)
--
2.1.0


--
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to