lkml.org 
[lkml]   [2012]   [Jan]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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.


\
 
 \ /
  Last update: 2012-01-09 23:39    [W:0.039 / U:2.840 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site