public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Joe Perches <joe@perches.com>
Cc: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Subject: Re: [RFC v01 2/3] PowerCap: Add class driver
Date: Fri, 02 Aug 2013 17:06:58 -0700	[thread overview]
Message-ID: <51FC49A2.5010901@linux.intel.com> (raw)
In-Reply-To: <1375483407.2034.146.camel@joe-AO722>

On 08/02/2013 03:43 PM, Joe Perches wrote:
> On Fri, 2013-08-02 at 11:08 -0700, Srinivas Pandruvada wrote:
>> Added power cap class driver, which provides an API for client drivers
>> to use and provide a consistant sys-fs interface to user mode.
> Just some stylistic notes.
>
>> diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
> []
>> +/* Power zone show function */
>> +#define define_device_show(_attr)		\
>> +static ssize_t show_##_attr(struct device *dev, struct device_attribute *attr,\
>> +			char *buf) \
> Using _attr and another variable named attr is at least
> visually confusing.
>
> Maybe use name or type instead of _attr?
>
>> +{ \
>> +	u64 value; \
>> +	ssize_t len = -EINVAL; \
>> +	struct powercap_zone_device *pcd_dev = dev_get_drvdata(dev); \
>> +	\
>> +	if (pcd_dev && pcd_dev->ops && pcd_dev->ops->get_##_attr) { \
>> +		mutex_lock(&pcd_dev->lock); \
>> +		if (!pcd_dev->ops->get_##_attr(pcd_dev, &value)) \
>> +			len = sprintf(buf, "%lld\n", value); \
>> +		mutex_unlock(&pcd_dev->lock); \
>> +	} \
>> +	\
>> +	return len; \
>> +}
>> +
>> +/* Power zone store function; only reset is possible */
>> +#define define_device_store(_attr)		\
>> +static ssize_t store_##_attr(struct device *dev,\
>> +				struct device_attribute *attr, \
>> +				const char *buf, size_t count) \
> here too
>
> []
>
>> +/* Power zone constraint show function */
>> +#define define_device_constraint_show(_attr) \
>> +static ssize_t show_constraint_##_attr(struct device *dev, \
>> +				struct device_attribute *attr,\
>> +				char *buf) \
> and here
>
> []
>
>> +/* Power zone constraint store function */
>> +#define define_device_constraint_store(_attr) \
>> +static ssize_t store_constraint_##_attr(struct device *dev,\
>> +				struct device_attribute *attr, \
>> +				const char *buf, size_t count) \
> etc...
>
>> +struct powercap_zone_constraint *powercap_zone_add_constraint(
>> +				struct powercap_zone_device *pcd_dev,
>> +				struct powercap_zone_constraint_ops *ops)
>> +{
> []
>> +	dev_dbg(&pcd_dev->device, "powercap_zone_add_constraint\n");
> These logging messages aren't useful.
> function tracing works very well.
>
>
>
Thanks. Will change in the next patchset.

Thanks,
Srinivas

  reply	other threads:[~2013-08-02 23:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-02 18:08 [RFC v01 0/3] Power Capping Framework Srinivas Pandruvada
2013-08-02 18:08 ` [RFC v01 1/3] PowerCap: Documentation Srinivas Pandruvada
2013-08-03  0:10   ` Joe Perches
2013-08-03  0:23     ` Srinivas Pandruvada
2013-08-03  0:25       ` Joe Perches
2013-08-05 19:09   ` Jonathan Corbet
2013-08-05 19:52     ` Srinivas Pandruvada
2013-08-02 18:08 ` [RFC v01 2/3] PowerCap: Add class driver Srinivas Pandruvada
2013-08-02 22:43   ` Joe Perches
2013-08-03  0:06     ` Srinivas Pandruvada [this message]
2013-08-02 18:08 ` [RFC v01 3/3] PowerCap: Added to drivers build Srinivas Pandruvada
2013-08-02 22:29 ` [RFC v01 0/3] Power Capping Framework Greg KH
2013-08-02 23:52   ` Srinivas Pandruvada
2013-08-03  0:53     ` Greg KH
2013-08-04 19:36       ` Arjan van de Ven
2013-08-02 22:30 ` Greg KH
2013-08-02 22:33   ` Joe Perches
2013-08-02 22:50     ` Greg KH
2013-08-03  0:03   ` Srinivas Pandruvada
2013-08-03  0:54     ` Greg KH

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=51FC49A2.5010901@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.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