[PATCH 2/2] Added parameter for selection power supply name from pdata

Rhyland Klein rklein at nvidia.com
Tue Dec 6 10:57:03 EST 2011


Change-Id: Ib0a41ff9ac8c1fc97aa7a87320f8d95be7988d71
Signed-off-by: Rhyland Klein <rklein at nvidia.com>
---
 drivers/power/sbs-battery.c       |    2 +-
 include/linux/power/sbs-battery.h |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/power/sbs-battery.c b/drivers/power/sbs-battery.c
index 1e60a54..567b8c1 100644
--- a/drivers/power/sbs-battery.c
+++ b/drivers/power/sbs-battery.c
@@ -615,7 +615,7 @@ static int __devinit sbs_probe(struct i2c_client *client,
 	chip->client = client;
 	chip->enable_detection = false;
 	chip->gpio_detect = false;
-	chip->power_supply.name = "battery";
+	chip->power_supply.name = (pdata->power_supply_name ? : "battery");
 	chip->power_supply.type = POWER_SUPPLY_TYPE_BATTERY;
 	chip->power_supply.properties = sbs_properties;
 	chip->power_supply.num_properties = ARRAY_SIZE(sbs_properties);
diff --git a/include/linux/power/sbs-battery.h b/include/linux/power/sbs-battery.h
index 2b0a9d9..fa9bc89 100644
--- a/include/linux/power/sbs-battery.h
+++ b/include/linux/power/sbs-battery.h
@@ -31,12 +31,14 @@
  * @i2c_retry_count:		# of times to retry on i2c IO failure
  * @poll_retry_count:		# of times to retry looking for new status after
  *				external change notification
+ * @power_supply_name:		Optional name for power supply: default: battery
  */
 struct sbs_platform_data {
 	int battery_detect;
 	int battery_detect_present;
 	int i2c_retry_count;
 	int poll_retry_count;
+	const char *power_supply_name;
 };
 
 #endif
-- 
1.7.0.4



More information about the devicetree-discuss mailing list