Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1406841

Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver

From Jon Hunter <jonathanh@nvidia.com>
Newsgroups linux.kernel
Subject Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver
Date 2016-05-25 13:10 +0200
Message-ID <rCERj-he-7@gated-at.bofh.it> (permalink)
References <ruKKe-2eW-21@gated-at.bofh.it> <rClbX-4eE-17@gated-at.bofh.it> <rCpSi-7fZ-15@gated-at.bofh.it> <rCEHD-8qn-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 25/05/16 11:58, Jon Hunter wrote:

...

> Looking at this a bit more I am wondering if we should prevent the
> battery for being polled before the registration has completed ...
> 
> diff --git a/drivers/power/bq27xxx_battery.c
> b/drivers/power/bq27xxx_battery.c
> index 45f6ebf88df6..32649183ecd9 100644
> --- a/drivers/power/bq27xxx_battery.c
> +++ b/drivers/power/bq27xxx_battery.c
> @@ -871,12 +871,14 @@ static int bq27xxx_battery_get_property(struct
> power_supply *psy,
>         int ret = 0;
>         struct bq27xxx_device_info *di = power_supply_get_drvdata(psy);
> 
> -       mutex_lock(&di->lock);
> -       if (time_is_before_jiffies(di->last_update + 5 * HZ)) {
> -               cancel_delayed_work_sync(&di->work);
> -               bq27xxx_battery_poll(&di->work.work);
> +       if (di->bat) {
> +               mutex_lock(&di->lock);
> +               if (time_is_before_jiffies(di->last_update + 5 * HZ)) {
> +                       cancel_delayed_work_sync(&di->work);
> +                       bq27xxx_battery_poll(&di->work.work);
> +               }
> +               mutex_unlock(&di->lock);
>         }
> -       mutex_unlock(&di->lock);

Alternatively, maybe the following is simpler ...

diff --git a/drivers/power/bq27xxx_battery.c
b/drivers/power/bq27xxx_battery.c
index 45f6ebf88df6..8a713b52e9f6 100644
--- a/drivers/power/bq27xxx_battery.c
+++ b/drivers/power/bq27xxx_battery.c
@@ -733,7 +733,8 @@ static void bq27xxx_battery_poll(struct work_struct
*work)
                        container_of(work, struct bq27xxx_device_info,
                                     work.work);

-       bq27xxx_battery_update(di);
+       if (di->bat)
+               bq27xxx_battery_update(di);

Jon

-- 
nvpublic

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-24 16:10 +0200
  Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Rhyland Klein <rklein@nvidia.com> - 2016-05-24 21:10 +0200
    Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 13:00 +0200
      Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 13:10 +0200
        Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Thierry Reding <treding@nvidia.com> - 2016-05-25 17:50 +0200
          Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 18:00 +0200
          Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Rhyland Klein <rklein@nvidia.com> - 2016-05-25 18:00 +0200
            Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 18:20 +0200
              Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 18:30 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 18:40 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Rhyland Klein <rklein@nvidia.com> - 2016-05-25 18:40 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-25 19:30 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Rhyland Klein <rklein@nvidia.com> - 2016-05-25 21:50 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-26 12:40 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-27 10:40 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-27 11:30 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-27 12:30 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-27 13:50 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Jon Hunter <jonathanh@nvidia.com> - 2016-05-27 14:20 +0200
                Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Krzysztof Kozlowski <k.kozlowski@samsung.com> - 2016-05-27 15:00 +0200
        Re: [PATCH] arm64: defconfig: Enable cros-ec and battery driver Rhyland Klein <rklein@nvidia.com> - 2016-05-25 18:00 +0200

csiph-web