From nobody Mon Jun 8 07:22:05 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 662493B1029; Wed, 3 Jun 2026 10:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483443; cv=none; b=tEAbFh7aP2vxejbb+NJTelWoH70GLGrgQlBlIkN5kEGQDoKNsxbJVAqEHm9pKr+IOD9scUFyzgULYF+d1uOxZLEgiULDyT0szs6fQuN/5j4NabhoOTU1WfnnzVKUDr3tQ5GFl4osmxvoCwxZ3Px3X8Ya5gdZd3NowTUuPXvvB6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483443; c=relaxed/simple; bh=BhIKTQ4OQ9RChf0q3imRx5L1bGzhInW1zKj/r7sEOZo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=X5bm120ZAKUllpHpzlhY38xb0RbNkruIHEozoOVLXNVyN8P/gxtyxkqeoE+OUhV3u73Oa16bMsj+B9ypN1ktBmYT4OubQo65Za1Ov/4ccCEwFNxI8qMrvGQlEtNCOf2zM+aVrHy7CNJH/H5BBCYKG1n5oYOvwv2Bx4HFPGFEycI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=e2blfiW/; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="e2blfiW/" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780483442; x=1812019442; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BhIKTQ4OQ9RChf0q3imRx5L1bGzhInW1zKj/r7sEOZo=; b=e2blfiW/W6Y2WCf96OViqobqeWib0ZzDojS/X0TsWXJZeABxX42rBQV0 LB5jIXE0Lakni9BbxXnfBCjvnwRp/VtkB2mNtgJS3tT8wJDC28016IuXd 6tZXfOqswJiSpqzbl0hGAmoLe6hLvj2XzM/fADnVyQCWeEk4kTVx2bbls 545eXf1UPzxjTOQzuSYPARBdkcieolsT1vDk3oA6CtYJeF2bGMwjR4iHB Xwqfh+5V5sB57mp1jogtlZALeWvcyMA+KHJUScWpqsd1CBwcYrZbW8qcW qBskPwclz81ntaNQlwfiMEg8F0Kx+axftYdh/aPE3raBCRcW2YnzagRVz w==; X-CSE-ConnectionGUID: rMEOoUbhSQKtuekea58Rww== X-CSE-MsgGUID: 9L5r8RWBT1azkAY/8vrgig== X-IronPort-AV: E=McAfee;i="6800,10657,11805"; a="80429109" X-IronPort-AV: E=Sophos;i="6.24,185,1774335600"; d="scan'208";a="80429109" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2026 03:44:00 -0700 X-CSE-ConnectionGUID: dQM4dhm3T3etxy/+iUafXw== X-CSE-MsgGUID: Kh+79lN5TR2EySDRK3tttA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,185,1774335600"; d="scan'208";a="241695745" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa008.fm.intel.com with ESMTP; 03 Jun 2026 03:43:57 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 2F51E98; Wed, 03 Jun 2026 12:43:56 +0200 (CEST) From: Andy Shevchenko To: Andy Shevchenko , Jiri Kosina , "Daniel J. Ogorchock" , Petr Mladek , Tamir Duberstein , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Cc: Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Jonathan Corbet , Shuah Khan , Benjamin Tissoires , Andrew Morton Subject: [PATCH v2 1/2] vsprintf: Add upper case flavour to %p[mM] Date: Wed, 3 Jun 2026 12:34:02 +0200 Message-ID: <20260603104351.152085-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260603104351.152085-1-andriy.shevchenko@linux.intel.com> References: <20260603104351.152085-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Some of the (ABI aware) code needs an upper case when printing MAC addresses. Introduce an extension for that into the existing %p[mM]. Signed-off-by: Andy Shevchenko --- Documentation/core-api/printk-formats.rst | 3 +++ lib/tests/printf_kunit.c | 2 ++ lib/vsprintf.c | 22 ++++++++++++++++------ 3 files changed, 21 insertions(+), 6 deletions(-) diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core= -api/printk-formats.rst index c0b1b6089307..57e887ff24bc 100644 --- a/Documentation/core-api/printk-formats.rst +++ b/Documentation/core-api/printk-formats.rst @@ -322,6 +322,7 @@ MAC/FDDI addresses %pMF 00-01-02-03-04-05 %pm 000102030405 %pmR 050403020100 + %p[mM][FR][U] =20 For printing 6-byte MAC/FDDI addresses in hex notation. The ``M`` and ``m`` specifiers result in a printed address with (M) or without (m) byte @@ -335,6 +336,8 @@ For Bluetooth addresses the ``R`` specifier shall be us= ed after the ``M`` specifier to use reversed byte order suitable for visual interpretation of Bluetooth addresses which are in the little endian order. =20 +When ``U`` is passed, the result is printed in the upper case. + Passed by reference. =20 IPv4 addresses diff --git a/lib/tests/printf_kunit.c b/lib/tests/printf_kunit.c index 58e639b01e83..eccf041ebd56 100644 --- a/lib/tests/printf_kunit.c +++ b/lib/tests/printf_kunit.c @@ -435,8 +435,10 @@ mac(struct kunit *kunittest) =20 test("2d:48:d6:fc:7a:05", "%pM", addr); test("05:7a:fc:d6:48:2d", "%pMR", addr); + test("05:7A:FC:D6:48:2D", "%pMRU", addr); test("2d-48-d6-fc-7a-05", "%pMF", addr); test("2d48d6fc7a05", "%pm", addr); + test("2D48D6FC7A05", "%pmU", addr); test("057afcd6482d", "%pmR", addr); } =20 diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 1389b50266bf..c9b6ec0f0de6 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -1303,31 +1303,39 @@ char *mac_address_string(char *buf, char *end, u8 *= addr, char mac_addr[sizeof("xx:xx:xx:xx:xx:xx")]; char *p =3D mac_addr; int i; - char separator; + char separator =3D ':'; bool reversed =3D false; + bool uc =3D false; =20 if (check_pointer(&buf, end, addr, spec)) return buf; =20 switch (fmt[1]) { case 'F': + uc =3D fmt[2] =3D=3D 'U'; separator =3D '-'; break; =20 case 'R': + uc =3D fmt[2] =3D=3D 'U'; reversed =3D true; - fallthrough; + break; + + case 'U': + uc =3D true; + break; =20 default: - separator =3D ':'; break; } =20 for (i =3D 0; i < 6; i++) { - if (reversed) - p =3D hex_byte_pack(p, addr[5 - i]); + u8 byte =3D reversed ? addr[5 - i] : addr[i]; + + if (uc) + p =3D hex_byte_pack_upper(p, byte); else - p =3D hex_byte_pack(p, addr[i]); + p =3D hex_byte_pack(p, byte); =20 if (fmt[0] =3D=3D 'M' && i !=3D 5) *p++ =3D separator; @@ -2410,6 +2418,7 @@ early_param("no_hash_pointers", no_hash_pointers_enab= le); * - 'MF' For a 6-byte MAC FDDI address, it prints the address * with a dash-separated hex notation * - '[mM]R' For a 6-byte MAC address, Reverse order (Bluetooth) + * - '[mM][FR][U]' One of the above in the upper case * - 'I' [46] for IPv4/IPv6 addresses printed in the usual way * IPv4 uses dot-separated decimal without leading 0's (1.2.3.4) * IPv6 uses colon separated network-order 16 bit hex with leading 0= 's @@ -2544,6 +2553,7 @@ char *pointer(const char *fmt, char *buf, char *end, = void *ptr, case 'm': /* Contiguous: 000102030405 */ /* [mM]F (FDDI) */ /* [mM]R (Reverse order; Bluetooth) */ + /* [mM][FR][U] (One of the above in the upper case) */ return mac_address_string(buf, end, ptr, spec, fmt); case 'I': /* Formatted IP supported * 4: 1.2.3.4 --=20 2.50.1 From nobody Mon Jun 8 07:22:05 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A5ECC38D019; Wed, 3 Jun 2026 10:44:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483441; cv=none; b=uGq6izk/EZYuo3IJVit5mMFNjovab5sqCqhMfhZQop9QilMZM/sHoyQ6irxTSdYSE8vPs47LPE9IWtvYeCg95YtFCdx8MMMH0T8nbW8w8CefbLlsI80CHRbupV2UoypwBqQCGFvD2pIax9Dz+wJZHUgMgPGrcrclRnAw4xjjLWk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780483441; c=relaxed/simple; bh=oZiUVbmkfwkJjNevEN1GRtwtJQOOjjxR9EYg2bGEtG4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TerehilgPmayWJAKs5fsNV5PSn9147vxngf6pjOjYFV31hgodJRy+HTrh8/PpgJ9m7RJezfXJ1+3QdDzor1rLBzfFjxm9DGMW1cRaRE9cSO3IVXqEhzXXSUA9P0jL0c2OIuKSNyVAqtzGNm4PSP5rtdjpE48iydJI4LGwBzTdjw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=pass smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=EkFXP1tA; arc=none smtp.client-ip=192.198.163.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="EkFXP1tA" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1780483441; x=1812019441; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=oZiUVbmkfwkJjNevEN1GRtwtJQOOjjxR9EYg2bGEtG4=; b=EkFXP1tAvjW0dLdoXx0gvZ9V0dbNluHsmuEuUNg5KgpvDPOrgHQgRPIg +9VTIJkav+MypfouaOFmLuqIqPM0M/IH7EJf8YpiarUW51CaKmjKpyR1f xW9/uAdR2uXN1AVw8cHKp53ZFpECnTpRsYuW3kBBsdDlHsKg8DbvyR++i HKBlQjz9mkCvoLOO6e6cyYUAlA5tuSLpvlBS8jbD0+9YNWyAD1sut/Ms7 WiRVTZulYN6XddU5dPJBZEkpMt6hjlTEdfKIP6QNLDp1X3vkqPcieRfxT 8eJ1ARcu/w8k6qv0LCaNfPtC8OXMfpmRjrmBIUCV8S6m7uXofehqrlKP6 w==; X-CSE-ConnectionGUID: YSA+NwxLRnaAAlIG0VTQaQ== X-CSE-MsgGUID: yzg0SKE+TY6RMXiTULBH0g== X-IronPort-AV: E=McAfee;i="6800,10657,11805"; a="80429104" X-IronPort-AV: E=Sophos;i="6.24,185,1774335600"; d="scan'208";a="80429104" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Jun 2026 03:44:00 -0700 X-CSE-ConnectionGUID: Vh2oqqU9QlGBTVxwUybgtQ== X-CSE-MsgGUID: tsGfTAxgRdGqdZDRdRsYrw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.24,185,1774335600"; d="scan'208";a="241695746" Received: from black.igk.intel.com ([10.91.253.5]) by fmviesa008.fm.intel.com with ESMTP; 03 Jun 2026 03:43:57 -0700 Received: by black.igk.intel.com (Postfix, from userid 1003) id 33B0899; Wed, 03 Jun 2026 12:43:56 +0200 (CEST) From: Andy Shevchenko To: Andy Shevchenko , Jiri Kosina , "Daniel J. Ogorchock" , Petr Mladek , Tamir Duberstein , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org Cc: Steven Rostedt , Rasmus Villemoes , Sergey Senozhatsky , Jonathan Corbet , Shuah Khan , Benjamin Tissoires , Andrew Morton Subject: [PATCH v2 2/2] HID: nintendo: Use %pM format specifier for MAC addresses Date: Wed, 3 Jun 2026 12:34:03 +0200 Message-ID: <20260603104351.152085-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20260603104351.152085-1-andriy.shevchenko@linux.intel.com> References: <20260603104351.152085-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Convert to %pM instead of using custom code. Signed-off-by: Andy Shevchenko Acked-by: Benjamin Tissoires --- drivers/hid/hid-nintendo.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/hid/hid-nintendo.c b/drivers/hid/hid-nintendo.c index 29008c2cc530..05c50f2530ef 100644 --- a/drivers/hid/hid-nintendo.c +++ b/drivers/hid/hid-nintendo.c @@ -2431,14 +2431,8 @@ static int joycon_read_info(struct joycon_ctlr *ctlr) for (i =3D 4, j =3D 0; j < 6; i++, j++) ctlr->mac_addr[j] =3D report->subcmd_reply.data[i]; =20 - ctlr->mac_addr_str =3D devm_kasprintf(&ctlr->hdev->dev, GFP_KERNEL, - "%02X:%02X:%02X:%02X:%02X:%02X", - ctlr->mac_addr[0], - ctlr->mac_addr[1], - ctlr->mac_addr[2], - ctlr->mac_addr[3], - ctlr->mac_addr[4], - ctlr->mac_addr[5]); + ctlr->mac_addr_str =3D devm_kasprintf(&ctlr->hdev->dev, GFP_KERNEL, "%pMU= ", + ctlr->mac_addr); if (!ctlr->mac_addr_str) return -ENOMEM; hid_info(ctlr->hdev, "controller MAC =3D %s\n", ctlr->mac_addr_str); --=20 2.50.1