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/3] hwmon: (ltc4245) Use device managed function to register hwmon device
Date: Sun, 23 Feb 2014 16:38:31 +0000	[thread overview]
Message-ID: <530A2407.40802@roeck-us.net> (raw)
In-Reply-To: <1392516972-27576-1-git-send-email-linux@roeck-us.net>

On 02/23/2014 02:42 AM, Jean Delvare wrote:
> On Sat, 15 Feb 2014 18:16:10 -0800, Guenter Roeck wrote:
>> This simplifies the code and reduces code size.
>>
>> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>   drivers/hwmon/ltc4245.c |   23 ++++-------------------
>>   1 file changed, 4 insertions(+), 19 deletions(-)
>>
>> diff --git a/drivers/hwmon/ltc4245.c b/drivers/hwmon/ltc4245.c
>> index d4172933..2c6da5d 100644
>> --- a/drivers/hwmon/ltc4245.c
>> +++ b/drivers/hwmon/ltc4245.c
>> @@ -512,24 +512,10 @@ static int ltc4245_probe(struct i2c_client *client,
>>   	/* Add sysfs hooks */
>>   	ltc4245_sysfs_add_groups(data);
>>
>> -	hwmon_dev = hwmon_device_register_with_groups(&client->dev,
>> -						      client->name, data,
>> -						      data->groups);
>> -	if (IS_ERR(hwmon_dev))
>> -		return PTR_ERR(hwmon_dev);
>> -
>> -	i2c_set_clientdata(client, hwmon_dev);
>> -
>> -	return 0;
>> -}
>> -
>> -static int ltc4245_remove(struct i2c_client *client)
>> -{
>> -	struct device *hwmon_dev = i2c_get_clientdata(client);
>> -
>> -	hwmon_device_unregister(hwmon_dev);
>> -
>> -	return 0;
>> +	hwmon_dev = devm_hwmon_device_register_with_groups(&client->dev,
>> +							   client->name, data,
>> +							   data->groups);
>> +	return PTR_ERR_OR_ZERO(hwmon_dev);
>>   }
>>
>>   static const struct i2c_device_id ltc4245_id[] = {
>> @@ -544,7 +530,6 @@ static struct i2c_driver ltc4245_driver = {
>>   		.name	= "ltc4245",
>>   	},
>>   	.probe		= ltc4245_probe,
>> -	.remove		= ltc4245_remove,
>>   	.id_table	= ltc4245_id,
>>   };
>>
>
> Nice.
>
> Reviewed-by: Jean Delvare <jdelvare@suse.de>
>

Thanks!

Guenter


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

      parent reply	other threads:[~2014-02-23 16:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-16  2:16 [lm-sensors] [PATCH 1/3] hwmon: (ltc4245) Use device managed function to register hwmon device Guenter Roeck
2014-02-23 10:42 ` Jean Delvare
2014-02-23 16: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=530A2407.40802@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.