linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] HID: sony: Print reversed MAC address via %pMR
@ 2017-12-11 13:06 Andy Shevchenko
  2017-12-13  2:22 ` Colenbrander, Roelof
  2018-01-23 14:38 ` Jiri Kosina
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2017-12-11 13:06 UTC (permalink / raw)
  To: Jiri Kosina, Benjamin Tissoires, linux-input,
	Roderick Colenbrander
  Cc: Andy Shevchenko

Reversed MAC addresses can be printed directly using %pMR specifier.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/hid/hid-sony.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index b9dc3ac4d4aa..138fd44d3c91 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -2399,10 +2399,7 @@ static int sony_check_add(struct sony_sc *sc)
 		memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
 
 		snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
-			"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
-			sc->mac_address[5], sc->mac_address[4],
-			sc->mac_address[3], sc->mac_address[2],
-			sc->mac_address[1], sc->mac_address[0]);
+			 "%pMR", sc->mac_address);
 	} else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
 			(sc->quirks & NAVIGATION_CONTROLLER_USB)) {
 		buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
@@ -2432,10 +2429,7 @@ static int sony_check_add(struct sony_sc *sc)
 			sc->mac_address[5-n] = buf[4+n];
 
 		snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
-			"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
-			sc->mac_address[5], sc->mac_address[4],
-			sc->mac_address[3], sc->mac_address[2],
-			sc->mac_address[1], sc->mac_address[0]);
+			 "%pMR", sc->mac_address);
 	} else {
 		return 0;
 	}
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
  2017-12-11 13:06 [PATCH v1] HID: sony: Print reversed MAC address via %pMR Andy Shevchenko
@ 2017-12-13  2:22 ` Colenbrander, Roelof
  2017-12-19 17:20   ` Andy Shevchenko
  2018-01-23 14:38 ` Jiri Kosina
  1 sibling, 1 reply; 6+ messages in thread
From: Colenbrander, Roelof @ 2017-12-13  2:22 UTC (permalink / raw)
  To: Andy Shevchenko, Jiri Kosina, Benjamin Tissoires,
	linux-input@vger.kernel.org

On 12/11/2017 05:07 AM, Andy Shevchenko wrote:
> Reversed MAC addresses can be printed directly using %pMR specifier.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>   drivers/hid/hid-sony.c | 10 ++--------
>   1 file changed, 2 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
> index b9dc3ac4d4aa..138fd44d3c91 100644
> --- a/drivers/hid/hid-sony.c
> +++ b/drivers/hid/hid-sony.c
> @@ -2399,10 +2399,7 @@ static int sony_check_add(struct sony_sc *sc)
>   		memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
>   
>   		snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
> -			"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
> -			sc->mac_address[5], sc->mac_address[4],
> -			sc->mac_address[3], sc->mac_address[2],
> -			sc->mac_address[1], sc->mac_address[0]);
> +			 "%pMR", sc->mac_address);
>   	} else if ((sc->quirks & SIXAXIS_CONTROLLER_USB) ||
>   			(sc->quirks & NAVIGATION_CONTROLLER_USB)) {
>   		buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
> @@ -2432,10 +2429,7 @@ static int sony_check_add(struct sony_sc *sc)
>   			sc->mac_address[5-n] = buf[4+n];
>   
>   		snprintf(sc->hdev->uniq, sizeof(sc->hdev->uniq),
> -			"%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx",
> -			sc->mac_address[5], sc->mac_address[4],
> -			sc->mac_address[3], sc->mac_address[2],
> -			sc->mac_address[1], sc->mac_address[0]);
> +			 "%pMR", sc->mac_address);
>   	} else {
>   		return 0;
>   	}
> 

Looks good and in a quick test seems to function.

Acked-by: Roderick Colenbrander <roderick.colenbranderer@sony.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
  2017-12-13  2:22 ` Colenbrander, Roelof
