mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Durgadoss R <durgadoss.r@intel.com>
Cc: rui.zhang@intel.com, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, hongbo.zhang@linaro.org,
	wni@nvidia.com
Subject: Re: [PATCH 2/8] Thermal: Create zone level APIs
Date: Tue, 18 Dec 2012 03:30:14 -0800	[thread overview]
Message-ID: <1355830214.19706.39.camel@joe-AO722> (raw)
In-Reply-To: <1355822977-4804-3-git-send-email-durgadoss.r@intel.com>

On Tue, 2012-12-18 at 14:59 +0530, Durgadoss R wrote:
> This patch adds a new thermal_zone structure to
> thermal.h. Also, adds zone level APIs to the thermal
> framework.

[]

> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c

> +#define GET_INDEX(tz, ptr, indx, type)			\
> +	do {						\
> +		int i;					\
> +		indx = -EINVAL;				\
> +		if (!tz || !ptr)			\
> +			break;				\
> +		mutex_lock(&type##_list_lock);		\
> +		for (i = 0; i < tz->type##_indx; i++) {	\
> +			if (tz->type##s[i] == ptr) {	\
> +				indx = i;		\
> +				break;			\
> +			}				\
> +		}					\
> +		mutex_unlock(&type##_list_lock);	\
> +	} while (0)

A statement expression macro returning int would be
more kernel style like and better to use.

(sorry about the whitespace, evolution 3.6 is crappy)

#define GET_INDEX(tx, ptr, type)				\
({								\
	int rtn = -EINVAL;					\
	do {							\
		int i;						\
		if (!tz || !ptr)				\
			break;					\
		mutex_lock(&type##_list_lock);			\
		for (i = 0; i < tz->type##_indx; i++) {		\
			if (tz->type##s[i] == ptr) {		\
				rtn = i;			\
				break;				\
			}					\
		}						\
		mutex_unlock(&type##_list_lock);		\
	} while (0);						\
	rtn;							\
})


> +static void remove_sensor_from_zone(struct thermal_zone *tz,
> +				struct thermal_sensor *ts)
> +{
> +	int j, indx;
> +
> +	GET_INDEX(tz, ts, indx, sensor);

This becomes

	indx = GET_INDEX(tx, ts, sensor);

> +	if (indx < 0)
> +		return;



  reply	other threads:[~2012-12-18 11:30 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-18  9:29 [PATCH 0/8] Thermal Framework Enhancements Durgadoss R
2012-12-18  9:29 ` [PATCH 1/8] Thermal: Create sensor level APIs Durgadoss R
2012-12-18 11:13   ` Joe Perches
2012-12-18  9:29 ` [PATCH 2/8] Thermal: Create zone " Durgadoss R
2012-12-18 11:30   ` Joe Perches [this message]
2012-12-20  6:02     ` R, Durgadoss
2012-12-18  9:29 ` [PATCH 3/8] Thermal: Add APIs to bind cdev to new zone structure Durgadoss R
2012-12-25  8:30   ` Wei Ni
2012-12-26  3:30     ` R, Durgadoss
2012-12-18  9:29 ` [PATCH 4/8] Thermal: Add Thermal_trip sysfs node Durgadoss R
2012-12-20  5:42   ` Greg KH
2012-12-20  7:52     ` R, Durgadoss
2012-12-20 16:12       ` Greg KH
2012-12-20 16:25         ` R, Durgadoss
2012-12-20 16:38           ` Greg KH
2012-12-20 16:58             ` R, Durgadoss
2012-12-20 17:51               ` Greg KH
2012-12-20 18:12                 ` R, Durgadoss
2012-12-27  7:01   ` Hongbo Zhang
2012-12-18  9:29 ` [PATCH 5/8] Thermal: Add 'thermal_map' " Durgadoss R
2012-12-18  9:29 ` [PATCH 6/8] Thermal: Add Documentation to new APIs Durgadoss R
2012-12-18  9:29 ` [PATCH 7/8] Thermal: Make PER_ZONE values configurable Durgadoss R
2012-12-18  9:29 ` [PATCH 8/8] Thermal: Dummy driver used for testing Durgadoss R
2012-12-25  8:38   ` Wei Ni
2012-12-26  3:29     ` R, Durgadoss
2012-12-20  5:37 ` [PATCH 0/8] Thermal Framework Enhancements Greg KH
2012-12-20  6:16   ` R, Durgadoss
2012-12-21  8:05 ` Wei Ni
2012-12-21  8:30   ` R, Durgadoss
2012-12-21  8:46     ` Hongbo Zhang
2012-12-21  9:17       ` R, Durgadoss
2013-02-05 10:46 [PATCHv3 " Durgadoss R
2013-02-05 10:46 ` [PATCH 2/8] Thermal: Create zone level APIs Durgadoss R
2013-02-08  8:11   ` Zhang Rui
2013-02-08  8:54     ` R, Durgadoss
2013-02-08  9:54       ` Zhang Rui
2013-02-08 10:27         ` R, Durgadoss
2013-02-28 19:29   ` Eduardo Valentin
2013-03-01 15:31     ` 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=1355830214.19706.39.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=durgadoss.r@intel.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: 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®