From: Lee Jones <lee.jones-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Quentin Schulz
<quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
knaack.h-Mmb7MZpHnFY@public.gmane.org,
lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org,
pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org,
wens-jdAy2FN1RRM@public.gmane.org,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 5/5] mfd: sunxi-gpadc-mfd: probe sunxi-gpadc-ts driver
Date: Mon, 25 Jul 2016 11:21:58 +0100 [thread overview]
Message-ID: <20160725102158.GJ14925@dell> (raw)
In-Reply-To: <11247e4f-d04d-d5bc-6ebf-a637820c011d-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
On Sun, 24 Jul 2016, Jonathan Cameron wrote:
> On 21/07/16 07:08, Maxime Ripard wrote:
> > Hi Quentin,
> >
> > On Wed, Jul 20, 2016 at 10:29:11AM +0200, Quentin Schulz wrote:
> >> This probes the touchscreen driver for Allwinner SoCs (A10, A13 and A31)
> >> when the property "allwinner,ts-attached" is set in the GPADC (rtp) node of
> >> the DT.
> >>
> >> Some comestic modifications done to shorten and increase readability of the
> >> code.
> >>
> >> Signed-off-by: Quentin Schulz <quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
> >> ---
> >> drivers/mfd/sunxi-gpadc-mfd.c | 115 ++++++++++++++++++++++++++++--------------
> >> 1 file changed, 77 insertions(+), 38 deletions(-)
> >>
> >> diff --git a/drivers/mfd/sunxi-gpadc-mfd.c b/drivers/mfd/sunxi-gpadc-mfd.c
> >> index 05a000b..9b9ed0b 100644
> >> --- a/drivers/mfd/sunxi-gpadc-mfd.c
> >> +++ b/drivers/mfd/sunxi-gpadc-mfd.c
> >> @@ -21,6 +21,11 @@
> >> #define SUNXI_IRQ_TEMP_DATA 1
> >> #define SUNXI_IRQ_TP_UP 2
> >>
> >> +#define SUNXI_GPADC_MFD_CELL(_name, _resources, _num_resources) { \
> >> + .name = _name, \
> >> + .resources = _resources, \
> >> + .num_resources = _num_resources \
> >> +}
> >>
> >> static struct resource adc_resources[] = {
> >> {
> >> @@ -64,33 +69,45 @@ static const struct regmap_irq_chip sunxi_gpadc_mfd_regmap_irq_chip = {
> >> };
> >>
> >> static struct mfd_cell sun4i_gpadc_mfd_cells[] = {
> >> - {
> >> - .name = "sun4i-a10-gpadc-iio",
> >> - .resources = adc_resources,
> >> - .num_resources = ARRAY_SIZE(adc_resources),
> >> - }, {
> >> - .name = "iio_hwmon",
> >> - }
> >> + SUNXI_GPADC_MFD_CELL("sun4i-a10-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> };
> >>
> >> static struct mfd_cell sun5i_gpadc_mfd_cells[] = {
> >> - {
> >> - .name = "sun5i-a13-gpadc-iio",
> >> - .resources = adc_resources,
> >> - .num_resources = ARRAY_SIZE(adc_resources),
> >> - }, {
> >> - .name = "iio_hwmon",
> >> - },
> >> + SUNXI_GPADC_MFD_CELL("sun5i-a13-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> };
> >>
> >> static struct mfd_cell sun6i_gpadc_mfd_cells[] = {
> >> - {
> >> - .name = "sun6i-a31-gpadc-iio",
> >> - .resources = adc_resources,
> >> - .num_resources = ARRAY_SIZE(adc_resources),
> >> - }, {
> >> - .name = "iio_hwmon",
> >> - },
> >> + SUNXI_GPADC_MFD_CELL("sun6i-a31-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> +};
> >
> > This should be part of a separate patch.
> >
> >> +
> >> +static struct mfd_cell sun4i_gpadc_mfd_cells_ts[] = {
> >> + SUNXI_GPADC_MFD_CELL("sun6i-a31-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> + SUNXI_GPADC_MFD_CELL("sunxi-gpadc-ts", ts_resources,
> >> + ARRAY_SIZE(ts_resources)),
> >> +};
> >> +
> >> +static struct mfd_cell sun5i_gpadc_mfd_cells_ts[] = {
> >> + SUNXI_GPADC_MFD_CELL("sun5i-a13-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> + SUNXI_GPADC_MFD_CELL("sunxi-gpadc-ts", ts_resources,
> >> + ARRAY_SIZE(ts_resources)),
> >> +};
> >> +
> >> +static struct mfd_cell sun6i_gpadc_mfd_cells_ts[] = {
> >> + SUNXI_GPADC_MFD_CELL("sun6i-a31-gpadc-iio", adc_resources,
> >> + ARRAY_SIZE(adc_resources)),
> >> + SUNXI_GPADC_MFD_CELL("iio_hwmon", NULL, 0),
> >> + SUNXI_GPADC_MFD_CELL("sunxi-gpadc-ts", ts_resources,
> >> + ARRAY_SIZE(ts_resources)),
> >> };
> >>
> >> static const struct regmap_config sunxi_gpadc_mfd_regmap_config = {
> >> @@ -142,23 +159,45 @@ static int sunxi_gpadc_mfd_probe(struct platform_device *pdev)
> >> }
> >>
> >> if (of_device_is_compatible(pdev->dev.of_node,
> >> - "allwinner,sun4i-a10-ts"))
> >> - ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> - sun4i_gpadc_mfd_cells,
> >> - ARRAY_SIZE(sun4i_gpadc_mfd_cells), NULL,
> >> - 0, NULL);
> >> - else if (of_device_is_compatible(pdev->dev.of_node,
> >> - "allwinner,sun5i-a13-ts"))
> >> - ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> - sun5i_gpadc_mfd_cells,
> >> - ARRAY_SIZE(sun5i_gpadc_mfd_cells), NULL,
> >> - 0, NULL);
> >> - else if (of_device_is_compatible(pdev->dev.of_node,
> >> - "allwinner,sun6i-a31-ts"))
> >> - ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> - sun6i_gpadc_mfd_cells,
> >> - ARRAY_SIZE(sun6i_gpadc_mfd_cells), NULL,
> >> - 0, NULL);
> >> + "allwinner,sun4i-a10-ts")) {
> >> + if (of_property_read_bool(pdev->dev.of_node,
> >> + "allwinner,ts-attached"))
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun4i_gpadc_mfd_cells_ts,
> >> + ARRAY_SIZE(sun4i_gpadc_mfd_cells_ts),
> >> + NULL, 0, NULL);
> >> + else
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun4i_gpadc_mfd_cells,
> >> + ARRAY_SIZE(sun4i_gpadc_mfd_cells),
> >> + NULL, 0, NULL);
> >> + } else if (of_device_is_compatible(pdev->dev.of_node,
> >> + "allwinner,sun5i-a13-ts")) {
> >> + if (of_property_read_bool(pdev->dev.of_node,
> >> + "allwinner,ts-attached"))
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun5i_gpadc_mfd_cells_ts,
> >> + ARRAY_SIZE(sun5i_gpadc_mfd_cells_ts),
> >> + NULL, 0, NULL);
> >> + else
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun5i_gpadc_mfd_cells,
> >> + ARRAY_SIZE(sun5i_gpadc_mfd_cells),
> >> + NULL, 0, NULL);
> >> + } else if (of_device_is_compatible(pdev->dev.of_node,
> >> + "allwinner,sun6i-a31-ts")) {
> >> + if (of_property_read_bool(pdev->dev.of_node,
> >> + "allwinner,ts-attached"))
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun6i_gpadc_mfd_cells_ts,
> >> + ARRAY_SIZE(sun6i_gpadc_mfd_cells_ts),
> >> + NULL, 0, NULL);
> >> + else
> >> + ret = mfd_add_devices(sunxi_gpadc_mfd_dev->dev, 0,
> >> + sun6i_gpadc_mfd_cells,
> >> + ARRAY_SIZE(sun6i_gpadc_mfd_cells),
> >> + NULL, 0, NULL);
> >> + }
> >
> > Please don't use any of_device_is_compatible.
> Hi Maxime,
>
> Why? (Just curious...)
'cos they make for ugly code.
Use of_match_device() instead.
--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
prev parent reply other threads:[~2016-07-25 10:21 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-20 8:29 [PATCH 0/5] add resistive touchscreen support for new Allwinner SoCs' GPADC's driver Quentin Schulz
2016-07-20 8:29 ` [PATCH 1/5] mfd: sunxi-gpadc-mfd: add TP_UP_PENDING irq Quentin Schulz
[not found] ` <1469003351-15263-1-git-send-email-quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-20 8:29 ` [PATCH 2/5] mfd: sunxi-gpadc-mfd: add buffer structure Quentin Schulz
[not found] ` <1469003351-15263-3-git-send-email-quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-24 10:32 ` Jonathan Cameron
2016-07-20 8:29 ` [PATCH 3/5] iio: adc: sunxi-gpadc-iio: enable iio_buffers Quentin Schulz
2016-07-20 8:38 ` Peter Meerwald-Stadler
2016-07-20 8:57 ` Quentin Schulz
2016-07-24 11:03 ` Jonathan Cameron
[not found] ` <ff7515ec-a064-95df-1118-93c7062c2237-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-09-24 17:40 ` Quentin Schulz
2016-09-25 9:10 ` Jonathan Cameron
2016-09-25 19:57 ` Quentin Schulz
2016-09-27 19:38 ` Jonathan Cameron
2016-07-20 8:29 ` [PATCH 4/5] input: touchscreen: support Allwinner SoCs' touchscreen Quentin Schulz
[not found] ` <1469003351-15263-5-git-send-email-quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-07-20 17:25 ` Dmitry Torokhov
2016-07-20 20:13 ` Jonathan Cameron
2016-09-24 18:26 ` Quentin Schulz
[not found] ` <ca39a2e7-6116-6f6e-3f61-78abfdefcbb7-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-09-24 18:39 ` Dmitry Torokhov
2016-07-21 6:29 ` Maxime Ripard
2016-07-21 6:41 ` Dmitry Torokhov
2016-07-25 9:45 ` maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8
2016-07-25 17:08 ` Dmitry Torokhov
2016-07-26 15:13 ` Maxime Ripard
2016-07-24 11:24 ` Jonathan Cameron
[not found] ` <8174039f-777e-b4b8-58c9-3509748f2799-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-09-25 19:44 ` Quentin Schulz
[not found] ` <db3ab94a-9dbb-3bd6-fe43-e530b42c9246-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2016-09-27 19:59 ` Jonathan Cameron
2016-07-20 8:29 ` [PATCH 5/5] mfd: sunxi-gpadc-mfd: probe sunxi-gpadc-ts driver Quentin Schulz
2016-07-21 6:08 ` Maxime Ripard
2016-07-24 11:26 ` Jonathan Cameron
2016-07-25 9:51 ` Maxime Ripard
2016-07-25 10:08 ` Jonathan Cameron
[not found] ` <11247e4f-d04d-d5bc-6ebf-a637820c011d-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2016-07-25 10:21 ` Lee Jones [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160725102158.GJ14925@dell \
--to=lee.jones-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
--cc=antoine.tenart-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
--cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
--cc=quentin.schulz-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=wens-jdAy2FN1RRM@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).