All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH 1/4] hwmon: (lm77) Rearrange code to no longer require forward declarations
Date: Sun, 13 Apr 2014 15:38:36 +0000	[thread overview]
Message-ID: <534AAF7C.9020208@roeck-us.net> (raw)
In-Reply-To: <1397322118-4275-1-git-send-email-linux@roeck-us.net>

On 04/13/2014 03:07 AM, Jean Delvare wrote:
> Hi Guenter,
>
> On Sat, 12 Apr 2014 10:01:55 -0700, Guenter Roeck wrote:
>> Forward declarations are easy to avoid and unnecessary.
>> Rearrange code to avoid it.
>>
>> No functional change.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/hwmon/lm77.c |  173 +++++++++++++++++++++++---------------------------
>>   1 file changed, 81 insertions(+), 92 deletions(-)
>> (...)
>
> Looks good, just one suggestion:
>
>> diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c
>> index 502771c..9e60eea 100644
>> --- a/drivers/hwmon/lm77.c
>> +++ b/drivers/hwmon/lm77.c
>> (...)
>> @@ -266,6 +292,14 @@ static const struct attribute_group lm77_group = {
>>   	.attrs = lm77_attributes,
>>   };
>>
>> +static void lm77_init_client(struct i2c_client *client)
>> +{
>> +	/* Initialize the LM77 chip - turn off shutdown mode */
>> +	int conf = lm77_read_value(client, LM77_REG_CONF);
>> +	if (conf & 1)
>> +		lm77_write_value(client, LM77_REG_CONF, conf & 0xfe);
>> +}
>
> IMHO this would rather go before lm77_probe() than lm77_detect().
> Having _init before _detect is almost an invitation to initialize the
> chip in the _detect function, which would be wrong.
>
Ok, makes sense. I'll move it.

Guenter

>> +
>>   /* Return 0 if detection is successful, -ENODEV otherwise */
>>   static int lm77_detect(struct i2c_client *client, struct i2c_board_info *info)
>>   {
>
> Acked-by: Jean Delvare <jdelvare@suse.de>
>


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

      parent reply	other threads:[~2014-04-13 15:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-12 17:01 [lm-sensors] [PATCH 1/4] hwmon: (lm77) Rearrange code to no longer require forward declarations Guenter Roeck
2014-04-13 10:07 ` Jean Delvare
2014-04-13 15:38 ` Guenter Roeck [this message]

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=534AAF7C.9020208@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=lm-sensors@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 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.