linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Ashish Jangam <ashish.jangam@kpitcummins.com>
Cc: linux-kernel@vger.kernel.org, Dajun <dajun.chen@diasemi.com>,
	arnd@arndb.de, sameo@linux.intel.com,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Anton Vorontsov <avorontsov@ru.mvista.com>
Subject: Re: [PATCH 02/06] MFD: DA9052/53 MFD core module v9 Added ADC support
Date: Mon, 9 Jan 2012 22:37:25 +0000	[thread overview]
Message-ID: <20120109223725.GG30766@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1326098770.3542.31.camel@dhruva>

On Mon, Jan 09, 2012 at 02:16:10PM +0530, Ashish Jangam wrote:
> Re-submitting the patch.

This is patch 2/6 - where are patches 1 and 3-6?

> +	/* Channel gets activated on enabling the Conversion bit */
> +	mux_sel = chan_mux[channel] | DA9052_ADC_MAN_MAN_CONV;
> +
> +	if (da9052->auxadc_active) {
> +		ret = -EBUSY;
> +		goto err;
> +	}
> +
> +	/* Enqueue the request */
> +	list_add(&req->list, &da9052->auxadc_pending);

Maintaining a list of outstanding requests seems a bit odd if it's only
possible to have a single active request at any one time.

> +
> +	ret = da9052_reg_write(da9052, DA9052_ADC_MAN_REG, mux_sel);
> +	if (ret < 0)
> +		goto err;
> +
> +	da9052->auxadc_active = channel;
> +
> +	mutex_unlock(&da9052->auxadc_lock);
> +
> +	/* Wait for an interrupt */
> +	wait_for_completion_timeout(&req->done, msecs_to_jiffies(500));
> +
> +	mutex_lock(&da9052->auxadc_lock);

With only one request being possible at once just not dropping the mutex
seems like the easiest approach - it'll mean that userspace doesn't need
to worry about -EBUSY and you could save all the allocation, deallocation
and list management.  As things stand I expect userspace will run into
errors sometimes.

  reply	other threads:[~2012-01-09 22:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-09  8:46 [PATCH 02/06] MFD: DA9052/53 MFD core module v9 Added ADC support Ashish Jangam
2012-01-09 22:37 ` Mark Brown [this message]
2012-01-10  5:50   ` Ashish Jangam
2012-01-10 22:43     ` Mark Brown
  -- strict thread matches above, loose matches on Subject: below --
2011-12-09 14:16 Ashish Jangam
2011-12-12  4:52 ` Mark Brown

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=20120109223725.GG30766@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=arnd@arndb.de \
    --cc=ashish.jangam@kpitcummins.com \
    --cc=avorontsov@ru.mvista.com \
    --cc=dajun.chen@diasemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    --cc=sfr@canb.auug.org.au \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).