Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp4194602ybg; Mon, 21 Oct 2019 05:22:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqxEvyFl6NuETteWH7FOYypff4ECRxzCNVJnH3BMMNXaiYFfzr+NZUUfh1e79x41oN98DA7z X-Received: by 2002:aa7:d758:: with SMTP id a24mr25106556eds.194.1571660521768; Mon, 21 Oct 2019 05:22:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571660521; cv=none; d=google.com; s=arc-20160816; b=asWjCRfK2BEeANcbtuFj9vj/kHkoim1465i+JX6XJmxUE0ppMQQfeVoExmayqyZzCU G9Tzo3NOysLPDZj2EE+H3CHORzHFxxvOxmGP3GHOp2qm+x/o6M60GJY8NBjIVEqMhEBF Xv6x+7XM5t4RawyPaN0Gt7l5tS+4ASfNRSVn9H5e5yIM7JJzSMpVzlWN68HQhSrGEfYj wSdl2Zt8UJ1KsUsh3HVCKPOTG/0ppFoMtpCDx9pZ3Bi4lfqmg8lvAFBdksv1fJYLAQGH qm+NjZoO7sHasZIPLslPD+YUA1TSE1SNn+YhAuUjy2gEOGiRys0RTYWke5fmeOAa2mgw 182A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=wnGtB4lj7QZakI4bXBl4LOnjDVuoS6i9juH0AaPHUsI=; b=W01NTRcM6ZRFFn0S8CMl0o04CKxUgKlU2vJ/9GEj+f4w4Ogwmw8ex8SgeslOijibDd 3jBfReWzZjU0M/RcbkSbvwknclLfy7mCJ35z0/nS3Z6ZCXWgVm7Bs7E5umWo2Dl90C88 0tzpnnpMvl0ykt7kdNIFDpq3VfwDv07VBwVMPAm85L+2y1RsTKQquN307VR2a7PP/2KW PPWhDeKL8596BRSVSQZ0MeF+Yq1Y7nXDpyKtpvefUUp6Td1csrDRHDlBuGouqN1DIJw6 FyYN3q+PtewlYRgzwVN75Fgi4LP9YtGL0aiqoXcpcu2svQl4BGYq5vYD5cA95Z1CX7LK BqQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=yqzJO5yr; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e11si8612550ejb.48.2019.10.21.05.21.38; Mon, 21 Oct 2019 05:22: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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=yqzJO5yr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728540AbfJUMVe (ORCPT + 99 others); Mon, 21 Oct 2019 08:21:34 -0400 Received: from mail-il1-f194.google.com ([209.85.166.194]:38636 "EHLO mail-il1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726767AbfJUMVe (ORCPT ); Mon, 21 Oct 2019 08:21:34 -0400 Received: by mail-il1-f194.google.com with SMTP id y5so11770439ilb.5 for ; Mon, 21 Oct 2019 05:21:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=wnGtB4lj7QZakI4bXBl4LOnjDVuoS6i9juH0AaPHUsI=; b=yqzJO5yrEuZ0AujBs35LlMVgp6QrGyJjIObeyazkPjRn1j5wQVKWq6ySSs5n6N4uiw w7AvSYJxB4dwHnN4Ik35WPXIfmBuhe7CsdcgDCSBhAMZJYWjhfy5dXSqH5XFQGMRCiL7 IDZuf7KHDhV7oNVgFuYj4nLiL3qZQdEK4nrMHqRbpO0nMszqcZGhHNGy/GBtrkmkYzAL yXeyd+jUgvOFi1sZvsBGEwDj2CQv2SACk7Dp90Yp6dxMObXcSZ58Nk2OSFEIQIPF4hSy Xtzxus/dbLmFmsv9pIP40s+WzRnsGXN55Dx17Z3AwLupEnMqRwCTVQozron87CbKuu/n mb5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=wnGtB4lj7QZakI4bXBl4LOnjDVuoS6i9juH0AaPHUsI=; b=F+E7uy5ig1cRr8xXTWJwy7l1WW+5HU3ZvwkQbj1acBpfXHDcMSxQNJsnOXkD3/zK9o 4g/6GO8ALVezCYbtj7KL98BsvbMNhH7VZi1cVfd5+WF7dLMDuS55BCRVLdRYWwsG1GwL 5t5DOemihOgOyprDI/6Wv8Hwh5zJ5wXfwb9znVntdRhAsWZA/hNqPJOGnqejWBtpQQy7 Jtu24nVjla71NL0Z3qtXFvGsiIhlv3k/vZ45f2NgFobR1uiSLzH2eQXUg4oe/uIioByT fWdPQPP1E6Vk6rB0r2xF47vkCmFFwmWrmHWVKgOHqV2GDUvjhPYtSixCkrpMWgmQgr94 0Eeg== X-Gm-Message-State: APjAAAUhueUCE61+qG594h5CuOBx5AIURuu2RU/pfsWBBYeXexOgC8ZT GXwpHIhln9AqRLUPopCBwCCr7aeic+y3OuT86owb/A== X-Received: by 2002:a92:410c:: with SMTP id o12mr25941800ila.287.1571660492888; Mon, 21 Oct 2019 05:21:32 -0700 (PDT) MIME-Version: 1.0 References: <20191019083556.19466-1-brgl@bgdev.pl> <20191019083556.19466-4-brgl@bgdev.pl> <20191021104509.p2bsll3rwe7ica6t@holly.lan> In-Reply-To: <20191021104509.p2bsll3rwe7ica6t@holly.lan> From: Bartosz Golaszewski Date: Mon, 21 Oct 2019 14:21:21 +0200 Message-ID: Subject: Re: [PATCH v6 3/9] backlight: gpio: explicitly set the direction of the GPIO To: Daniel Thompson Cc: Yoshinori Sato , Rich Felker , Lee Jones , Jingoo Han , Bartlomiej Zolnierkiewicz , Linus Walleij , Andy Shevchenko , Jacopo Mondi , Linux-sh list , Linux Kernel Mailing List , "open list:DRM PANEL DRIVERS" , Linux Fbdev development list , Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pon., 21 pa=C5=BA 2019 o 12:45 Daniel Thompson napisa=C5=82(a): > > 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 outpu= t. > > > > 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/b= acklight/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(). > Fair enough, the latter sounds good in this case. Bart