[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1355829202.19706.28.camel@joe-AO722>
Date: Tue, 18 Dec 2012 03:13:22 -0800
From: Joe Perches <joe@...ches.com>
To: Durgadoss R <durgadoss.r@...el.com>
Cc: rui.zhang@...el.com, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org, hongbo.zhang@...aro.org,
wni@...dia.com
Subject: Re: [PATCH 1/8] Thermal: Create sensor level APIs
On Tue, 2012-12-18 at 14:59 +0530, Durgadoss R wrote:
> This patch creates sensor level APIs, in the
> generic thermal framework.
Just some trivial notes.
> diff --git a/drivers/thermal/thermal_sys.c b/drivers/thermal/thermal_sys.c
[]
> +static ssize_t
> +sensor_temp_show(struct device *dev, struct device_attribute *attr, char *buf)
> +{
> + int ret;
> + long val;
> + struct thermal_sensor *ts = to_thermal_sensor(dev);
> +
> + ret = ts->ops->get_temp(ts, &val);
> +
> + return ret ? ret : sprintf(buf, "%ld\n", val);
I'd much prefer the form
ret = ts->ops...
if (ret)
return ret;
return sprintf(buf, "%ld\n", val);
Otherwise, maybe use gcc's pretty common ?: extension
return ret ?: sprintf(...)
[]
> +static int enable_sensor_thresholds(struct thermal_sensor *ts, int count)
> +{
> + int i;
> + int size = sizeof(struct thermal_attr) * count;
> +
> + ts->thresh_attrs = kzalloc(size, GFP_KERNEL);
kcalloc
> + if (!ts->thresh_attrs)
> + return -ENOMEM;
> +
> + if (ts->ops->get_hyst) {
> + ts->hyst_attrs = kzalloc(size, GFP_KERNEL);
kcalloc here too
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists