Merge branch 'acpi-driver'

Merge ACPI core driver core driver updates and assorted driver updates
related to ACPI support for 7.1-rc1:

 - Clean up the ACPI AC and ACPI PAD (processor aggregator device)
   drivers (Rafael Wysocki)

 - Rework checking for duplicate video bus devices and consolidate
   pnp.bus_id workarounds handling in the ACPI video bus driver (Rafael
   Wysocki)

 - Update the ACPI core device drivers to stop setting acpi_device_name()
   unnecessarily (Rafael Wysocki)

 - Rearrange code using acpi_device_class() in the ACPI core device
   drivers and update them to stop setting acpi_device_class()
   unnecessarily (Rafael Wysocki)

 - Define ACPI_AC_CLASS in one place (Rafael Wysocki)

 - Convert the ni903x_wdt watchdog driver and the xen ACPI PAD driver to
   bind to platform devices instead of ACPI devices (Rafael Wysocki)

* acpi-driver:
  watchdog: ni903x_wdt: Convert to a platform driver
  ACPI: PAD: xen: Convert to a platform driver
  ACPI: AC: Define ACPI_AC_CLASS in one place
  ACPI: driver: Do not set acpi_device_class() unnecessarily
  ACPI: driver: Avoid using pnp.device_class for netlink handling
  ACPI: event: Redefine acpi_notifier_call_chain()
  ACPI: driver: Do not set acpi_device_name() unnecessarily
  ACPI: video: Consolidate pnp.bus_id workarounds handling
  ACPI: video: Rework checking for duplicate video bus devices
  driver core: auxiliary bus: Introduce dev_is_auxiliary()
  ACPI: PAD: Rearrange notify handler installation and removal
  ACPI: AC: Get rid of unnecessary declarations
This commit is contained in:
Rafael J. Wysocki
2026-04-09 21:54:15 +02:00
26 changed files with 132 additions and 204 deletions

View File

