From mboxrd@z Thu Jan 1 00:00:00 1970 From: Florian Vaussard Subject: Re: [PATCH 3/3] iio: potentiometer: mcp4531: Add device tree binding Date: Wed, 22 Jun 2016 08:22:46 +0200 Message-ID: <829a4507-39d7-e04a-9672-6309def89ee2@heig-vd.ch> References: <1466492137-32683-1-git-send-email-florian.vaussard@heig-vd.ch> <1466492137-32683-4-git-send-email-florian.vaussard@heig-vd.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: Sender: linux-iio-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Peter Rosin , devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Jonathan Cameron , Hartmut Knaack , Lars-Peter Clausen , Peter Meerwald-Stadler Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , Slawomir Stepien , Joachim Eastwood , Matt Ranostay , Cristina Moraru , linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Vaussard Florian List-Id: devicetree@vger.kernel.org Hello Peter, Le 21. 06. 16 =E0 09:51, Peter Rosin a =E9crit : > On 2016-06-21 08:55, Florian Vaussard wrote: >> This patch adds the necessary device tree binding to allow DT probin= g of >> currently supported parts. >> >> Signed-off-by: Florian Vaussard >> --- >> drivers/iio/potentiometer/mcp4531.c | 83 ++++++++++++++++++++++++++= ++++++++++- >> 1 file changed, 82 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/iio/potentiometer/mcp4531.c b/drivers/iio/poten= tiometer/mcp4531.c >> index 2251173..41a1e46 100644 >> --- a/drivers/iio/potentiometer/mcp4531.c >> +++ b/drivers/iio/potentiometer/mcp4531.c >> @@ -31,6 +31,8 @@ >> #include >> #include >> #include >> +#include >> +#include >> =20 >> #include >> =20 >> @@ -188,12 +190,84 @@ static const struct iio_info mcp4531_info =3D = { >> .driver_module =3D THIS_MODULE, >> }; >> =20 >> +#ifdef CONFIG_OF >> +static const struct of_device_id mcp45xx_of_match[] =3D { >=20 > 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. >=20 > { .compatible =3D "microchip,mcp4531-502", .data =3D &mcp4531_cfg[MC= P453x_502] }, > etc >=20 > and then adjust accordingly in mcp4531_probe()? >=20 Yes the casting is pretty ugly. And kbuild agrees with you :) I took th= is 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... >=20 This seems necessary in order to have the vendor ID in the compatible s= tring. Thanks for your review. =46lorian