From: Hartmut Knaack <knaack.h@gmx.de>
To: "Ivan T. Ivanov" <iivanov@mm-sol.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald <pmeerw@pmeerw.net>,
Stanimir Varbanov <svarbanov@mm-sol.com>,
Angelo Compagnucci <angelo.compagnucci@gmail.com>,
Grant Likely <grant.likely@linaro.org>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org
Subject: Re: [PATCH v4 2/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver
Date: Tue, 11 Nov 2014 23:39:34 +0100 [thread overview]
Message-ID: <54629026.3080002@gmx.de> (raw)
In-Reply-To: <1415694109.22935.13.camel@mm-sol.com>
Ivan T. Ivanov schrieb am 11.11.2014 09:21:
> Hi Hartmut,
>
> On Mon, 2014-11-10 at 22:11 +0100, Hartmut Knaack wrote:
>> Ivan T. Ivanov schrieb am 03.11.2014 16:24:
>>> From: Stanimir Varbanov <svarbanov@mm-sol.com>
>>>
>>> The voltage ADC is peripheral of Qualcomm SPMI PMIC chips. It has
>>> 15 bits resolution and register space inside PMIC accessible across
>>> SPMI bus.
>>>
>>> The vadc driver registers itself through IIO interface.
>> Reviewing again, I got the feeling that due to the complexity of adc reads (writing to register
>> to start conversion, waiting a decent time for the conversion to complete, reading the result),
>> it would be beneficial to use a mutex in vadc_read_raw or its depending functions.
>
> Hm, yes, but there is such a nice info_exist_lock :-) in core functions,
> which in practice serve the same purpose.
I seem to miss that. Please point me in the right direction.
>
>> Also, I would want to double-check that the CPU in this type of chips is little endian.
>
> Yes, it is.
>
>> Besides that, a few minor issues inline.
>
>>> +static int vadc_probe(struct platform_device *pdev)
>>> +{
>>> + struct device_node *node = pdev->dev.of_node;
>>> + struct device *dev = &pdev->dev;
>>> + struct iio_dev *indio_dev;
>>> + struct vadc_priv *vadc;
>>> + struct regmap *regmap;
>>> + int ret, irq_eoc;
>>> + u32 res;
>> Since vadc->base is u16, shouldn't res be u16 as well? Also think about naming it reg, as this is
>> the property name in DT.
>
> Yes, but #address-cells for the node is 1, so I would like to keep it 32 bits.
>
>>> +
>>> + regmap = dev_get_regmap(dev->parent, NULL);
>>> + if (!regmap)
>>> + return -ENODEV;
>>> +
>>> + ret = of_property_read_u32(node, "reg", &res);
>> For u16, there would be of_property_read_u16().
>>> + if (ret < 0)
>>> + return -ENODEV;
>> Just return ret here?
>
> I am usually trying to follow these recommendations[1]. In practice driver
> core cares only for EPROBE_DEFER, ENODEV and ENXIO, while of_property_read_u32()
> can return ENODATA and EOVERFLOW, which did't not make sense for the core.
Please point me in the right direction on this one, too. It is pretty common to pass error codes up, as it is also mentioned in [1].
Yet, this thread in [1] seems more like a draft to me, as Greg K-H wrote in the end: "Fair enough, care to respin this and send it out to me for review?"
>
> Thank you,
> Ivan
>
> [1] http://www.gossamer-threads.com/lists/linux/kernel/1010603
> --
> To unsubscribe from this list: send the line "unsubscribe linux-iio" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-11-11 22:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-03 15:24 [PATCH v4 0/2] Initial support for voltage ADC Ivan T. Ivanov
[not found] ` <1415028270-25860-1-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-03 15:24 ` [PATCH v4 1/2] DT: iio: vadc: document dt binding Ivan T. Ivanov
[not found] ` <1415028270-25860-2-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-05 0:01 ` Hartmut Knaack
2014-11-05 13:12 ` Jonathan Cameron
2014-11-05 14:07 ` Ivan T. Ivanov
2014-11-03 15:24 ` [PATCH v4 2/2] iio: vadc: Qualcomm SPMI PMIC voltage ADC driver Ivan T. Ivanov
2014-11-05 13:09 ` Jonathan Cameron
[not found] ` <545A218F.5060301-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2014-11-05 13:57 ` Ivan T. Ivanov
[not found] ` <1415195855.3660.4.camel-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-05 14:06 ` Jonathan Cameron
2014-11-05 15:01 ` Ivan T. Ivanov
[not found] ` <1415199681.3660.8.camel-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-05 15:32 ` Jonathan Cameron
[not found] ` <1415028270-25860-3-git-send-email-iivanov-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-10 21:11 ` Hartmut Knaack
2014-11-11 8:21 ` Ivan T. Ivanov
2014-11-11 22:39 ` Hartmut Knaack [this message]
[not found] ` <54629026.3080002-Mmb7MZpHnFY@public.gmane.org>
2014-11-12 8:55 ` Ivan T. Ivanov
2014-11-17 22:12 ` Hartmut Knaack
2014-11-18 8:23 ` Ivan T. Ivanov
[not found] ` <1416299013.30131.4.camel-NEYub+7Iv8PQT0dZR+AlfA@public.gmane.org>
2014-11-22 11:55 ` Jonathan Cameron
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=54629026.3080002@gmx.de \
--to=knaack.h@gmx.de \
--cc=angelo.compagnucci@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=iivanov@mm-sol.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=svarbanov@mm-sol.com \
/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).