All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: "Basak, Partha" <p-basak2@ti.com>
Cc: "Que, Simon" <sque@ti.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"Kanigeri, Hari" <h-kanigeri2@ti.com>,
	Ohad Ben-Cohen <ohad@wizery.com>,
	"Shilimkar, Santosh" <santosh.shilimkar@ti.com>
Subject: Re: [RFC v.4] omap: hwspinlock: Added hwspinlock driver
Date: Thu, 12 Aug 2010 07:11:21 -0700	[thread overview]
Message-ID: <87eie3vs3a.fsf@deeprootsystems.com> (raw)
In-Reply-To: <B85A65D85D7EB246BE421B3FB0FBB59301E80AC50C@dbde02.ent.ti.com> (Partha Basak's message of "Tue, 10 Aug 2010 20:49:49 +0530")

"Basak, Partha" <p-basak2@ti.com> 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






      parent reply	other threads:[~2010-08-12 14:11 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-06 20:25 [RFC v.4] omap: hwspinlock: Added hwspinlock driver Que, Simon
2010-07-07  5:34 ` Shilimkar, Santosh
2010-08-10 15:19 ` Basak, Partha
2010-08-11 22:44   ` Kanigeri, Hari
2010-09-19 14:45     ` Ohad Ben-Cohen
2010-09-20 17:30       ` Kevin Hilman
2010-09-21  7:19         ` Cousson, Benoit
2010-09-22 15:10       ` Kanigeri, Hari
2010-08-12 14:11   ` Kevin Hilman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eie3vs3a.fsf@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=h-kanigeri2@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=ohad@wizery.com \
    --cc=p-basak2@ti.com \
    --cc=santosh.shilimkar@ti.com \
    --cc=sque@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.