[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130715092922.36a7960a@endymion.delvare>
Date: Mon, 15 Jul 2013 09:29:22 +0200
From: Jean Delvare <khali@...ux-fr.org>
To: Wei Ni <wni@...dia.com>
Cc: linux@...ck-us.net, thierry.reding@...il.com,
lm-sensors@...sensors.org, linux-kernel@...r.kernel.org,
linux-tegra@...r.kernel.org
Subject: Re: [PATCH v3 1/4] hwmon: (lm90) split set&show temp as common
codes
Hi Wei,
On Mon, 15 Jul 2013 14:05:08 +0800, Wei Ni wrote:
> On 07/12/2013 09:26 PM, Jean Delvare wrote:
> > Can I see a recent version of the code which will need this change? It
> > makes no sense to apply this first part which makes the code more
> > complex with no benefit, without the second part which needs it, so
> > they should be applied together or not at all.
>
> In my RFC patches, there had many codes about thermal fw, which need
> this patch, so I put them together.
> And now I split the RFC patches, this series is preparing to use the
> thermal fw.
> As you said, I want to register lm90 as the thermal zone device, it need
> to hook some callback, such as .get_temp. if apply this patch, I can
> write the .get_temp simply, something like:
>
> +static int lm90_read_temp2_temp(struct thermal_zone_device *thz,
> unsigned long *temp)
> +{
> + struct lm90_data *data = thz->devdata;
> + struct i2c_client *client = to_i2c_client(data->hwmon_dev->parent);
> + struct device *dev = &client->dev;+
> +
> + *temp = (long)read_temp11(dev, TEMP11_REMOTE_TEMP);
> +
> + return 0;
> +}
> +
> +static struct thermal_zone_device_ops remote_ops = {
> + .get_temp = lm90_read_temp2_temp,
> +};
>
> If without this patch, I have to rewrite the lm90_read_temp2_temp(),
> which almost same as the show_temp11(), I think it's not good. When use
> this patch and following 3/3 patch, the code will be more readable and
> clear.
I understand the idea.
> Anyway, if you want, I can send this patch as a separate one. :)
Yes please, I think it would help me do a better code review and
testing as well.
--
Jean Delvare
--
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