Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp3765467rwi; Wed, 12 Oct 2022 06:33:19 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6HtaQprv6KVYSY+2g7pxESdbOVd+aZvKM1FAuLTZHrqOFKcQcRgRouFZa2EMow5cxQFGNF X-Received: by 2002:aa7:810d:0:b0:563:1fa6:fecc with SMTP id b13-20020aa7810d000000b005631fa6feccmr20695518pfi.24.1665581599209; Wed, 12 Oct 2022 06:33:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665581599; cv=none; d=google.com; s=arc-20160816; b=X/1mTd8JrWVbm4aZ1r7PAbA/1iqgmhWhoRrVEo0hzPTRm5e3laUhRJcVhINvM0Aa8A KnwrXpIpO7eW/nr1ig0dbIpF2CpZt3b/tLoHs0kG/xAjuoNmLjJKylHpAnvdStAYRdTK tFyRb+3UspirmkYXRy5+iJEEC5DpRkYLiZgtBu1td8geyDqkXzAfWsgjh/FHv047WRyg 9dMLz1+c6shQin3OrFHbHA99doF0e8maPv7+pPxVsFs9zlfM0s2UQvqFqp7zBhzRTkgw Dt6Z9YQzcMVCcXR7hzvnwmQPEeIUgeNFzO+9d5l2ycCMQOHjdwhdF+9xT1P54Vvb0O2R Lphw== 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=GSKBjOBiqaOTaHysaB4pz2t1Du2wGynhkDAhihJpt4w=; b=L6fnAGXU3FGxmt+Y+hOjoHMGXhNiX/i1XKQTu2yOgQ6J3/WQwZejAxgbnLsdkrdYS7 2FcuKUgn0qi7YzMueNs5beuo4XVJL8974wFPevHuXKxZaOX+9LQtFCS356lsGJDao/hD 3+MSBLkA+VmK7NDD/bpK64D5Ok5JWcYO/tI/OWLTuYd01fPIMcvyDzvbiYh8HjeU4yOS mcGpca0r2SQyO0/XJYVkER1+RMvHP94Qw28PtIM1njbwmVJbFU04Cg82yOLUIWT9u8ty 7OLNlobpIYYVjuuAnvv0eGFOuwFQsqnTYqQFjSceJ9G2Cdf9lMtobfUMyx2enEEwKE77 1rZQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p9-20020a170902e74900b0017db9b9d54asi4821282plf.300.2022.10.12.06.33.03; Wed, 12 Oct 2022 06:33:19 -0700 (PDT) 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 S229653AbiJLN2I (ORCPT + 99 others); Wed, 12 Oct 2022 09:28:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229639AbiJLN2E (ORCPT ); Wed, 12 Oct 2022 09:28:04 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BDC27A9243 for ; Wed, 12 Oct 2022 06:28:03 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oibmD-0000J9-Jg; Wed, 12 Oct 2022 15:28:01 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1oibmC-0016Pw-T1; Wed, 12 Oct 2022 15:28:00 +0200 Received: from sha by dude02.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1oibmB-001EoB-Ps; Wed, 12 Oct 2022 15:27:59 +0200 From: Sascha Hauer To: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Felipe Balbi , kernel@pengutronix.de, Mark Brown , Sascha Hauer Subject: [PATCH] usb: phy: generic: make vcc regulator optional Date: Wed, 12 Oct 2022 15:27:54 +0200 Message-Id: <20221012132754.292151-1-s.hauer@pengutronix.de> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: sha@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 phy-generic uses the existance of the property "vcc-supply" to see if a regulator is optional or not. Use devm_regulator_get_optional() instead which exists for this purpose. Using devm_regulator_get_optional() avoids "supply vcc not found, using dummy regulator" messages. Signed-off-by: Sascha Hauer --- drivers/usb/phy/phy-generic.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c index 34b9f81401871..92d3e067067c6 100644 --- a/drivers/usb/phy/phy-generic.c +++ b/drivers/usb/phy/phy-generic.c @@ -209,7 +209,7 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) int err = 0; u32 clk_rate = 0; - bool needs_vcc = false, needs_clk = false; + bool needs_clk = false; if (dev->of_node) { struct device_node *node = dev->of_node; @@ -217,7 +217,6 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) if (of_property_read_u32(node, "clock-frequency", &clk_rate)) clk_rate = 0; - needs_vcc = of_property_read_bool(node, "vcc-supply"); needs_clk = of_property_read_bool(node, "clocks"); } nop->gpiod_reset = devm_gpiod_get_optional(dev, "reset", @@ -260,13 +259,10 @@ int usb_phy_gen_create_phy(struct device *dev, struct usb_phy_generic *nop) } } - nop->vcc = devm_regulator_get(dev, "vcc"); - if (IS_ERR(nop->vcc)) { - dev_dbg(dev, "Error getting vcc regulator: %ld\n", - PTR_ERR(nop->vcc)); - if (needs_vcc) - return -EPROBE_DEFER; - } + nop->vcc = devm_regulator_get_optional(dev, "vcc"); + if (IS_ERR(nop->vcc) && PTR_ERR(nop->vcc) != -ENODEV) + return dev_err_probe(dev, PTR_ERR(nop->vcc), + "could not get vcc regulator\n"); nop->vbus_draw = devm_regulator_get_exclusive(dev, "vbus"); if (PTR_ERR(nop->vbus_draw) == -ENODEV) -- 2.30.2