From patchwork Fri Aug 19 19:16:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 12949134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8E773C32771 for ; Fri, 19 Aug 2022 19:17:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 795A110E96E; Fri, 19 Aug 2022 19:17:21 +0000 (UTC) Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9536D10E969 for ; Fri, 19 Aug 2022 19:17:14 +0000 (UTC) Received: by mail-lf1-x12a.google.com with SMTP id q7so3613822lfu.5 for ; Fri, 19 Aug 2022 12:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc; bh=9edAeyqaKV/eGnwpb24p/sONsQF5z28Zi5ENLBQsjis=; b=h6ypV1yJJL0qgQWg/+xo1mrjVedomBmbMvZzcElTA/w5mp5AzC6W+u6FM9JDglXkIG f0EFLHWGo01cUs200DNYrrE6L7hXnRJgrmsN3nxPtq0WRtbiVaWN0fK7/Bozw+co8ct3 N7jegGVnAPQ6/HVWGzefch1Xj7qjpj5QD9aeg6b/BAwEzRoHMSeCzqFpyzI7bt44XxEf PkgVNQHotIjqfqbYWMSGqsZl1QgjFRS16rUzvyO+euq9YakFRFWR0EKnqy86MKW/Qf2G +C/mu5/XgdOkFRaygzwDwmWhPYn3zHZ7r39kQU7pF39sfCqo+neujKXn6s0k1jENe6My ngQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc; bh=9edAeyqaKV/eGnwpb24p/sONsQF5z28Zi5ENLBQsjis=; b=rXPxb/SqyHGxjkcIpa8RTUEqSKSUEAOtcSZgB18AD4hD5cpkEFrBZ9YWY1zzfQ7QEs UpWssBLSZIDkNlkYNMahWRgtCyafzKIAvVE/WYRpqA5bwnnN5EbK8qAxPas5c0BITwj6 dnAoUhzL3WTv0Lhe9tmtWmxLbZU/g66M+c7wgXTsEDBpj9DL6B91lcf1ul0ktmVvv6EO 2D5NZXpKshI7sd5g/W4m/UMhCPmZn9s6gWTukHEnpstnG34n8uJTRRmXTU/J0fv3zMb3 jdwoiNrokDGNSTsLOMzNY2EOkcz3jiI1Hf/d48Q4IZ3nPcvObcVvHy92aTvc5vm2mBns +RIg== X-Gm-Message-State: ACgBeo2Bhe1kLliRr2Nm+vSuZXg7pizKFCFy5rbXjHXCqZRFxM/1+ABX jWsIJtWCoZ/q6Rd6hGguVIk= X-Google-Smtp-Source: AA6agR6L/s1W7mzQnKhc+50x8bAWnpqHS1+yAXDPOhAZzl8NwA/GrakaeTQCnoodLt11WOWWYq+qjA== X-Received: by 2002:a05:6512:23a7:b0:492:b613:817 with SMTP id c39-20020a05651223a700b00492b6130817mr2872025lfv.492.1660936632748; Fri, 19 Aug 2022 12:17:12 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id u17-20020ac243d1000000b0048afeb4ea32sm737760lfl.100.2022.08.19.12.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Aug 2022 12:17:11 -0700 (PDT) Date: Fri, 19 Aug 2022 22:16:48 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Subject: [PATCH v3 00/14] Use devm helpers for regulator get and enable Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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: Miaoqian Lin , Xiang wangx , Neil Armstrong , David Airlie , Michael Turquette , dri-devel@lists.freedesktop.org, Nuno =?iso-8859-1?q?S=E1?= , Laurent Pinchart , Andrzej Hajda , linux-clk@vger.kernel.org, Jerome Brunet , Jonathan Corbet , Kevin Hilman , Matti Vaittinen , Jernej Skrabec , linux-iio@vger.kernel.org, Alexandru Lazar , Alexandru Ardelean , Lorenzo Bianconi , Guenter Roeck , Alexandru Tachici , linux-hwmon@vger.kernel.org, Jean Delvare , Michael Hennerich , Jonas Karlman , Martin Blumenstingl , Mark Brown , Cai Huoqing , Aswath Govindraju , linux-amlogic@lists.infradead.org, Andy Shevchenko , Johan Hovold , linux-arm-kernel@lists.infradead.org, Stephen Boyd , linux-doc@vger.kernel.org, Liam Girdwood , Robert Foss , linux-kernel@vger.kernel.org, Peter Rosin , Jonathan Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use devm helpers for regulator get and enable NOTE: The series depends on commit ee94aff2628b ("Devm helpers for regulator get and enable") which currently sits in Mark's regulator/for-next A few* drivers seem to pattern demonstrated by pseudocode: - devm_regulator_get() - regulator_enable() - devm_add_action_or_reset(regulator_disable()) devm helpers for this pattern were added to remove bunch of code from drivers. Typically following: - replace 3 calls (devm_regulator_get[_optional](), regulator_enable(), devm_add_action_or_reset()) with just one (devm_regulator_get_enable[_optional]()). - drop disable callback. I believe this simplifies things by removing some dublicated code. This series reowrks a few drivers. There is still plenty of fish in the sea for people who like to improve the code (or count the beans ;]). Finally - most of the converted drivers have not been tested (other than compile-tested) due to lack of HW. All reviews and testing is _highly_ appreciated (as always!). Revision history: v3: - Drop already applied helper patches - Add a few more drivers RFCv1 => v2: - Add devm_regulator_bulk_get_enable() and devm_regulator_bulk_put() - Convert a couple of drivers to use the new devm_regulator_bulk_get_enable(). - Squash all IIO patches into one. Patch 1: Add new devm-helper APIs to docs. Patch 2: simplified CLK driver(s) Patch 3: simplified GPU driver(s) Patch 4 - 5: simplified hwmon driver(s) Patch 6 - 14: simplified IIO driver(s) --- Matti Vaittinen (14): docs: devres: regulator: Add new get_enable functions to devres.rst clk: cdce925: simplify using devm_regulator_get_enable() gpu: drm: simplify drivers using devm_regulator_*get_enable*() hwmon: lm90: simplify using devm_regulator_get_enable() hwmon: adm1177: simplify using devm_regulator_get_enable() iio: ad7192: Simplify using devm_regulator_get_enable() iio: ltc2688: Simplify using devm_regulator_*get_enable() iio: bmg160_core: Simplify using devm_regulator_*get_enable() iio: st_lsm6dsx: Simplify using devm_regulator_*get_enable() iio: ad7476: simplify using devm_regulator_get_enable() iio: ad7606: simplify using devm_regulator_get_enable() iio: max1241: simplify using devm_regulator_get_enable() iio: max1363: simplify using devm_regulator_get_enable() iio: hmc425a: simplify using devm_regulator_get_enable() .../driver-api/driver-model/devres.rst | 4 +++ drivers/clk/clk-cdce925.c | 21 +++---------- drivers/gpu/drm/bridge/sii902x.c | 22 ++------------ drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 ++------------ drivers/hwmon/adm1177.c | 27 ++--------------- drivers/hwmon/lm90.c | 15 ++-------- drivers/iio/adc/ad7192.c | 15 ++-------- drivers/iio/adc/ad7476.c | 11 +------ drivers/iio/adc/ad7606.c | 22 ++------------ drivers/iio/adc/ad7606.h | 1 - drivers/iio/adc/max1241.c | 28 ++--------------- drivers/iio/adc/max1363.c | 11 +------ drivers/iio/amplifiers/hmc425a.c | 17 +---------- drivers/iio/dac/ltc2688.c | 23 ++------------ drivers/iio/gyro/bmg160_core.c | 24 ++------------- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx.h | 2 -- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 30 ++++--------------- 17 files changed, 41 insertions(+), 255 deletions(-)