From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1EAC433B4 for ; Wed, 14 Apr 2021 13:57:11 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9157860E08 for ; Wed, 14 Apr 2021 13:57:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9157860E08 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=VTsl5gzD2IvNVXb6rvbkE0ZJcOxp7SzlUctE2Ug61/I=; b=fuTye0qYR6f6OynScpZAiWnaPD P/hsJHYBJDa9kUXjrAn+AD9/p05T+votobKiTUjIxOHmKm0xgjMhPJy/b+s7UpB7IpxkpQ1toXcU0 7PcmDLHo66u6xAhYS40RztaQ9Pys0sEhP2oQQ7WalG0WUozK9gVMAhoeXX4US0TXWimFWSI7Rt6F8 B+zj+e72Yo3v1CEdd4Zi//JiP4cswt+kMXqOg1FuuoaHZ3HrCRXvkImfO7US+ziTTarHxZzKBZ9A0 JKp98cLk1fZVEOz848vZjqQ+/j8dQxXN7bdr3gRTGYo94bR1TzkKC/pPPJ04qNHSi/ZmLnAFpWgrf JmqZbaNQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWfzV-00CpiC-UN; Wed, 14 Apr 2021 13:55:38 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWfzQ-00CphL-4u for linux-arm-kernel@desiato.infradead.org; Wed, 14 Apr 2021 13:55:32 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type: Content-ID:Content-Description:In-Reply-To:References; bh=ygW7Y65vTGdNrKvd3IqSOUFhu0nUjAAUwu38bD6lMsg=; b=CCWqP6fZNeTjhYPCwXlXEn6kn/ nslY+oC91qWD5EDF6HNVj9VExM7IAWM3Lw7Rx1ukpLhZL0uxxErmZFARR56upN/xT1zqfh9AC2Pac lneIL6LHrR6xXn3z8SQrqd1NnCy+s/ysTa4IPwgNai5LDpDn7uSkkj96HsFZJzzhRGwumjaWLnL/H xiPNVBxwFZrGGVyqDshkctUBiDKnLHTMRQxFKNj0+1yEfB71+jLwAD+PGvbleJA6wyOAnRAcR3B9j Mj+uJ6DY56Og6tziBgmwEAtHD0DUFvMJltRgY6BvQeCwLTPkBKdKC/fck8r/XEPe3kzoajuPYj4Lj I5OBbzUQ==; Received: from mail-oi1-f175.google.com ([209.85.167.175]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWfzN-007ofy-Gr for linux-arm-kernel@lists.infradead.org; Wed, 14 Apr 2021 13:55:30 +0000 Received: by mail-oi1-f175.google.com with SMTP id d12so20632093oiw.12 for ; Wed, 14 Apr 2021 06:55:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ygW7Y65vTGdNrKvd3IqSOUFhu0nUjAAUwu38bD6lMsg=; b=BLyDqgJrsjCEtLdfklwrHbgB8PWXok9cOJ3tRwLsETVJIbFtbYLRn5zQ/jzP2dYGry 5r6cLSirUn8JGHlKLZIsM+h2VYjv5AE1p1UTZ/Fqau9OzzP0K0Cnfn61SsBOKD8f3ZzK 0MRAZq+L76ydntM+m8nfh5/r3yPqX3SaL2WPsSUUSlwc7dfE/zvf522Bk67YNbJsrOgs l09Pu0zpJLg2NQhF9E9NunONG6ftkuxwItY6sUKrUMDhNtGacXnvbL2CWIHLQw53agF6 FjWu863MOAzwi7XgxQHMPjtRyQbV6d7mAP4A/dXjmWeoSTafFLyF90bS7qQ20cx0OOu7 /wVw== X-Gm-Message-State: AOAM531emx4979vUnWuOyMjD7hz6VtbEID/tZ6k76JznN+2AFRZWp52x bgLKab8/2n58U8iWIOla3A== X-Google-Smtp-Source: ABdhPJzYu8oC6yjlWl3YieIDUJ08MnRI14+kL1+dtSXuy8xm5ha1sTX5idQ4ykdZEwGdeqV8w0vRbg== X-Received: by 2002:aca:df08:: with SMTP id w8mr2534923oig.126.1618408527949; Wed, 14 Apr 2021 06:55:27 -0700 (PDT) Received: from xps15.herring.priv (24-155-109-49.dyn.grandenetworks.net. [24.155.109.49]) by smtp.googlemail.com with ESMTPSA id y2sm3154007ooa.10.2021.04.14.06.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Apr 2021 06:55:27 -0700 (PDT) From: Rob Herring To: Kishon Vijay Abraham I , Vinod Koul Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Aswath Govindraju Subject: [PATCH] phy: Allow a NULL phy name for devm_phy_get() Date: Wed, 14 Apr 2021 08:55:25 -0500 Message-Id: <20210414135525.3535787-1-robh@kernel.org> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210414_065529_580988_F274EA40 X-CRM114-Status: GOOD ( 13.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org For a single PHY, there's no reason to have a phy-names entry in DT. The DT specific get functions allow for this already, but devm_phy_get() WARNs in this case. Other subsystems also don't warn in their get functions. Let's drop the WARN for DT case in devm_phy_get(). Cc: Kishon Vijay Abraham I Cc: Vinod Koul Signed-off-by: Rob Herring --- Note that I think the device_link_add later on is now redundant with fw_devlinks. If so, this can be simplified to just calling of_phy_get() for DT case. drivers/phy/phy-core.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 71cb10826326..3e4971253ec1 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -667,16 +667,18 @@ struct phy *phy_get(struct device *dev, const char *string) struct phy *phy; struct device_link *link; - if (string == NULL) { - dev_WARN(dev, "missing string\n"); - return ERR_PTR(-EINVAL); - } - if (dev->of_node) { - index = of_property_match_string(dev->of_node, "phy-names", - string); + if (string) + index = of_property_match_string(dev->of_node, "phy-names", + string); + else + index = 0; phy = _of_phy_get(dev->of_node, index); } else { + if (string == NULL) { + dev_WARN(dev, "missing string\n"); + return ERR_PTR(-EINVAL); + } phy = phy_find(dev, string); } if (IS_ERR(phy)) -- 2.27.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel