Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4095390ybg; Mon, 21 Oct 2019 03:47:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzf2xbzhYtXZCRzu+Tec/jeoDSMJnCK7RR5CYMktISViiAEmUObhOYBf+xUoazNI+gS4MDI X-Received: by 2002:a50:da0f:: with SMTP id z15mr24145953edj.137.1571654821853; Mon, 21 Oct 2019 03:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571654821; cv=none; d=google.com; s=arc-20160816; b=qSHuqQFWnzn2MTfufIaGP22syAvqjZoORY3WzC5Pknejzt0UPSP6k9gOTFoc5ttx83 em5ZrjWBbsVNTrxLLpojWAiTkLPtgq/47OeIxlVePh83sWMs63vWeGb+1QXfEZkeVqV+ ftxIVEfjKVu883xARLffwG8qohlwqDTlGOt9BzrF573T4dug8Md1nhhg0JJZWhY4Ybwj VVG+61zhkAgXyuEwb50XGqJ6qH1/bxWEVDfy4SvwKEAnSyRRL6LAWXX87QtZgLBJBXSz 2Xy9g21rgcWJ43RXwg3nj+hPvMe9L4TlC+DTjEVstvkQ9kKpFxI/0JfFk+NgxEvqvtQ8 M+IA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=CJo1vGs4ohyige0AyAjrZb8zyvlwhFRLiB6YWgX+C3o=; b=dInpbTNhknivBHqSoZbSWY4yDO+xBZJbbNl8sxyUnyWuRmjxE2SW8jhaOT4XBHUrIx 3FPyOxl9ZTMBQoMnibVHpdPNIQxk5d9wZeBUZ+9pgf16PwpR+CZqKMyy1h75tjvsqH10 ez+hcpVBfADYzuwF80PArgLbfstO61TLZyY4LqI2A30zCTu7ALPvSclz3Yyr3ANljnp2 cblP2sxLUIANx3t3fk1jAsDXPIxz1ns+mT3nQ994gylm9aCoerJiNGJpZ8GqpS/wE1X6 Sy+6q3XqY64tEJ86Yu8iF6qFgQ7S/S+rCAIU6ABR62hnodtbaYqtEel1lX0O9UQqAKa7 1www== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUNMfWi8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id d10si10429950edk.115.2019.10.21.03.46.38; Mon, 21 Oct 2019 03:47:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=lUNMfWi8; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1728225AbfJUKpP (ORCPT + 99 others); Mon, 21 Oct 2019 06:45:15 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38106 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727328AbfJUKpP (ORCPT ); Mon, 21 Oct 2019 06:45:15 -0400 Received: by mail-wr1-f65.google.com with SMTP id v9so2111089wrq.5 for ; Mon, 21 Oct 2019 03:45:12 -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:user-agent; bh=CJo1vGs4ohyige0AyAjrZb8zyvlwhFRLiB6YWgX+C3o=; b=lUNMfWi8td8fXPOYsOUuMBA9nWhRm0sBIXWMkl4sTFpawsp/CTPCpFr6O8gwzrzkgk pkxXJHfF/gQ3TH5qexZiA6RIH368flsN8Q+PTma85+Ev6H7rpZsULwO8EYlzGqtRM4gw 7rj2u20jS7LAGi79W7V6cauUS6INpXUN64sMSlhP6LYN+rfZ8nrOtLkRdsGrYBQLjaWn rkgJ5ukLRCJEzn35zoa5dDskWA+2SzE5LItepTXVZpSDG8HN32mqrw2Nw26qf845wK/e D25QsJ3zYhtkMR6iFCZBrEwuV8SpHikU8FdSzNcQxPV+dujq4CCtNkJmNqJRRNfiwSe/ 7iuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=CJo1vGs4ohyige0AyAjrZb8zyvlwhFRLiB6YWgX+C3o=; b=bwuMOYGNblkBwE0jlMKmVIq14URn+o28XIqo9rr0fp5PSNF95LJ8KyPZiny4/lj1b0 vEeLFeWzBpYVlyhxuUNEFjY0GU61OugGDV+ilBwgUyE7hdF+ze2Hd6s6TR2XlHPUBzuX CL5xLVis9Yd0bU+fVyEge6JL1HtcAL9QnhcinFAMmfsNQo0QPryTDm2j7+5U/1rpvWFM nMa7Fg8Ny4wsz8iK1Qug9T6TkeLemWcyttYUPTeI8A5ns4vph4n3xA/fmTsqlFZu8AFy IOIsm1be9c/XVojIcNOfNwycwKlXAiatDgN/6K6T2FlnuyxFQhuS78EAk0kNfsn5xGIO xhQQ== X-Gm-Message-State: APjAAAWUq7EkWS++w80eck5Su7aHCWgbafeZboPhUmLzRuNLZorl/7RX CBKu8V9jLWcA3ih5EgMQXg8YlQ== X-Received: by 2002:a5d:408f:: with SMTP id o15mr17537508wrp.139.1571654711412; Mon, 21 Oct 2019 03:45:11 -0700 (PDT) Received: from holly.lan (cpc141214-aztw34-2-0-cust773.18-1.cable.virginm.net. [86.9.19.6]) by smtp.gmail.com with ESMTPSA id x21sm921318wmj.42.2019.10.21.03.45.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Oct 2019 03:45:10 -0700 (PDT) Date: Mon, 21 Oct 2019 11:45:09 +0100 From: Daniel Thompson To: Bartosz Golaszewski Cc: Yoshinori Sato , Rich Felker , Lee Jones , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi , linux-sh@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, Bartosz Golaszewski Subject: Re: [PATCH v6 3/9] backlight: gpio: explicitly set the direction of the GPIO Message-ID: <20191021104509.p2bsll3rwe7ica6t@holly.lan> References: <20191019083556.19466-1-brgl@bgdev.pl> <20191019083556.19466-4-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191019083556.19466-4-brgl@bgdev.pl> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 19, 2019 at 10:35:50AM +0200, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > The GPIO backlight driver currently requests the line 'as is', without > acively setting its direction. This can lead to problems: if the line > is in input mode by default, we won't be able to drive it later when > updating the status and also reading its initial value doesn't make > sense for backlight setting. > > Request the line 'as is' initially, so that we can read its value > without affecting it but then change the direction to output explicitly > when setting the initial brightness. > > Also: check the current direction and only read the value if it's output. > > Signed-off-by: Bartosz Golaszewski Intent looks good to me but... > --- > drivers/video/backlight/gpio_backlight.c | 23 ++++++++++++++++++----- > 1 file changed, 18 insertions(+), 5 deletions(-) > > diff --git a/drivers/video/backlight/gpio_backlight.c b/drivers/video/backlight/gpio_backlight.c > index 3955b513f2f8..a36ac3a45b81 100644 > --- a/drivers/video/backlight/gpio_backlight.c > +++ b/drivers/video/backlight/gpio_backlight.c > @@ -25,9 +25,8 @@ struct gpio_backlight { > int def_value; > }; > > -static int gpio_backlight_update_status(struct backlight_device *bl) > +static int gpio_backlight_get_curr_brightness(struct backlight_device *bl) This function does not get the current brightness (e.g. what the hardware is currently doing). Given we've just nuked the function that *did* get the current brightness from the hardware this isn't an acceptable name. Would like something like calc_brightness() or get_next_brightness(). Daniel.