@ 2017-12-19 17:20   ` Andy Shevchenko
  2017-12-20  9:40     ` Benjamin Tissoires
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2017-12-19 17:20 UTC (permalink / raw)
  To: Colenbrander, Roelof, Jiri Kosina, Benjamin Tissoires,
	linux-input@vger.kernel.org

On Wed, 2017-12-13 at 02:22 +0000, Colenbrander, Roelof wrote:
> On 12/11/2017 05:07 AM, Andy Shevchenko wrote:
> > Reversed MAC addresses can be printed directly using %pMR specifier.

> Looks good and in a quick test seems to function.
> 
> Acked-by: Roderick Colenbrander <roderick.colenbranderer@sony.com>
> 

Benjamin, perhaps it's good enough to being applied?

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
  2017-12-19 17:20   ` Andy Shevchenko
@ 2017-12-20  9:40     ` Benjamin Tissoires
  2018-01-18 13:41       ` Andy Shevchenko
  0 siblings, 1 reply; 6+ messages in thread
From: Benjamin Tissoires @ 2017-12-20  9:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Colenbrander, Roelof, Jiri Kosina, linux-input@vger.kernel.org

Hi Andy,

On Tue, Dec 19, 2017 at 6:20 PM, Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Wed, 2017-12-13 at 02:22 +0000, Colenbrander, Roelof wrote:
>> On 12/11/2017 05:07 AM, Andy Shevchenko wrote:
>> > Reversed MAC addresses can be printed directly using %pMR specifier.
>
>> Looks good and in a quick test seems to function.
>>
>> Acked-by: Roderick Colenbrander <roderick.colenbranderer@sony.com>
>>
>
> Benjamin, perhaps it's good enough to being applied?

This question should be directed to Jiri :)

Anyway:
Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Cheers,
Benjamin

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
  2017-12-20  9:40     ` Benjamin Tissoires
@ 2018-01-18 13:41       ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-01-18 13:41 UTC (permalink / raw)
  To: Benjamin Tissoires
  Cc: Colenbrander, Roelof, Jiri Kosina, linux-input@vger.kernel.org

On Wed, 2017-12-20 at 10:40 +0100, Benjamin Tissoires wrote:
> Hi Andy,
> 
> On Tue, Dec 19, 2017 at 6:20 PM, Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Wed, 2017-12-13 at 02:22 +0000, Colenbrander, Roelof wrote:
> > > On 12/11/2017 05:07 AM, Andy Shevchenko wrote:
> > > > Reversed MAC addresses can be printed directly using %pMR
> > > > specifier.
> > > Looks good and in a quick test seems to function.
> > > 
> > > Acked-by: Roderick Colenbrander <roderick.colenbranderer@sony.com>
> > > 
> > 
> > Benjamin, perhaps it's good enough to being applied?
> 
> This question should be directed to Jiri :)

Jiri?

> Anyway:
> Acked-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>

Thanks!

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] HID: sony: Print reversed MAC address via %pMR
  2017-12-11 13:06 [PATCH v1] HID: sony: Print reversed MAC address via %pMR Andy Shevchenko
  2017-12-13  2:22 ` Colenbrander, Roelof
@ 2018-01-23 14:38 ` Jiri Kosina
  1 sibling, 0 replies; 6+ messages in thread
From: Jiri Kosina @ 2018-01-23 14:38 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: Benjamin Tissoires, linux-input, Roderick Colenbrander

On Mon, 11 Dec 2017, Andy Shevchenko wrote:

> Reversed MAC addresses can be printed directly using %pMR specifier.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Applied, thanks (and sorry for the delay caused by spectral meltdown).

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-01-23 14:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11 13:06 [PATCH v1] HID: sony: Print reversed MAC address via %pMR Andy Shevchenko
2017-12-13  2:22 ` Colenbrander, Roelof
2017-12-19 17:20   ` Andy Shevchenko
2017-12-20  9:40     ` Benjamin Tissoires
2018-01-18 13:41       ` Andy Shevchenko
2018-01-23 14:38 ` Jiri Kosina

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).