mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-04 14:44:55 -04:00
Merge branches 'acpi-battery', 'acpi-button' and 'acpi-driver'
Merge additional updates of multiple core ACPI device drivers (battery, button, video, EC, SMBUS HC) for 7.0-rc1: - Drop redundant checks from the ACPI notify handler and the driver remove callback in the ACPI battery driver (Rafael Wysocki) - Move the creation of the wakeup source during the ACPI button driver probe to an earlier point to avoid missing a wakeup event due to a race and clean up system wakeup handling and remove callback in that driver (Rafael Wysocki) - Drop unnecessary driver_data pointer clearing from the ACPI EC and SMBUS HC drivers and make the ACPI backlight (video) driver clear the device's driver_data pointer on remove (Rafael Wysocki) * acpi-battery: ACPI: battery: Drop redundant checks from acpi_battery_remove() ACPI: battery: Drop redundant check from acpi_battery_notify() * acpi-button: ACPI: button: Tweak acpi_button_remove() ACPI: button: Tweak system wakeup handling ACPI: button: Call device_init_wakeup() earlier during probe * acpi-driver: ACPI: driver: Drop driver_data pointer clearing from two drivers ACPI: video: Clear driver_data pointer on remove
This commit is contained in:
@@ -2116,6 +2116,7 @@ static void acpi_video_bus_remove(struct platform_device *pdev)
|
||||
|
||||
kfree(video->attached_array);
|
||||
kfree(video);
|
||||
device->driver_data = NULL;
|
||||
}
|
||||
|
||||
static int __init is_i740(struct pci_dev *dev)
|
||||
|
||||
@@ -1066,9 +1066,6 @@ static void acpi_battery_notify(acpi_handle handle, u32 event, void *data)
|
||||
struct acpi_device *device = battery->device;
|
||||
struct power_supply *old;
|
||||
|
||||
if (!battery)
|
||||
return;
|
||||
|
||||
guard(mutex)(&battery->update_lock);
|
||||
|
||||
old = battery->bat;
|
||||
@@ -1274,13 +1271,9 @@ static int acpi_battery_probe(struct platform_device *pdev)
|
||||
|
||||
static void acpi_battery_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
struct acpi_battery *battery = platform_get_drvdata(pdev);
|
||||
|
||||
if (!device || !battery)
|
||||
return;
|
||||
|
||||
acpi_dev_remove_notify_handler(device, ACPI_ALL_NOTIFY,
|
||||
acpi_dev_remove_notify_handler(battery->device, ACPI_ALL_NOTIFY,
|
||||
acpi_battery_notify);
|
||||
|
||||
device_init_wakeup(&pdev->dev, false);
|
||||
|
||||
@@ -170,7 +170,7 @@ static struct platform_driver acpi_button_driver = {
|
||||
|
||||
struct acpi_button {
|
||||
struct acpi_device *adev;
|
||||
struct platform_device *pdev;
|
||||
struct device *dev; /* physical button device */
|
||||
unsigned int type;
|
||||
struct input_dev *input;
|
||||
char phys[32]; /* for input device */
|
||||
@@ -398,7 +398,7 @@ static int acpi_lid_update_state(struct acpi_button *button,
|
||||
return state;
|
||||
|
||||
if (state && signal_wakeup)
|
||||
acpi_pm_wakeup_event(&button->pdev->dev);
|
||||
acpi_pm_wakeup_event(button->dev);
|
||||
|
||||
return acpi_lid_notify_state(button, state);
|
||||
}
|
||||
@@ -455,7 +455,7 @@ static void acpi_button_notify(acpi_handle handle, u32 event, void *data)
|
||||
return;
|
||||
}
|
||||
|
||||
acpi_pm_wakeup_event(&button->pdev->dev);
|
||||
acpi_pm_wakeup_event(button->dev);
|
||||
|
||||
if (button->suspended || event == ACPI_BUTTON_NOTIFY_WAKE)
|
||||
return;
|
||||
@@ -550,7 +550,7 @@ static int acpi_button_probe(struct platform_device *pdev)
|
||||
|
||||
platform_set_drvdata(pdev, button);
|
||||
|
||||
button->pdev = pdev;
|
||||
button->dev = &pdev->dev;
|
||||
button->adev = device;
|
||||
button->input = input = input_allocate_device();
|
||||
if (!input) {
|
||||
@@ -625,6 +625,8 @@ static int acpi_button_probe(struct platform_device *pdev)
|
||||
goto err_remove_fs;
|
||||
}
|
||||
|
||||
device_init_wakeup(button->dev, true);
|
||||
|
||||
switch (device->device_type) {
|
||||
case ACPI_BUS_TYPE_POWER_BUTTON:
|
||||
status = acpi_install_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
|
||||
@@ -655,11 +657,11 @@ static int acpi_button_probe(struct platform_device *pdev)
|
||||
lid_device = device;
|
||||
}
|
||||
|
||||
device_init_wakeup(&pdev->dev, true);
|
||||
pr_info("%s [%s]\n", name, acpi_device_bid(device));
|
||||
return 0;
|
||||
|
||||
err_input_unregister:
|
||||
device_init_wakeup(button->dev, false);
|
||||
input_unregister_device(input);
|
||||
err_remove_fs:
|
||||
acpi_button_remove_fs(button);
|
||||
@@ -670,10 +672,10 @@ static int acpi_button_probe(struct platform_device *pdev)
|
||||
|
||||
static void acpi_button_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
struct acpi_button *button = platform_get_drvdata(pdev);
|
||||
struct acpi_device *adev = button->adev;
|
||||
|
||||
switch (device->device_type) {
|
||||
switch (adev->device_type) {
|
||||
case ACPI_BUS_TYPE_POWER_BUTTON:
|
||||
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
|
||||
acpi_button_event);
|
||||
@@ -683,7 +685,7 @@ static void acpi_button_remove(struct platform_device *pdev)
|
||||
acpi_button_event);
|
||||
break;
|
||||
default:
|
||||
acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY,
|
||||
acpi_remove_notify_handler(adev->handle, ACPI_DEVICE_NOTIFY,
|
||||
button->type == ACPI_BUTTON_TYPE_LID ?
|
||||
acpi_lid_notify :
|
||||
acpi_button_notify);
|
||||
@@ -691,6 +693,8 @@ static void acpi_button_remove(struct platform_device *pdev)
|
||||
}
|
||||
acpi_os_wait_events_complete();
|
||||
|
||||
device_init_wakeup(button->dev, false);
|
||||
|
||||
acpi_button_remove_fs(button);
|
||||
input_unregister_device(button->input);
|
||||
kfree(button);
|
||||
|
||||
@@ -1754,12 +1754,10 @@ static int acpi_ec_probe(struct platform_device *pdev)
|
||||
|
||||
static void acpi_ec_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
struct acpi_ec *ec = platform_get_drvdata(pdev);
|
||||
|
||||
release_region(ec->data_addr, 1);
|
||||
release_region(ec->command_addr, 1);
|
||||
device->driver_data = NULL;
|
||||
if (ec != boot_ec) {
|
||||
ec_remove_handlers(ec);
|
||||
acpi_ec_free(ec);
|
||||
|
||||
@@ -275,13 +275,11 @@ static int acpi_smbus_hc_probe(struct platform_device *pdev)
|
||||
|
||||
static void acpi_smbus_hc_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
struct acpi_smb_hc *hc = platform_get_drvdata(pdev);
|
||||
|
||||
acpi_ec_remove_query_handler(hc->ec, hc->query_bit);
|
||||
acpi_os_wait_events_complete();
|
||||
kfree(hc);
|
||||
device->driver_data = NULL;
|
||||
}
|
||||
|
||||
module_platform_driver(acpi_smb_hc_driver);
|
||||
|
||||
Reference in New Issue
Block a user