[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <829a4507-39d7-e04a-9672-6309def89ee2@heig-vd.ch>
Date: Wed, 22 Jun 2016 08:22:46 +0200
From: Florian Vaussard <florian.vaussard@...g-vd.ch>
To: Peter Rosin <peda@...ntia.se>, <devicetree@...r.kernel.org>,
Jonathan Cameron <jic23@...nel.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>
CC: Rob Herring <robh+dt@...nel.org>, Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
Slawomir Stepien <sst@...zta.fm>,
Joachim Eastwood <manabian@...il.com>,
Matt Ranostay <mranostay@...il.com>,
Cristina Moraru <cristina.moraru09@...il.com>,
<linux-iio@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
Vaussard Florian <florian.vaussard@...g-vd.ch>
Subject: Re: [PATCH 3/3] iio: potentiometer: mcp4531: Add device tree binding
Hello Peter,
Le 21. 06. 16 à 09:51, Peter Rosin a écrit :
> On 2016-06-21 08:55, Florian Vaussard wrote:
>> This patch adds the necessary device tree binding to allow DT probing of
>> currently supported parts.
>>
>> Signed-off-by: Florian Vaussard <florian.vaussard@...g-vd.ch>
>> ---
>> drivers/iio/potentiometer/mcp4531.c | 83 ++++++++++++++++++++++++++++++++++++-
>> 1 file changed, 82 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iio/potentiometer/mcp4531.c b/drivers/iio/potentiometer/mcp4531.c
>> index 2251173..41a1e46 100644
>> --- a/drivers/iio/potentiometer/mcp4531.c
>> +++ b/drivers/iio/potentiometer/mcp4531.c
>> @@ -31,6 +31,8 @@
>> #include <linux/module.h>
>> #include <linux/i2c.h>
>> #include <linux/err.h>
>> +#include <linux/of.h>
>> +#include <linux/of_device.h>
>>
>> #include <linux/iio/iio.h>
>>
>> @@ -188,12 +190,84 @@ static const struct iio_info mcp4531_info = {
>> .driver_module = THIS_MODULE,
>> };
>>
>> +#ifdef CONFIG_OF
>> +static const struct of_device_id mcp45xx_of_match[] = {
>
> Should be named mcp4531_of_match, also the casting to void and
> then back to an integer type is ugly. Would it work to store a
> pointer directly into the mcp4531_cfg array instead? I.e.
>
> { .compatible = "microchip,mcp4531-502", .data = &mcp4531_cfg[MCP453x_502] },
> etc
>
> and then adjust accordingly in mcp4531_probe()?
>
Yes the casting is pretty ugly. And kbuild agrees with you :) I took this from
another driver (lame excuse). Your suggestion is sensible, I will give it a try.
> That is, if you need this patch at all, see my reply to 2/3...
>
This seems necessary in order to have the vendor ID in the compatible string.
Thanks for your review.
Florian
Powered by blists - more mailing lists