Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp2500365pxb; Fri, 17 Sep 2021 11:08:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNPc5hBNxaKqY3v8ZfLxwkH1ShV65Qt9F6MgWcgwoTydv3nyTQAW4T4owUm4lZMy1LS7zf X-Received: by 2002:a17:907:7752:: with SMTP id kx18mr14102013ejc.276.1631902081696; Fri, 17 Sep 2021 11:08:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631902081; cv=none; d=google.com; s=arc-20160816; b=m6yTGuEUOxiS36tW7ezZOM5XRBeu8QNYqDW9Q5nld0vSPqlKSTIe4M5a2FnlCu/8/F c7FPoI/S5ld3OmhMqC1FANZYr/iMM19lwK+95UMxXyTphxjIOuI4il1O4oEXwtiCt4QG c0Cpi/cGuiGYL0K7xxIUng4W9Cdpxa32FgW3e9zDAoykSNRvVwrG5bTeetxuqAKmDMuI X+j3xrG4mZ3LUQASQxr2cE1ZPboZF7TjJv85TH9VW92eeaCHlStjqnHZvSqBedy0lKNJ fo2c0aqiBXAlQjyFVKHUuc28RRY7h1/FC+hiGdigJ2kW01hs9skw3aLAQP6ixDtnEj81 Q34Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=4hOBpaSYMnA8iXHA1EVV20O7A0NeSkpoXYY1w1e2akY=; b=jPieuqXCaunPaPIfUsHqV5zdXzAEXjgIxE3RLOUwhAOky+3n0n6CPrqayqhB8ka+QV ATG9QlnE/5LeihJ2eWVf5RtimBPo1pteGk7APTzv55Qpfq+6bQcaeZczzdk6TcbSsOSZ DRYplwN6r1PddwtuKGk59tDyzgpRIfOWWmtlMSV6vINC0dnpUbrxoddL94mBzOZRnrbT NbP16SHj0guQJ+97zVkEVsxZq5WQqvAxYH50uczVfmuphXWbXW20ZJWqz+I8U3mN4F4d KrfRWuxKFfmrJ0mWpHiSwBUPD/husT3jnLDYNTACysldwNFqEPTJ03A0OZVpaFuFcr92 uNPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Na9BN6IX; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f6si7485480ejl.695.2021.09.17.11.07.37; Fri, 17 Sep 2021 11:08:01 -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=@linaro.org header.s=google header.b=Na9BN6IX; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245580AbhIQJUa (ORCPT + 99 others); Fri, 17 Sep 2021 05:20:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239041AbhIQJTI (ORCPT ); Fri, 17 Sep 2021 05:19:08 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07545C061764 for ; Fri, 17 Sep 2021 02:17:32 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id d207-20020a1c1dd8000000b00307e2d1ec1aso6384723wmd.5 for ; Fri, 17 Sep 2021 02:17:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=4hOBpaSYMnA8iXHA1EVV20O7A0NeSkpoXYY1w1e2akY=; b=Na9BN6IXqEtILfxmjrbI3/Guf6JjAUedlnkEhGnoF/Z/L/QUMo24uTQOQykju7rAJa qxgoYwhQtDdLb+ouAUxb1uSgjJ60x6y8lkcHjOMBowX3lJ8x4LmDVsrFQXvjF9dtFChO V0s6lbPs+4YIJhJU4/N5tLNF7zn8kD2aBeYxM2XAPuLBVab7e4I04M1b8JGBoY31qCpO jSS3YqhBnndDMJw3YyruplpahsrLm/8mrB7CJ0VOVbFwW7PuQ/z7x2nHd8/szYct2xgO x6UKZYIDamnV2wxI5Q55kHnoiHYWcvH1qmJjw23ccIVEhAAlI5mtjwiX/ManbS4UaONg J9FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=4hOBpaSYMnA8iXHA1EVV20O7A0NeSkpoXYY1w1e2akY=; b=ojDrJ8clBwzGNemrawzi6AB5/PYITawK1S/ovMZLXUtJnsFH9MqYoKmvc7jjWHTRu4 hKTsVpgE8UeblZFtxWxabivTMY+gSrvpEZSXTiZPqXaVUVUxQ0lMON9Zrng3VDFM7+0W 1gs2JCmnssKuZ8L99L5X8E+SiQ/bhxkJecNikVfHh/xrr35drdDgcVJ10ehYWCJ+ANts gSkbTSat/Y8cmLLZYmVdNNBGnE7xwOQrExiQcgHAYiPiVcdaa31gT0DHrErKjlrlElxq fnEP6suSO2le1v5TfMWt5QcijTnus06tZYINWsf8TGD1/qrOP2A1l6b348iD088qHP97 j9/A== X-Gm-Message-State: AOAM5304V/SSIp6SPh+EBn8Qdi4XP8BjSw7jd69T240EsyBUeP1qcHEo WNhsSoDS3aVv7OV5/BKz1/DAFQ== X-Received: by 2002:a7b:cb45:: with SMTP id v5mr13647501wmj.184.1631870251485; Fri, 17 Sep 2021 02:17:31 -0700 (PDT) Received: from maple.lan (cpc141216-aztw34-2-0-cust174.18-1.cable.virginm.net. [80.7.220.175]) by smtp.gmail.com with ESMTPSA id p4sm5716272wmg.16.2021.09.17.02.17.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Sep 2021 02:17:30 -0700 (PDT) Date: Fri, 17 Sep 2021 10:17:29 +0100 From: Daniel Thompson To: Cai Huoqing Cc: Lee Jones , Jingoo Han , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] backlight: bd6107: Make use of the helper function dev_err_probe() Message-ID: <20210917091729.elpngrzpvmp43wns@maple.lan> References: <20210917031308.17623-1-caihuoqing@baidu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210917031308.17623-1-caihuoqing@baidu.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 17, 2021 at 11:13:06AM +0800, Cai Huoqing wrote: > When possible use dev_err_probe help to properly deal with the > PROBE_DEFER error, the benefit is that DEFER issue will be logged > in the devices_deferred debugfs file. > Using dev_err_probe() can reduce code size, and the error value > gets printed. > > Signed-off-by: Cai Huoqing Change seems OK but does this really need to be done one file at a time? I'd prefer to see all of backlight handled in one go (given the scope of this change if applied across the kernel it needs automatic tooling anyway). Daniel. > --- > drivers/video/backlight/bd6107.c | 16 ++++++---------- > 1 file changed, 6 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/backlight/bd6107.c b/drivers/video/backlight/bd6107.c > index 515184fbe33a..e21b793302a2 100644 > --- a/drivers/video/backlight/bd6107.c > +++ b/drivers/video/backlight/bd6107.c > @@ -120,7 +120,6 @@ static int bd6107_probe(struct i2c_client *client, > struct backlight_device *backlight; > struct backlight_properties props; > struct bd6107 *bd; > - int ret; > > if (pdata == NULL) { > dev_err(&client->dev, "No platform data\n"); > @@ -148,11 +147,9 @@ static int bd6107_probe(struct i2c_client *client, > * the reset. > */ > bd->reset = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH); > - if (IS_ERR(bd->reset)) { > - dev_err(&client->dev, "unable to request reset GPIO\n"); > - ret = PTR_ERR(bd->reset); > - return ret; > - } > + if (IS_ERR(bd->reset)) > + return dev_err_probe(&client->dev, PTR_ERR(bd->reset), > + "unable to request reset GPIO\n"); > > memset(&props, 0, sizeof(props)); > props.type = BACKLIGHT_RAW; > @@ -164,10 +161,9 @@ static int bd6107_probe(struct i2c_client *client, > dev_name(&client->dev), > &bd->client->dev, bd, > &bd6107_backlight_ops, &props); > - if (IS_ERR(backlight)) { > - dev_err(&client->dev, "failed to register backlight\n"); > - return PTR_ERR(backlight); > - } > + if (IS_ERR(backlight)) > + return dev_err_probe(&client->dev, PTR_ERR(backlight), > + "failed to register backlight\n"); > > backlight_update_status(backlight); > i2c_set_clientdata(client, backlight); > -- > 2.25.1 >