From patchwork Mon Mar 24 14:39:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 14027460 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (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 98C8E25F963; Mon, 24 Mar 2025 14:47:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742827681; cv=none; b=rnOpKqHZbexVWYBE8DwdbpaTgCW7CnYUZR+uqF2QXvA/X6N6iDltjfJKPH+7NiJgZ0jA37IBQB60MXEyaL+nDzpz15bYiYLso0dZ5sJkSUkcUHvQaw/HcsNBYP3PqIYj1mZQWZx+SGim9TXcruZGgmGlqs5by8H362xjSoSF1cw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742827681; c=relaxed/simple; bh=3Zof91lWD3nLZ3P7usuHkGaIG+jzELNo83GIF4XRpBs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=btFMM1EnJlr4KE1HLx47rTof69YhYC1dllNQI2NPh/4qzY+MEwYBCariFMa6PLiCziEsDIZyYzZNRkMK9l89NpKbU0r/ouoeetdu1UWMMnDWq+qw7i1Iy3A9/FvR5p4Jon+CaG3RbrhQL+2KCDq9RRrifzuhn4j5Zn9mlqE1cVQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VBA/+gp5; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none 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="VBA/+gp5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1742827680; x=1774363680; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3Zof91lWD3nLZ3P7usuHkGaIG+jzELNo83GIF4XRpBs=; b=VBA/+gp5jO1vX/gfGFG893cDAoqBV3yrQpNi0nzN2gqOGYysIfWuJO9v bDWvSrEiBRx+HT0WlBoLa+tjSbeOOzHAHJ+0eUXlLonz/4XPXucKup4iM qVDys1cdyGdfjWThh1petWbBna7UtB/qicFeNMg3v66h+vS/17JzUlc+b B9w8Hi9Tc/Vis58C848puYiERXgyVVOpyhwW5pOqwjTEg87WEet0Zi/SI 8Qv0ydgy8OWnRSG1R7bKMUnMFohUzh6buJlaNlZuu2DpFOZdx686vMhVw WWKuQl4hl3/1H83d2+drtFFoJ186nRhtzvZBy0YC9QwsZQ3jfX/R0ZHGL w==; X-CSE-ConnectionGUID: TVrqICFMS4C6RGbLiKXk8A== X-CSE-MsgGUID: pMIeBOWZRoCcArxmDGVAsQ== X-IronPort-AV: E=McAfee;i="6700,10204,11383"; a="43192116" X-IronPort-AV: E=Sophos;i="6.14,272,1736841600"; d="scan'208";a="43192116" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Mar 2025 07:47:57 -0700 X-CSE-ConnectionGUID: KA0XWa67QaWd+yHu7NrpSg== X-CSE-MsgGUID: UGSEefHOT7GjJT8snXp6cA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.14,272,1736841600"; d="scan'208";a="124022003" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa010.jf.intel.com with ESMTP; 24 Mar 2025 07:47:54 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id E65C912C; Mon, 24 Mar 2025 16:47:52 +0200 (EET) From: Andy Shevchenko To: Andy Shevchenko , linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Heiner Kallweit , Russell King Subject: [PATCH net v3 1/2] =?utf-8?q?net=3A_phy=3A_Introduce_PHY=5FID=5FSIZ?= =?utf-8?q?E_=E2=80=94_minimum_size_for_PHY_ID_string?= Date: Mon, 24 Mar 2025 16:39:29 +0200 Message-ID: <20250324144751.1271761-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250324144751.1271761-1-andriy.shevchenko@linux.intel.com> References: <20250324144751.1271761-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The PHY_ID_FMT defines the format specifier "%s:%02x" to form the PHY ID string, where the maximum of the first part is defined in MII_BUS_ID_SIZE, including NUL terminator, and the second part is implied to be 3 as the maximum address is limited to 32, meaning that 2 hex digits is more than enough, plus ':' (colon) delimiter. However, some drivers, which are using PHY_ID_FMT, customise buffer size and do that incorrectly. Introduce a new constant PHY_ID_SIZE that makes the minimum required size explicit, so drivers are encouraged to use it. Suggested-by: "Russell King (Oracle)" Signed-off-by: Andy Shevchenko Reviewed-by: Russell King (Oracle) --- include/linux/phy.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/phy.h b/include/linux/phy.h index 19f076a71f94..5bb8dfb3d15c 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -310,6 +310,7 @@ static inline long rgmii_clock(int speed) /* Used when trying to connect to a specific phy (mii bus id:phy device id) */ #define PHY_ID_FMT "%s:%02x" +#define PHY_ID_SIZE (MII_BUS_ID_SIZE + 3) #define MII_BUS_ID_SIZE 61