Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2590806iof; Wed, 8 Jun 2022 08:05:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUNAL0UVZQ2PvjaQk+XlqHLSPYhlyEH2qmMHEa4dr3cjhqbq04tEJitn7TXBhbIPGyar3Q X-Received: by 2002:a63:692:0:b0:3fd:e23d:f7d5 with SMTP id 140-20020a630692000000b003fde23df7d5mr11441761pgg.323.1654700755824; Wed, 08 Jun 2022 08:05:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654700755; cv=none; d=google.com; s=arc-20160816; b=H6VR+XiLZ2L7cE82MayTHn9bBZ6kjPB78hUBXInZu5rZhfdNa2yvasyui8dVL/gERO jkJ4Mf0UFCU8VMvogRgEJZGdqPNhlO/U2dY2wLBzsZSHxLNdx0Eta4E4gUEeO8of767l jR5nb34ZrlTau4aHjyF5EppvrC1fda3sJYIQwiEemloUP74nFfdRBfiOJ4I+PLIDWqws mTz/REew1/4dj4lz839OEk9l946XYtGRYSA071EcvgpoCq4xzVcNGYnF2UZ61GC7IBeZ r2lv0YEzW2qYfnwttj4OPUYfvnBcrD+pZ5qftHzWyBDV1mF2jLFaBPi/qvUZZydsAujv Eogg== 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=khBUE53X9QuO6dWoSeEXJmXd2fMLigTEjdoQDhHw9mU=; b=n71W8bzW3Zt/iQ9ZFADez8iwzDDb0Qf/w2wqpt/F0amYJfKAB15qL3AIu4qvMiOXoM 7o92RvdXPBWD5wEwGfeTkmuVPgFdzQCrd+gH4NZg+hRu2C9BS1Vr7DIYThSEdx6JN+t4 yTSLu+cTdKBaZo7kGr6cTSpJlthjh5uvdpJQQMg4MFLgFNqTILd4ZooyRtw7gz9U/N7G mC/j0euQDkJAW65jloSAhpsL89/oOYLhkaQHIS12RiClnSqGxlsuYYYif+lZhaKUVyPs ma818G561K4sj93kmBw3yO74G495Wx5o4P8aJdoCnfa6d1+mxDzQBOKecCprtptP1nWw boPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zygb11Po; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m12-20020a170902f64c00b0016198140119si17541923plg.606.2022.06.08.08.05.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 08:05:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Zygb11Po; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CC56E4434; Wed, 8 Jun 2022 07:37:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241320AbiFHOgz (ORCPT + 99 others); Wed, 8 Jun 2022 10:36:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241488AbiFHOgx (ORCPT ); Wed, 8 Jun 2022 10:36:53 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0E2691562 for ; Wed, 8 Jun 2022 07:36:46 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id d14so19645958wra.10 for ; Wed, 08 Jun 2022 07:36:46 -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=khBUE53X9QuO6dWoSeEXJmXd2fMLigTEjdoQDhHw9mU=; b=Zygb11Po3xDFIHW2f+svcZVUL+ZvG2ZRBoGgdGzKTr0Kbk0U0KLEHUhPGDjn9UDod4 8YdMOQoEFnHaWsA9c5BtdfJEyOk8qA79OEExEabcm92kdN2REqzYhAYxAIChyKgBKBJv xrbalNL9qXh0cL+SlrXMWypEq4ZFjxKCenwUsuTr/6K5Z+dSWKaDcVR/mNHdUZzcM5Lz 68FzKB6yp9pt75OTd1dPBnsuNgW7aiCn7Nk2BfEaBgWn9U1tT+btkuzh3xO0izONkRPh WLU3dkz0/JaRYem8VX/l+AWseou10xPiimxGawgdHEPTjDJunaaRhJf58Y6PIua/vQAk z0Mg== 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=khBUE53X9QuO6dWoSeEXJmXd2fMLigTEjdoQDhHw9mU=; b=4ww+dDC852JkmF1r5XRfOVvAywFEAt0sqPHAWZHBWoXc665HUEldJIjouRuz+GIHZ3 Puxlwwi48es2oqHEO0lZz50sNuRAySCEF9F1jMGjCRjSqY+eT543tspAwF9M5cBHBIxa 8izyen5NjBFfbEp6d3KDC1ehcn/tXnlyYdLJGuCaW+j+Ykj7C+71zV4FWpqsmj2Nb2Aj 3+2mksOriid/Z1VZa+g1FLxPBozQwhRZZY/u+wcHElrnU7oNdM/yhJ4FWM8WriMVDbvL OZ4Rp3Fw/5PlburKp5b9D8kEfsux0mEChqs2mYf2ZicH6E5fvwkueOXGBPtojy7pKBWz 8isQ== X-Gm-Message-State: AOAM531BQN1pfZC6TRpxju9LopTwHKYRQvdHC4Ffz+nX/cpRDcVVOjE0 IQ3hq73pluYUvFVp/rGV8ejAiw== X-Received: by 2002:a5d:6d8b:0:b0:218:4de1:25a0 with SMTP id l11-20020a5d6d8b000000b002184de125a0mr10508544wrs.8.1654699005239; Wed, 08 Jun 2022 07:36:45 -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 k2-20020a5d5182000000b0020c5253d8fcsm21942007wrv.72.2022.06.08.07.36.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 07:36:44 -0700 (PDT) Date: Wed, 8 Jun 2022 15:36:43 +0100 From: Daniel Thompson To: Stephen Kitt Cc: Lee Jones , Jingoo Han , Helge Deller , dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 4/4] backlight: tosa: Use backlight helper Message-ID: <20220608143643.km7eainfqvttuoqe@maple.lan> References: <20220607190925.1134737-1-steve@sk2.org> <20220607190925.1134737-5-steve@sk2.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220607190925.1134737-5-steve@sk2.org> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jun 07, 2022 at 09:09:25PM +0200, Stephen Kitt wrote: > Instead of retrieving the backlight brightness in struct > backlight_properties manually, and then checking whether the backlight > should be on at all, use backlight_get_brightness() which does all > this and insulates this from future changes. > > Signed-off-by: Stephen Kitt > Cc: Lee Jones > Cc: Daniel Thompson > Cc: Jingoo Han > Cc: Helge Deller > Cc: dri-devel@lists.freedesktop.org > Cc: linux-fbdev@vger.kernel.org Reviewed-by: Daniel Thompson ... and, wowzer, the code before your change wasn't much fun to read! > static int tosa_bl_update_status(struct backlight_device *dev) > { > - struct backlight_properties *props = &dev->props; > struct tosa_bl_data *data = bl_get_data(dev); > - int power = max(props->power, props->fb_blank); > - int brightness = props->brightness; > - > - if (power) > - brightness = 0; > + int brightness = backlight_get_brightness(dev); > > tosa_bl_set_backlight(data, brightness); Daniel.