Permalink
Browse files

AT91: IIO: cosmetic fixes, better error messages

Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

Cc: Patrice Vilchez <patrice.vilchez@atmel.com>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  • Loading branch information...
mripard authored and Nicolas Ferre committed Dec 5, 2011
1 parent 87beb0b commit b942f35151fcb3d31fc07e14eb12b21060837aaa
Showing with 22 additions and 18 deletions.
  1. +19 −15 drivers/staging/iio/adc/at91_adc.c
  2. +3 −3 include/linux/platform_data/at91_adc.h
@@ -42,16 +42,16 @@ struct at91_adc_desc {
};
struct at91_adc_state {
- struct clk *clk;
- bool done;
- struct mutex lock;
- int irq;
- wait_queue_head_t wq_data_avail;
- u16 last_value;
- void __iomem *reg_base;
- unsigned int vref_mv;
- unsigned long channels_mask;
- struct at91_adc_desc *desc;
+ u32 channels_mask;
+ struct clk *clk;
+ bool done;
+ struct at91_adc_desc *desc;
+ int irq;
+ u16 last_value;
+ struct mutex lock;
+ void __iomem *reg_base;
+ u32 vref_mv;
+ wait_queue_head_t wq_data_avail;
};
static struct at91_adc_desc at91_adc_desc_sam9g20 = {
@@ -103,7 +103,7 @@ static irqreturn_t at91_adc_eoc_trigger(int irq, void *private)
}
static int at91_adc_channel_init(struct iio_dev *idev,
- struct at91_adc_data *pdata)
+ struct at91_adc_data *pdata)
{
struct at91_adc_state *st = iio_priv(idev);
struct iio_chan_spec *chan_array;
@@ -139,8 +139,8 @@ static void at91_adc_channel_remove(struct iio_dev *idev)
}
static int at91_adc_read_raw(struct iio_dev *idev,
- struct iio_chan_spec const *chan,
- int *val, int *val2, long mask)
+ struct iio_chan_spec const *chan,
+ int *val, int *val2, long mask)
{
struct at91_adc_state *st = iio_priv(idev);
int ret;
@@ -310,8 +310,10 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
/* Setup the ADC channels available on the board */
ret = at91_adc_channel_init(idev, pdata);
- if (ret < 0)
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Couldn't initialize the channels.\n");
goto error_free_clk;
+ }
init_waitqueue_head(&st->wq_data_avail);
mutex_init(&st->lock);
@@ -320,8 +322,10 @@ static int __devinit at91_adc_probe(struct platform_device *pdev)
st->channels_mask = pdata->channels_used;
ret = iio_device_register(idev);
- if (ret < 0)
+ if (ret < 0) {
+ dev_err(&pdev->dev, "Couldn't register the device.\n");
goto error_free_channels;
+ }
return 0;
@@ -17,12 +17,12 @@
/**
* struct at91_adc_data - platform data for ADC driver
- * @channels_use: channels in use on the board as a bitmask
+ * @channels_used: channels in use on the board as a bitmask
* @vref: Reference voltage for the ADC in millvolts
*/
struct at91_adc_data {
- u32 channels_used;
- u16 vref;
+ unsigned long channels_used;
+ u16 vref;
};
extern void __init at91_add_device_adc(struct at91_adc_data *data);

0 comments on commit b942f35

Please sign in to comment.