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: 12949130 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 C909BC32771 for ; Fri, 19 Aug 2022 19:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id: MIME-Version:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=DcfTI/dCF/nLPaHwYZCpWq+yHQDrrnvNHP3ka6DoG1Y=; b=mle +4HJPTkoRrNe9k2Ic0tFQEi82HJi3DTRfvyKspXdQd65ansJ87KHHZlHvtgdjoUG0oVkM6BKjDE5K IIPYPaW5m30savannS4Q+QSKvPAw6HtmNPlRH6RNu3wjRB2Pfofzps3EYZUbaFC2GAC7aV2Jj9aTG MdGB1vvdnA9+AiTd6kqZzRKJCz64TynDsaNry6AJfZk9SFosvqH567EW1tVRIkuMExP/LAGjM+cbB zfRaEU7NbfL5HOrwmBM3i4XpTC0cI/jgQiOFh7OtW3c3y1zQ7DOtk39aR+7yss1dF0bmR16KcwRqs WWAUKh28cuSE525HZEu9ClFVZQRq3Nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oP7Ud-00BWSv-4N; Fri, 19 Aug 2022 19:17:19 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oP7UZ-00BWQS-7N; Fri, 19 Aug 2022 19:17:16 +0000 Received: by mail-lf1-x134.google.com with SMTP id a9so7261019lfm.12; 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=eI2ifyHWNNhWZLDbr7MuE7d2yLP+GElWQ1NihCm/Un7RVHS68Tw9tqhSIDF/SAfwyp ruum4AIL4vKkLVFDJ79RDvNkG01DBCm5FcGiJDBjls/K8xlTi+bolAP/u84i/A+UlU/R qd/9bSdc/K8nhATyyg+NaV3MrkFhSuUqvVS7wVWmVOgBq++ogBfSwFxpJIEvUiqUpf18 TRxt1eOdo/VmnI8+aW3Xn8YURU0JNZQeZjo1Qy/LNCY/zTKRFI16xK0/kgOWjdWvkZ9f edcOThTuaIhjDGQY01IVjuCuhJGtKup/KmO7hxlOgfYKe1RzZ3LHZrYB6UxjcLQRzNne DOlw== X-Gm-Message-State: ACgBeo2WbH1NJJryen3HBPzIjnwuuuXkn8RHmYX6Wx1MrlepwL9WjYeq X+oEMyin/wapm18Qs0nH8hs= 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 Cc: Jonathan Corbet , Michael Turquette , Stephen Boyd , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Michael Hennerich , Jean Delvare , Guenter Roeck , Lars-Peter Clausen , Alexandru Tachici , Jonathan Cameron , Nuno =?iso-8859-1?q?S=E1?= , Lorenzo Bianconi , Liam Girdwood , Mark Brown , Matti Vaittinen , Aswath Govindraju , Peter Rosin , Andy Shevchenko , Johan Hovold , Alexandru Ardelean , Cai Huoqing , Alexandru Lazar , Miaoqian Lin , Xiang wangx , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-clk@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, linux-iio@vger.kernel.org Subject: [PATCH v3 00/14] Use devm helpers for regulator get and enable Message-ID: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220819_121715_325735_D89DEBE5 X-CRM114-Status: GOOD ( 15.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(-)