From: "R, Durgadoss" <durgadoss.r@intel.com> To: "Zhang, Rui" <rui.zhang@intel.com> Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "eduardo.valentin@ti.com" <eduardo.valentin@ti.com>, "hongbo.zhang@linaro.org" <hongbo.zhang@linaro.org>, "wni@nvidia.com" <wni@nvidia.com> Subject: RE: [PATCH 2/8] Thermal: Create zone level APIs Date: Fri, 8 Feb 2013 08:54:12 +0000 [thread overview] Message-ID: <4D68720C2E767A4AA6A8796D42C8EB5927AAB1@BGSMSX101.gar.corp.intel.com> (raw) In-Reply-To: <1360311092.2242.28.camel@rzhang1-mobl4> [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #1: Type: text/plain; charset="utf-8", Size: 1622 bytes --] Hi Rui, > -----Original Message----- > From: Zhang, Rui > Sent: Friday, February 08, 2013 1:42 PM > To: R, Durgadoss > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > eduardo.valentin@ti.com; hongbo.zhang@linaro.org; wni@nvidia.com > Subject: Re: [PATCH 2/8] Thermal: Create zone level APIs > > On Tue, 2013-02-05 at 16:16 +0530, Durgadoss R wrote: > > This patch adds a new thermal_zone structure to > > thermal.h. Also, adds zone level APIs to the thermal > > framework. > > [snip.] > > + > > +struct thermal_sensor *get_sensor_by_name(const char *name) > > +{ > > + struct thermal_sensor *pos; > > + struct thermal_sensor *ts = NULL; > > + > > + mutex_lock(&sensor_list_lock); > > + for_each_thermal_sensor(pos) { > > + if (!strnicmp(pos->name, name, THERMAL_NAME_LENGTH)) > { > > + ts = pos; > > + break; > > this function depends on the assumption that all the sensor names are > unique. > thus I prefer to go through all the list and return -EINVAL if duplicate > names found, because in this case, the pointer returned may be not the > sensor we want to get. Yes, I agree with you. But I prefer having this check in the register API itself, which then will not allow duplicates. The reason being, we use this get* API (comparatively) a lot more than the register APIs. And putting this check in the register APIs means doing this check only once. Let me know what you think. And the same for cooling devices too. Thanks, Durga ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
WARNING: multiple messages have this Message-ID (diff)
From: "R, Durgadoss" <durgadoss.r@intel.com> To: "Zhang, Rui" <rui.zhang@intel.com> Cc: "linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "eduardo.valentin@ti.com" <eduardo.valentin@ti.com>, "hongbo.zhang@linaro.org" <hongbo.zhang@linaro.org>, "wni@nvidia.com" <wni@nvidia.com> Subject: RE: [PATCH 2/8] Thermal: Create zone level APIs Date: Fri, 8 Feb 2013 08:54:12 +0000 [thread overview] Message-ID: <4D68720C2E767A4AA6A8796D42C8EB5927AAB1@BGSMSX101.gar.corp.intel.com> (raw) In-Reply-To: <1360311092.2242.28.camel@rzhang1-mobl4> Hi Rui, > -----Original Message----- > From: Zhang, Rui > Sent: Friday, February 08, 2013 1:42 PM > To: R, Durgadoss > Cc: linux-pm@vger.kernel.org; linux-kernel@vger.kernel.org; > eduardo.valentin@ti.com; hongbo.zhang@linaro.org; wni@nvidia.com > Subject: Re: [PATCH 2/8] Thermal: Create zone level APIs > > On Tue, 2013-02-05 at 16:16 +0530, Durgadoss R wrote: > > This patch adds a new thermal_zone structure to > > thermal.h. Also, adds zone level APIs to the thermal > > framework. > > [snip.] > > + > > +struct thermal_sensor *get_sensor_by_name(const char *name) > > +{ > > + struct thermal_sensor *pos; > > + struct thermal_sensor *ts = NULL; > > + > > + mutex_lock(&sensor_list_lock); > > + for_each_thermal_sensor(pos) { > > + if (!strnicmp(pos->name, name, THERMAL_NAME_LENGTH)) > { > > + ts = pos; > > + break; > > this function depends on the assumption that all the sensor names are > unique. > thus I prefer to go through all the list and return -EINVAL if duplicate > names found, because in this case, the pointer returned may be not the > sensor we want to get. Yes, I agree with you. But I prefer having this check in the register API itself, which then will not allow duplicates. The reason being, we use this get* API (comparatively) a lot more than the register APIs. And putting this check in the register APIs means doing this check only once. Let me know what you think. And the same for cooling devices too. Thanks, Durga
next prev parent reply other threads:[~2013-02-08 8:54 UTC|newest] Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-05 10:46 [PATCHv3 0/8] Thermal Framework Enhancements Durgadoss R 2013-02-05 10:46 ` [PATCH 1/8] Thermal: Create sensor level APIs Durgadoss R 2013-02-08 7:53 ` Zhang Rui 2013-02-08 8:26 ` R, Durgadoss 2013-02-08 8:26 ` R, Durgadoss 2013-02-08 9:54 ` Zhang Rui 2013-02-28 18:58 ` Eduardo Valentin 2013-02-28 18:58 ` Eduardo Valentin 2013-03-01 5:08 ` R, Durgadoss 2013-02-05 10:46 ` [PATCH 2/8] Thermal: Create zone " Durgadoss R 2013-02-08 8:11 ` Zhang Rui 2013-02-08 8:54 ` R, Durgadoss [this message] 2013-02-08 8:54 ` R, Durgadoss 2013-02-08 9:54 ` Zhang Rui 2013-02-08 10:27 ` R, Durgadoss 2013-02-08 10:27 ` R, Durgadoss 2013-02-28 19:29 ` Eduardo Valentin 2013-02-28 19:29 ` Eduardo Valentin 2013-03-01 15:31 ` R, Durgadoss 2013-02-05 10:46 ` [PATCH 3/8] Thermal: Add APIs to bind cdev to new zone structure Durgadoss R 2013-02-08 8:28 ` Zhang Rui 2013-02-28 19:35 ` Eduardo Valentin 2013-02-28 19:35 ` Eduardo Valentin 2013-03-01 15:33 ` R, Durgadoss 2013-02-05 10:46 ` [PATCH 4/8] Thermal: Add trip point sysfs nodes for sensor Durgadoss R 2013-02-08 8:50 ` Zhang Rui 2013-02-28 19:51 ` Eduardo Valentin 2013-02-28 19:51 ` Eduardo Valentin 2013-03-01 15:34 ` R, Durgadoss 2013-02-05 10:46 ` [PATCH 5/8] Thermal: Create Thermal map sysfs attributes for a zone Durgadoss R 2013-02-08 9:04 ` Zhang Rui 2013-02-08 9:08 ` R, Durgadoss 2013-02-08 9:08 ` R, Durgadoss 2013-02-08 9:55 ` Zhang Rui 2013-02-28 21:30 ` Eduardo Valentin 2013-02-28 21:30 ` Eduardo Valentin 2013-02-05 10:46 ` [PATCH 6/8] Thermal: Add Documentation to new APIs Durgadoss R 2013-02-08 9:21 ` Zhang Rui 2013-02-05 10:46 ` [PATCH 7/8] Thermal: Add ABI Documentation for sysfs interfaces Durgadoss R 2013-02-05 10:46 ` [PATCH 8/8] Thermal: Dummy driver used for testing Durgadoss R 2013-02-08 7:53 ` [PATCHv3 0/8] Thermal Framework Enhancements Zhang Rui 2013-02-08 9:35 ` Zhang Rui 2013-02-28 21:33 ` Eduardo Valentin 2013-02-28 21:33 ` Eduardo Valentin 2013-03-01 5:12 ` R, Durgadoss 2013-08-29 19:38 ` Eduardo Valentin 2013-08-29 19:38 ` Eduardo Valentin 2013-08-30 9:20 ` R, Durgadoss 2013-08-30 12:34 ` Eduardo Valentin 2013-08-30 13:21 ` R, Durgadoss -- strict thread matches above, loose matches on Subject: below -- 2012-12-18 9:29 [PATCH " Durgadoss R 2012-12-18 9:29 ` [PATCH 2/8] Thermal: Create zone level APIs Durgadoss R 2012-12-18 11:30 ` Joe Perches 2012-12-20 6:02 ` R, Durgadoss
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=4D68720C2E767A4AA6A8796D42C8EB5927AAB1@BGSMSX101.gar.corp.intel.com \ --to=durgadoss.r@intel.com \ --cc=eduardo.valentin@ti.com \ --cc=hongbo.zhang@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-pm@vger.kernel.org \ --cc=rui.zhang@intel.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: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.