Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp685140rwb; Thu, 12 Jan 2023 10:56:07 -0800 (PST) X-Google-Smtp-Source: AMrXdXsWivKp8qKNv2j1fYZHOwOhgeQSF/3SB+C7SGAWbZWzyE9J0qUgJYKb85KwHkBPalzKC45v X-Received: by 2002:a17:907:c203:b0:7ad:84c7:503a with SMTP id ti3-20020a170907c20300b007ad84c7503amr64211491ejc.72.1673549767237; Thu, 12 Jan 2023 10:56:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673549767; cv=none; d=google.com; s=arc-20160816; b=j9n3oymDWFzUpivmE1yd76QdZ49EftnFktyJ3aj+8kKkEfBHb7x5Eaid6R9tlwgtIc BPqMTsAHuzamRRJugyf4eNju4VqeF9vjn++BpQyFNuCfeW7zbA5KOtdDntDqU3nAE9rD ixFjU02DZR+J2gMq0SlFYgEO4KeJVD7Je1dKvrnqXjikFN8/QPqM9iqdNqt2RzV7oH5Q gE+tXYABpOj3XGjPunopl0lmFbJji6f6lK3YWhOfPfd2fGBDYi4gv2oBLRs83yh7sVrF wHDRaraXX5t5z6Q5vL5PEKiRbQU9XJvOfwi9J9g2jLQxq4jY2BvuGquhBoWjQfq304rd 0Ubg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=FW5z2Ni65JqORfe5kR2fZTjRFME3bRJQ++9zz5tKQow=; b=pyV+78yu+zqO8XdrLqjOAfb1884xao5miC3HJ5V5CrJHWU/QfhCtKjRKA0qCAGtoKI DTT09Ili47h11llViSncqvj7A/aju07aXTGn93T93vOJkfkkGN1dlvMkJE9Ruc/dWIog WuGRkIgVs072fr22ClpOI1+pjf2c2RjyVLrsWPoBefcJnoZx11g/1JfbE7p5KtPpls0x vS77rQ+uRaDl/jC3GvMEa0qi4hAejdrl1u+OMHI2Ua6gKQsddh52rfjHVYYCT5ZME1OF eEvgnGI3zRwLRCsVgp2d09gHA1TfaAVTGg8b8FTpvZW7ntNZY9E51ZPaaLWXq5eJcy0P I4Hg== 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 dr11-20020a170907720b00b007c0d95413bfsi18706909ejc.665.2023.01.12.10.55.55; Thu, 12 Jan 2023 10:56:07 -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 S240047AbjALSDw (ORCPT + 50 others); Thu, 12 Jan 2023 13:03:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240167AbjALSCg (ORCPT ); Thu, 12 Jan 2023 13:02:36 -0500 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 520853E870 for ; Thu, 12 Jan 2023 09:26:01 -0800 (PST) Received: from ptz.office.stw.pengutronix.de ([2a0a:edc0:0:900:1d::77] helo=[127.0.0.1]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pG1Kr-0000MD-Uv; Thu, 12 Jan 2023 18:25:54 +0100 Message-ID: Date: Thu, 12 Jan 2023 18:25:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH] usb: phy: generic: make vcc regulator optional Content-Language: en-US To: Sascha Hauer , linux-usb@vger.kernel.org Cc: Felipe Balbi , Mark Brown , linux-kernel@vger.kernel.org, kernel@pengutronix.de References: <20221012132754.292151-1-s.hauer@pengutronix.de> From: Ahmad Fatoum In-Reply-To: <20221012132754.292151-1-s.hauer@pengutronix.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2a0a:edc0:0:900:1d::77 X-SA-Exim-Mail-From: a.fatoum@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,NICE_REPLY_A, 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 On 12.10.22 15:27, Sascha Hauer wrote: > 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. Gentle ping. > 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) -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |