All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wei Ni <wni@nvidia.com>
To: Guenter Roeck <linux@roeck-us.net>,
	"khali@linux-fr.org" <khali@linux-fr.org>
Cc: "lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [lm-sensors] [PATCH 1/2] hwmon: (lm90) split set&show temp as common codes
Date: Tue, 25 Feb 2014 08:21:19 +0000	[thread overview]
Message-ID: <530C527F.1020806@nvidia.com> (raw)
In-Reply-To: <530C391B.5090206@roeck-us.net>

On 02/25/2014 02:32 PM, Guenter Roeck wrote:
> On 02/24/2014 10:21 PM, Wei Ni wrote:
>> Split set&show temp codes as common functions, so we can use it
>> directly when implement linux thermal framework.
>> And handle error return value for the lm90_select_remote_channel
>> and write_tempx, then set_temp8 and set_temp11 could return it
>> to user-space.
>>
>> Signed-off-by: Wei Ni <wni@nvidia.com>
>> Signed-off-by: Jean Delvare <khali@linux-fr.org>
>> ---
>>   drivers/hwmon/lm90.c |  170 ++++++++++++++++++++++++++++++++++----------------
>>   1 file changed, 115 insertions(+), 55 deletions(-)
>>
>> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
>> index c9ff08d..fb9e224 100644
>> --- a/drivers/hwmon/lm90.c
>> +++ b/drivers/hwmon/lm90.c
>> @@ -473,20 +473,29 @@ static int lm90_read16(struct i2c_client *client, u8 regh, u8 regl, u16 *value)
>>    * various registers have different meanings as a result of selecting a
>>    * non-default remote channel.
>>    */
>> -static inline void lm90_select_remote_channel(struct i2c_client *client,
>> -					      struct lm90_data *data,
>> -					      int channel)
>> +static inline int lm90_select_remote_channel(struct i2c_client *client,
>> +					     struct lm90_data *data,
>> +					     int channel)
>>   {
>>   	u8 config;
>> +	int err;
>>
>>   	if (data->kind = max6696) {
>>   		lm90_read_reg(client, LM90_REG_R_CONFIG1, &config);
>>   		config &= ~0x08;
>>   		if (channel)
>>   			config |= 0x08;
>> -		i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
>> -					  config);
>> +		err = i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
>> +						config);
>> +		if (err < 0) {
>> +			dev_err(&client->dev,
>> +				"Failed to select remote channel %d, err %d\n",
>> +				channel, err);
>> +			return err;
> 
> Not my call to make, but I really dislike all that new noisiness.
> Sure, it is ok to pass the error back, but in my opinion that is
> good enough. If every driver in the kernel would be that noisy,
> the log would be all but useless.

This was discussed in https://lkml.org/lkml/2013/12/227
Jean wish to catch and return write errors,then the set_temp8() could
return error to user-space.

Thanks.
Wei.

> 
> Guenter
> 


_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

WARNING: multiple messages have this Message-ID (diff)
From: Wei Ni <wni@nvidia.com>
To: Guenter Roeck <linux@roeck-us.net>,
	"khali@linux-fr.org" <khali@linux-fr.org>
Cc: "lm-sensors@lm-sensors.org" <lm-sensors@lm-sensors.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] hwmon: (lm90) split set&show temp as common codes
Date: Tue, 25 Feb 2014 16:21:19 +0800	[thread overview]
Message-ID: <530C527F.1020806@nvidia.com> (raw)
In-Reply-To: <530C391B.5090206@roeck-us.net>

On 02/25/2014 02:32 PM, Guenter Roeck wrote:
> On 02/24/2014 10:21 PM, Wei Ni wrote:
>> Split set&show temp codes as common functions, so we can use it
>> directly when implement linux thermal framework.
>> And handle error return value for the lm90_select_remote_channel
>> and write_tempx, then set_temp8 and set_temp11 could return it
>> to user-space.
>>
>> Signed-off-by: Wei Ni <wni@nvidia.com>
>> Signed-off-by: Jean Delvare <khali@linux-fr.org>
>> ---
>>   drivers/hwmon/lm90.c |  170 ++++++++++++++++++++++++++++++++++----------------
>>   1 file changed, 115 insertions(+), 55 deletions(-)
>>
>> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
>> index c9ff08d..fb9e224 100644
>> --- a/drivers/hwmon/lm90.c
>> +++ b/drivers/hwmon/lm90.c
>> @@ -473,20 +473,29 @@ static int lm90_read16(struct i2c_client *client, u8 regh, u8 regl, u16 *value)
>>    * various registers have different meanings as a result of selecting a
>>    * non-default remote channel.
>>    */
>> -static inline void lm90_select_remote_channel(struct i2c_client *client,
>> -					      struct lm90_data *data,
>> -					      int channel)
>> +static inline int lm90_select_remote_channel(struct i2c_client *client,
>> +					     struct lm90_data *data,
>> +					     int channel)
>>   {
>>   	u8 config;
>> +	int err;
>>
>>   	if (data->kind == max6696) {
>>   		lm90_read_reg(client, LM90_REG_R_CONFIG1, &config);
>>   		config &= ~0x08;
>>   		if (channel)
>>   			config |= 0x08;
>> -		i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
>> -					  config);
>> +		err = i2c_smbus_write_byte_data(client, LM90_REG_W_CONFIG1,
>> +						config);
>> +		if (err < 0) {
>> +			dev_err(&client->dev,
>> +				"Failed to select remote channel %d, err %d\n",
>> +				channel, err);
>> +			return err;
> 
> Not my call to make, but I really dislike all that new noisiness.
> Sure, it is ok to pass the error back, but in my opinion that is
> good enough. If every driver in the kernel would be that noisy,
> the log would be all but useless.

This was discussed in https://lkml.org/lkml/2013/12/227
Jean wish to catch and return write errors,then the set_temp8() could
return error to user-space.

Thanks.
Wei.

> 
> Guenter
> 


  reply	other threads:[~2014-02-25  8:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25  6:21 [lm-sensors] [PATCH 0/2] expose lm90 to thermal fw Wei Ni
2014-02-25  6:21 ` Wei Ni
2014-02-25  6:21 ` [lm-sensors] [PATCH 1/2] hwmon: (lm90) split set&show temp as common codes Wei Ni
2014-02-25  6:21   ` Wei Ni
2014-02-25  6:32   ` [lm-sensors] " Guenter Roeck
2014-02-25  6:32     ` Guenter Roeck
2014-02-25  8:21     ` Wei Ni [this message]
2014-02-25  8:21       ` Wei Ni
2014-02-25  8:57       ` [lm-sensors] " Guenter Roeck
2014-02-25  8:57         ` Guenter Roeck
2014-02-25  9:21         ` [lm-sensors] " Wei Ni
2014-02-25  9:21           ` Wei Ni
2014-02-25 16:06           ` [lm-sensors] " Guenter Roeck
2014-02-25 16:06             ` Guenter Roeck
2014-02-28  3:21             ` [lm-sensors] " Wei Ni
2014-02-28  3:21               ` Wei Ni
2014-02-25  6:21 ` [lm-sensors] [PATCH 2/2] hwmon: lm90: expose to thermal fw via DT nodes Wei Ni
2014-02-25  6:21   ` Wei Ni

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=530C527F.1020806@nvidia.com \
    --to=wni@nvidia.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=lm-sensors@lm-sensors.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 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.