diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-23 18:19:35 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-06-25 11:49:18 +0200 |
| commit | a2f55994ab45f8fe0b26cace10bf5de5697f5ab4 (patch) | |
| tree | 3e20fcfed417cac4f1a0fdafd2884890dbf9e7ca /drivers | |
| parent | 9b40c2b72362a5ea92128ca7b83307986ac6246f (diff) | |
| download | linux-a2f55994ab45f8fe0b26cace10bf5de5697f5ab4.tar.gz linux-a2f55994ab45f8fe0b26cace10bf5de5697f5ab4.tar.bz2 linux-a2f55994ab45f8fe0b26cace10bf5de5697f5ab4.zip | |
Revert "hwmon: Make chip parameter for with_info API mandatory"
This reverts commit 1ec0bc72f5dab3ab367ae5230cf6f212d805a225 which is
commit ddaefa209c4ac791c1262e97c9b2d0440c8ef1d5 upstream. It should not
have been applied to the stable trees.
Link: https://lore.kernel.org/r/20220622154454.GA1864037@roeck-us.net
Reported-by: Julian Haller <julian.haller@philips.com>
Reported-by: Guenter Roeck <linux@roeck-us.net>
Cc: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/hwmon/hwmon.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index fb82d8ee0dd6..c4051a3e63c2 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -695,12 +695,11 @@ EXPORT_SYMBOL_GPL(hwmon_device_register_with_groups); /** * hwmon_device_register_with_info - register w/ hwmon - * @dev: the parent device (mandatory) - * @name: hwmon name attribute (mandatory) - * @drvdata: driver data to attach to created device (optional) - * @chip: pointer to hwmon chip information (mandatory) + * @dev: the parent device + * @name: hwmon name attribute + * @drvdata: driver data to attach to created device + * @chip: pointer to hwmon chip information * @extra_groups: pointer to list of additional non-standard attribute groups - * (optional) * * hwmon_device_unregister() must be called when the device is no * longer needed. @@ -713,10 +712,13 @@ hwmon_device_register_with_info(struct device *dev, const char *name, const struct hwmon_chip_info *chip, const struct attribute_group **extra_groups) { - if (!dev || !name || !chip) + if (!name) + return ERR_PTR(-EINVAL); + + if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info)) return ERR_PTR(-EINVAL); - if (!chip->ops || !chip->ops->is_visible || !chip->info) + if (chip && !dev) return ERR_PTR(-EINVAL); return __hwmon_device_register(dev, name, drvdata, chip, extra_groups); |
