Messages in this thread | | | Date | Wed, 5 Mar 2014 09:40:29 +0800 | From | Lee Jones <> | Subject | Re: [PATCHv2 2/9] mfd: twl4030-madc: Add DT support and convert to IIO framework |
| |
> This converts twl4030-madc module to use the Industrial IO ADC > framework and adds device tree support. > > Signed-off-by: Sebastian Reichel <sre@debian.org> > --- > drivers/mfd/twl4030-madc.c | 126 +++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 116 insertions(+), 10 deletions(-) > > diff --git a/drivers/mfd/twl4030-madc.c b/drivers/mfd/twl4030-madc.c > index 5458561..0479af0 100644 > --- a/drivers/mfd/twl4030-madc.c > +++ b/drivers/mfd/twl4030-madc.c
<snip>
@@ -702,28 +766,50 @@ static int twl4030_madc_probe(struct platform_device *pdev)
> - madc = devm_kzalloc(&pdev->dev, sizeof(*madc), GFP_KERNEL); > - if (!madc) > + > + iio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*madc)); > + if (!iio_dev) { > + dev_err(&pdev->dev, "failed allocating iio device\n"); > return -ENOMEM; > + } > > + madc = iio_priv(iio_dev); > madc->dev = &pdev->dev; > + madc->use_second_irq = false;
You don't need to do this a) it will be set below and b) it's already false since you used kzalloc() to zero the region.
<snip>
> - madc->imr = (pdata->irq_line == 1) ? > - TWL4030_MADC_IMR1 : TWL4030_MADC_IMR2; > - madc->isr = (pdata->irq_line == 1) ? > - TWL4030_MADC_ISR1 : TWL4030_MADC_ISR2; > + if (pdata && pdata->irq_line != 1) > + madc->use_second_irq = true; > + else if (!pdata) > + madc->use_second_irq = of_property_read_bool(np, > + "ti,system-uses-second-madc-irq");
How about:
if (pdata) madc->use_second_irq = (pdata->irq_line != 1); else madc->use_second_irq = of_property_read_bool(np, "ti,system-uses-second-madc-irq");
<snip>
> + ret = iio_device_register(iio_dev); > + if (ret) { > + dev_dbg(&pdev->dev, "could not register iio device\n");
This should be a dev_err().
<snip>
> +#ifdef CONFIG_OF > +static const struct of_device_id twl_madc_of_match[] = { > + {.compatible = "ti,twl4030-madc", },
nit: "{ .compatible"
> static struct platform_driver twl4030_madc_driver = { > .probe = twl4030_madc_probe, > .remove = twl4030_madc_remove, > .driver = { > .name = "twl4030_madc", > .owner = THIS_MODULE, > + .of_match_table = of_match_ptr(twl_madc_of_match), > },
Also fix this please.
> }; >
-- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |