Skip to contentSkip to conversation

battery hot add

DISCUSSION Len Brown 3 participants 3 messages Aug 18, 2007 – Aug 20, 2007 ACPI

lore
Share & tools
lore
#2 lore raw
In reply to Len Brown
Quoted 7 lines · Len Brown

Shaohua,
do you plan to update your battery hot-add patch here?:

http://bugzilla.kernel.org/show_bug.cgi?id=2884

Alexey,
as the battery maintainer, have you run into this problem on other systems?

IMO this should get fixed by always registering an ACPI device even if its status is not present.
The code has changed here a bit, but it should be this line (possibly more):
drivers/acpi/scan.c:acpi_add_single_object()

	case ACPI_BUS_TYPE_DEVICE:
		result = acpi_bus_get_status(device);
		if (ACPI_FAILURE(result) || !device->status.present) {
			result = -ENOENT;
			goto end;
		}
		break;

I worked on that quite a while ago, sent some ideas, but never got much response.
Main question is why do ACPI devices not get registered if they are not present, is there a specific reason for that?

IMO add/remove functions should called on every device, present or not. start/stop functions should be called for devices that are present at init time or get (un)present later?

If this can be done (register not present devices) battery hotplug is working out of the box and about 300 lines can be thrown out of acpi_memhotplug.c which works around this. Container, dock, bay and other hotplugable devices may also benefit from that change.

Thomas