[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120109223725.GG30766@opensource.wolfsonmicro.com>
Date: Mon, 9 Jan 2012 22:37:25 +0000
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Ashish Jangam <ashish.jangam@...tcummins.com>
Cc: linux-kernel@...r.kernel.org, Dajun <dajun.chen@...semi.com>,
arnd@...db.de, sameo@...ux.intel.com,
Stephen Rothwell <sfr@...b.auug.org.au>,
Anton Vorontsov <avorontsov@...mvista.com>
Subject: Re: [PATCH 02/06] MFD: DA9052/53 MFD core module v9 Added ADC
support
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists