From: Eduardo Valentin <edubezval@gmail.com>
To: Lukasz Majewski <l.majewski@samsung.com>
Cc: Linux PM <linux-pm@vger.kernel.org>,
Caesar Wang <caesar.wang@rock-chips.com>, Wei Ni <wni@nvidia.com>,
Mikko Perttunen <mikko.perttunen@kapsi.fi>,
Alexandre Courbot <gnurou@gmail.com>,
devicetree@vger.kernel.org,
Grant Likely <grant.likely@linaro.org>,
Guenter Roeck <linux@roeck-us.net>,
Jean Delvare <jdelvare@suse.de>,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
lm-sensors@lm-sensors.org, Rob Herring <robh+dt@kernel.org>,
Stephen Warren <swarren@wwwdotorg.org>,
Thierry Reding <thierry.reding@gmail.com>,
Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH 1/1] thermal: of: improve of-thermal sensor registration API
Date: Tue, 18 Nov 2014 08:50:31 -0400 [thread overview]
Message-ID: <20141118125029.GA15239@developer> (raw)
In-Reply-To: <20141118083857.18e07130@amdc2363>
[-- Attachment #1: Type: text/plain, Size: 3204 bytes --]
Hey Lukasz,
On Tue, Nov 18, 2014 at 08:38:57AM +0100, Lukasz Majewski wrote:
> Hi Eduardo,
>
> In the mail topic we have PATCH 1/1 but I think that it should be PATCH
> v3 1/1.
>
Yeah, sent it without checking that. Fixing in V4, no issues.
<big cut>
> > @@ -107,10 +106,7 @@ static int of_thermal_get_temp(struct
> > thermal_zone_device *tz, {
> > struct __thermal_zone *data = tz->devdata;
> >
> > - if (!data->get_temp)
> > - return -EINVAL;
>
> To be consistent, I think that we should keep the above check [1].
>
> if (!data->ops->get_temp)
> return -EINVAL;
>
> The same check is done with get_trend callback.
>
OK. I agree, and disagree, :-). Now that you mention here, I will resend
with your request applied. The reasoning is to, yes, keep the
consistency. However, not to be the same as .get_trend, but in fact, to
keep same behavior as the code as it is currently. The thing is
.get_temp is required field, while .get_trend is not. So, checking for
required fields in the registration makes more sense than checking it
only when the field is needed.
However, as I mentioned, to keep the same behavior, before and after the
patch, it makes sense we keep the checks as they are. I will send v4
with this amendment.
> > -
> > - return data->get_temp(data->sensor_data, temp);
> > + return data->ops->get_temp(data->sensor_data, temp);
> > }
> >
> > static int of_thermal_get_trend(struct thermal_zone_device *tz, int
> > trip, @@ -120,10 +116,10 @@ static int of_thermal_get_trend(struct
> > thermal_zone_device *tz, int trip, long dev_trend;
> > int r;
> >
> > - if (!data->get_trend)
> > + if (!data->ops->get_trend)
> > return -EINVAL;
> >
> > - r = data->get_trend(data->sensor_data, &dev_trend);
> > + r = data->ops->get_trend(data->sensor_data, &dev_trend);
> > if (r)
> > return r;
> >
> > @@ -324,8 +320,7 @@ static struct thermal_zone_device_ops
> > of_thermal_ops = { static struct thermal_zone_device *
> > thermal_zone_of_add_sensor(struct device_node *zone,
> > struct device_node *sensor, void *data,
> > - int (*get_temp)(void *, long *),
> > - int (*get_trend)(void *, long *))
> > + const struct thermal_zone_of_device_ops
> > *ops) {
> > struct thermal_zone_device *tzd;
> > struct __thermal_zone *tz;
> > @@ -336,9 +331,11 @@ thermal_zone_of_add_sensor(struct device_node
> > *zone,
> > tz = tzd->devdata;
> >
> > + if (!(ops && ops->get_temp))
> > + return ERR_PTR(-EINVAL);
>
> IMHO, here we should only check:
> if (!ops)
> return ERR_PTR(-EINVAL);
>
> And check if specific callbacks are available in other
> functions (like [1])
>
OK. For the sake of this change only, I agree. However, I might be
sending patches on top of this one to keep the checks of required fields in the
registration itself.
Cheers,
> > }
>
> Despite this minor comments, feel free to add :-)
>
> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com>
OK. Thanks.
>
> --
> Best regards,
>
> Lukasz Majewski
>
> Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Eduardo Valentin
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2014-11-18 12:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1416263769-6578-1-git-send-email-edubezval@gmail.com>
2014-11-17 22:36 ` [PATCH 1/1] thermal: of: improve of-thermal sensor registration API Eduardo Valentin
[not found] ` <1416263769-6578-2-git-send-email-edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-17 22:44 ` [PATCHv2 " Eduardo Valentin
2014-11-18 0:05 ` [PATCH " Eduardo Valentin
2014-11-18 7:38 ` Lukasz Majewski
2014-11-18 12:50 ` Eduardo Valentin [this message]
[not found] ` <1416264255-10083-1-git-send-email-edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-11-18 0:11 ` [PATCHv2 " Mikko Perttunen
[not found] ` <546A8EA9.5070001-/1wQRMveznE@public.gmane.org>
2014-11-18 0:01 ` Eduardo Valentin
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=20141118125029.GA15239@developer \
--to=edubezval@gmail.com \
--cc=caesar.wang@rock-chips.com \
--cc=devicetree@vger.kernel.org \
--cc=gnurou@gmail.com \
--cc=grant.likely@linaro.org \
--cc=jdelvare@suse.de \
--cc=l.majewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=lm-sensors@lm-sensors.org \
--cc=mikko.perttunen@kapsi.fi \
--cc=robh+dt@kernel.org \
--cc=rui.zhang@intel.com \
--cc=swarren@wwwdotorg.org \
--cc=thierry.reding@gmail.com \
--cc=wni@nvidia.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).