Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp155375pxb; Fri, 17 Sep 2021 22:10:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwYczlITb/XoO7uAXqCjljgba6vS1HpF5DXb0+tuziKf0re7rPRClTuTUA6DZ+KHB22UqJY X-Received: by 2002:a6b:3f02:: with SMTP id m2mr11046133ioa.136.1631941830836; Fri, 17 Sep 2021 22:10:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631941830; cv=none; d=google.com; s=arc-20160816; b=Gp3+bIPfCZFQ230kMH902ARYdX29qwSIEloCNSD9Nidih8J9/9ihuNK4NvJHyxiQCe Fa2eO9LpOW8Rk10mnxM0A1HmAH3G36j6nBeBCxDCIsaGY+b0bHV+893zn9qKSZbzgvwz A4XKrt+9B9SgKWKX1beYQfK4pcgexknKQtQ+gl5JqmJXAi0O7x1xZUVVIXBp18D2cajh IPEIqUavuLWnVULyYxfA8tL1G0zqo8jREMmcAFPRQJtPq/wI2/3JUPe4YRsbkNU14cgP st3KkP9QTunT3QvsiFe1JZ8v/JOQlC/IYYu64yktPoeqwD9tSZyzqkJ6grqqEVncMLgG 6/ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gD3D1HE4zYILu0+ZzkTQiVhB8QdO4UEirY2pAFsXAsg=; b=gwHO1ooEM947TDEmCFYpzOBt/8awbIEOzOCXu/SsvsNULGeIYo1k1zsIV9ultljgxC bkxNYe6OwxIG5MQXO8nB32PIDDniN26k9ei6sLlMbsA6LIQohGWWGEtFW1D0+nwXeV6k KbYc6PWROchiskScjWvqJJODCqvlNtR+QHPmJqsoG0dt6QiUTfd2OhHr7HB5/htVdYXG tlstt9cIWsM7Xd2AW3Y/QG9RerDGZAe2FoVhotvZBn/+TNExsmZaX5KnQnLlXjLH+InY HyvG0lbMNLg//XcWK6kuZTbpBZvDNVejfYLkvCdrL4lIz6Lxrx+x8pSBvVvYNSbgAQ1l 0GKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=DNI0JghG; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m33si6833580jaf.66.2021.09.17.22.10.19; Fri, 17 Sep 2021 22:10:30 -0700 (PDT) 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=@chromium.org header.s=google header.b=DNI0JghG; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344810AbhIQWuj (ORCPT + 99 others); Fri, 17 Sep 2021 18:50:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37134 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236208AbhIQWui (ORCPT ); Fri, 17 Sep 2021 18:50:38 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2151FC061574 for ; Fri, 17 Sep 2021 15:49:16 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id c10so22254237qko.11 for ; Fri, 17 Sep 2021 15:49:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gD3D1HE4zYILu0+ZzkTQiVhB8QdO4UEirY2pAFsXAsg=; b=DNI0JghGS/WxXoZfwSOl/X9w3UNCgpUUCeVhuj6wL4UmBoTqF0gmnpp44a7/HPq10w HRI/x3+zg2doHDzTKrVweEnN1amNMoITseoC+BKj2ADxrlWrKcbVX+BVykGKpd3z+tVo HWZ70ILMD4fKmMZjSXvOX1FRUirS4gZ7baPsU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gD3D1HE4zYILu0+ZzkTQiVhB8QdO4UEirY2pAFsXAsg=; b=DyHl00N//AfBbEyE7l67+8bQOhNo44n4UbdNUnwgwcWUPt3XqvKgAfBexSlCJ9d96E JldR8mMTFwiMDYOnoLq5+6DEcV/Uqrh8J/WEZvYSUF3e6GbJkYpQFgxys5JvzrELDyaY rNnAdts47A5ugqJ5ovcbvijjlNU1N9BDB8xvuwh7+A8CwM6o7WeE1RCYeiZD+dK86Cn2 +j2KC8qQ0PapX/7TE3y3y41MsFLh5nvXOFnIttYh6fzPAA01jChZA+gGirTC0qBx1r24 3W/btVGKDHT1q559sBNSpQMCld7BjCoAD5yb+ZjPQxigG0QzYgbZquXlFlLoqwxVYPI2 WnPg== X-Gm-Message-State: AOAM531vzsMJIhgoE55rgVV4uqt3iWHza4WKvasPs8xkTscGvckA822f gaqWr8ZvpOpdplo+149rhQrz/AHFBcM3oOkeTkiGjw== X-Received: by 2002:a25:6744:: with SMTP id b65mr1144453ybc.100.1631918955276; Fri, 17 Sep 2021 15:49:15 -0700 (PDT) MIME-Version: 1.0 References: <20210914162825.v3.1.I85e46da154e3fa570442b496a0363250fff0e44e@changeid> <20210914162825.v3.2.Ib06997ddd73e2ac29e185f039d85cfa8e760d641@changeid> In-Reply-To: From: Philip Chen Date: Fri, 17 Sep 2021 15:49:04 -0700 Message-ID: Subject: Re: [PATCH v3 2/3] drm/bridge: parade-ps8640: Use regmap APIs To: Doug Anderson Cc: Stephen Boyd , LKML , Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Neil Armstrong , Robert Foss , dri-devel Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Doug and Stephen, Thanks for the review. Before we reach a consensus on the best logging option, I'll just remove the printouts from this patch and just return PTR_ERR. Once we reach a consensus, we can probably improve logging in a separate patch. On Fri, Sep 17, 2021 at 8:02 AM Doug Anderson wrote: > > Hi, > > On Thu, Sep 16, 2021 at 11:12 PM Stephen Boyd wrote: > > > > > > > In the case of devm_regmap_init_i2c(), the driver could be fine but > > > > > you might be trying to instantiate it on a system whose i2c bus lacks > > > > > the needed functionality. That's not a bug in the bridge driver but an > > > > > error in system integration. Yeah, after bringup of the new system you > > > > > probably don't need the error, but it will be useful during people's > > > > > bringups year after year. > > > > > > > > > > > > > The point I'm trying to make is that these error messages in probe > > > > almost never get printed after the driver is brought up on the hardware > > > > that starts shipping out to non-kernel developers. Of course they happen > > > > when kernel devs are enabling new hardware year after year on the same > > > > tried and tested driver. They're worthwhile messages to have to make our > > > > lives easier at figuring out some misconfiguration, etc. The problem is > > > > they lead to bloat once the bringup/configuration phase is over. > > > > > > > > At one point we directed driver authors at dev_dbg() for these prints so > > > > that the strings would be removed from the kernel image if debugging > > > > wasn't enabled. It looks like dev_err_probe() goes in the opposite > > > > direction by printing an error message and passing the string to an > > > > exported function, so dev_dbg() won't reduce the image size. Ugh! > > > > > > So maybe the key here is that "CONFIG_PRINTK=n" is not the same as > > > "CONFIG_I_THINK_PROBE_ERRORS_ARE_BLOAT" and it's not just that one has > > > a more flippant name than the other. I think your argument about the > > > fact that these errors almost never come up in practice is actually > > > true for pretty much _all_ probe errors, isn't it? So if you wanted to > > > keep non-probe errors in your system (keep PRINTK=y) and just do away > > > with these bloat-y probe errors then dev_err_probe() could really be > > > the key and there'd be a big benefit for using for all these errors > > > during probe, not just ones that have a chance of deferring. ...and > > > yes, you could make this config do something fancy like do a stack > > > dump or print the return address if you actually hit one of these > > > errors once you've thrown away the string. > > > > Yes, but it's also just as important to push similar messages, i.e. "I > > failed to get some resource", into the API that hands resources out so > > that bloat is minimized further and drivers are kept simple. > > Sure, but this is a slippery slope. If there's any chance that a > caller might want to know about the error but _not_ want the error > message printed then you can't push the error message into the API. > It's really hard to find error cases (even with "get resource" type > functions) where the caller _always_ wants the error reported. Even > kmalloc() has a nod to this with __GFP_NOWARN, though I'm not > advocating adding a "no warn" flag to all APIs. It's always possible > that the caller is expecting some types of errors and handles the case > elegantly. > > Let's pop all the way back up to the original point here, which was > about devm_regmap_init_i2c(). What should happen with errors? Let's > look specifically at the errors that could be returned by > regmap_get_i2c_bus() which is the first thing devm_regmap_init_i2c() > tries to do. Those errors have to do with the i2c bus not supporting > the features needed by our regmap. > > > a) We could return the error without printing anything like the code does today. > > No bloat, but during bringup of this bridge chip on a new i2c bus we'd > have to manually add printouts to the probe function to figure out > this error. > > > b) We could push error reporting into regmap_get_i2c_bus(). > > No per-driver bloat, but some drivers might have a legitimate reason > not to have an error print here. Perhaps they have a fallback `regmap` > config that they want to be able to use that works with different bus > capabilities. I don't think we can do this. > > > c) We could use dev_dbg() to print the error > > Only bloat if dynamic debug or DEBUG is defined > > > d) We could use dev_err_probe() to print the error > > Extra bloat, though it could be minimized (without sacrificing all > "printk") with a future patch to drop the string from dev_err_probe() > and perhaps replace it with a WARN_ON(). Also handles the fact that > perhaps someday someone might find a reason that regmap_get_i2c_bus() > and/or devm_regmap_init_i2c() should suddenly start returning > -EPROBE_DEFER. > > > I'm still advocating for "d)" above and I believe you originally > advocated for "a)" or "c)". It's really not such a huge deal, so if > you're adamant about "a)" then I'll shut up. I'm curious if I've > managed to convince you all about "d)" though. > > -Doug