Skip to content

Commit e370cc8

Browse files
bentissrafaeljw
authored andcommitted
ACPI / button: remove pointer to old lid_sysfs on unbind
When we removed the procfs dir on error or if the driver is unbound, the two variables acpi_lid_dir and acpi_button_dir were not reset. On the next rebind, those static variables were not null and we couldn't re-register the device again. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Acked-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 3540c32 commit e370cc8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/acpi/button.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,10 @@ static int acpi_button_add_fs(struct acpi_device *device)
232232
acpi_device_dir(device) = NULL;
233233
remove_lid_dir:
234234
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
235+
acpi_lid_dir = NULL;
235236
remove_button_dir:
236237
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
238+
acpi_button_dir = NULL;
237239
goto done;
238240
}
239241

@@ -250,7 +252,9 @@ static int acpi_button_remove_fs(struct acpi_device *device)
250252
acpi_lid_dir);
251253
acpi_device_dir(device) = NULL;
252254
remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir);
255+
acpi_lid_dir = NULL;
253256
remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir);
257+
acpi_button_dir = NULL;
254258

255259
return 0;
256260
}

0 commit comments

Comments
 (0)