@@ -21,8 +21,6 @@
#include <linux/acpi.h>
#include <acpi/battery.h>
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_AC_DEVICE_NAME "AC Adapter"
#define ACPI_AC_FILE_STATE "state"
#define ACPI_AC_NOTIFY_STATUS 0x80
#define ACPI_AC_STATUS_OFFLINE 0x00
@@ -33,22 +31,12 @@ MODULE_AUTHOR("Paul Diefenbaugh");
MODULE_DESCRIPTION("ACPI AC Adapter Driver");
MODULE_LICENSE("GPL");
static int acpi_ac_probe(struct platform_device *pdev);
static void acpi_ac_remove(struct platform_device *pdev);
static void acpi_ac_notify(acpi_handle handle, u32 event, void *data);
static const struct acpi_device_id ac_device_ids[] = {
{"ACPI0003", 0},
{"", 0},
};
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
#ifdef CONFIG_PM_SLEEP
static int acpi_ac_resume(struct device *dev);
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static int ac_sleep_before_get_state_ms;
static int ac_only;
@@ -141,10 +129,11 @@ static void acpi_ac_notify(acpi_handle handle, u32 event, void *data)
msleep(ac_sleep_before_get_state_ms);
acpi_ac_get_state(ac);
acpi_bus_generate_netlink_event(adev->pnp.device_class,
dev_name(&adev->dev), event,
(u32) ac->state);
acpi_notifier_call_chain(adev, event, (u32) ac->state);
acpi_bus_generate_netlink_event(ACPI_AC_CLASS,
dev_name(&adev->dev), event,
ac->state);
acpi_notifier_call_chain(ACPI_AC_CLASS, acpi_device_bid(adev),
event, ac->state);
power_supply_changed(ac->charger);
}
}
@@ -213,8 +202,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
return -ENOMEM;
ac->device = adev;
strscpy(acpi_device_name(adev), ACPI_AC_DEVICE_NAME);
strscpy(acpi_device_class(adev), ACPI_AC_CLASS);
platform_set_drvdata(pdev, ac);
@@ -236,8 +223,8 @@ static int acpi_ac_probe(struct platform_device *pdev)
goto err_release_ac;
}
pr_info("%s [%s] (%s-line)\n", acpi_device_name(adev),
acpi_device_bid(adev), str_on_off(ac->state));
pr_info("AC Adapter [%s] (%s-line)\n", acpi_device_bid(adev),
str_on_off(ac->state));
ac->battery_nb.notifier_call = acpi_ac_battery_notify;
register_acpi_notifier(&ac->battery_nb);
@@ -272,10 +259,10 @@ static int acpi_ac_resume(struct device *dev)
return 0;
}
#else
#define acpi_ac_resume NULL
#endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static void acpi_ac_remove(struct platform_device *pdev)
{
struct acpi_ac *ac = platform_get_drvdata(pdev);

View File

@@ -18,9 +18,7 @@
#include "internal.h"
#define ACPI_MEMORY_DEVICE_CLASS "memory"
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
#define ACPI_MEMORY_DEVICE_NAME "Hotplug Mem Device"
static const struct acpi_device_id memory_device_ids[] = {
{ACPI_MEMORY_DEVICE_HID, 0},
@@ -297,8 +295,6 @@ static int acpi_memory_device_add(struct acpi_device *device,
INIT_LIST_HEAD(&mem_device->res_list);
mem_device->device = device;
mem_device->mgid = -1;
sprintf(acpi_device_name(device), "%s", ACPI_MEMORY_DEVICE_NAME);
sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
device->driver_data = mem_device;
/* Get the range from the _CRS */

View File

@@ -23,8 +23,6 @@
#include <asm/mwait.h>
#include <xen/xen.h>
#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
#define ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME "Processor Aggregator"
#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS 0
@@ -407,16 +405,15 @@ static void acpi_pad_handle_notify(acpi_handle handle)
mutex_unlock(&isolated_cpus_lock);
}
static void acpi_pad_notify(acpi_handle handle, u32 event,
void *data)
static void acpi_pad_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_device *adev = data;
switch (event) {
case ACPI_PROCESSOR_AGGREGATOR_NOTIFY:
acpi_pad_handle_notify(handle);
acpi_bus_generate_netlink_event(adev->pnp.device_class,
dev_name(&adev->dev), event, 0);
acpi_bus_generate_netlink_event("acpi_pad",
dev_name(&adev->dev), event, 0);
break;
default:
pr_warn("Unsupported event [0x%x]\n", event);
@@ -427,30 +424,19 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
static int acpi_pad_probe(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
acpi_status status;
strscpy(acpi_device_name(adev), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
strscpy(acpi_device_class(adev), ACPI_PROCESSOR_AGGREGATOR_CLASS);
status = acpi_install_notify_handler(adev->handle,
ACPI_DEVICE_NOTIFY, acpi_pad_notify, adev);
if (ACPI_FAILURE(status))
return -ENODEV;
return 0;
return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acpi_pad_notify, adev);
}
static void acpi_pad_remove(struct platform_device *pdev)
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
mutex_lock(&isolated_cpus_lock);
acpi_pad_idle_cpus(0);
mutex_unlock(&isolated_cpus_lock);
acpi_remove_notify_handler(adev->handle,
ACPI_DEVICE_NOTIFY, acpi_pad_notify);
acpi_dev_remove_notify_handler(ACPI_COMPANION(&pdev->dev),
ACPI_DEVICE_NOTIFY, acpi_pad_notify);
}
static const struct acpi_device_id pad_device_ids[] = {

View File

@@ -436,8 +436,6 @@ static int acpi_processor_add(struct acpi_device *device,
}
pr->handle = device->handle;
strscpy(acpi_device_name(device), ACPI_PROCESSOR_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
device->driver_data = pr;
result = acpi_processor_get_info(device);

View File

@@ -30,9 +30,6 @@
#include <linux/uaccess.h>
#include <linux/string_choices.h>
#define ACPI_VIDEO_BUS_NAME "Video Bus"
#define ACPI_VIDEO_DEVICE_NAME "Video Device"
#define MAX_NAME_LEN 20
MODULE_AUTHOR("Bruno Ducrot");
@@ -1144,9 +1141,6 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
return -ENOMEM;
}
strscpy(acpi_device_name(device), ACPI_VIDEO_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
data->device_id = device_id;
data->video = video;
data->dev = device;
@@ -1570,7 +1564,8 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
break;
}
if (acpi_notifier_call_chain(device, event, 0))
if (acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
event, 0))
/* Something vetoed the keypress. */
keycode = 0;
@@ -1611,7 +1606,8 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (video_device->backlight)
backlight_force_update(video_device->backlight,
BACKLIGHT_UPDATE_HOTKEY);
acpi_notifier_call_chain(device, event, 0);
acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
event, 0);
return;
}
@@ -1644,7 +1640,8 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
if (keycode)
may_report_brightness_keys = true;
acpi_notifier_call_chain(device, event, 0);
acpi_notifier_call_chain(ACPI_VIDEO_CLASS, acpi_device_bid(device),
event, 0);
if (keycode && (report_key_events & REPORT_BRIGHTNESS_KEY_EVENTS)) {
input_report_key(input, keycode, 1);
@@ -1681,26 +1678,6 @@ static int acpi_video_resume(struct notifier_block *nb,
return NOTIFY_DONE;
}
static acpi_status
acpi_video_bus_match(acpi_handle handle, u32 level, void *context,
void **return_value)
{
struct acpi_device *device = context;
struct acpi_device *sibling;
if (handle == device->handle)
return AE_CTRL_TERMINATE;
sibling = acpi_fetch_acpi_dev(handle);
if (!sibling)
return AE_OK;
if (!strcmp(acpi_device_name(sibling), ACPI_VIDEO_BUS_NAME))
return AE_ALREADY_EXISTS;
return AE_OK;
}
static void acpi_video_dev_register_backlight(struct acpi_video_device *device)
{
struct backlight_properties props;
@@ -1902,7 +1879,7 @@ static int acpi_video_bus_add_notify_handler(struct acpi_video_bus *video,
snprintf(video->phys, sizeof(video->phys),
"%s/video/input0", acpi_device_hid(video->device));
input->name = acpi_device_name(video->device);
input->name = "Video Bus";
input->phys = video->phys;
input->id.bustype = BUS_HOST;
input->id.product = 0x06;
@@ -1976,53 +1953,69 @@ static int acpi_video_bus_put_devices(struct acpi_video_bus *video)
return 0;
}
static int instance;
static int duplicate_dev_check(struct device *sibling, void *data)
{
struct acpi_video_bus *video;
if (sibling == data || !dev_is_auxiliary(sibling))
return 0;
guard(mutex)(&video_list_lock);
list_for_each_entry(video, &video_bus_head, entry) {
if (video == dev_get_drvdata(sibling))
return -EEXIST;
}
return 0;
}
static bool acpi_video_bus_dev_is_duplicate(struct device *dev)
{
return device_for_each_child(dev->parent, dev, duplicate_dev_check);
}
static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
const struct auxiliary_device_id *id_unused)
{
struct acpi_device *device = ACPI_COMPANION(&aux_dev->dev);
static DEFINE_MUTEX(probe_lock);
struct acpi_video_bus *video;
static int instance;
bool auto_detect;
int error;
acpi_status status;
status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
acpi_dev_parent(device)->handle, 1,
acpi_video_bus_match, NULL,
device, NULL);
if (status == AE_ALREADY_EXISTS) {
/* Probe one video bus device at a time in case there are duplicates. */
guard(mutex)(&probe_lock);
if (!allow_duplicates && acpi_video_bus_dev_is_duplicate(&aux_dev->dev)) {
pr_info(FW_BUG
"Duplicate ACPI video bus devices for the"
" same VGA controller, please try module "
"parameter \"video.allow_duplicates=1\""
"if the current driver doesn't work.\n");
if (!allow_duplicates)
return -ENODEV;
return -ENODEV;
}
video = kzalloc_obj(struct acpi_video_bus);
if (!video)
return -ENOMEM;
/* a hack to fix the duplicate name "VID" problem on T61 */
if (!strcmp(device->pnp.bus_id, "VID")) {
if (instance)
device->pnp.bus_id[3] = '0' + instance;
instance++;
}
/* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
if (!strcmp(device->pnp.bus_id, "VGA")) {
/*
* A hack to fix the duplicate name "VID" problem on T61 and the
* duplicate name "VGA" problem on Pa 3553.
*/
if (!strcmp(device->pnp.bus_id, "VID") ||
!strcmp(device->pnp.bus_id, "VGA")) {
if (instance)
device->pnp.bus_id[3] = '0' + instance;
instance++;
}
auxiliary_set_drvdata(aux_dev, video);
video->device = device;
strscpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
device->driver_data = video;
acpi_video_bus_find_cap(video);
@@ -2043,11 +2036,10 @@ static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
*/
acpi_device_fix_up_power_children(device);
pr_info("%s [%s] (multi-head: %s rom: %s post: %s)\n",
ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
str_yes_no(video->flags.multihead),
str_yes_no(video->flags.rom),
str_yes_no(video->flags.post));
pr_info("Video Device [%s] (multi-head: %s rom: %s post: %s)\n",
acpi_device_bid(device), 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);

View File

@@ -33,8 +33,6 @@
#define ACPI_BATTERY_CAPACITY_VALID(capacity) \
((capacity) != 0 && (capacity) != ACPI_BATTERY_VALUE_UNKNOWN)
#define ACPI_BATTERY_DEVICE_NAME "Battery"
/* Battery power unit: 0 means mW, 1 means mA */
#define ACPI_BATTERY_POWER_UNIT_MA 1
@@ -1080,10 +1078,11 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
if (event == ACPI_BATTERY_NOTIFY_INFO)
acpi_battery_refresh(battery);
acpi_battery_update(battery, false);
acpi_bus_generate_netlink_event(device->pnp.device_class,
acpi_bus_generate_netlink_event(ACPI_BATTERY_CLASS,
dev_name(&device->dev), event,
acpi_battery_present(battery));
acpi_notifier_call_chain(device, event, acpi_battery_present(battery));
acpi_notifier_call_chain(ACPI_BATTERY_CLASS, acpi_device_bid(device),
event, acpi_battery_present(battery));
/* acpi_battery_update could remove power_supply object */
if (old && battery->bat)
power_supply_changed(battery->bat);
@@ -1229,8 +1228,6 @@ static int acpi_battery_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, battery);
battery->device = device;
strscpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
result = devm_mutex_init(&pdev->dev, &battery->update_lock);
if (result)

View File

@@ -468,7 +468,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
input_report_key(input, keycode, 0);
input_sync(input);
acpi_bus_generate_netlink_event(device->pnp.device_class,
acpi_bus_generate_netlink_event(acpi_device_class(device),
dev_name(&device->dev),
event, ++button->pushed);
}
@@ -558,27 +558,26 @@ static int acpi_button_probe(struct platform_device *pdev)
goto err_free_button;
}
name = acpi_device_name(device);
class = acpi_device_class(device);
if (!strcmp(hid, ACPI_BUTTON_HID_POWER) ||
!strcmp(hid, ACPI_BUTTON_HID_POWERF)) {
button->type = ACPI_BUTTON_TYPE_POWER;
handler = acpi_button_notify;
strscpy(name, ACPI_BUTTON_DEVICE_NAME_POWER, MAX_ACPI_DEVICE_NAME_LEN);
name = ACPI_BUTTON_DEVICE_NAME_POWER;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_POWER);
} else if (!strcmp(hid, ACPI_BUTTON_HID_SLEEP) ||
!strcmp(hid, ACPI_BUTTON_HID_SLEEPF)) {
button->type = ACPI_BUTTON_TYPE_SLEEP;
handler = acpi_button_notify;
strscpy(name, ACPI_BUTTON_DEVICE_NAME_SLEEP, MAX_ACPI_DEVICE_NAME_LEN);
name = ACPI_BUTTON_DEVICE_NAME_SLEEP;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_SLEEP);
} else if (!strcmp(hid, ACPI_BUTTON_HID_LID)) {
button->type = ACPI_BUTTON_TYPE_LID;
handler = acpi_lid_notify;
strscpy(name, ACPI_BUTTON_DEVICE_NAME_LID, MAX_ACPI_DEVICE_NAME_LEN);
name = ACPI_BUTTON_DEVICE_NAME_LID;
sprintf(class, "%s/%s",
ACPI_BUTTON_CLASS, ACPI_BUTTON_SUBCLASS_LID);
input->open = acpi_lid_input_open;
@@ -698,6 +697,8 @@ static void acpi_button_remove(struct platform_device *pdev)
acpi_button_remove_fs(button);
input_unregister_device(button->input);
kfree(button);
memset(acpi_device_class(adev), 0, sizeof(acpi_device_class));
}
static int param_set_lid_init_state(const char *val,

View File

@@ -35,9 +35,6 @@
#include "internal.h"
#define ACPI_EC_CLASS "embedded_controller"
#define ACPI_EC_DEVICE_NAME "Embedded Controller"
/* EC status register */
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
@@ -1683,9 +1680,6 @@ static int acpi_ec_probe(struct platform_device *pdev)
struct acpi_ec *ec;
int ret;
strscpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_EC_CLASS);
if (boot_ec && (boot_ec->handle == device->handle ||
!strcmp(acpi_device_hid(device), ACPI_ECDT_HID))) {
/* Fast path: this device corresponds to the boot EC. */

View File

@@ -24,12 +24,13 @@
/* ACPI notifier chain */
static BLOCKING_NOTIFIER_HEAD(acpi_chain_head);
int acpi_notifier_call_chain(struct acpi_device *dev, u32 type, u32 data)
int acpi_notifier_call_chain(const char *device_class,
const char *bus_id, u32 type, u32 data)
{
struct acpi_bus_event event;
strscpy(event.device_class, dev->pnp.device_class);
strscpy(event.bus_id, dev->pnp.bus_id);
strscpy(event.device_class, device_class);
strscpy(event.bus_id, bus_id);
event.type = type;
event.data = data;
return (blocking_notifier_call_chain(&acpi_chain_head, 0, (void *)&event)

View File

@@ -29,8 +29,6 @@
#include "internal.h"
#define ACPI_PCI_LINK_CLASS "pci_irq_routing"
#define ACPI_PCI_LINK_DEVICE_NAME "PCI Interrupt Link"
#define ACPI_PCI_LINK_MAX_POSSIBLE 16
static int acpi_pci_link_add(struct acpi_device *device,
@@ -725,8 +723,6 @@ static int acpi_pci_link_add(struct acpi_device *device,
return -ENOMEM;
link->device = device;
strscpy(acpi_device_name(device), ACPI_PCI_LINK_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
device->driver_data = link;
mutex_lock(&acpi_link_lock);

View File

@@ -24,8 +24,6 @@
#include <linux/platform_data/x86/apple.h>
#include "internal.h"
#define ACPI_PCI_ROOT_CLASS "pci_bridge"
#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
static int acpi_pci_root_add(struct acpi_device *device,
const struct acpi_device_id *not_used);
static void acpi_pci_root_remove(struct acpi_device *device);
@@ -689,8 +687,6 @@ static int acpi_pci_root_add(struct acpi_device *device,
root->device = device;
root->segment = segment & 0xFFFF;
strscpy(acpi_device_name(device), ACPI_PCI_ROOT_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
device->driver_data = root;
if (hotadd && dmar_device_add(handle)) {
@@ -698,9 +694,8 @@ static int acpi_pci_root_add(struct acpi_device *device,
goto end;
}
pr_info("%s [%s] (domain %04x %pR)\n",
acpi_device_name(device), acpi_device_bid(device),
root->segment, &root->secondary);
pr_info("PCI Root Bridge [%s] (domain %04x %pR)\n",
acpi_device_bid(device), root->segment, &root->secondary);
root->mcfg_addr = acpi_pci_root_get_mcfg_addr(handle);

View File

@@ -37,8 +37,6 @@
#include "sleep.h"
#include "internal.h"
#define ACPI_POWER_CLASS "power_resource"
#define ACPI_POWER_DEVICE_NAME "Power Resource"
#define ACPI_POWER_RESOURCE_STATE_OFF 0x00
#define ACPI_POWER_RESOURCE_STATE_ON 0x01
#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
@@ -955,8 +953,6 @@ struct acpi_device *acpi_add_power_resource(acpi_handle handle)
mutex_init(&resource->resource_lock);
INIT_LIST_HEAD(&resource->list_node);
INIT_LIST_HEAD(&resource->dependents);
strscpy(acpi_device_name(device), ACPI_POWER_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_POWER_CLASS);
device->power.state = ACPI_STATE_UNKNOWN;
device->flags.match_driver = true;

View File

@@ -53,7 +53,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_device *device = data;
struct acpi_processor *pr;
int saved;
int saved, ev_data = 0;
if (device->handle != handle)
return;
@@ -66,33 +66,27 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data)
case ACPI_PROCESSOR_NOTIFY_PERFORMANCE:
saved = pr->performance_platform_limit;
acpi_processor_ppc_has_changed(pr, 1);
if (saved == pr->performance_platform_limit)
break;
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event,
pr->performance_platform_limit);
ev_data = pr->performance_platform_limit;
if (saved == ev_data)
return;
break;
case ACPI_PROCESSOR_NOTIFY_POWER:
acpi_processor_power_state_has_changed(pr);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
case ACPI_PROCESSOR_NOTIFY_THROTTLING:
acpi_processor_tstate_has_changed(pr);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
case ACPI_PROCESSOR_NOTIFY_HIGEST_PERF_CHANGED:
cpufreq_update_limits(pr->id);
acpi_bus_generate_netlink_event(device->pnp.device_class,
dev_name(&device->dev), event, 0);
break;
default:
acpi_handle_debug(handle, "Unsupported event [0x%x]\n", event);
break;
return;
}
return;
acpi_bus_generate_netlink_event("processor", dev_name(&device->dev),
event, ev_data);
}
static int __acpi_processor_start(struct acpi_device *device);

View File

@@ -26,8 +26,6 @@
#include "sbshc.h"
#define ACPI_SBS_CLASS "sbs"
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_SBS_DEVICE_NAME "Smart Battery System"
#define ACPI_BATTERY_DIR_NAME "BAT%i"
#define ACPI_AC_DIR_NAME "AC0"
@@ -648,8 +646,6 @@ static int acpi_sbs_probe(struct platform_device *pdev)
sbs->hc = dev_get_drvdata(pdev->dev.parent);
sbs->device = device;
strscpy(acpi_device_name(device), ACPI_SBS_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_SBS_CLASS);
result = acpi_charger_add(sbs);
if (result && result != -ENODEV)

View File

@@ -18,9 +18,6 @@
#include "sbshc.h"
#include "internal.h"
#define ACPI_SMB_HC_CLASS "smbus_host_ctl"
#define ACPI_SMB_HC_DEVICE_NAME "ACPI SMBus HC"
struct acpi_smb_hc {
struct acpi_ec *ec;
struct mutex lock;
@@ -251,9 +248,6 @@ static int acpi_smbus_hc_probe(struct platform_device *pdev)
return -EIO;
}
strscpy(acpi_device_name(device), ACPI_SMB_HC_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_SMB_HC_CLASS);
hc = kzalloc_obj(struct acpi_smb_hc);
if (!hc)
return -ENOMEM;

View File

@@ -35,7 +35,6 @@
#include "internal.h"
#define ACPI_THERMAL_CLASS "thermal_zone"
#define ACPI_THERMAL_DEVICE_NAME "Thermal Zone"
#define ACPI_THERMAL_NOTIFY_TEMPERATURE 0x80
#define ACPI_THERMAL_NOTIFY_THRESHOLDS 0x81
#define ACPI_THERMAL_NOTIFY_DEVICES 0x82
@@ -341,7 +340,7 @@ static void acpi_thermal_trips_update(struct acpi_thermal *tz, u32 event)
thermal_zone_for_each_trip(tz->thermal_zone,
acpi_thermal_adjust_trip, &atd);
acpi_queue_thermal_check(tz);
acpi_bus_generate_netlink_event(adev->pnp.device_class,
acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS,
dev_name(&adev->dev), event, 0);
}
@@ -543,7 +542,7 @@ static void acpi_thermal_zone_device_hot(struct thermal_zone_device *thermal)
{
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS,
dev_name(&tz->device->dev),
ACPI_THERMAL_NOTIFY_HOT, 1);
}
@@ -552,7 +551,7 @@ static void acpi_thermal_zone_device_critical(struct thermal_zone_device *therma
{
struct acpi_thermal *tz = thermal_zone_device_priv(thermal);
acpi_bus_generate_netlink_event(tz->device->pnp.device_class,
acpi_bus_generate_netlink_event(ACPI_THERMAL_CLASS,
dev_name(&tz->device->dev),
ACPI_THERMAL_NOTIFY_CRITICAL, 1);
@@ -800,8 +799,6 @@ static int acpi_thermal_probe(struct platform_device *pdev)
tz->device = device;
strscpy(tz->name, device->pnp.bus_id);
strscpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strscpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
acpi_thermal_aml_dependency_fix(tz);
@@ -879,8 +876,8 @@ static int acpi_thermal_probe(struct platform_device *pdev)
mutex_init(&tz->thermal_check_lock);
INIT_WORK(&tz->thermal_check_work, acpi_thermal_check_fn);
pr_info("%s [%s] (%ld C)\n", acpi_device_name(device),
acpi_device_bid(device), deci_kelvin_to_celsius(tz->temp_dk));
pr_info("Thermal Zone [%s] (%ld C)\n", acpi_device_bid(device),
deci_kelvin_to_celsius(tz->temp_dk));
result = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
acpi_thermal_notify, tz);

View File

@@ -502,6 +502,16 @@ struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev,
}
EXPORT_SYMBOL_GPL(__devm_auxiliary_device_create);
/**
* dev_is_auxiliary - check if the device is an auxiliary one
* @dev: device to check
*/
bool dev_is_auxiliary(struct device *dev)
{
return dev->bus == &auxiliary_bus_type;
}
EXPORT_SYMBOL_GPL(dev_is_auxiliary);
void __init auxiliary_bus_init(void)
{
WARN_ON(bus_register(&auxiliary_bus_type));

View File

@@ -26,8 +26,6 @@
#include <linux/types.h>
#define ACPI_AC_CLASS "ac_adapter"
struct atif_verify_interface {
u16 size; /* structure size in bytes (includes size field) */
u16 version; /* version */

View File

@@ -44,8 +44,6 @@ bool radeon_atpx_dgpu_req_power_for_displays(void);
static inline bool radeon_atpx_dgpu_req_power_for_displays(void) { return false; }
#endif
#define ACPI_AC_CLASS "ac_adapter"
struct atif_verify_interface {
u16 size; /* structure size in bytes (includes size field) */
u16 version; /* version */

View File

@@ -58,8 +58,6 @@ enum hp_ec_offsets {
#define HP_POWER_LIMIT_DEFAULT 0x00
#define HP_POWER_LIMIT_NO_CHANGE 0xFF
#define ACPI_AC_CLASS "ac_adapter"
#define zero_if_sup(tmp) (zero_insize_support?0:sizeof(tmp)) // use when zero insize is required
enum hp_thermal_profile_omen_v0 {

View File

@@ -53,7 +53,6 @@
#define LENOVO_CAPABILITY_DATA_01_GUID "7A8F5407-CB67-4D6E-B547-39B3BE018154"
#define LENOVO_FAN_TEST_DATA_GUID "B642801B-3D21-45DE-90AE-6E86F164FB21"
#define ACPI_AC_CLASS "ac_adapter"
#define ACPI_AC_NOTIFY_STATUS 0x80
#define LWMI_FEATURE_ID_FAN_TEST 0x05

View File

@@ -8,6 +8,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/watchdog.h>
#define NIWD_CONTROL 0x01
@@ -177,9 +178,9 @@ static const struct watchdog_ops ni903x_wdd_ops = {
.get_timeleft = ni903x_wdd_get_timeleft,
};
static int ni903x_acpi_add(struct acpi_device *device)
static int ni903x_acpi_probe(struct platform_device *pdev)
{
struct device *dev = &device->dev;
struct device *dev = &pdev->dev;
struct watchdog_device *wdd;
struct ni903x_wdt *wdt;
acpi_status status;
@@ -189,10 +190,10 @@ static int ni903x_acpi_add(struct acpi_device *device)
if (!wdt)
return -ENOMEM;
device->driver_data = wdt;
platform_set_drvdata(pdev, wdt);
wdt->dev = dev;
status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
status = acpi_walk_resources(ACPI_HANDLE(dev), METHOD_NAME__CRS,
ni903x_resources, wdt);
if (ACPI_FAILURE(status) || wdt->io_base == 0) {
dev_err(dev, "failed to get resources\n");
@@ -224,9 +225,9 @@ static int ni903x_acpi_add(struct acpi_device *device)
return 0;
}
static void ni903x_acpi_remove(struct acpi_device *device)
static void ni903x_acpi_remove(struct platform_device *pdev)
{
struct ni903x_wdt *wdt = acpi_driver_data(device);
struct ni903x_wdt *wdt = platform_get_drvdata(pdev);
ni903x_wdd_stop(&wdt->wdd);
watchdog_unregister_device(&wdt->wdd);
@@ -238,16 +239,16 @@ static const struct acpi_device_id ni903x_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, ni903x_device_ids);
static struct acpi_driver ni903x_acpi_driver = {
.name = NIWD_NAME,
.ids = ni903x_device_ids,
.ops = {
.add = ni903x_acpi_add,
.remove = ni903x_acpi_remove,
static struct platform_driver ni903x_acpi_driver = {
.probe = ni903x_acpi_probe,
.remove = ni903x_acpi_remove,
.driver = {
.name = NIWD_NAME,
.acpi_match_table = ni903x_device_ids,
},
};
module_acpi_driver(ni903x_acpi_driver);
module_platform_driver(ni903x_acpi_driver);
MODULE_DESCRIPTION("NI 903x Watchdog");
MODULE_AUTHOR("Jeff Westfahl <jeff.westfahl@ni.com>");

View File

@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <xen/xen.h>
#include <xen/interface/version.h>
#include <xen/xen-ops.h>
@@ -107,8 +108,9 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
}
}
static int acpi_pad_add(struct acpi_device *device)
static int acpi_pad_probe(struct platform_device *pdev)
{
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
acpi_status status;
strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
@@ -122,13 +124,13 @@ static int acpi_pad_add(struct acpi_device *device)
return 0;
}
static void acpi_pad_remove(struct acpi_device *device)
static void acpi_pad_remove(struct platform_device *pdev)
{
mutex_lock(&xen_cpu_lock);
xen_acpi_pad_idle_cpus(0);
mutex_unlock(&xen_cpu_lock);
acpi_remove_notify_handler(device->handle,
acpi_remove_notify_handler(ACPI_HANDLE(&pdev->dev),
ACPI_DEVICE_NOTIFY, acpi_pad_notify);
}
@@ -137,13 +139,12 @@ static const struct acpi_device_id pad_device_ids[] = {
{"", 0},
};
static struct acpi_driver acpi_pad_driver = {
.name = "processor_aggregator",
.class = ACPI_PROCESSOR_AGGREGATOR_CLASS,
.ids = pad_device_ids,
.ops = {
.add = acpi_pad_add,
.remove = acpi_pad_remove,
static struct platform_driver acpi_pad_driver = {
.probe = acpi_pad_probe,
.remove = acpi_pad_remove,
.driver = {
.name = "acpi_processor_aggregator",
.acpi_match_table = pad_device_ids,
},
};
@@ -157,6 +158,6 @@ static int __init xen_acpi_pad_init(void)
if (!xen_running_on_version_or_later(4, 2))
return -ENODEV;
return acpi_bus_register_driver(&acpi_pad_driver);
return platform_driver_register(&acpi_pad_driver);
}
subsys_initcall(xen_acpi_pad_init);

View File

@@ -613,6 +613,8 @@ struct acpi_bus_event {
u32 data;
};
#define ACPI_AC_CLASS "ac_adapter"
extern struct kobject *acpi_kobj;
extern int acpi_bus_generate_netlink_event(const char*, const char*, u8, int);
void acpi_bus_private_data_handler(acpi_handle, void *);
@@ -625,7 +627,8 @@ int acpi_dev_install_notify_handler(struct acpi_device *adev,
void acpi_dev_remove_notify_handler(struct acpi_device *adev,
u32 handler_type,
acpi_notify_handler handler);
extern int acpi_notifier_call_chain(struct acpi_device *, u32, u32);
extern int acpi_notifier_call_chain(const char *device_class,
const char *bus_id, u32 type, u32 data);
extern int register_acpi_notifier(struct notifier_block *);
extern int unregister_acpi_notifier(struct notifier_block *);

View File

@@ -14,8 +14,6 @@
#include <asm/acpi.h>
#define ACPI_PROCESSOR_CLASS "processor"
#define ACPI_PROCESSOR_DEVICE_NAME "Processor"
#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
#define ACPI_PROCESSOR_CONTAINER_HID "ACPI0010"

View File

@@ -271,6 +271,8 @@ struct auxiliary_device *__devm_auxiliary_device_create(struct device *dev,
__devm_auxiliary_device_create(dev, KBUILD_MODNAME, devname, \
platform_data, 0)
bool dev_is_auxiliary(struct device *dev);
/**
* module_auxiliary_driver() - Helper macro for registering an auxiliary driver
* @__auxiliary_driver: auxiliary driver struct