Re: [PATCH v4 2/5] acpi: battery: make optional power_supply register

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

 



On Thu, Jun 30, 2016 at 2:00 AM, Srinivas Pandruvada
<srinivas.pandruvada@xxxxxxxxxxxxxxx> wrote:
> Added additional paramater to acpi_battery_common_add(), which makes it
> optional to register with power_supply class or /proc/acpi/battery.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@xxxxxxxxxxxxxxx>
> ---
>  drivers/acpi/battery.c        |  7 ++++++-
>  drivers/acpi/battery.h        |  2 +-
>  drivers/acpi/battery_common.c | 27 +++++++++++++++++----------
>  3 files changed, 24 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index a5c9bde..5482d50 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -85,13 +85,18 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
>
>  static SIMPLE_DEV_PM_OPS(acpi_battery_pm, NULL, acpi_battery_common_resume);
>
> +static int acpi_battery_add(struct acpi_device *device)
> +{
> +       return acpi_battery_common_add(device, true);
> +}
> +
>  static struct acpi_driver acpi_battery_driver = {
>         .name = "battery",
>         .class = ACPI_BATTERY_CLASS,
>         .ids = battery_device_ids,
>         .flags = ACPI_DRIVER_ALL_NOTIFY_EVENTS,
>         .ops = {
> -               .add = acpi_battery_common_add,
> +               .add = acpi_battery_add,
>                 .remove = acpi_battery_common_remove,
>                 .notify = acpi_battery_common_notify,
>                 },
> diff --git a/drivers/acpi/battery.h b/drivers/acpi/battery.h
> index 99cac62..626093c 100644
> --- a/drivers/acpi/battery.h
> +++ b/drivers/acpi/battery.h
> @@ -26,7 +26,7 @@ extern int battery_bix_broken_package;
>  extern int battery_notification_delay_ms;
>  extern struct proc_dir_entry *acpi_battery_dir;
>
> -int acpi_battery_common_add(struct acpi_device *device);
> +int acpi_battery_common_add(struct acpi_device *device, bool power_supply_register);

I would call the second argument "real_battery" or similar.  An
analogously the new field in struct acpi_battery.

Then, I'd register with the power supply class if real_battery was true.
--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux