I don't have the original patch to reply on, so some comments here. On Sat, Apr 20, 2013 at 07:14:02PM +0200, Lars-Peter Clausen wrote: > > +void tsc_self_reset(struct imx_adc_state *st) static. > > +{ > > + unsigned long reg; > > + > > + reg = readl_relaxed(st->reg_base + IMX_ADC_TGCR); > > + reg |= IMX_ADC_TGCR_TSC_RST; > > + writel_relaxed(reg, st->reg_base + IMX_ADC_TGCR); > > + > > + while (readl_relaxed(st->reg_base + IMX_ADC_TGCR) & > > + IMX_ADC_TGCR_TSC_RST) > > + continue; > > Needs a timeout in case for the unlikely event the hardware malfunctions. > > > +} > [...] > > > +void imx_adc_read_general(unsigned short *result, struct imx_adc_state *st) ditto. More functions which should be static follow. > > + > > + /* Reset */ > > + tsc_self_reset(st); > > + > > + st->reg = regulator_get(&pdev->dev, "ext-vref"); Use devm_regulator_get > > + if (!IS_ERR_OR_NULL(st->reg)) { Don't use IS_ERR_OR_NULL. regulator_get will always return an error pointer, so IS_ERR() is correct here. Also, please use positive logic which is easier to read. > > + /* Set power mode */ > > + adc_set_power_mode(st); > > + > > + /* Set queue */ > > + adc_set_queue(st); Remove those comments, they contain no information. Better even, remove all these functions manipulating this single register and replace it with a simple: tgcr = IMX_ADC_TGCR_IPG_CLK_EN | IMX_ADC_TGCR_POWER_ON | 31 << IMX_ADC_TGCR_ADCCLKCFG_SHIFT; if (IS_ERR(regulator)) tgcr |= IMX_ADC_TGCR_INTREFEN; writel_relaxed(tgcr, st->reg_base + IMX_ADC_TGCR); > > + ret = iio_device_register(iodev); > > + if (ret < 0) { > > + dev_err(&pdev->dev, "Couldn't register the device.\n"); Such messages become much more useful when the error code is printed aswell. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | -- To unsubscribe from this list: send the line "unsubscribe linux-iio" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html