From: Quentin Schulz <quentin.schulz@free-electrons.com>
To: Jonathan Cameron <jic23@kernel.org>,
jdelvare@suse.com, Guenter Roeck <linux@roeck-us.net>,
knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
wens@csie.org, lee.jones@linaro.org
Cc: thomas.petazzoni@free-electrons.com,
antoine.tenart@free-electrons.com, linux-kernel@vger.kernel.org,
linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Zhang Rui <rui.zhang@intel.com>,
Eduardo Valentin <edubezval@gmail.com>,
linux-pm <linux-pm@vger.kernel.org>
Subject: Re: [PATCH v4 3/3] iio: adc: add support for Allwinner SoCs ADC
Date: Mon, 5 Sep 2016 08:29:20 +0200 [thread overview]
Message-ID: <f085ee35-889f-58e3-15d6-e6f3c0d15a92@free-electrons.com> (raw)
In-Reply-To: <272fb672-602c-1757-be9f-eadf928b330c@kernel.org>
On 04/09/2016 16:35, Jonathan Cameron wrote:
> On 01/09/16 15:05, Quentin Schulz wrote:
>> The Allwinner SoCs all have an ADC that can also act as a touchscreen
>> controller and a thermal sensor. This patch adds the ADC driver which is
>> based on the MFD for the same SoCs ADC.
>>
>> This also registers the thermal adc channel in the iio map array so
>> iio_hwmon could use it without modifying the Device Tree. This registers
>> the driver in the thermal framework.
>>
>> This driver probes on three different platform_device_id to take into
>> account slight differences (registers bit and temperature computation)
>> between Allwinner SoCs ADCs.
>>
>> Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
> One utterly trivial point about unrolling code ordering inline.
>
> Other than the bit about patch 1 I'm basically happy with this..
ACK. Will revert this patch in v5. Thanks.
> However I would like some input (i.e. an Ack) from thermal given this
> sets up a thermal zone.
>
> Zhang or Eduardo, could you take a quick look at this and confirm you
> are happy with it?
>
> Thanks,
>
> Jonathan
[...]
>> +
>> +err_map:
>> + iio_map_array_unregister(indio_dev);
>> +
>> +err_fifo_irq:
>> + /* Disable FIFO_DATA_PENDING interrupt on hardware side. */
>> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
>> + SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN,
>> + 0);
>> +
>> +err_temp_irq:
>> + /* Disable TEMP_DATA_PENDING interrupt on hardware side. */
>> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
>> + SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN,
>> + 0);
>> +
>> +err:
>> + pm_runtime_put(&pdev->dev);
>> + pm_runtime_disable(&pdev->dev);
>> +
>> + return ret;
>> +}
>> +
>> +static int sun4i_gpadc_remove(struct platform_device *pdev)
>> +{
>> + struct sun4i_gpadc_dev *info;
>> + struct iio_dev *indio_dev = platform_get_drvdata(pdev);
>> +
>> + info = iio_priv(indio_dev);
>> + iio_device_unregister(indio_dev);
>> + iio_map_array_unregister(indio_dev);
>> + pm_runtime_put(&pdev->dev);
>> + pm_runtime_disable(&pdev->dev);
> Its really minor but in the interests of 'obviously correct' making
> review easy I'd rather everything in the remove was in the reverse order
> of probe (and hence the same as the error path in probe for most of it).
>
> That would put the pm_runtime stuff last I think..
>
> If you weren't rerolling anyway over patch 1 I'd probably have just let
> this go, but might as well make this trivial change as well.
>
I'm going with the following order:
pm_runtime_put
pm_runtime_disable
regmap_update_bits
iio_map_array_unregister
iio_device_unregister
Is that okay? (I don't really know which one of iio_map_array_unregister
or iio_device_unregister to put first, if it matters in any way).
Thanks!
Quentin
>
>> + /*
>> + * Disable TEMP_DATA_PENDING and FIFO_DATA_PENDING interrupts on
>> + * hardware side.
>> + */
>> + regmap_update_bits(info->regmap, SUN4I_GPADC_INT_FIFOC,
>> + SUN4I_GPADC_INT_FIFOC_TEMP_IRQ_EN |
>> + SUN4I_GPADC_INT_FIFOC_TP_DATA_IRQ_EN,
>> + 0);
>> +
>> + return 0;
>> +}
>> +
>> +static const struct platform_device_id sun4i_gpadc_id[] = {
>> + { "sun4i-a10-gpadc-iio", (kernel_ulong_t)&sun4i_gpadc_soc_specific },
>> + { "sun5i-a13-gpadc-iio", (kernel_ulong_t)&sun5i_gpadc_soc_specific },
>> + { "sun6i-a31-gpadc-iio", (kernel_ulong_t)&sun6i_gpadc_soc_specific },
>> + { /* sentinel */ },
>> +};
>> +
>> +static struct platform_driver sun4i_gpadc_driver = {
>> + .driver = {
>> + .name = "sun4i-gpadc-iio",
>> + .pm = &sun4i_gpadc_pm_ops,
>> + },
>> + .id_table = sun4i_gpadc_id,
>> + .probe = sun4i_gpadc_probe,
>> + .remove = sun4i_gpadc_remove,
>> +};
>> +
>> +module_platform_driver(sun4i_gpadc_driver);
>> +
>> +MODULE_DESCRIPTION("ADC driver for sunxi platforms");
>> +MODULE_AUTHOR("Quentin Schulz <quentin.schulz@free-electrons.com>");
>> +MODULE_LICENSE("GPL v2");
>>
>
next prev parent reply other threads:[~2016-09-05 6:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-01 14:05 [PATCH v4 0/3] " Quentin Schulz
2016-09-01 14:05 ` [PATCH v4 1/3] hwmon: iio_hwmon: delay probing with late_initcall Quentin Schulz
2016-09-01 14:05 ` [PATCH v4 2/3] mfd: add support for Allwinner SoCs ADC Quentin Schulz
2016-09-04 14:36 ` Jonathan Cameron
2016-09-01 14:05 ` [PATCH v4 3/3] iio: adc: " Quentin Schulz
2016-09-04 14:35 ` Jonathan Cameron
2016-09-05 6:29 ` Quentin Schulz [this message]
2016-09-05 19:51 ` Jonathan Cameron
2016-09-04 16:12 ` Peter Meerwald-Stadler
2016-09-05 6:48 ` Quentin Schulz
2016-09-05 8:07 ` Peter Meerwald-Stadler
2016-09-05 8:52 ` Quentin Schulz
2016-09-05 9:02 ` Peter Meerwald-Stadler
2016-09-05 7:07 ` Maxime Ripard
2016-09-05 7:11 ` Quentin Schulz
2016-09-05 16:47 ` Joshua Clayton
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=f085ee35-889f-58e3-15d6-e6f3c0d15a92@free-electrons.com \
--to=quentin.schulz@free-electrons.com \
--cc=antoine.tenart@free-electrons.com \
--cc=edubezval@gmail.com \
--cc=jdelvare@suse.com \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=pmeerw@pmeerw.net \
--cc=rui.zhang@intel.com \
--cc=thomas.petazzoni@free-electrons.com \
--cc=wens@csie.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
all inboxes | Powered by JetHome®