All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frank Praznik <frank.praznik@oh.rr.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, Frank Praznik <frank.praznik@oh.rr.com>
Subject: [PATCH v4 5/7] HID: sony: Use the controller Bluetooth MAC address as the unique value in the battery name string
Date: Wed,  2 Apr 2014 12:31:23 -0400	[thread overview]
Message-ID: <1396456285-23755-6-git-send-email-frank.praznik@oh.rr.com> (raw)
In-Reply-To: <1396456285-23755-1-git-send-email-frank.praznik@oh.rr.com>

Use the controller Bluetooth MAC address as the unique identifier in the
battery name string instead of the atomic integer that was used before.

Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
---

 drivers/hid/hid-sony.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index a86542a..c709161 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1413,8 +1413,6 @@ static int sony_battery_get_property(struct power_supply *psy,
 
 static int sony_battery_probe(struct sony_sc *sc)
 {
-	static atomic_t power_id_seq = ATOMIC_INIT(0);
-	unsigned long power_id;
 	struct hid_device *hdev = sc->hdev;
 	int ret;
 
@@ -1424,15 +1422,13 @@ static int sony_battery_probe(struct sony_sc *sc)
 	 */
 	sc->battery_capacity = 100;
 
-	power_id = (unsigned long)atomic_inc_return(&power_id_seq);
-
 	sc->battery.properties = sony_battery_props;
 	sc->battery.num_properties = ARRAY_SIZE(sony_battery_props);
 	sc->battery.get_property = sony_battery_get_property;
 	sc->battery.type = POWER_SUPPLY_TYPE_BATTERY;
 	sc->battery.use_for_apm = 0;
-	sc->battery.name = kasprintf(GFP_KERNEL, "sony_controller_battery_%lu",
-				     power_id);
+	sc->battery.name = kasprintf(GFP_KERNEL, "sony_controller_battery_%pMR",
+				     sc->mac_address);
 	if (!sc->battery.name)
 		return -ENOMEM;
 
-- 
1.8.3.2


  parent reply	other threads:[~2014-04-02 16:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-02 16:31 [PATCH v4 0/7] HID: sony: More Sony controller fixes and improvements Frank Praznik
2014-04-02 16:31 ` [PATCH v4 1/7] HID: sony: Fix cancel_work_sync mismerge Frank Praznik
2014-04-03 12:24   ` Jiri Kosina
2014-04-02 16:31 ` [PATCH v4 2/7] HID: sony: Use inliners for work queue initialization and cancellation Frank Praznik
2014-04-02 16:31 ` [PATCH v4 3/7] HID: sony: Use a struct for the Sixaxis output report Frank Praznik
2014-04-02 16:31 ` [PATCH v4 4/7] HID: sony: Convert startup and shutdown functions to use a uniform parameter type Frank Praznik
2014-04-02 16:31 ` Frank Praznik [this message]
2014-04-02 16:31 ` [PATCH v4 6/7] HID: sony: Initialize the controller LEDs with a device ID value Frank Praznik
2014-04-02 16:31 ` [PATCH v4 7/7] HID: sony: Add blink support to the Sixaxis and DualShock 4 LEDs Frank Praznik
2014-04-04  5:55   ` simon
     [not found]     ` <533EBE48.5010100@oh.rr.com>
2014-04-04 16:11       ` simon
2014-04-04 18:37         ` Frank Praznik
2014-04-04 21:13           ` simon
2014-04-04 23:41             ` Frank Praznik
2014-04-09  5:51       ` simon
2014-04-09 17:41         ` Frank Praznik
2014-04-02 22:36 ` [PATCH v4 0/7] HID: sony: More Sony controller fixes and improvements Jiri Kosina

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=1396456285-23755-6-git-send-email-frank.praznik@oh.rr.com \
    --to=frank.praznik@oh.rr.com \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.