Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp600094pxb; Thu, 19 Nov 2020 09:03:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsSWWQCZcUJdFx8q6iRAYawIN/15LWONWO5iX4VLQ0r/NBB0qc3ujFcaBjbsXlBiIX7VMJ X-Received: by 2002:a50:a6c9:: with SMTP id f9mr31760872edc.158.1605805417038; Thu, 19 Nov 2020 09:03:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605805417; cv=none; d=google.com; s=arc-20160816; b=FHjybl92CpcAeL8dANO+QTdPy++CFhxc3a8i3GO0qo3jAs/wc9tVAV6uDUTzSfrmyF VQr8FexyXp+dsUNtm7XtTxtQ9K+h1ovfRdJBPikcdgMNMyjouOaIbo2LTkq3NKj/ZezJ eTGmkoJykvBQ6Kfx/km2/AVy01hZ10GKJFnWPc6hmdoywnvkZPO4P6EnbOTL6x5Fgolx nV4D4v6DojnMj5qY7msxz2J96z+fDJB/ManpzwzRzkZ7xvd+nOy/RLqtYuBTv+zE92Xu 6hhR3EjxTaimoAJzfZd0SmLeewETiJFQYM9V3daL85t3caN+ETLA4KhJUxsA3nujDMoM yI3Q== 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 :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature; bh=+tQ2BXpjik3+doDfIP6ABRAYhXmrT3iSlTSk4pFFTkU=; b=aVCgAfjoSEherhReExhpM6+Z3Kjsay68H4MIPNb5v2BLlHySevBAWn0lBnT0zQrSiF SCZmur2KAZNy7fQU3isjMSzQDokSZNzBi9DlPXuGpr1vh+AIzlfHnAxnvR8PDaHoJbmw uL7ypRH1o8a1FDT5gHpNF0g8/SoAtrhHT8QjiLFRO8UTE5vlfplfJwbrhK1wSHJJuNi8 w8edKeF2rQYmfqZdX/5Y65cWTJnehdG5CZbwVb8cEbmkzw71d9ff9xTj02vytz0hM0fe +UV21lvD5LEZKFXAe3BBD+3Rkt8M9icDZqcbCPBVb8QHlM+FYTfh1VBYkSWb/IoZhHBE QEww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XEj7iwUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id zn8si150535ejb.299.2020.11.19.09.03.11; Thu, 19 Nov 2020 09:03:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=XEj7iwUM; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729212AbgKSQ7E (ORCPT + 99 others); Thu, 19 Nov 2020 11:59:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727888AbgKSQ7D (ORCPT ); Thu, 19 Nov 2020 11:59:03 -0500 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8ACEAC0613CF; Thu, 19 Nov 2020 08:59:03 -0800 (PST) Received: by mail-wr1-x442.google.com with SMTP id k2so7240911wrx.2; Thu, 19 Nov 2020 08:59:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=+tQ2BXpjik3+doDfIP6ABRAYhXmrT3iSlTSk4pFFTkU=; b=XEj7iwUMNcqJjovR5s2ZwAvW1v+LRRbZVk34TPQcu071YWvMcS9NqpGTOUVAbsgbQf aNy7pDOToG2/q/Dbv/Qu1klqi+dIi+QHSxPpvt5UZtkUACsqvwNjofh7/qRmPYMCig6q gPQoerZzHJcrDxu5KHuDUowz1Tj3Me8ToIn7mxvqaGnlRiWqKswfCTPO1SLI58DY2X/u nwDwLE4ReWbiaUjFVpgFFyVq/z5ExDWjsGnIV/3Kr/8lrZT06e10lj+pyYItmssu3Kzv A0npQziOhB61zYQ60o5vmKoEt+QGh3xjDdzf70/g3cF2U+1/urk8q1+XrQNtM/Oku+X2 tW9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=+tQ2BXpjik3+doDfIP6ABRAYhXmrT3iSlTSk4pFFTkU=; b=RWtoqncGBKDYZ6leGVpowBRHwMDpwsfoeUOH+0iFqfwu29STvuv16PN1z49NXbKlE5 FFzYdiXS/3gT9PyWhBJwTf9Y/INrWLuJlgZkYnsBlDik9OhUC4uAvLoY4Ch4IjcWUA4y Gek8NdIWXwxG3lUoKjigNFjonvc5mr9fIYZxtpWnNREusQhtVPc1GtggGWemk+8mlgmA xD18DrY1032lxaCrv2j/SJUXxl1IRJQgfMwBDnjFwDmuphkLOaed4Fz7dOClNLmP9MCQ YdCVc0wcHf547+795kDFAxRNJ0US1S4pTTdcQD+ptWr+CWPtF2UkKFntUoEuH3lwlhva QGsw== X-Gm-Message-State: AOAM533QScjWSNUp6b69hZewt8PsfQv0Ddoq+Sb8CXktzQHQW2ntAtiw yTykneey8mRzAENDOm5gchCdhtxGEU1Drg== X-Received: by 2002:adf:f7c7:: with SMTP id a7mr12235117wrq.347.1605805142047; Thu, 19 Nov 2020 08:59:02 -0800 (PST) Received: from ?IPv6:2003:ea:8f23:2800:6d7c:9ea3:dfaa:d617? (p200300ea8f2328006d7c9ea3dfaad617.dip0.t-ipconnect.de. [2003:ea:8f23:2800:6d7c:9ea3:dfaa:d617]) by smtp.googlemail.com with ESMTPSA id e3sm495182wro.90.2020.11.19.08.59.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Nov 2020 08:59:01 -0800 (PST) Subject: Re: [PATCH] mdio_bus: suppress err message for reset gpio EPROBE_DEFER To: Grygorii Strashko , "David S. Miller" , netdev@vger.kernel.org, Jakub Kicinski , Andrew Lunn Cc: linux-kernel@vger.kernel.org References: <20201118142426.25369-1-grygorii.strashko@ti.com> <0329ed05-371b-0bb5-4f85-75ecaff6a70b@gmail.com> <655ec6e4-6e75-1835-034c-ec18dac505e8@ti.com> From: Heiner Kallweit Message-ID: <7c2e8a07-4cb6-ee9c-9d64-9cf68b0390c7@gmail.com> Date: Thu, 19 Nov 2020 17:58:56 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <655ec6e4-6e75-1835-034c-ec18dac505e8@ti.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 19.11.2020 um 14:38 schrieb Grygorii Strashko: > > > On 19/11/2020 14:30, Heiner Kallweit wrote: >> Am 18.11.2020 um 15:24 schrieb Grygorii Strashko: >>> The mdio_bus may have dependencies from GPIO controller and so got >>> deferred. Now it will print error message every time -EPROBE_DEFER is >>> returned from: >>> __mdiobus_register() >>>   |-devm_gpiod_get_optional() >>> without actually identifying error code. >>> >>> "mdio_bus 4a101000.mdio: mii_bus 4a101000.mdio couldn't get reset GPIO" >>> >>> Hence, suppress error message when devm_gpiod_get_optional() returning >>> -EPROBE_DEFER case. >>> >>> Signed-off-by: Grygorii Strashko >>> --- >>>   drivers/net/phy/mdio_bus.c | 7 ++++--- >>>   1 file changed, 4 insertions(+), 3 deletions(-) >>> >>> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c >>> index 757e950fb745..54fc13043656 100644 >>> --- a/drivers/net/phy/mdio_bus.c >>> +++ b/drivers/net/phy/mdio_bus.c >>> @@ -546,10 +546,11 @@ int __mdiobus_register(struct mii_bus *bus, struct module *owner) >>>       /* de-assert bus level PHY GPIO reset */ >>>       gpiod = devm_gpiod_get_optional(&bus->dev, "reset", GPIOD_OUT_LOW); >>>       if (IS_ERR(gpiod)) { >>> -        dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO\n", >>> -            bus->id); >>> +        err = PTR_ERR(gpiod); >>> +        if (err != -EPROBE_DEFER) >>> +            dev_err(&bus->dev, "mii_bus %s couldn't get reset GPIO %d\n", bus->id, err); >>>           device_del(&bus->dev); >>> -        return PTR_ERR(gpiod); >>> +        return err; >>>       } else    if (gpiod) { >>>           bus->reset_gpiod = gpiod; >>>   >> >> Using dev_err_probe() here would simplify the code. >> > > this was my first though, but was not sure if it's correct as dev_err_probe() will use dev > to store defer reason, but the same 'dev' is deleted on the next line. > If you look at device_del() you see that it calls driver_deferred_probe_del() which frees the reason string. Means you're right in a way that storing the deferral reason doesn't provide any benefit here, but it also doesn't hurt. Good thing about using dev_err_probe() is also that it prints a debug info in case of deferral what may help people chasing an issue involving this deferral. > I also thought about using bus->parent, but it's not always provided. > > So, if you think dev_err_probe(0) can be used - I can change and re-send. >