From patchwork Sun Sep 26 19:26:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 12518441 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7DA5C433EF for ; Sun, 26 Sep 2021 19:26:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B807A60F58 for ; Sun, 26 Sep 2021 19:26:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229698AbhIZT21 (ORCPT ); Sun, 26 Sep 2021 15:28:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229623AbhIZT21 (ORCPT ); Sun, 26 Sep 2021 15:28:27 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65800C061570 for ; Sun, 26 Sep 2021 12:26:50 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id l8so12182884edw.2 for ; Sun, 26 Sep 2021 12:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MjFc4qpdSBS8qeywuUDP1DYg3DGmfu9tyeJ/HZHA26w=; b=URLhrsBbVcZzrEKxtP+L1BeVdakxp6+4O7NCymsdQvAbchVWa/q1imWa0N740vjQKj ZMahEITTJPS3s3c8TiLmHK9E69KHzY3e6vWd6OB75fi4NkUcpo7tEiklYKTegyAJcyjI LQRAeOeGoK7vMluCr5XuZoCdTfPpJ320ijXF9Tgw6Gb+vSFYw3JPojaS+5VVEuNyV4rv ZJ4yxtrm+4t3TERQ7ycDf2jy2OI01JtWorlgevP8hOejejgZ72HCslpsOtaDRLxAvsey psDEzso1M8D2a7u6lwLNJmEaBAJFS5cSUFe3Cf+UsITe0Mx0oYAHKQEwtz1XmNLI3Xqy TN5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=MjFc4qpdSBS8qeywuUDP1DYg3DGmfu9tyeJ/HZHA26w=; b=brL9n6vau+U00lRRTKCBpFoNzT+l25wlq/vCjO+jNDaubdVc+duhXs65EjzEVKFzU5 EhRRPB6F3koaYEDYLiotg5Cw4YmfrDNwBDFIN9/0xszhvNbaqkq8F7VGthaLE8lMnxAR YFCTpwx8fDDKXXNZtsKiA64I49hYx4LFn8y7BghHjRBWq/onIoL7j+uU2nr7WgSluNzB Ppy3VVrLY9y1X1R3T4H5wrUOOw/WIZ3A+JwfCq04oSRUL9Nw1w/YzxIQFmNGaVnI0nKA vGYv9lQ/3FnZCnGlT6mVByyo2Nu0WZX+L4dj4lYsnBJjtj1mPj9n/TSU1UyWSkFhsyH2 IdPg== X-Gm-Message-State: AOAM531KQY5qfDVMKNfYQevEroIX5kiKcH792oeuQejLTcxANwPMnrzE GAodFeBBJD7RTTnZGeBdP4cM95TutNLprA== X-Google-Smtp-Source: ABdhPJz+wRgSGku9dd+vBllmqVI0rc2Rbxy2N4TLILRmNl6CW9Rdash0m8SMy9tRPXCs+nSzRE3ArA== X-Received: by 2002:a05:6402:1e88:: with SMTP id f8mr18443735edf.126.1632684409035; Sun, 26 Sep 2021 12:26:49 -0700 (PDT) Received: from neptune.. ([188.27.128.17]) by smtp.gmail.com with ESMTPSA id z18sm9183078edq.29.2021.09.26.12.26.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 12:26:48 -0700 (PDT) From: Alexandru Ardelean To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: jic23@kernel.org, Alexandru Ardelean Subject: [PATCH 1/2] iio: adc: berlin2-adc: convert probe to device-managed only Date: Sun, 26 Sep 2021 22:26:41 +0300 Message-Id: <20210926192642.4051329-1-aardelean@deviqon.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org This driver requires only a devm_add_action_or_reset() hook for the power-down of the device, and then devm_iio_device_register() can be used directly. Signed-off-by: Alexandru Ardelean --- drivers/iio/adc/berlin2-adc.c | 34 +++++++++++----------------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/iio/adc/berlin2-adc.c b/drivers/iio/adc/berlin2-adc.c index 8b04b95b7b7a..03987d7e6b3d 100644 --- a/drivers/iio/adc/berlin2-adc.c +++ b/drivers/iio/adc/berlin2-adc.c @@ -280,6 +280,13 @@ static const struct iio_info berlin2_adc_info = { .read_raw = berlin2_adc_read_raw, }; +static void berlin2_adc_powerdown(void *regmap) +{ + regmap_update_bits(regmap, BERLIN2_SM_CTRL, + BERLIN2_SM_CTRL_ADC_POWER, 0); + +} + static int berlin2_adc_probe(struct platform_device *pdev) { struct iio_dev *indio_dev; @@ -293,7 +300,6 @@ static int berlin2_adc_probe(struct platform_device *pdev) return -ENOMEM; priv = iio_priv(indio_dev); - platform_set_drvdata(pdev, indio_dev); priv->regmap = syscon_node_to_regmap(parent_np); of_node_put(parent_np); @@ -333,29 +339,12 @@ static int berlin2_adc_probe(struct platform_device *pdev) BERLIN2_SM_CTRL_ADC_POWER, BERLIN2_SM_CTRL_ADC_POWER); - ret = iio_device_register(indio_dev); - if (ret) { - /* Power down the ADC */ - regmap_update_bits(priv->regmap, BERLIN2_SM_CTRL, - BERLIN2_SM_CTRL_ADC_POWER, 0); + ret = devm_add_action_or_reset(&pdev->dev, berlin2_adc_powerdown, + priv->regmap); + if (ret) return ret; - } - - return 0; -} - -static int berlin2_adc_remove(struct platform_device *pdev) -{ - struct iio_dev *indio_dev = platform_get_drvdata(pdev); - struct berlin2_adc_priv *priv = iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - - /* Power down the ADC */ - regmap_update_bits(priv->regmap, BERLIN2_SM_CTRL, - BERLIN2_SM_CTRL_ADC_POWER, 0); - return 0; + return devm_iio_device_register(&pdev->dev, indio_dev); } static const struct of_device_id berlin2_adc_match[] = { @@ -370,7 +359,6 @@ static struct platform_driver berlin2_adc_driver = { .of_match_table = berlin2_adc_match, }, .probe = berlin2_adc_probe, - .remove = berlin2_adc_remove, }; module_platform_driver(berlin2_adc_driver); From patchwork Sun Sep 26 19:26:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Ardelean X-Patchwork-Id: 12518443 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81999C433FE for ; Sun, 26 Sep 2021 19:26:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5E25060F46 for ; Sun, 26 Sep 2021 19:26:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229822AbhIZT2a (ORCPT ); Sun, 26 Sep 2021 15:28:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57412 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhIZT22 (ORCPT ); Sun, 26 Sep 2021 15:28:28 -0400 Received: from mail-ed1-x536.google.com (mail-ed1-x536.google.com [IPv6:2a00:1450:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22D3C061575 for ; Sun, 26 Sep 2021 12:26:51 -0700 (PDT) Received: by mail-ed1-x536.google.com with SMTP id x7so45128100edd.6 for ; Sun, 26 Sep 2021 12:26:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5GrBVYKyGe3R4WdYLhUpWL5eCxBj8V0aX1OyU1mgO6s=; b=eGWlTFMYyBzQ8KGJEy8oBccT7qiz60OJL/J6hXnLpZGOgWs3dxBDIfJUnzJGF+WKuD sVY8Jb6ICIrKiyoAdPKRHuUVAkxeQ8HSXLU6g67Z+Z/fJvVzk1mYHUT52mcUl9EJBJ+t jWPwbxHAWHJ1w/PayA8e5SJUry5H1q3rZadSoNuoRJ1L3n+RW72NjfaQTLQOmBnu5msw rU63bng1pS9KO8JfqJGS31SMefCAcDNNye0Y9qHwkt43uyn8tU8N0zlVJXf+b34JbeLT SDKpzmYwGIzcjxIpQB4jgq8A6O4YmIYLvzLFZHBxaAoWbHACfHI8+n0L6+fHQKZ3f/aT F6NQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5GrBVYKyGe3R4WdYLhUpWL5eCxBj8V0aX1OyU1mgO6s=; b=5tJ7e0j8EUqMLaEsPJSJ2hNnUyIKuIu47O60RW3qqqifFG5pfhG02Ab7iPSXV9ULYi ch630119BSQ8KNsFvaAR41eE6rcx0UdF2zE2wX7bb+qOu9GbP5XHAitCRcZQwzFBMmqr 4rTb1hE+Muc+Yec/eKiF75V2/MVzTWlkyfE6/37T9KWe6PPNpOCi3xR5WuDyQd5jF90R uAbC9uDDy7f02ZQRDCifPLAWs/grM5N8Y8nWsVnnKk5+pGruHKQtnmp3wJFqTyiEPohY RcovzJZuI3UtVLWnCu44WQyHdebIxaVB4YIFs2/8mFIzD2YJ47c8oQoYMoe0W8bC/QF0 fRdw== X-Gm-Message-State: AOAM5318GZDo5gSawh3iBdBubh4YxPScCt31k6j6erzldbWiQtvfTDTu Ph6NCponv+dabZwQmy3W2PLjTDL4cnpjpA== X-Google-Smtp-Source: ABdhPJzQ5pDL00oTPKYzM/A/GVu1jizKhJ0cRgwq7Oy2UYI29DA+H6TdRU3E9pKqYZ1FJnZTe2Lstg== X-Received: by 2002:a17:907:7848:: with SMTP id lb8mr23056281ejc.494.1632684410181; Sun, 26 Sep 2021 12:26:50 -0700 (PDT) Received: from neptune.. ([188.27.128.17]) by smtp.gmail.com with ESMTPSA id z18sm9183078edq.29.2021.09.26.12.26.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 12:26:49 -0700 (PDT) From: Alexandru Ardelean To: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: jic23@kernel.org, Alexandru Ardelean Subject: [PATCH 2/2] iio: adc: Kconfig: add COMPILE_TEST dep for berlin2-adc Date: Sun, 26 Sep 2021 22:26:42 +0300 Message-Id: <20210926192642.4051329-2-aardelean@deviqon.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210926192642.4051329-1-aardelean@deviqon.com> References: <20210926192642.4051329-1-aardelean@deviqon.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Otherwise most build checks will omit this driver from a compile-test due to it's dependency only on the BERLIN_ARCH symbol. Signed-off-by: Alexandru Ardelean --- drivers/iio/adc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index 0ceea8e69e3c..8bf5b62a73f4 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -354,7 +354,7 @@ config BCM_IPROC_ADC config BERLIN2_ADC tristate "Marvell Berlin2 ADC driver" - depends on ARCH_BERLIN + depends on ARCH_BERLIN || COMPILE_TEST help Marvell Berlin2 ADC driver. This ADC has 8 channels, with one used for temperature measurement.