From nobody Mon Feb 9 00:10:20 2026 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 19F4C1E3784 for ; Tue, 7 Jan 2025 11:34:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736249689; cv=none; b=Hg6tz0/OAhz53oUK7jiG5eMjrnjqJ6quVk4lp/cONWRsUMdJqZX48NV+DHHHIfuNRucnsFE0hk24SqdGo/yG1GfK3dbhHVB8ctPsBnuXjFDtebOlLMknYlkoXiGhRr6Mnfw3zq+O9lQs7xKrI5lMi0+hhfpQrrMZSSbmCkTMJuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736249689; c=relaxed/simple; bh=yro6Fb292OesZxRRM8mQxqtzIX7FbinQYBOMbsq3Z18=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:To:Cc; b=Dt2PHTvEqxBc7WYAyxtG3nVAah6AdMqFVXpZL4HGv3lO+1KuxwS1iu33NPEGHAOXClg9d3qZd7mx6LueD5Ib4yhSsj8V0EObBL16kWd5LIhlhnjeFjsTS1utWo/eK+8onMrgcWsc3ivBxFidcIl3Ktnye6rK7FFuVf38V1gP03I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=qpHEXuTB; arc=none smtp.client-ip=209.85.208.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="qpHEXuTB" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-303489e8775so172749651fa.3 for ; Tue, 07 Jan 2025 03:34:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1736249684; x=1736854484; darn=vger.kernel.org; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=IsaqEkTVz9aUu2ao0R4XXXsvE/jpqouXclpX4uJ7pLE=; b=qpHEXuTBLJfdSSOVvmuAz78sktMqg448XkZV7o4ZFbQsP/mELpwJsEK3m6hJnw01WC nJI6oJ4c1syBmZKaW5Ra8Pfec6xyJ0fR1ug61niQLVpcEOY9sq6uWyqx8V6atex5Vpwo CqNpy3csXavFscxeIzbbkaWDfJQMaQYCNMedQd4UBlGdd1E6X6i/9tj5GS+oNqeEluZn iFUnRd9b7uo5sSn6NHlkDY2WrtuCZ8gy040m5XiNDBvJHa7yKIqOjhVC6H2urr7O2TTf WmtOSKKP/8xUMsNHXaYrVSbsopAF8WSIssR6Eh4yezpdrzY7oAOiihqNaEbBZV4f0UeO yM9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736249684; x=1736854484; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=IsaqEkTVz9aUu2ao0R4XXXsvE/jpqouXclpX4uJ7pLE=; b=bqEWvO9EvmXxNqsAkJtDzSWQjS5eei7ta6enJdShw8lgybilYg22kLT+QjgGG1uuBh bIQUtPHJUbLbIdltfLL6bbpMLkdxc06i8+ZuwJicIVryISFYPU5NmFVYSzowH7fGtLWy ik/IhcQ4dYPYuy1cE1U96vXHwbsi0ge41eLTPxMPvmPJYz4Ps/uEvd8+/a9bG4We9cDB JqXvPgbF2onh5Nz++6kGwLvZ0Sv8LR7Xcm2f8D+TT0aES6xc7ncrSQloIUeXcAaqpSkY vZarZM6JuoHnpT1Pig4/ZSeIoOyeBd2/ax5B3HE7NKh0OjOMXFm0czI03WLm2DJzGlMa EHFA== X-Forwarded-Encrypted: i=1; AJvYcCVkxqbFmHRFzqbQj43HNew6IRI0VItmVV7Rpks9pxcoWXDpT+LIwHjL/Y1H4ModP/63jf0cyN3TWQoGbDI=@vger.kernel.org X-Gm-Message-State: AOJu0YzmEV9EB/rLngLDK4iG6h712Hd0SD0TZVjuLb19QRIQDfbp+vGe pNHo1kFeX9BXR8LPA80OUSUrkB+iv3Mc2ATW6h4+jko8nzq7UaptYNKn/56xJro= X-Gm-Gg: ASbGncvVY3bT8s9fmkExvquhMBrjQ3jvgQRfC2BCESfXJioqI9VAz6lqueIKe14NJrS C0LiCDclalFTLocB5Bp1y0XJFPOLgD3bmCaPzP3cPWBfy0paqDW9Oc5m3WZRgTi7c9q/5lN7Fkc +EH/1th+QqJiIy8EUE32ITYTSJZviSpIdQwtaLh+RqMDq3Hxl3du51ty5r+Ptahf64+p/THz24A Ik6sRGPWumT+D8k/83fo/uFAiMlQbzhzLNi0SB+8tOMhK0mcFlHYh+v1T3xDi7l X-Google-Smtp-Source: AGHT+IEyaw8n6J4gC8jnNf1Iu+pVRqUYxPTdsk4ajP+mg4qoS9xlnrhddOZ3LiXMFNPXBV5dIGkqpQ== X-Received: by 2002:a05:651c:2215:b0:302:2cdf:7fbb with SMTP id 38308e7fff4ca-3046851e45fmr220057481fa.6.1736249684096; Tue, 07 Jan 2025 03:34:44 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3045b083f8bsm59479221fa.117.2025.01.07.03.34.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jan 2025 03:34:42 -0800 (PST) From: Dmitry Baryshkov Date: Tue, 07 Jan 2025 13:34:42 +0200 Subject: [PATCH] phy: core: don't require set_mode() callback for phy_get_mode() to work Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250107-phy-fix-set-moe-v1-1-b3dfe9391672@linaro.org> X-B4-Tracking: v=1; b=H4sIAFERfWcC/x2MSQqAMAwAvyI5G6iFUvAr4sEl1RxsSyOiFP9u8 DgMMxWECpNA31QodLFwigpd28CyT3Ej5FUZrLHOdMZj3h8MfKPQiUciXK13SwiOrJ9Bq1xI9X8 cxvf9AG4w5e5hAAAA X-Change-ID: 20250107-phy-fix-set-moe-d275cff5e27b To: Vinod Koul , Kishon Vijay Abraham I Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Damon Ding X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1474; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yro6Fb292OesZxRRM8mQxqtzIX7FbinQYBOMbsq3Z18=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnfRFS+nM4HlH/ZXO9N7il3bt/5nLgb5XjrnIHF MyxYQKrdAKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ30RUgAKCRCLPIo+Aiko 1TVhB/sHzcukOUmUEHYmuBr95Tszc8/Potdy1h/6xzd3YIslr3oHOKUecys0LP4TfBsxJz7Gj6O wIzVCDvk5QjFvoqTn04pOD0v0pfIt0xz99MhGnGiqujNe5duaTkleVTCWmoJ2JF4FDt3g8fm+C2 uv/gjSUCSvI5oQOV2iX8gPJCPcz+zyOe2jSSjksTD2IlzMmwRQhpUhmoXa/jNP7KQmM8JyyVMTv p3Fk/OXpL6oCpZItjkvtpHWquNbzi9emYyasYc9sCW3I4YJ5HZa5+2XHYER85UzBREmG6Odj697 El9AvAh8kgA8GUuUdd3TcCP9tVwp+d4HohL23lBOMqfL/DXZ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A As reported by Diamond Ding, the phy_get_mode() call doesn't work as expected unless the PHY driver has a .set_mode() call. This prompts PHY drivers to have empty stubs for .set_mode() for the sake of being able to get the mode. Make .set_mode() callback truly optional and update PHY's mode even if it there is none. Cc: Damon Ding Link: https://lore.kernel.org/r/96f8310f-93f1-4bcb-8637-137e1159ff83@rock-c= hips.com Signed-off-by: Dmitry Baryshkov Tested-by: Damon Ding --- drivers/phy/phy-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 8dfdce605a905d7f38205727151258af41f807a9..067316dfcd83a6fc8428cddd27d= 3b7ebfc270831 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -405,13 +405,14 @@ EXPORT_SYMBOL_GPL(phy_power_off); =20 int phy_set_mode_ext(struct phy *phy, enum phy_mode mode, int submode) { - int ret; + int ret =3D 0; =20 - if (!phy || !phy->ops->set_mode) + if (!phy) return 0; =20 mutex_lock(&phy->mutex); - ret =3D phy->ops->set_mode(phy, mode, submode); + if (phy->ops->set_mode) + ret =3D phy->ops->set_mode(phy, mode, submode); if (!ret) phy->attrs.mode =3D mode; mutex_unlock(&phy->mutex); --- base-commit: 7b4b9bf203da94fbeac75ed3116c84aa03e74578 change-id: 20250107-phy-fix-set-moe-d275cff5e27b Best regards, --=20 Dmitry Baryshkov