diff options
-rw-r--r-- | Documentation/admin-guide/pnp.rst | 3 | ||||
-rw-r--r-- | MAINTAINERS | 2 | ||||
-rw-r--r-- | arch/x86/kernel/acpi/cppc.c | 2 | ||||
-rw-r--r-- | drivers/acpi/Kconfig | 2 | ||||
-rw-r--r-- | drivers/acpi/acpi_video.c | 7 | ||||
-rw-r--r-- | drivers/acpi/button.c | 10 | ||||
-rw-r--r-- | drivers/acpi/fan.h | 1 | ||||
-rw-r--r-- | drivers/acpi/fan_attr.c | 37 | ||||
-rw-r--r-- | drivers/acpi/fan_core.c | 25 | ||||
-rw-r--r-- | drivers/acpi/fan_hwmon.c | 8 | ||||
-rw-r--r-- | drivers/acpi/hed.c | 7 | ||||
-rw-r--r-- | drivers/acpi/platform_profile.c | 45 | ||||
-rw-r--r-- | drivers/acpi/power.c | 5 | ||||
-rw-r--r-- | drivers/acpi/thermal.c | 2 | ||||
-rw-r--r-- | drivers/pnp/base.h | 4 | ||||
-rw-r--r-- | drivers/pnp/card.c | 32 | ||||
-rw-r--r-- | drivers/pnp/core.c | 16 | ||||
-rw-r--r-- | include/linux/platform_profile.h | 2 | ||||
-rw-r--r-- | include/linux/pnp.h | 2 |
19 files changed, 99 insertions, 113 deletions
diff --git a/Documentation/admin-guide/pnp.rst b/Documentation/admin-guide/pnp.rst index 3eda08191d13..24d80e3eb309 100644 --- a/Documentation/admin-guide/pnp.rst +++ b/Documentation/admin-guide/pnp.rst @@ -129,9 +129,6 @@ pnp_put_protocol pnp_register_protocol use this to register a new PnP protocol -pnp_unregister_protocol - use this function to remove a PnP protocol from the Plug and Play Layer - pnp_register_driver adds a PnP driver to the Plug and Play Layer diff --git a/MAINTAINERS b/MAINTAINERS index c32759cdc569..45be17d71dfc 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -356,7 +356,7 @@ ACPI PMIC DRIVERS M: "Rafael J. Wysocki" <rafael@kernel.org> M: Len Brown <lenb@kernel.org> R: Andy Shevchenko <andy@kernel.org> -R: Mika Westerberg <mika.westerberg@linux.intel.com> +R: Mika Westerberg <westeri@kernel.org> L: linux-acpi@vger.kernel.org S: Supported Q: https://patchwork.kernel.org/project/linux-acpi/list/ diff --git a/arch/x86/kernel/acpi/cppc.c b/arch/x86/kernel/acpi/cppc.c index d745dd586303..f96053c305c6 100644 --- a/arch/x86/kernel/acpi/cppc.c +++ b/arch/x86/kernel/acpi/cppc.c @@ -4,6 +4,8 @@ * Copyright (c) 2016, Intel Corporation. */ +#include <linux/bitfield.h> + #include <acpi/cppc_acpi.h> #include <asm/msr.h> #include <asm/processor.h> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index d81b55f5068c..7f10aa38269d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig @@ -452,7 +452,7 @@ config ACPI_SBS the modules will be called sbs and sbshc. config ACPI_HED - tristate "Hardware Error Device" + bool "Hardware Error Device" help This driver supports the Hardware Error Device (PNP0C33), which is used to report some hardware errors notified via diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index a972831dbd66..efdadc74e3f4 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c @@ -27,6 +27,7 @@ #include <linux/acpi.h> #include <acpi/video.h> #include <linux/uaccess.h> +#include <linux/string_choices.h> #define ACPI_VIDEO_BUS_NAME "Video Bus" #define ACPI_VIDEO_DEVICE_NAME "Video Device" @@ -2039,9 +2040,9 @@ static int acpi_video_bus_add(struct acpi_device *device) pr_info("%s [%s] (multi-head: %s rom: %s post: %s)\n", ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), - video->flags.multihead ? "yes" : "no", - video->flags.rom ? "yes" : "no", - video->flags.post ? "yes" : "no"); + str_yes_no(video->flags.multihead), + str_yes_no(video->flags.rom), + str_yes_no(video->flags.post)); mutex_lock(&video_list_lock); list_add_tail(&video->entry, &video_bus_head); mutex_unlock(&video_list_lock); diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 7773e6b860e7..90b09840536d 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -24,6 +24,7 @@ #define ACPI_BUTTON_CLASS "button" #define ACPI_BUTTON_FILE_STATE "state" #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 +#define ACPI_BUTTON_NOTIFY_WAKE 0x02 #define ACPI_BUTTON_NOTIFY_STATUS 0x80 #define ACPI_BUTTON_SUBCLASS_POWER "power" @@ -443,7 +444,12 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data) struct input_dev *input; int keycode; - if (event != ACPI_BUTTON_NOTIFY_STATUS) { + switch (event) { + case ACPI_BUTTON_NOTIFY_STATUS: + break; + case ACPI_BUTTON_NOTIFY_WAKE: + break; + default: acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n", event); return; @@ -629,7 +635,7 @@ static int acpi_button_add(struct acpi_device *device) break; default: status = acpi_install_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, handler, + ACPI_ALL_NOTIFY, handler, device); break; } diff --git a/drivers/acpi/fan.h b/drivers/acpi/fan.h index 488b51e2cb31..15eba1c70e66 100644 --- a/drivers/acpi/fan.h +++ b/drivers/acpi/fan.h @@ -49,6 +49,7 @@ struct acpi_fan_fst { struct acpi_fan { bool acpi4; + bool has_fst; struct acpi_fan_fif fif; struct acpi_fan_fps *fps; int fps_count; diff --git a/drivers/acpi/fan_attr.c b/drivers/acpi/fan_attr.c index f4f6e2381f1d..22d29ac2447c 100644 --- a/drivers/acpi/fan_attr.c +++ b/drivers/acpi/fan_attr.c @@ -75,15 +75,6 @@ int acpi_fan_create_attributes(struct acpi_device *device) struct acpi_fan *fan = acpi_driver_data(device); int i, status; - sysfs_attr_init(&fan->fine_grain_control.attr); - fan->fine_grain_control.show = show_fine_grain_control; - fan->fine_grain_control.store = NULL; - fan->fine_grain_control.attr.name = "fine_grain_control"; - fan->fine_grain_control.attr.mode = 0444; - status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr); - if (status) - return status; - /* _FST is present if we are here */ sysfs_attr_init(&fan->fst_speed.attr); fan->fst_speed.show = show_fan_speed; @@ -92,7 +83,19 @@ int acpi_fan_create_attributes(struct acpi_device *device) fan->fst_speed.attr.mode = 0444; status = sysfs_create_file(&device->dev.kobj, &fan->fst_speed.attr); if (status) - goto rem_fine_grain_attr; + return status; + + if (!fan->acpi4) + return 0; + + sysfs_attr_init(&fan->fine_grain_control.attr); + fan->fine_grain_control.show = show_fine_grain_control; + fan->fine_grain_control.store = NULL; + fan->fine_grain_control.attr.name = "fine_grain_control"; + fan->fine_grain_control.attr.mode = 0444; + status = sysfs_create_file(&device->dev.kobj, &fan->fine_grain_control.attr); + if (status) + goto rem_fst_attr; for (i = 0; i < fan->fps_count; ++i) { struct acpi_fan_fps *fps = &fan->fps[i]; @@ -109,18 +112,18 @@ int acpi_fan_create_attributes(struct acpi_device *device) for (j = 0; j < i; ++j) sysfs_remove_file(&device->dev.kobj, &fan->fps[j].dev_attr.attr); - goto rem_fst_attr; + goto rem_fine_grain_attr; } } return 0; -rem_fst_attr: - sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); - rem_fine_grain_attr: sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr); +rem_fst_attr: + sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); + return status; } @@ -129,9 +132,13 @@ void acpi_fan_delete_attributes(struct acpi_device *device) struct acpi_fan *fan = acpi_driver_data(device); int i; + sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); + + if (!fan->acpi4) + return; + for (i = 0; i < fan->fps_count; ++i) sysfs_remove_file(&device->dev.kobj, &fan->fps[i].dev_attr.attr); - sysfs_remove_file(&device->dev.kobj, &fan->fst_speed.attr); sysfs_remove_file(&device->dev.kobj, &fan->fine_grain_control.attr); } diff --git a/drivers/acpi/fan_core.c b/drivers/acpi/fan_core.c index 10016f52f4f4..8ad12ad3aaaf 100644 --- a/drivers/acpi/fan_core.c +++ b/drivers/acpi/fan_core.c @@ -203,12 +203,16 @@ static const struct thermal_cooling_device_ops fan_cooling_ops = { * -------------------------------------------------------------------------- */ +static bool acpi_fan_has_fst(struct acpi_device *device) +{ + return acpi_has_method(device->handle, "_FST"); +} + static bool acpi_fan_is_acpi4(struct acpi_device *device) { return acpi_has_method(device->handle, "_FIF") && acpi_has_method(device->handle, "_FPS") && - acpi_has_method(device->handle, "_FSL") && - acpi_has_method(device->handle, "_FST"); + acpi_has_method(device->handle, "_FSL"); } static int acpi_fan_get_fif(struct acpi_device *device) @@ -327,7 +331,12 @@ static int acpi_fan_probe(struct platform_device *pdev) device->driver_data = fan; platform_set_drvdata(pdev, fan); - if (acpi_fan_is_acpi4(device)) { + if (acpi_fan_has_fst(device)) { + fan->has_fst = true; + fan->acpi4 = acpi_fan_is_acpi4(device); + } + + if (fan->acpi4) { result = acpi_fan_get_fif(device); if (result) return result; @@ -335,7 +344,9 @@ static int acpi_fan_probe(struct platform_device *pdev) result = acpi_fan_get_fps(device); if (result) return result; + } + if (fan->has_fst) { result = devm_acpi_fan_create_hwmon(device); if (result) return result; @@ -343,9 +354,9 @@ static int acpi_fan_probe(struct platform_device *pdev) result = acpi_fan_create_attributes(device); if (result) return result; + } - fan->acpi4 = true; - } else { + if (!fan->acpi4) { result = acpi_device_update_power(device, NULL); if (result) { dev_err(&device->dev, "Failed to set initial power state\n"); @@ -391,7 +402,7 @@ err_remove_link: err_unregister: thermal_cooling_device_unregister(cdev); err_end: - if (fan->acpi4) + if (fan->has_fst) acpi_fan_delete_attributes(device); return result; @@ -401,7 +412,7 @@ static void acpi_fan_remove(struct platform_device *pdev) { struct acpi_fan *fan = platform_get_drvdata(pdev); - if (fan->acpi4) { + if (fan->has_fst) { struct acpi_device *device = ACPI_COMPANION(&pdev->dev); acpi_fan_delete_attributes(device); diff --git a/drivers/acpi/fan_hwmon.c b/drivers/acpi/fan_hwmon.c index bd0d31a398fa..e8d90605106e 100644 --- a/drivers/acpi/fan_hwmon.c +++ b/drivers/acpi/fan_hwmon.c @@ -43,6 +43,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_ case hwmon_fan_input: return 0444; case hwmon_fan_target: + /* Only acpi4 fans support fan control. */ + if (!fan->acpi4) + return 0; + /* * When in fine grain control mode, not every fan control value * has an associated fan performance state. @@ -57,6 +61,10 @@ static umode_t acpi_fan_hwmon_is_visible(const void *drvdata, enum hwmon_sensor_ case hwmon_power: switch (attr) { case hwmon_power_input: + /* Only acpi4 fans support fan control. */ + if (!fan->acpi4) + return 0; + /* * When in fine grain control mode, not every fan control value * has an associated fan performance state. diff --git a/drivers/acpi/hed.c b/drivers/acpi/hed.c index 7652515a6be1..3499f86c411e 100644 --- a/drivers/acpi/hed.c +++ b/drivers/acpi/hed.c @@ -80,7 +80,12 @@ static struct acpi_driver acpi_hed_driver = { .remove = acpi_hed_remove, }, }; -module_acpi_driver(acpi_hed_driver); + +static int __init acpi_hed_driver_init(void) +{ + return acpi_bus_register_driver(&acpi_hed_driver); +} +subsys_initcall(acpi_hed_driver_init); MODULE_AUTHOR("Huang Ying"); MODULE_DESCRIPTION("ACPI Hardware Error Device Driver"); diff --git a/drivers/acpi/platform_profile.c b/drivers/acpi/platform_profile.c index ef9444482db1..671407fc2bd4 100644 --- a/drivers/acpi/platform_profile.c +++ b/drivers/acpi/platform_profile.c @@ -289,14 +289,14 @@ static int _remove_hidden_choices(struct device *dev, void *arg) /** * platform_profile_choices_show - Show the available profile choices for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to * * Return: The number of bytes written */ -static ssize_t platform_profile_choices_show(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_choices_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) { struct aggregate_choices_data data = { @@ -371,14 +371,14 @@ static int _store_and_notify(struct device *dev, void *data) /** * platform_profile_show - Show the current profile for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to write to * * Return: The number of bytes written */ -static ssize_t platform_profile_show(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) { enum platform_profile_option profile = PLATFORM_PROFILE_LAST; @@ -400,15 +400,15 @@ static ssize_t platform_profile_show(struct device *dev, /** * platform_profile_store - Set the profile for legacy sysfs interface - * @dev: The device + * @kobj: The kobject * @attr: The attribute * @buf: The buffer to read from * @count: The number of bytes to read * * Return: The number of bytes read */ -static ssize_t platform_profile_store(struct device *dev, - struct device_attribute *attr, +static ssize_t platform_profile_store(struct kobject *kobj, + struct kobj_attribute *attr, const char *buf, size_t count) { struct aggregate_choices_data data = { @@ -442,12 +442,12 @@ static ssize_t platform_profile_store(struct device *dev, return count; } -static DEVICE_ATTR_RO(platform_profile_choices); -static DEVICE_ATTR_RW(platform_profile); +static struct kobj_attribute attr_platform_profile_choices = __ATTR_RO(platform_profile_choices); +static struct kobj_attribute attr_platform_profile = __ATTR_RW(platform_profile); static struct attribute *platform_profile_attrs[] = { - &dev_attr_platform_profile_choices.attr, - &dev_attr_platform_profile.attr, + &attr_platform_profile_choices.attr, + &attr_platform_profile.attr, NULL }; @@ -627,24 +627,23 @@ EXPORT_SYMBOL_GPL(platform_profile_register); /** * platform_profile_remove - Unregisters a platform profile class device * @dev: Class device - * - * Return: 0 */ -int platform_profile_remove(struct device *dev) +void platform_profile_remove(struct device *dev) { - struct platform_profile_handler *pprof = to_pprof_handler(dev); - int id; + struct platform_profile_handler *pprof; + + if (IS_ERR_OR_NULL(dev)) + return; + + pprof = to_pprof_handler(dev); + guard(mutex)(&profile_lock); - id = pprof->minor; + ida_free(&platform_profile_ida, pprof->minor); device_unregister(&pprof->dev); - ida_free(&platform_profile_ida, id); sysfs_notify(acpi_kobj, NULL, "platform_profile"); - sysfs_update_group(acpi_kobj, &platform_profile_group); - - return 0; } EXPORT_SYMBOL_GPL(platform_profile_remove); diff --git a/drivers/acpi/power.c b/drivers/acpi/power.c index 25174c24d3d7..b7243d7563b1 100644 --- a/drivers/acpi/power.c +++ b/drivers/acpi/power.c @@ -29,6 +29,7 @@ #include <linux/init.h> #include <linux/types.h> #include <linux/slab.h> +#include <linux/string_choices.h> #include <linux/pm_runtime.h> #include <linux/sysfs.h> #include <linux/acpi.h> @@ -197,7 +198,7 @@ static int __get_state(acpi_handle handle, u8 *state) cur_state = sta & ACPI_POWER_RESOURCE_STATE_ON; acpi_handle_debug(handle, "Power resource is %s\n", - cur_state ? "on" : "off"); + str_on_off(cur_state)); *state = cur_state; return 0; @@ -240,7 +241,7 @@ static int acpi_power_get_list_state(struct list_head *list, u8 *state) break; } - pr_debug("Power resource list is %s\n", cur_state ? "on" : "off"); + pr_debug("Power resource list is %s\n", str_on_off(cur_state)); *state = cur_state; return 0; diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c index 95982c098d5b..0c874186f8ae 100644 --- a/drivers/acpi/thermal.c +++ b/drivers/acpi/thermal.c @@ -803,7 +803,7 @@ static int acpi_thermal_add(struct acpi_device *device) acpi_thermal_aml_dependency_fix(tz); - /* Get trip points [_CRT, _PSV, etc.] (required). */ + /* Get trip points [_ACi, _PSV, etc.] (required). */ acpi_thermal_get_trip_points(tz); crit_temp = acpi_thermal_get_critical_trip(tz); diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h index 4e80273dfb1e..b342570d0236 100644 --- a/drivers/pnp/base.h +++ b/drivers/pnp/base.h @@ -9,7 +9,6 @@ extern const struct attribute_group *pnp_dev_groups[]; extern const struct bus_type pnp_bus_type; int pnp_register_protocol(struct pnp_protocol *protocol); -void pnp_unregister_protocol(struct pnp_protocol *protocol); #define PNP_EISA_ID_MASK 0x7fffffff void pnp_eisa_id_to_string(u32 id, char *str); @@ -21,9 +20,7 @@ int pnp_add_device(struct pnp_dev *dev); struct pnp_id *pnp_add_id(struct pnp_dev *dev, const char *id); int pnp_add_card(struct pnp_card *card); -void pnp_remove_card(struct pnp_card *card); int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev); -void pnp_remove_card_device(struct pnp_dev *dev); struct pnp_port { resource_size_t min; /* min base number */ @@ -138,7 +135,6 @@ void pnp_init_resources(struct pnp_dev *dev); void pnp_fixup_device(struct pnp_dev *dev); void pnp_free_options(struct pnp_dev *dev); int __pnp_add_device(struct pnp_dev *dev); -void __pnp_remove_device(struct pnp_dev *dev); int pnp_check_port(struct pnp_dev *dev, struct resource *res); int pnp_check_mem(struct pnp_dev *dev, struct resource *res); diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 9610a9f08ff4..c7596dc24fbd 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c @@ -270,25 +270,6 @@ int pnp_add_card(struct pnp_card *card) } /** - * pnp_remove_card - removes a PnP card from the PnP Layer - * @card: pointer to the card to remove - */ -void pnp_remove_card(struct pnp_card *card) -{ - struct list_head *pos, *temp; - - device_unregister(&card->dev); - mutex_lock(&pnp_lock); - list_del(&card->global_list); - list_del(&card->protocol_list); - mutex_unlock(&pnp_lock); - list_for_each_safe(pos, temp, &card->devices) { - struct pnp_dev *dev = card_to_pnp_dev(pos); - pnp_remove_card_device(dev); - } -} - -/** * pnp_add_card_device - adds a device to the specified card * @card: pointer to the card to add to * @dev: pointer to the device to add @@ -307,19 +288,6 @@ int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) } /** - * pnp_remove_card_device- removes a device from the specified card - * @dev: pointer to the device to remove - */ -void pnp_remove_card_device(struct pnp_dev *dev) -{ - mutex_lock(&pnp_lock); - dev->card = NULL; - list_del(&dev->card_list); - mutex_unlock(&pnp_lock); - __pnp_remove_device(dev); -} - -/** * pnp_request_card_device - Searches for a PnP device under the specified card * @clink: pointer to the card link, cannot be NULL * @id: pointer to a PnP ID structure that explains the rules for finding the device diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index 6a60c5d83383..ac48db6dcfe3 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c @@ -78,16 +78,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol) return ret; } -/** - * pnp_unregister_protocol - removes a pnp protocol from the pnp layer - * @protocol: pointer to the corresponding pnp_protocol structure - */ -void pnp_unregister_protocol(struct pnp_protocol *protocol) -{ - pnp_remove_protocol(protocol); - device_unregister(&protocol->dev); -} - static void pnp_free_ids(struct pnp_dev *dev) { struct pnp_id *id; @@ -220,12 +210,6 @@ int pnp_add_device(struct pnp_dev *dev) return 0; } -void __pnp_remove_device(struct pnp_dev *dev) -{ - pnp_delist_device(dev); - device_unregister(&dev->dev); -} - static int __init pnp_init(void) { return bus_register(&pnp_bus_type); diff --git a/include/linux/platform_profile.h b/include/linux/platform_profile.h index 8c9df7dadd5d..a299225ab92e 100644 --- a/include/linux/platform_profile.h +++ b/include/linux/platform_profile.h @@ -50,7 +50,7 @@ struct platform_profile_ops { struct device *platform_profile_register(struct device *dev, const char *name, void *drvdata, const struct platform_profile_ops *ops); -int platform_profile_remove(struct device *dev); +void platform_profile_remove(struct device *dev); struct device *devm_platform_profile_register(struct device *dev, const char *name, void *drvdata, const struct platform_profile_ops *ops); diff --git a/include/linux/pnp.h b/include/linux/pnp.h index b7a7158aaf65..23fe3eaf242d 100644 --- a/include/linux/pnp.h +++ b/include/linux/pnp.h @@ -290,7 +290,7 @@ static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data) } struct pnp_fixup { - char id[7]; + char id[8]; void (*quirk_function) (struct pnp_dev *dev); /* fixup function */ }; |