Re: [RFC v.4] omap: hwspinlock: Added hwspinlock driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Basak, Partha" <p-basak2@xxxxxx> writes:

>> +/* Attempt to acquire a spinlock once */
>> +int hwspinlock_trylock(struct hwspinlock *handle)
>> +{
>> +       int retval = 0;
>> +
>> +       if (WARN_ON(handle == NULL))
>> +               return -EINVAL;
>> +
>> +       if (WARN_ON(in_irq()))
>> +               return -EPERM;
>> +
>> +       if (pm_runtime_get(&handle->pdev->dev) < 0)
>> +               return -ENODEV;
>> +
>> +       /* Attempt to acquire the lock by reading from it */
>> +       retval = readl(handle->lock_reg);
>> +
>> +       if (retval == HWSPINLOCK_BUSY)
>> +               pm_runtime_put(&handle->pdev->dev);
>
> Any reason for using pm_runtime_put instead of pm_runtime_put_sync?
>
> Using pm_runtime_gett_sync & pm_runtime_put_sync have been recommended
> by Kevin Hilman.

err, not exacly. 

I recommend use of the runtime PM API.  Driver writers can decide
whether they want to use the _sync() version of the API (which has
immediate side effect) or the normal version which may have delayed side
effect.

Kevin





--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux