From patchwork Wed Jan 18 10:02:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 45169 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2267934wrn; Wed, 18 Jan 2023 02:58:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXvKGU9X2BzlHbGuts8cU2IxZpvJk7IjT60tOunVFmqfavj2yZv2df5gL2Axqk1VLP9327V3 X-Received: by 2002:a05:6402:2405:b0:49d:1a59:176b with SMTP id t5-20020a056402240500b0049d1a59176bmr7867125eda.30.1674039485970; Wed, 18 Jan 2023 02:58:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674039485; cv=none; d=google.com; s=arc-20160816; b=ooWxNJuKuB19WUHz648PZn2ww74jRnEPbgZDUOvlwzlTAqAbEDrQXzwgLMtQgUW6aS JF+Mrr/7r0kf9UnB/3poMEdvfhd2y8n1CFpKRaVkBfccc1TQEVmBh2tGXeJ8F6Ciu5Kj JIUJWVdISu+Id+p+R3hVTXtisFdkfnAX1eweC4EOU/pxYxIiiB5VcP3xffLU+IDJZUZB HAMGMgwtMi5NLJHJGS4RA6Y6MWTQGx0ULyttwSjdIURupP+rfs/3lJNZ2ZRYnC3fnlxc DNqzF125/QjWrNr/0vcLHdIGUNz0GXs2df227ItUl0DqaCqO+PWPw6C5/bMMKEA16DKf 0Tqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=lUA1ky0lPQCRFoE/22ArciCl1rDOQApKnzIjLJRDnw4=; b=SBGTPbRR1aRztbw8ybsRXjo2kJ/Gj0KU6VO40+7THChYNeMvgPsY4fCHXLGh0AURCn 5kIzdaMUw5mOw/lf8i2Vx6EmB71AaRmvQ28WsfjgJLM+ZvDGk44fd8LRKAE7ceL4KEWn eFaX3wGmZwmGSWrLz9T3WsKReJ3em3DWR4fHlCLg+lhsCFDw0R0Fpgif4bqwCDa7Ancd QIluoijydutQOVfvXvlf0GNR6nSmGDi5/7k0qC/o+2l0SaJdOTnEO1AfOSpdeggOTd1i /5MJ0KIExbkX/pN4dLJAIPw7uFjV5eF0jlI6n+0KiCNo9N6+GzrDCMRnZB79MYnUJqBO xLCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a056402359000b0049e5332b5e7si1172716edc.46.2023.01.18.02.57.40; Wed, 18 Jan 2023 02:58:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230130AbjARK4g (ORCPT + 99 others); Wed, 18 Jan 2023 05:56:36 -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 X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755357627789703100?= X-GMAIL-MSGID: =?utf-8?q?1755357627789703100?= 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, const char *string) static inline struct phy *phy_optional_get(struct device *dev, const char *string) { - return ERR_PTR(-ENOSYS); + return NULL; } static inline struct phy *devm_phy_get(struct device *dev, const char *string)