From nobody Sun Sep 14 20:45:31 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D996AC004D4 for ; Wed, 18 Jan 2023 10:56:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230144AbjARK4h (ORCPT ); Wed, 18 Jan 2023 05:56:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47658 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbjARKxH (ORCPT ); Wed, 18 Jan 2023 05:53:07 -0500 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6179488756 for ; Wed, 18 Jan 2023 02:02:22 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:4745:2e6d:e3a6:3327]) by laurent.telenet-ops.be with bizsmtp id AA2F2900N2zf9gW01A2FTg; Wed, 18 Jan 2023 11:02:19 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pI5Gj-005aHF-Rw; Wed, 18 Jan 2023 11:02:15 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pI5Gp-001JHm-5C; Wed, 18 Jan 2023 11:02:15 +0100 From: Geert Uytterhoeven To: Vinod Koul , Kishon Vijay Abraham I Cc: Maxime Ripard , Andrew Lunn , linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH] phy: Return NULL if the PHY is optional (part two) Date: Wed, 18 Jan 2023 11:02:12 +0100 Message-Id: <663dfcec9f703c41759dcd4cd824d00caa2dd5fb.1674036031.git.geert+renesas@glider.be> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If we're trying to get a handle to an optional PHY, then the PHY framework being disabled shouldn't return a hard error. Instead, return NULL just like phy_optional_get() does when there's no PHY provided in the DT. Based on commit 11a6e41c0ee503ff ("phy: Return NULL if the phy is optional"), which did the same thing for devm_phy_optional_get(). Signed-off-by: Geert Uytterhoeven --- It seems there were never any in-tree users of this function since its introduction in 788a4d56ff378bff ("drivers: phy: Add support for optional phys") in v3.14. Perhaps it should be removed? --- include/linux/phy/phy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h index b1413757fcc3b89b..559c3da515073697 100644 --- a/include/linux/phy/phy.h +++ b/include/linux/phy/phy.h @@ -429,7 +429,7 @@ static inline struct phy *phy_get(struct device *dev, c= onst char *string) static inline struct phy *phy_optional_get(struct device *dev, const char *string) { - return ERR_PTR(-ENOSYS); + return NULL; } =20 static inline struct phy *devm_phy_get(struct device *dev, const char *str= ing) --=20 2.34.1