Commit e1894703 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

ACPI: driver: Do not set acpi_device_class() unnecessarily



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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3706295.iIbC2pHGDl@rafael.j.wysocki
parent 76866c91
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -203,7 +203,6 @@ static int acpi_ac_probe(struct platform_device *pdev)
		return -ENOMEM;

	ac->device = adev;
	strscpy(acpi_device_class(adev), ACPI_AC_CLASS);

	platform_set_drvdata(pdev, ac);

+0 −2
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@

#include "internal.h"

#define ACPI_MEMORY_DEVICE_CLASS		"memory"
#define ACPI_MEMORY_DEVICE_HID			"PNP0C80"

static const struct acpi_device_id memory_device_ids[] = {
@@ -296,7 +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_class(device), "%s", ACPI_MEMORY_DEVICE_CLASS);
	device->driver_data = mem_device;

	/* Get the range from the _CRS */
+1 −4
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@
#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
@@ -413,7 +412,7 @@ static void acpi_pad_notify(acpi_handle handle, u32 event, void *data)
	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:
@@ -426,8 +425,6 @@ static int acpi_pad_probe(struct platform_device *pdev)
{
	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);
}
+0 −1
Original line number Diff line number Diff line
@@ -438,7 +438,6 @@ static int acpi_processor_add(struct acpi_device *device,
	}

	pr->handle = device->handle;
	strscpy(acpi_device_class(device), ACPI_PROCESSOR_CLASS);
	device->driver_data = pr;

	result = acpi_processor_get_info(device);
+0 −3
Original line number Diff line number Diff line
@@ -1141,8 +1141,6 @@ static int acpi_video_bus_get_one_device(struct acpi_device *device, void *arg)
		return -ENOMEM;
	}

	strscpy(acpi_device_class(device), ACPI_VIDEO_CLASS);

	data->device_id = device_id;
	data->video = video;
	data->dev = device;
@@ -2018,7 +2016,6 @@ static int acpi_video_bus_probe(struct auxiliary_device *aux_dev,
	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);
Loading