Re: [PATCH 1/3 v6] battery: Add the battery hooking API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 18/12/2017, Rafael J. Wysocki <rafael@xxxxxxxxxx> wrote:
>
> What if a module registering the hook is loaded after
> sysfs_add_battery() has run for the battery object in question?

The battery module keeps track of the batteries that get added or removed
from the system. When a hook is registered, it will always get a list
of currently
present batteries not matter of the time when the hook is loaded.

> What if it attempts to register a hook while this code is running?

If was not able to produce any race conditions, but I have added some locking
mechanisms in the new, 7th revision of the patch.

> What if two entities try to add or remove hooks simultaneously?

This has been solved in version 7 with mutual exclusions.

> Don't you think any locking or other synchronization is necessary?

I have implemented mutual exclusions.

> Also, what if someone attempts to add a hook when the ACPI battery
> module is not loaded?  Will that still work?

The module that requests the hooks will fail to load with the following

> [  149.259127] thinkpad_acpi: Unknown symbol battery_hook_register (err 0)
> [  149.259158] thinkpad_acpi: Unknown symbol battery_hook_unregister (err 0)

> Thanks,
> Rafael
>

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ibm-acpi-devel mailing list
ibm-acpi-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/ibm-acpi-devel



[Index of Archives]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Photo]     [Yosemite Photos]     [Yosemite Advice]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]

  Powered by Linux