Several core ACPI device drivers set acpi_device_class() for the given
struct acpi_device to whatever they like, but that value is never used
unless the driver itself uses it and, sadly, they neglect to clear it on
remove. Since the only one of them still using acpi_device_class()
after previous changes is the button driver, update the others to stop
setting it in vain. Also drop the related device class sybmols that
become redundant.
Since the ACPI button driver continues to use acpi_device_class(), make
it clear the struct field represented by acpi_device_class() in its
remove callback.
No intentional functional impact.
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3706295.iIbC2pHGDl@rafael.j.wysocki
return -ENOMEM;
ac->device = adev;
- strscpy(acpi_device_class(adev), ACPI_AC_CLASS);
platform_set_drvdata(pdev, ac);
#include "internal.h"
-#define ACPI_MEMORY_DEVICE_CLASS "memory"
#define ACPI_MEMORY_DEVICE_HID "PNP0C80"
static const struct acpi_device_id memory_device_ids[] = {
INIT_LIST_HEAD(&mem_device->res_list);
mem_device->device = device;
mem_device->mgid = -1;
- sprintf(acpi_device_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
device->driver_data = mem_device;
/* Get the range from the _CRS */
#include <asm/mwait.h>
#include <xen/xen.h>
-#define ACPI_PROCESSOR_AGGREGATOR_CLASS "acpi_pad"
#define ACPI_PROCESSOR_AGGREGATOR_NOTIFY 0x80
#define ACPI_PROCESSOR_AGGREGATOR_STATUS_SUCCESS 0
switch (event) {
case ACPI_PROCESSOR_AGGREGATOR_NOTIFY:
acpi_pad_handle_notify(handle);
- acpi_bus_generate_netlink_event(ACPI_PROCESSOR_AGGREGATOR_CLASS,
+ acpi_bus_generate_netlink_event("acpi_pad",
dev_name(&adev->dev), event, 0);
break;
default:
{
struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
- strscpy(acpi_device_class(adev), ACPI_PROCESSOR_AGGREGATOR_CLASS);
-
return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acpi_pad_notify, adev);
}
}
pr->handle = device->handle;
- strscpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
device->driver_data = pr;
result = acpi_processor_get_info(device);
return -ENOMEM;
}
- strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
-
data->device_id = device_id;
data->video = video;
data->dev = device;
auxiliary_set_drvdata(aux_dev, video);
video->device = device;
- strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
device->driver_data = video;
acpi_video_bus_find_cap(video);
platform_set_drvdata(pdev, battery);
battery->device = device;
- strscpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
result = devm_mutex_init(&pdev->dev, &battery->update_lock);
if (result)
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,
#include "internal.h"
-#define ACPI_EC_CLASS "embedded_controller"
-
/* EC status register */
#define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */
#define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */
struct acpi_ec *ec;
int ret;
- 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. */
#include "internal.h"
-#define ACPI_PCI_LINK_CLASS "pci_irq_routing"
#define ACPI_PCI_LINK_MAX_POSSIBLE 16
static int acpi_pci_link_add(struct acpi_device *device,
return -ENOMEM;
link->device = device;
- strscpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS);
device->driver_data = link;
mutex_lock(&acpi_link_lock);
#include <linux/platform_data/x86/apple.h>
#include "internal.h"
-#define ACPI_PCI_ROOT_CLASS "pci_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);
root->device = device;
root->segment = segment & 0xFFFF;
- strscpy(acpi_device_class(device), ACPI_PCI_ROOT_CLASS);
device->driver_data = root;
if (hotadd && dmar_device_add(handle)) {
#include "sleep.h"
#include "internal.h"
-#define ACPI_POWER_CLASS "power_resource"
#define ACPI_POWER_RESOURCE_STATE_OFF 0x00
#define ACPI_POWER_RESOURCE_STATE_ON 0x01
#define ACPI_POWER_RESOURCE_STATE_UNKNOWN 0xFF
mutex_init(&resource->resource_lock);
INIT_LIST_HEAD(&resource->list_node);
INIT_LIST_HEAD(&resource->dependents);
- strscpy(acpi_device_class(device), ACPI_POWER_CLASS);
device->power.state = ACPI_STATE_UNKNOWN;
device->flags.match_driver = true;
return;
}
- acpi_bus_generate_netlink_event(ACPI_PROCESSOR_CLASS,
- dev_name(&device->dev), event, ev_data);
+ acpi_bus_generate_netlink_event("processor", dev_name(&device->dev),
+ event, ev_data);
}
static int __acpi_processor_start(struct acpi_device *device);
#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"
sbs->hc = dev_get_drvdata(pdev->dev.parent);
sbs->device = device;
- strscpy(acpi_device_class(device), ACPI_SBS_CLASS);
result = acpi_charger_add(sbs);
if (result && result != -ENODEV)
#include "sbshc.h"
#include "internal.h"
-#define ACPI_SMB_HC_CLASS "smbus_host_ctl"
-
struct acpi_smb_hc {
struct acpi_ec *ec;
struct mutex lock;
return -EIO;
}
- strscpy(acpi_device_class(device), ACPI_SMB_HC_CLASS);
-
hc = kzalloc_obj(struct acpi_smb_hc);
if (!hc)
return -ENOMEM;
tz->device = device;
strscpy(tz->name, device->pnp.bus_id);
- strscpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
acpi_thermal_aml_dependency_fix(tz);
#include <asm/acpi.h>
-#define ACPI_PROCESSOR_CLASS "processor"
#define ACPI_PROCESSOR_DEVICE_HID "ACPI0007"
#define ACPI_PROCESSOR_CONTAINER_HID "ACPI0010"