linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH v4 5/5] acpi: battery_common: battery present status for INT3407
Date: Wed, 29 Jun 2016 17:00:19 -0700	[thread overview]
Message-ID: <1467244819-19046-6-git-send-email-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <1467244819-19046-1-git-send-email-srinivas.pandruvada@linux.intel.com>

acpi_battery_get_status() will be called often to check if the battery is
present. This call sets status.battery_present field to return the status.
But When enumerated via DPTF power (INT3407), since this field will not be
set as this is not a battery but it will still set the status.present
field. So a check is added when hid is INT3407 check for the presence and
set the status.battery_present flag, so that the rest of the driver calls
don't fail looking for status.battery_present flag.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 drivers/acpi/battery_common.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/acpi/battery_common.c b/drivers/acpi/battery_common.c
index aaf32ab..89966c4 100644
--- a/drivers/acpi/battery_common.c
+++ b/drivers/acpi/battery_common.c
@@ -387,6 +387,11 @@ static int acpi_battery_get_status(struct acpi_battery *battery)
 		return -ENODEV;
 	}
 
+	if (!strcmp(acpi_device_hid(battery->device), "INT3407")) {
+		if (battery->device->status.present)
+			battery->device->status.battery_present = 1;
+	}
+
 	return 0;
 }
 
-- 
2.5.0


      parent reply	other threads:[~2016-06-29 23:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  0:00 [PATCH v4 0/5] DPTF Platform power participant driver Srinivas Pandruvada
2016-06-30  0:00 ` [PATCH v4 1/5] acpi: battery: Split battery driver for reuse by DPTF power participant Srinivas Pandruvada
2016-06-30 22:08   ` Rafael J. Wysocki
2016-06-30 22:39     ` Srinivas Pandruvada
2016-06-30  0:00 ` [PATCH v4 2/5] acpi: battery: make optional power_supply register Srinivas Pandruvada
2016-06-30 22:10   ` Rafael J. Wysocki
2016-06-30  0:00 ` [PATCH v4 3/5] acpi: battery: allow externel access of battery information Srinivas Pandruvada
2016-06-30  0:00 ` [PATCH v4 4/5] acpi: dptf_power: Add DPTF power participant Srinivas Pandruvada
2016-06-30 22:15   ` Rafael J. Wysocki
2016-06-30  0:00 ` Srinivas Pandruvada [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1467244819-19046-6-git-send-email-srinivas.pandruvada@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).