From patchwork Mon Dec 11 13:06:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 10105019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C183960360 for ; Mon, 11 Dec 2017 13:07:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F6422018E for ; Mon, 11 Dec 2017 13:07:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 826562958E; Mon, 11 Dec 2017 13:07:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 158FD2018E for ; Mon, 11 Dec 2017 13:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752439AbdLKNHQ (ORCPT ); Mon, 11 Dec 2017 08:07:16 -0500 Received: from mga02.intel.com ([134.134.136.20]:36544 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbdLKNHP (ORCPT ); Mon, 11 Dec 2017 08:07:15 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 11 Dec 2017 05:07:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,391,1508828400"; d="scan'208";a="17278838" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 11 Dec 2017 05:07:13 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id BFE8A109; Mon, 11 Dec 2017 15:06:12 +0200 (EET) From: Andy Shevchenko To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org, Roderick Colenbrander Cc: Andy Shevchenko Subject: [PATCH v1] HID: sony: Print reversed MAC address via %pMR Date: Mon, 11 Dec 2017 15:06:12 +0200 Message-Id: <20171211130612.34715-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.15.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reversed MAC addresses can be printed directly using %pMR specifier. Signed-off-by: Andy Shevchenko Acked-by: Roderick Colenbrander Acked-by: Benjamin Tissoires --- 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; }