From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46335C433E6 for ; Fri, 28 Aug 2020 09:40:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2155E208D5 for ; Fri, 28 Aug 2020 09:40:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZK+v2bmQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728680AbgH1Jkm (ORCPT ); Fri, 28 Aug 2020 05:40:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728269AbgH1Jkl (ORCPT ); Fri, 28 Aug 2020 05:40:41 -0400 Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E6F4C061264 for ; Fri, 28 Aug 2020 02:40:41 -0700 (PDT) Received: by mail-lj1-x241.google.com with SMTP id t6so570374ljk.9 for ; Fri, 28 Aug 2020 02:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=ZK+v2bmQLBjTkyTKleZ4cfX+TpXVVDGN80D4Cqhya1JdXh0uk4uzMDHh2YlIQSpubL Z10w4VCoiKA/QgWuuZ5KY2SSF/NdAfsZ8Z7nPX9LBb/JyULoZ5s1U1uF9CiBp4+Wkz87 UVyBls0s8KH5oRJgVt7FdhME4Vx55DOD4UbsTASNmspQx/J3yK4b0UHT8fabcBfERM7O 66e2Tt7LkEfbLu/tG5Z8CwjGrynpQGPYK1M6cFDHBJI9/2UsJ6JIxk2cLkqBUoKGZpo3 HRM3wL3Z+XZD/kWUuGbHjv9zynSMwTgAPsurI1JevBX9DJAIZHRJewlsm5WQYkde7sIN Jojg== 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; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=HVz04zz0mEI0H+tQUYJX96wiRsb1HmgZjOePskm03MoZwMy2a2vunps/JRc3YUI1wB f3XOi8VfxyhXCKkAgcnZUBzSC79zkGQcJvrK75QaryXBomYm8zrN5tHbEC5hizqgOcud 8VeU3dTNF6xYZssrsSdFz/NeTHCDDYHxHfvmQQn6eF+j7QLA087AyE936YaZi3sEH1iX N7XCumQiOLzfL6alVlyO/jmwFQT7g2fNibSp/KtCEXZz6YV5EkKyflbZhBiyxcHvo0NT Q3jzSEnzJbyYBbQ9O8urXpUlz7XE7zAX6zVFeaL9x4/JWjZYX6VdqKSR+El9q5JFM4al +yWg== X-Gm-Message-State: AOAM532dmGsOMCNu2GJg8NOlmqdNNTpsQ7xJvLiHCbD1qW+Bd3t91ccR OGRr39BeGO1FnxLV+iFAH2+qJGnGmDcZUXAN7+Wn6w== X-Google-Smtp-Source: ABdhPJyobFr8wlwoGMVpjT4BBlaiB53c0xbtwloUtEybXVxTnB6o94g4sI9w40AbLQ+tg744duwQYVnD0klCkIcxAA4= X-Received: by 2002:a2e:9dd0:: with SMTP id x16mr472930ljj.144.1598607638931; Fri, 28 Aug 2020 02:40:38 -0700 (PDT) MIME-Version: 1.0 References: <20200823104532.1024798-1-sam@ravnborg.org> In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org> From: Linus Walleij Date: Fri, 28 Aug 2020 11:40:28 +0200 Message-ID: Subject: Re: [PATCH v2 0/24] backlight: add init macros and accessors To: Sam Ravnborg Cc: "open list:DRM PANEL DRIVERS" , Jingoo Han , Lee Jones , Daniel Thompson , Daniel Vetter , Alex Deucher , amd-gfx@lists.freedesktop.org, Andrzej Hajda , =?UTF-8?Q?Christian_K=C3=B6nig?= , Chris Wilson , Ezequiel Garcia , Hans de Goede , Hoegeun Kwon , Inki Dae , Jani Nikula , Jernej Skrabec , Jonas Karlman , Joonas Lahtinen , Jyri Sarha , Kieran Bingham , Konrad Dybcio , Laurent Pinchart , Linux-Renesas , Maarten Lankhorst , Manasi Navare , Neil Armstrong , Patrik Jakobsson , =?UTF-8?Q?Pawe=C5=82_Chmiel?= , Philippe CORNU , Rob Clark , Robert Chiras , Rodrigo Vivi , Sebastian Reichel , Thierry Reding , Tomi Valkeinen , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Vinay Simha BN , Wambui Karuga , Zheng Bin Content-Type: text/plain; charset="UTF-8" Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Sun, Aug 23, 2020 at 12:45 PM Sam Ravnborg wrote: > The first patch trims backlight_update_status() so it can be called with a NULL > backlight_device. Then the caller do not need to add this check just to avoid > a NULL reference. > > The backlight drivers uses several different patterns when registering > a backlight: > > - Register backlight and assign properties later > - Define a local backlight_properties variable and use memset > - Define a const backlight_properties and assign relevant properties > > On top of this there was differences in what members was assigned. > > To align how backlight drivers are initialized introduce following helper macros: > - DECLARE_BACKLIGHT_INIT_FIRMWARE() > - DECLARE_BACKLIGHT_INIT_PLATFORM() > - DECLARE_BACKLIGHT_INIT_RAW() > > The macros are introduced in patch 2. > > The backlight drivers used direct access to backlight_properties. > Encapsulate these in get/set access operations resulting in following benefits: > - The access methods can be called with a NULL pointer so logic around the > access can be made simpler. > - The update_brightness and enable_brightness simplifies the users > - The code is in most cases more readable with the access operations. > - When everyone uses the access methods refactoring in the backlight core is simpler. > > The get/set operations are introduced in patch 3. > > The gpio backlight driver received a small overhaul in a set of three patches. > The result is a smaller and more readable driver. > > The remaining patches updates all backlight users in drivers/gpu/drm/* > With this patch set all of drivers/gpu/drm/: > - All backlight references to FB_BLANK* are gone from drm/* > - All direct references to backlight properties are gone > - All panel drivers uses the devm_ variant for registering backlight > Daniel Vetter had some concerns with this for future updates, > but we are aligned now and can update if refoctoring demands it > - All panel drivers uses the backlight support in drm_panel > > Individual patches are only sent to the people listed in the patch + a few more. > Please check https://lore.kernel.org/dri-devel/ for the full series. > > v2: > - Documented BACKLIGHT_PROPS as it may be used by drivers > - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel) > - Added backlight_update_brightness() and use it (Daniel) > - Added backlight_enable_brightness() and use it > - Moved remaining drm_panel driver to use backlight support in drm_panel > - gpio backlight driver overhaul > > The patches are made on top of the for-backlight-next branch at > https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git > The branch needs v5.8-rc1 backported to build as dev_err_probe() > is used. > > The first 6 patches are candidates for the backlight tree. > If they are applied then this should preferably be to an immutable > branch we can merge to drm-misc-next where the drm patches shall go. > > The drm patches has known conflics and shall *not* be applied to the > backlight tree, they are included in this patchset to show how the > new functions are used. > > Diffstat for the drm bits alone looks nice: > 25 files changed, 243 insertions(+), 460 deletions(-) > > Feedback welcome! Thank you for trying to make backlight easier for developers. I am a big supporter of this type of simplifications and generalizations, it is what makes DRM great. The series: Acked-by: Linus Walleij Yours, Linus Walleij From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C70F1C433E2 for ; Fri, 28 Aug 2020 09:40:42 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9AF032075B for ; Fri, 28 Aug 2020 09:40:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZK+v2bmQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9AF032075B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E44BC6E462; Fri, 28 Aug 2020 09:40:41 +0000 (UTC) Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 090366E462 for ; Fri, 28 Aug 2020 09:40:41 +0000 (UTC) Received: by mail-lj1-x244.google.com with SMTP id w25so559407ljo.12 for ; Fri, 28 Aug 2020 02:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=ZK+v2bmQLBjTkyTKleZ4cfX+TpXVVDGN80D4Cqhya1JdXh0uk4uzMDHh2YlIQSpubL Z10w4VCoiKA/QgWuuZ5KY2SSF/NdAfsZ8Z7nPX9LBb/JyULoZ5s1U1uF9CiBp4+Wkz87 UVyBls0s8KH5oRJgVt7FdhME4Vx55DOD4UbsTASNmspQx/J3yK4b0UHT8fabcBfERM7O 66e2Tt7LkEfbLu/tG5Z8CwjGrynpQGPYK1M6cFDHBJI9/2UsJ6JIxk2cLkqBUoKGZpo3 HRM3wL3Z+XZD/kWUuGbHjv9zynSMwTgAPsurI1JevBX9DJAIZHRJewlsm5WQYkde7sIN Jojg== 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; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=g97rK+cx8pLylE5kQP9LTc0zitKj5ri4SG52HAB3xmEa47I4jzTA6LCP+3F+gIVeTx SPFCJL0w7GIzqqWvdQ4StlqEdUISRpZkqWyePrV6Hos/VnUpxFb3Vugy52LgFJCxn73k Xwc7JQWSEBLIP5wsgNvi+iTxzlOGX9PNfbr7yiaav2DdrcV4oiVGoNk2hchS5PCUCG0w eL/zNu1rzH5MiReSkACzcivDxQ69i4nw12SFOjXp+GRivVRuqI69RGnGECU6u6IOh9SE xLSQbpr9utk+t8+D/OlNj2LfxxKRK+qTMAwT12LJTVsX63fqj8Dxq5b0Xq46eZTcbJja wcqg== X-Gm-Message-State: AOAM530Oi03CCVlonyKZQ4EOFd5VsdogxAfOyFXedztX2kJG4HPR94ot h+IhUyR8VQchyHu4LT7h1dChbRg1nypndNO0+CNe5w== X-Google-Smtp-Source: ABdhPJyobFr8wlwoGMVpjT4BBlaiB53c0xbtwloUtEybXVxTnB6o94g4sI9w40AbLQ+tg744duwQYVnD0klCkIcxAA4= X-Received: by 2002:a2e:9dd0:: with SMTP id x16mr472930ljj.144.1598607638931; Fri, 28 Aug 2020 02:40:38 -0700 (PDT) MIME-Version: 1.0 References: <20200823104532.1024798-1-sam@ravnborg.org> In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org> From: Linus Walleij Date: Fri, 28 Aug 2020 11:40:28 +0200 Message-ID: Subject: Re: [PATCH v2 0/24] backlight: add init macros and accessors To: Sam Ravnborg X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Daniel Vetter , "open list:DRM PANEL DRIVERS" , Chris Wilson , Andrzej Hajda , Thierry Reding , Laurent Pinchart , Lee Jones , Sebastian Reichel , Manasi Navare , Daniel Thompson , Konrad Dybcio , amd-gfx@lists.freedesktop.org, Zheng Bin , Tomi Valkeinen , Ezequiel Garcia , Robert Chiras , Vinay Simha BN , Hoegeun Kwon , =?UTF-8?Q?Pawe=C5=82_Chmiel?= , Jonas Karlman , Hans de Goede , Jyri Sarha , Rodrigo Vivi , Jernej Skrabec , Jingoo Han , Philippe CORNU , Linux-Renesas , Kieran Bingham , Alex Deucher , Wambui Karuga , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sun, Aug 23, 2020 at 12:45 PM Sam Ravnborg wrote: > The first patch trims backlight_update_status() so it can be called with a NULL > backlight_device. Then the caller do not need to add this check just to avoid > a NULL reference. > > The backlight drivers uses several different patterns when registering > a backlight: > > - Register backlight and assign properties later > - Define a local backlight_properties variable and use memset > - Define a const backlight_properties and assign relevant properties > > On top of this there was differences in what members was assigned. > > To align how backlight drivers are initialized introduce following helper macros: > - DECLARE_BACKLIGHT_INIT_FIRMWARE() > - DECLARE_BACKLIGHT_INIT_PLATFORM() > - DECLARE_BACKLIGHT_INIT_RAW() > > The macros are introduced in patch 2. > > The backlight drivers used direct access to backlight_properties. > Encapsulate these in get/set access operations resulting in following benefits: > - The access methods can be called with a NULL pointer so logic around the > access can be made simpler. > - The update_brightness and enable_brightness simplifies the users > - The code is in most cases more readable with the access operations. > - When everyone uses the access methods refactoring in the backlight core is simpler. > > The get/set operations are introduced in patch 3. > > The gpio backlight driver received a small overhaul in a set of three patches. > The result is a smaller and more readable driver. > > The remaining patches updates all backlight users in drivers/gpu/drm/* > With this patch set all of drivers/gpu/drm/: > - All backlight references to FB_BLANK* are gone from drm/* > - All direct references to backlight properties are gone > - All panel drivers uses the devm_ variant for registering backlight > Daniel Vetter had some concerns with this for future updates, > but we are aligned now and can update if refoctoring demands it > - All panel drivers uses the backlight support in drm_panel > > Individual patches are only sent to the people listed in the patch + a few more. > Please check https://lore.kernel.org/dri-devel/ for the full series. > > v2: > - Documented BACKLIGHT_PROPS as it may be used by drivers > - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel) > - Added backlight_update_brightness() and use it (Daniel) > - Added backlight_enable_brightness() and use it > - Moved remaining drm_panel driver to use backlight support in drm_panel > - gpio backlight driver overhaul > > The patches are made on top of the for-backlight-next branch at > https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git > The branch needs v5.8-rc1 backported to build as dev_err_probe() > is used. > > The first 6 patches are candidates for the backlight tree. > If they are applied then this should preferably be to an immutable > branch we can merge to drm-misc-next where the drm patches shall go. > > The drm patches has known conflics and shall *not* be applied to the > backlight tree, they are included in this patchset to show how the > new functions are used. > > Diffstat for the drm bits alone looks nice: > 25 files changed, 243 insertions(+), 460 deletions(-) > > Feedback welcome! Thank you for trying to make backlight easier for developers. I am a big supporter of this type of simplifications and generalizations, it is what makes DRM great. The series: Acked-by: Linus Walleij Yours, Linus Walleij _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4EC05C433E7 for ; Fri, 28 Aug 2020 09:40:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 242F9208D5 for ; Fri, 28 Aug 2020 09:40:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZK+v2bmQ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 242F9208D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 642D76EB8B; Fri, 28 Aug 2020 09:40:42 +0000 (UTC) Received: from mail-lj1-x241.google.com (mail-lj1-x241.google.com [IPv6:2a00:1450:4864:20::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 146796EB8B for ; Fri, 28 Aug 2020 09:40:41 +0000 (UTC) Received: by mail-lj1-x241.google.com with SMTP id w25so559410ljo.12 for ; Fri, 28 Aug 2020 02:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=ZK+v2bmQLBjTkyTKleZ4cfX+TpXVVDGN80D4Cqhya1JdXh0uk4uzMDHh2YlIQSpubL Z10w4VCoiKA/QgWuuZ5KY2SSF/NdAfsZ8Z7nPX9LBb/JyULoZ5s1U1uF9CiBp4+Wkz87 UVyBls0s8KH5oRJgVt7FdhME4Vx55DOD4UbsTASNmspQx/J3yK4b0UHT8fabcBfERM7O 66e2Tt7LkEfbLu/tG5Z8CwjGrynpQGPYK1M6cFDHBJI9/2UsJ6JIxk2cLkqBUoKGZpo3 HRM3wL3Z+XZD/kWUuGbHjv9zynSMwTgAPsurI1JevBX9DJAIZHRJewlsm5WQYkde7sIN Jojg== 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; bh=ZUip6H2+jjLmhsYJSfGTRg7Ifd0FUyC3bIqJ6snuBqc=; b=QtF+gPc6cI84Dzx94EV/XocD7bg3tOLWRf8DHCde7F80STnJjwq1H7xN4l1NWyDgMC g3v4JaHql0Phn4rst0FF5XfKLfG7X+VfI0Ct6Oavn26NrmhpEK0iUKEVDdpNCfM+anyf 4Le5O35VMd06mCPBhxcV7nl5XHn4gvrsOxsmBOLeG6DgWkV203UsWgRnbQOpKcqGgBeZ b9V3UYq7HT3VZhruHQ8y+iB6wvFNfMpoD2gyofQCjEyGczLvWP49KpKhEX7YL6qG7/l3 K7+RciJ2CItbPeZJ+nAdGuwClCMccfAx/O5pUMNjgwGrDj1IsJMpW0I2Wc7Hj+Mo9mLj zZ+A== X-Gm-Message-State: AOAM5303ESIlLgXfqWU/HNuGsu+txPWLODnfdN1pr0rdUWCWVgklGN9i aYBaTcNWTTeyDEk85u2qZhmHS0nH1dlu0ZKBcxYzag== X-Google-Smtp-Source: ABdhPJyobFr8wlwoGMVpjT4BBlaiB53c0xbtwloUtEybXVxTnB6o94g4sI9w40AbLQ+tg744duwQYVnD0klCkIcxAA4= X-Received: by 2002:a2e:9dd0:: with SMTP id x16mr472930ljj.144.1598607638931; Fri, 28 Aug 2020 02:40:38 -0700 (PDT) MIME-Version: 1.0 References: <20200823104532.1024798-1-sam@ravnborg.org> In-Reply-To: <20200823104532.1024798-1-sam@ravnborg.org> From: Linus Walleij Date: Fri, 28 Aug 2020 11:40:28 +0200 Message-ID: Subject: Re: [PATCH v2 0/24] backlight: add init macros and accessors To: Sam Ravnborg X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Daniel Vetter , Joonas Lahtinen , "open list:DRM PANEL DRIVERS" , Chris Wilson , Andrzej Hajda , Thierry Reding , Laurent Pinchart , Lee Jones , Sebastian Reichel , =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Manasi Navare , Daniel Thompson , Konrad Dybcio , amd-gfx@lists.freedesktop.org, Zheng Bin , Tomi Valkeinen , Ezequiel Garcia , Robert Chiras , Vinay Simha BN , Hoegeun Kwon , =?UTF-8?Q?Pawe=C5=82_Chmiel?= , Jonas Karlman , Maarten Lankhorst , Jani Nikula , Inki Dae , Hans de Goede , Jyri Sarha , Rodrigo Vivi , Jernej Skrabec , Jingoo Han , Philippe CORNU , Patrik Jakobsson , Linux-Renesas , Rob Clark , Kieran Bingham , Alex Deucher , Wambui Karuga , =?UTF-8?Q?Christian_K=C3=B6nig?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Sun, Aug 23, 2020 at 12:45 PM Sam Ravnborg wrote: > The first patch trims backlight_update_status() so it can be called with a NULL > backlight_device. Then the caller do not need to add this check just to avoid > a NULL reference. > > The backlight drivers uses several different patterns when registering > a backlight: > > - Register backlight and assign properties later > - Define a local backlight_properties variable and use memset > - Define a const backlight_properties and assign relevant properties > > On top of this there was differences in what members was assigned. > > To align how backlight drivers are initialized introduce following helper macros: > - DECLARE_BACKLIGHT_INIT_FIRMWARE() > - DECLARE_BACKLIGHT_INIT_PLATFORM() > - DECLARE_BACKLIGHT_INIT_RAW() > > The macros are introduced in patch 2. > > The backlight drivers used direct access to backlight_properties. > Encapsulate these in get/set access operations resulting in following benefits: > - The access methods can be called with a NULL pointer so logic around the > access can be made simpler. > - The update_brightness and enable_brightness simplifies the users > - The code is in most cases more readable with the access operations. > - When everyone uses the access methods refactoring in the backlight core is simpler. > > The get/set operations are introduced in patch 3. > > The gpio backlight driver received a small overhaul in a set of three patches. > The result is a smaller and more readable driver. > > The remaining patches updates all backlight users in drivers/gpu/drm/* > With this patch set all of drivers/gpu/drm/: > - All backlight references to FB_BLANK* are gone from drm/* > - All direct references to backlight properties are gone > - All panel drivers uses the devm_ variant for registering backlight > Daniel Vetter had some concerns with this for future updates, > but we are aligned now and can update if refoctoring demands it > - All panel drivers uses the backlight support in drm_panel > > Individual patches are only sent to the people listed in the patch + a few more. > Please check https://lore.kernel.org/dri-devel/ for the full series. > > v2: > - Documented BACKLIGHT_PROPS as it may be used by drivers > - Dropped backlight_set_power_{on,off}, they were a mistake (Daniel) > - Added backlight_update_brightness() and use it (Daniel) > - Added backlight_enable_brightness() and use it > - Moved remaining drm_panel driver to use backlight support in drm_panel > - gpio backlight driver overhaul > > The patches are made on top of the for-backlight-next branch at > https://git.kernel.org/pub/scm/linux/kernel/git/lee/backlight.git > The branch needs v5.8-rc1 backported to build as dev_err_probe() > is used. > > The first 6 patches are candidates for the backlight tree. > If they are applied then this should preferably be to an immutable > branch we can merge to drm-misc-next where the drm patches shall go. > > The drm patches has known conflics and shall *not* be applied to the > backlight tree, they are included in this patchset to show how the > new functions are used. > > Diffstat for the drm bits alone looks nice: > 25 files changed, 243 insertions(+), 460 deletions(-) > > Feedback welcome! Thank you for trying to make backlight easier for developers. I am a big supporter of this type of simplifications and generalizations, it is what makes DRM great. The series: Acked-by: Linus Walleij Yours, Linus Walleij _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx