From: Jean Delvare <jdelvare@suse.de>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v3] hwmon: Make name attribute mandatory for new APIs
Date: Wed, 25 Jan 2017 14:03:04 +0100 [thread overview]
Message-ID: <20170125140304.3c3f85f3@endymion> (raw)
In-Reply-To: <1485336880-16958-1-git-send-email-linux@roeck-us.net>
On Wed, 25 Jan 2017 01:34:40 -0800, Guenter Roeck wrote:
> It does not make sense to use one of the the new APIs when not
> even providing a name attribute. Make it mandatory.
>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v3: hwmon_device_register() needs to call __hwmon_device_register() directly.
> v2: One should use ERR_PTR where appropriate
>
> drivers/hwmon/hwmon.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
> index 0c5660ccdbf4..affff8195fff 100644
> --- a/drivers/hwmon/hwmon.c
> +++ b/drivers/hwmon/hwmon.c
> @@ -651,6 +651,9 @@ hwmon_device_register_with_groups(struct device *dev, const char *name,
> void *drvdata,
> const struct attribute_group **groups)
> {
> + if (!name)
> + return ERR_PTR(-EINVAL);
> +
> return __hwmon_device_register(dev, name, drvdata, NULL, groups);
> }
> EXPORT_SYMBOL_GPL(hwmon_device_register_with_groups);
> @@ -674,6 +677,9 @@ hwmon_device_register_with_info(struct device *dev, const char *name,
> const struct hwmon_chip_info *chip,
> const struct attribute_group **extra_groups)
> {
> + if (!name)
> + return ERR_PTR(-EINVAL);
> +
> if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info))
> return ERR_PTR(-EINVAL);
>
> @@ -695,7 +701,7 @@ struct device *hwmon_device_register(struct device *dev)
> dev_warn(dev,
> "hwmon_device_register() is deprecated. Please convert the driver to use hwmon_device_register_with_info().\n");
>
> - return hwmon_device_register_with_groups(dev, NULL, NULL, NULL);
> + return __hwmon_device_register(dev, NULL, NULL, NULL, NULL);
> }
> EXPORT_SYMBOL_GPL(hwmon_device_register);
>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
--
Jean Delvare
SUSE L3 Support
prev parent reply other threads:[~2017-01-25 13:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-25 9:34 [PATCH v3] hwmon: Make name attribute mandatory for new APIs Guenter Roeck
2017-01-25 13:03 ` Jean Delvare [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=20170125140304.3c3f85f3@endymion \
--to=jdelvare@suse.de \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox