From patchwork Tue Jun 21 20:26:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889721 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DABC1C433EF for ; Tue, 21 Jun 2022 20:18:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354046AbiFUUSr (ORCPT ); Tue, 21 Jun 2022 16:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353874AbiFUUSU (ORCPT ); Tue, 21 Jun 2022 16:18:20 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEF2E175B7 for ; Tue, 21 Jun 2022 13:18:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 22633CE1BB7 for ; Tue, 21 Jun 2022 20:18:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F112C341C4; Tue, 21 Jun 2022 20:18:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842695; bh=wT0k2V4BfqgDPP8eWfBsEY4I+Qdr87NC2xiZZedL3HY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eewN/WNNsCu9O4f1lIsxAvrp7XI3nuv29rdj3ODWUi8WQMEWil14nA8MK81CQWpVM kdvOHLaFONTf5ent8GH4OQKbpZdsgHUbQQ5OELcn0RWFfNg5G6PEbX+RkcaeAzT8Y9 AgjqoLFuPVDVBwhI8pGyjqY888SpYFx03MT0qcJckWfoq9M12OnT1ZV54p1Bukvlga MPRMFzg/po9lP25pcxbzTeyBc/mqN+Um+PlX05fP7PXrfLjXmhUBpUhUIKE3G7PI4j a2qog0Z7aObtf9uaj8FekMMKAVI1LjASDehQXZz4IzxZdXIu3nvcDvJLDbZ6S2Q5k2 GJ+thPi3/KgMQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 01/36] iio: accel: bma220: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:44 +0100 Message-Id: <20220621202719.13644-2-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bma220_spi.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c index b6d9ab8e2054..fcbd695e4654 100644 --- a/drivers/iio/accel/bma220_spi.c +++ b/drivers/iio/accel/bma220_spi.c @@ -289,20 +289,20 @@ static int bma220_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } -static __maybe_unused int bma220_suspend(struct device *dev) +static int bma220_suspend(struct device *dev) { struct spi_device *spi = to_spi_device(dev); return bma220_power(spi, false); } -static __maybe_unused int bma220_resume(struct device *dev) +static int bma220_resume(struct device *dev) { struct spi_device *spi = to_spi_device(dev); return bma220_power(spi, true); } -static SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(bma220_pm_ops, bma220_suspend, bma220_resume); static const struct spi_device_id bma220_spi_id[] = { {"bma220", 0}, @@ -318,7 +318,7 @@ MODULE_DEVICE_TABLE(spi, bma220_spi_id); static struct spi_driver bma220_driver = { .driver = { .name = "bma220_spi", - .pm = &bma220_pm_ops, + .pm = pm_sleep_ptr(&bma220_pm_ops), .acpi_match_table = bma220_acpi_id, }, .probe = bma220_probe, From patchwork Tue Jun 21 20:26:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889722 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B650C43334 for ; Tue, 21 Jun 2022 20:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353056AbiFUUSr (ORCPT ); Tue, 21 Jun 2022 16:18:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUS3 (ORCPT ); Tue, 21 Jun 2022 16:18:29 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FDAD1DA56 for ; Tue, 21 Jun 2022 13:18:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 218D1B81809 for ; Tue, 21 Jun 2022 20:18:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECEE4C3411C; Tue, 21 Jun 2022 20:18:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842703; bh=l4nv19W6BC0ctKMPIekSFk2iYtxMBWB2o9K6cfytrDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=taRmd36+d7BGqxnI+Iw+dA9Aadq8TtScx952kZ8WfwApWT6tpsyZP/uGx9Ly3tqQk ODFC3iZV3x6iLCVQNV5qX9hFvXJQ/c1B7DxMsy6KjHYaKsZyVwLdGf5G9FtL7TRVKT nK7bX7JeoFqOHbn/IpaAeHJsDGk4yJSa0lodZxs9/BNCn6KLJacQl4TU1rfZwemvei AmLTqjUJpzYhvhtcUNQr02LyCfxLRMGhO/Iz9k1HY/r7ISofXLZyLpfNSnuxEssjb4 AWS5footrA+r0Wy6atqqrzmOGDDdECJw34KKoQ+ntlosqhW/nyLPoZ6pdVtP10aoio JOWY3hJOxH4uw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 02/36] iio: adc: ad799x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:45 +0100 Message-Id: <20220621202719.13644-3-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Lars-Peter Clausen --- drivers/iio/adc/ad799x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/ad799x.c b/drivers/iio/adc/ad799x.c index 220228c375d3..262bd7665b33 100644 --- a/drivers/iio/adc/ad799x.c +++ b/drivers/iio/adc/ad799x.c @@ -896,7 +896,7 @@ static int ad799x_remove(struct i2c_client *client) return 0; } -static int __maybe_unused ad799x_suspend(struct device *dev) +static int ad799x_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct ad799x_state *st = iio_priv(indio_dev); @@ -908,7 +908,7 @@ static int __maybe_unused ad799x_suspend(struct device *dev) return 0; } -static int __maybe_unused ad799x_resume(struct device *dev) +static int ad799x_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct ad799x_state *st = iio_priv(indio_dev); @@ -941,7 +941,7 @@ static int __maybe_unused ad799x_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ad799x_pm_ops, ad799x_suspend, ad799x_resume); static const struct i2c_device_id ad799x_id[] = { { "ad7991", ad7991 }, @@ -960,7 +960,7 @@ MODULE_DEVICE_TABLE(i2c, ad799x_id); static struct i2c_driver ad799x_driver = { .driver = { .name = "ad799x", - .pm = &ad799x_pm_ops, + .pm = pm_sleep_ptr(&ad799x_pm_ops), }, .probe = ad799x_probe, .remove = ad799x_remove, From patchwork Tue Jun 21 20:26:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889723 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE279CCA47E for ; Tue, 21 Jun 2022 20:18:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233414AbiFUUSs (ORCPT ); Tue, 21 Jun 2022 16:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354263AbiFUUSd (ORCPT ); Tue, 21 Jun 2022 16:18:33 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4853C1D0DF for ; Tue, 21 Jun 2022 13:18:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D9F33617EF for ; Tue, 21 Jun 2022 20:18:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BD84C341C4; Tue, 21 Jun 2022 20:18:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842712; bh=baUC6gbnbR2suKxte6Pu4Y0VG5xjBX8ODlhKdHq/I6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=paf2iyOSurYL4AeR0dTKjU2ypcnI1On36A5OFSMeCnpcMQ80kko7xjqgs0ounzaJV ZL3D9Q/5DT4I4R5kqSkB3UWRd/a0z0ltFmV+MNnMyT8OMB2whW+OpDnmdfgsHNj/3F myRqXlCboogA0gGxXtlw2xHZbkvLoUFcJ0OxnBzlfUjsoiA33PDLWJ2WAhg8UCrAbo n5P/gHqObqM4hEgzj+nWJeBlANPlxaPIIm28RWG+88ejCnBMQbtAwfx4V+1FifZ3Px pXmJI9uamhndRNbogv0NnMqNZR3F91qExnvNnEn+Q7hR2050e/l6CDaSCoIUApyZZL m7k1nFOWzC8SQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 03/36] iio: adc: at91-sam5d2: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:46 +0100 Message-Id: <20220621202719.13644-4-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Eugen Hristev Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Ludovic Desroches --- drivers/iio/adc/at91-sama5d2_adc.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/at91-sama5d2_adc.c b/drivers/iio/adc/at91-sama5d2_adc.c index fe3131c9593c..279430c1d88c 100644 --- a/drivers/iio/adc/at91-sama5d2_adc.c +++ b/drivers/iio/adc/at91-sama5d2_adc.c @@ -2103,7 +2103,7 @@ static int at91_adc_remove(struct platform_device *pdev) return 0; } -static __maybe_unused int at91_adc_suspend(struct device *dev) +static int at91_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); @@ -2123,7 +2123,7 @@ static __maybe_unused int at91_adc_suspend(struct device *dev) return pinctrl_pm_select_sleep_state(dev); } -static __maybe_unused int at91_adc_resume(struct device *dev) +static int at91_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(indio_dev); @@ -2169,7 +2169,8 @@ static __maybe_unused int at91_adc_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, + at91_adc_resume); static const struct of_device_id at91_adc_dt_match[] = { { @@ -2190,7 +2191,7 @@ static struct platform_driver at91_adc_driver = { .driver = { .name = "at91-sama5d2_adc", .of_match_table = at91_adc_dt_match, - .pm = &at91_adc_pm_ops, + .pm = pm_sleep_ptr(&at91_adc_pm_ops), }, }; module_platform_driver(at91_adc_driver) From patchwork Tue Jun 21 20:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889724 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25BF8CCA473 for ; Tue, 21 Jun 2022 20:18:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352453AbiFUUSs (ORCPT ); Tue, 21 Jun 2022 16:18:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354321AbiFUUSm (ORCPT ); Tue, 21 Jun 2022 16:18:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 957AD1CB00 for ; Tue, 21 Jun 2022 13:18:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 336A1617C0 for ; Tue, 21 Jun 2022 20:18:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3B9DC3411C; Tue, 21 Jun 2022 20:18:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842720; bh=tXUjAECGDC97pW6hCsoM/tmUG9QCEtVKk1DKRB1Ft2Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lr3Mb7zggQ1zHxZu6DU7+NKq6et8EmRysin5REdkgA2gxFkpJmOw9Rw+aw9Yd/wOH 4U5MSYnKx8CcfS9vV7Ed3Zc5TxMAH9KCXxs5GcI0fQYFmlj3Rn7bZjummm+LIuymKa WVm4o7YjMbDy+KokuTjuQNzyAg/CIJ3kfRPKD/+3d4+wl1iHRqBOkyG4T/7rCOqoU6 lHJNJANScQpxDTYpZl1PbX8x6XzO0pomKeriEAwHabE5Lr57TMBenD3P2zqBwhlpbI c5fuTCtp5ebGMTP/d0MnkHB7BuINc6K3TwBrS8xph2bbi4NWYIBzP6Bby4E+T7VQHC JR65gz2drS7Gw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 04/36] iio: adc: imx7d_adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:47 +0100 Message-Id: <20220621202719.13644-5-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron In this case we only gain the ability to have the compiler drop the struct dev_pm_ops because the callbacks are called from paths other than suspend and resume. In general the purpose of this new macro is to allow automated removal of the callbacks as well, but that doesn't apply here. Signed-off-by: Jonathan Cameron Cc: Haibo Chen Reviewed-by: Haibo Chen --- drivers/iio/adc/imx7d_adc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c index 119217af2bde..86caff1d006b 100644 --- a/drivers/iio/adc/imx7d_adc.c +++ b/drivers/iio/adc/imx7d_adc.c @@ -540,14 +540,15 @@ static int imx7d_adc_probe(struct platform_device *pdev) return 0; } -static SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, imx7d_adc_enable); +static DEFINE_SIMPLE_DEV_PM_OPS(imx7d_adc_pm_ops, imx7d_adc_disable, + imx7d_adc_enable); static struct platform_driver imx7d_adc_driver = { .probe = imx7d_adc_probe, .driver = { .name = "imx7d_adc", .of_match_table = imx7d_adc_match, - .pm = &imx7d_adc_pm_ops, + .pm = pm_sleep_ptr(&imx7d_adc_pm_ops), }, }; From patchwork Tue Jun 21 20:26:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889725 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 766A5C43334 for ; Tue, 21 Jun 2022 20:18:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353327AbiFUUSv (ORCPT ); Tue, 21 Jun 2022 16:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353370AbiFUUSu (ORCPT ); Tue, 21 Jun 2022 16:18:50 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 033331CFCD for ; Tue, 21 Jun 2022 13:18:50 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8CCF1617C0 for ; Tue, 21 Jun 2022 20:18:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 27297C341C4; Tue, 21 Jun 2022 20:18:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842729; bh=ZVo5W6uwva7QBmpp/yht+4hpbNEb+/jkE57WTOxF3eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iEF6e5+jhzRMrSUynDv7ddCxj6k+BjA87fZQPP/04TFQgvIGOt12foL/E6Ggd3XEe ixLudVAMz/OhvnFS/yX0p96UjUp7IZMpXp2MvXzlAZ6uDfHGzLgJnPvXZSLc24MTQ+ xqRo+OUp1bFt+SD1Ic+ysQjbOIb+Q0icPFjKjnVcWwxZAlgaYlzzCqwOA0b3tlK9wC SR960NsSdi0S1flABNsrRDxVGEunSsVHz1zj7CzABPTXVZ/Kw5um04BsgN1GwTKDXx 7xm8C8r8l9xgYzluyJeR6fFpgLbysigaLKt4RkDv8+PleVhUgFj2ua4KM23l13u14G HtUug2gt2DBpw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 05/36] iio: adc: meson_saradc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:48 +0100 Message-Id: <20220621202719.13644-6-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Martin Blumenstingl Acked-by: Martin Blumenstingl --- drivers/iio/adc/meson_saradc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c index c18be3c519af..1a68b099d323 100644 --- a/drivers/iio/adc/meson_saradc.c +++ b/drivers/iio/adc/meson_saradc.c @@ -1281,22 +1281,22 @@ static int meson_sar_adc_remove(struct platform_device *pdev) return meson_sar_adc_hw_disable(indio_dev); } -static int __maybe_unused meson_sar_adc_suspend(struct device *dev) +static int meson_sar_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); return meson_sar_adc_hw_disable(indio_dev); } -static int __maybe_unused meson_sar_adc_resume(struct device *dev) +static int meson_sar_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); return meson_sar_adc_hw_enable(indio_dev); } -static SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops, - meson_sar_adc_suspend, meson_sar_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(meson_sar_adc_pm_ops, + meson_sar_adc_suspend, meson_sar_adc_resume); static struct platform_driver meson_sar_adc_driver = { .probe = meson_sar_adc_probe, @@ -1304,7 +1304,7 @@ static struct platform_driver meson_sar_adc_driver = { .driver = { .name = "meson-saradc", .of_match_table = meson_sar_adc_of_match, - .pm = &meson_sar_adc_pm_ops, + .pm = pm_sleep_ptr(&meson_sar_adc_pm_ops), }, }; From patchwork Tue Jun 21 20:26:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889726 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8EE27C433EF for ; Tue, 21 Jun 2022 20:19:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353370AbiFUUS7 (ORCPT ); Tue, 21 Jun 2022 16:18:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55592 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353829AbiFUUS6 (ORCPT ); Tue, 21 Jun 2022 16:18:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13BCB1D0D9 for ; Tue, 21 Jun 2022 13:18:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9FF05B81B07 for ; Tue, 21 Jun 2022 20:18:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E97FC3411C; Tue, 21 Jun 2022 20:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842735; bh=x2PiwguIMrd2VtOAUeefXIFIY9Q6YPvjrYNa4Dg7XKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dJ4j7a0NM/Zp4d8FwRabULy50M1xTWMzA2s+tN5/1FwHPxuwrbIEeeR0sw2BGA+zR oeDHzL0f5GM1xFx/UrEpBV57OkI83dG2SOkdrJYwaMxEepe2z9by1I2bh96NgXQT+O 8wP3XevYNzrBvs6hbKjjbR6ywl62+b0Oo0AuOBh7KcFexJZLJt5eSmVTwt5UfWe0b5 qVij840qom2iW9c/FtUJ83X6nwyNLqC0H6F8+yTo5kcrPCGGUP3Ck9mxHUxQTh7l3Y 1zEslFpZ0MBvj6MmORSfTf0Q6dTage6x93DZec6ZlzLRIrjNaPWC0bNgqzafbRFGtQ cKLlTSdLbThKw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 06/36] iio: adc: mt6577_auxadc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:49 +0100 Message-Id: <20220621202719.13644-7-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Zhiyong Tao Cc: Hui Liu --- drivers/iio/adc/mt6577_auxadc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/mt6577_auxadc.c b/drivers/iio/adc/mt6577_auxadc.c index e78c96a185db..0e134777bdd2 100644 --- a/drivers/iio/adc/mt6577_auxadc.c +++ b/drivers/iio/adc/mt6577_auxadc.c @@ -215,7 +215,7 @@ static const struct iio_info mt6577_auxadc_info = { .read_raw = &mt6577_auxadc_read_raw, }; -static int __maybe_unused mt6577_auxadc_resume(struct device *dev) +static int mt6577_auxadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev); @@ -234,7 +234,7 @@ static int __maybe_unused mt6577_auxadc_resume(struct device *dev) return 0; } -static int __maybe_unused mt6577_auxadc_suspend(struct device *dev) +static int mt6577_auxadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct mt6577_auxadc_device *adc_dev = iio_priv(indio_dev); @@ -330,9 +330,9 @@ static int mt6577_auxadc_remove(struct platform_device *pdev) return 0; } -static SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops, - mt6577_auxadc_suspend, - mt6577_auxadc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mt6577_auxadc_pm_ops, + mt6577_auxadc_suspend, + mt6577_auxadc_resume); static const struct of_device_id mt6577_auxadc_of_match[] = { { .compatible = "mediatek,mt2701-auxadc", .data = &mt8173_compat }, @@ -349,7 +349,7 @@ static struct platform_driver mt6577_auxadc_driver = { .driver = { .name = "mt6577-auxadc", .of_match_table = mt6577_auxadc_of_match, - .pm = &mt6577_auxadc_pm_ops, + .pm = pm_sleep_ptr(&mt6577_auxadc_pm_ops), }, .probe = mt6577_auxadc_probe, .remove = mt6577_auxadc_remove, From patchwork Tue Jun 21 20:26:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889727 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 50C36C43334 for ; Tue, 21 Jun 2022 20:19:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353834AbiFUUTG (ORCPT ); Tue, 21 Jun 2022 16:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353829AbiFUUTF (ORCPT ); Tue, 21 Jun 2022 16:19:05 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 078F41D0DF for ; Tue, 21 Jun 2022 13:19:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id B825EB81B25 for ; Tue, 21 Jun 2022 20:19:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D0D4FC341C4; Tue, 21 Jun 2022 20:18:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842742; bh=2xO87HhT38VDOw5b4Fn6tFwR4OECAouBEKFn/DWq+/o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I0eOSFKD5Lo23ZE0tTyKINEBltNdOG/VOUyT9kxGI3FHksqRcIPUFfL96+AY+AwY0 MNqdladPuneIN3ELbhC9aaj0Xfcd/JnryA/yDUx4hfPYJsL30arahAIOukC7Ep+FFM +Rww+hXrfEf1vvG49MzCRR10c6D6me2yYbVTCsQUWtn1WYKfhIfpEVZ2DIBhvJB6nm 9wPzGA/FYVVmrWX5eYb5LXw0mlMePybhR0X9RrBa1E+2rjm5Ylts2vlx2FbC4qHxaW 7dnXv+rKX1KEV9+6z5M0sJ1ypp2eqqm4SEsuUUQCmS0pH7bPXJa/JT9982hEtgWCfl RjWzdPd6U/zkQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 07/36] iio: adc: stmpe-adc: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:50 +0100 Message-Id: <20220621202719.13644-8-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. This one is a little unusual as no suspend callback, but the cleanup is still worthwhile (and eventual aim is to get rid of old macro). Signed-off-by: Jonathan Cameron Cc: Philippe Schenker --- drivers/iio/adc/stmpe-adc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/adc/stmpe-adc.c b/drivers/iio/adc/stmpe-adc.c index 000e5cfecb43..67518e460e05 100644 --- a/drivers/iio/adc/stmpe-adc.c +++ b/drivers/iio/adc/stmpe-adc.c @@ -333,7 +333,7 @@ static int stmpe_adc_probe(struct platform_device *pdev) return devm_iio_device_register(&pdev->dev, indio_dev); } -static int __maybe_unused stmpe_adc_resume(struct device *dev) +static int stmpe_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct stmpe_adc *info = iio_priv(indio_dev); @@ -343,7 +343,7 @@ static int __maybe_unused stmpe_adc_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(stmpe_adc_pm_ops, NULL, stmpe_adc_resume); static const struct of_device_id stmpe_adc_ids[] = { { .compatible = "st,stmpe-adc", }, @@ -355,7 +355,7 @@ static struct platform_driver stmpe_adc_driver = { .probe = stmpe_adc_probe, .driver = { .name = "stmpe-adc", - .pm = &stmpe_adc_pm_ops, + .pm = pm_sleep_ptr(&stmpe_adc_pm_ops), .of_match_table = stmpe_adc_ids, }, }; From patchwork Tue Jun 21 20:26:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889728 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F692C433EF for ; Tue, 21 Jun 2022 20:19:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353874AbiFUUTM (ORCPT ); Tue, 21 Jun 2022 16:19:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353829AbiFUUTL (ORCPT ); Tue, 21 Jun 2022 16:19:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEF791D0D9 for ; Tue, 21 Jun 2022 13:19:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5B6BF6181B for ; Tue, 21 Jun 2022 20:19:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EDCC6C3411C; Tue, 21 Jun 2022 20:19:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842749; bh=eEPrs1xDJR+y6tB+19ehvO/V27G6EQJV2luVs4zGJ/4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QViiKv7+0jmsVLL2Zwti4DOgldyNYnPamgbW9ulLsa1rl/1HdBOAn0q3+h+/wz5oC /Pf/mYUa2ZaK27ahECrsEjy9RVKzuwTEpprcGOAWdo2QsjbVEQCM+7JzP/BymvQHz/ S1PvcHwZeWQ/z/VhVrc9YeQToWdgG/bc+vU7PBih+ByYjfBjWkGQPXePkqwnwRJITs Kof2nYTlmY3TlPHbwGJWGCWbFUNgb++CMMgiN9411tzDfeWwfq5RorE9Zs6aLyY8h5 okI+MzoMqFj3kvP7Awxi2VECTKg0YVmCQSA8IO9xRLr1hJFZnDKKBQHfTx+p6ad3Hx EKvmwMCdQrP5w== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 08/36] iio: adc: ti-am335x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:51 +0100 Message-Id: <20220621202719.13644-9-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Miquel Raynal Reviewed-by: Miquel Raynal --- drivers/iio/adc/ti_am335x_adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/ti_am335x_adc.c b/drivers/iio/adc/ti_am335x_adc.c index 567d43a30955..642c5c4895e3 100644 --- a/drivers/iio/adc/ti_am335x_adc.c +++ b/drivers/iio/adc/ti_am335x_adc.c @@ -702,7 +702,7 @@ static int tiadc_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused tiadc_suspend(struct device *dev) +static int tiadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct tiadc_device *adc_dev = iio_priv(indio_dev); @@ -715,7 +715,7 @@ static int __maybe_unused tiadc_suspend(struct device *dev) return 0; } -static int __maybe_unused tiadc_resume(struct device *dev) +static int tiadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct tiadc_device *adc_dev = iio_priv(indio_dev); @@ -732,7 +732,7 @@ static int __maybe_unused tiadc_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(tiadc_pm_ops, tiadc_suspend, tiadc_resume); static const struct of_device_id ti_adc_dt_ids[] = { { .compatible = "ti,am3359-adc", }, @@ -744,7 +744,7 @@ MODULE_DEVICE_TABLE(of, ti_adc_dt_ids); static struct platform_driver tiadc_driver = { .driver = { .name = "TI-am335x-adc", - .pm = &tiadc_pm_ops, + .pm = pm_sleep_ptr(&tiadc_pm_ops), .of_match_table = ti_adc_dt_ids, }, .probe = tiadc_probe, From patchwork Tue Jun 21 20:26:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889729 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69372C433EF for ; Tue, 21 Jun 2022 20:19:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354029AbiFUUTX (ORCPT ); Tue, 21 Jun 2022 16:19:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUTW (ORCPT ); Tue, 21 Jun 2022 16:19:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2760B2613C for ; Tue, 21 Jun 2022 13:19:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id D20A6B81B24 for ; Tue, 21 Jun 2022 20:19:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D358C341C5; Tue, 21 Jun 2022 20:19:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842758; bh=FTxPvwWZ+PsYz/PMouUMeUBi5brTPtjcJ0J79lS6jtw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A359trlrZJ7jwrpvDWNzr3v9Bd+emOvKWCMKG5Awa76gkbKYQMTEOBpcDMEvTB8/z 2+wyHlqUxbF0jdx8z+lyzZUUBD2Y72t749/8Kwk5V2NxobVpmqbYf8Hw0rs913vh52 MgaNr/zG+pfwNV/qq5gGhK3AsHDgnbdTDlWj413CaC7f57+bFa4mRFR99UiPSYoovC lLQ3o/beBdAUxdvmXtzqnDkyBcNF07oXd4J5RprO0FfWnHScoVGf5Nb4nhu0N+ZPuk Pmr2mlv7gNeaNCckvCYaDQ8kEaHengWjGWKV8Ae+xp82uR1T4c7nqLha41mU51HPZn iLVVCRZxcPhUw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 09/36] iio: adc: xilinx-ams: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:52 +0100 Message-Id: <20220621202719.13644-10-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Michal Simek --- drivers/iio/adc/xilinx-ams.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/xilinx-ams.c b/drivers/iio/adc/xilinx-ams.c index a55396c1f8b2..8dad2b232ba7 100644 --- a/drivers/iio/adc/xilinx-ams.c +++ b/drivers/iio/adc/xilinx-ams.c @@ -1421,7 +1421,7 @@ static int ams_probe(struct platform_device *pdev) return devm_iio_device_register(&pdev->dev, indio_dev); } -static int __maybe_unused ams_suspend(struct device *dev) +static int ams_suspend(struct device *dev) { struct ams *ams = iio_priv(dev_get_drvdata(dev)); @@ -1430,20 +1430,20 @@ static int __maybe_unused ams_suspend(struct device *dev) return 0; } -static int __maybe_unused ams_resume(struct device *dev) +static int ams_resume(struct device *dev) { struct ams *ams = iio_priv(dev_get_drvdata(dev)); return clk_prepare_enable(ams->clk); } -static SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ams_pm_ops, ams_suspend, ams_resume); static struct platform_driver ams_driver = { .probe = ams_probe, .driver = { .name = "xilinx-ams", - .pm = &ams_pm_ops, + .pm = pm_sleep_ptr(&ams_pm_ops), .of_match_table = ams_of_match_table, }, }; From patchwork Tue Jun 21 20:26:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889730 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 43BF1C433EF for ; Tue, 21 Jun 2022 20:19:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353829AbiFUUTb (ORCPT ); Tue, 21 Jun 2022 16:19:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUTa (ORCPT ); Tue, 21 Jun 2022 16:19:30 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA7A81CFCD for ; Tue, 21 Jun 2022 13:19:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8C594B81809 for ; Tue, 21 Jun 2022 20:19:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24F46C3411C; Tue, 21 Jun 2022 20:19:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842767; bh=2VOKrsbJJyFWIQ+Jx64qLLEpnySDWXWZeeq6TPRQzXw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=u71zx0eEJzwq5BO14M0v49eH203ytIOxl5P4X9JN1bwlVrbO2YScLOeFPhlchWwXx YZs5wkFoIpJj+ISdMZNLie7vylE6WzFtdF3wMNjBOJ3Riaz1h4dgttbi0yeY/rcdtw r6ERqQssL7m8/FCkJA8lYaqrHVYp6ahmR4/maF9R3isFNx0ngtUfaO9GbpxmTyERX8 Nl47zidaqbU4g6mqFbj+tbQLqwsDFBwEaSG6eCfEX94xn5y0OS5q5s+zZE8MElmVwl /KzQvGkoDKUB9yU9tYEK62eJ+ahfPcjGxp5lrF55v+UGE7K/oeNphl/R+fM+zMrqaq SEImKaAmv/a2Q== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 10/36] iio: chemical: scd4x: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:53 +0100 Message-Id: <20220621202719.13644-11-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Roan van Dijk --- drivers/iio/chemical/scd4x.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/chemical/scd4x.c b/drivers/iio/chemical/scd4x.c index 37143b5526ee..54066532ea45 100644 --- a/drivers/iio/chemical/scd4x.c +++ b/drivers/iio/chemical/scd4x.c @@ -551,7 +551,7 @@ static const struct iio_chan_spec scd4x_channels[] = { }, }; -static int __maybe_unused scd4x_suspend(struct device *dev) +static int scd4x_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct scd4x_state *state = iio_priv(indio_dev); @@ -564,7 +564,7 @@ static int __maybe_unused scd4x_suspend(struct device *dev) return regulator_disable(state->vdd); } -static int __maybe_unused scd4x_resume(struct device *dev) +static int scd4x_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct scd4x_state *state = iio_priv(indio_dev); @@ -577,7 +577,7 @@ static int __maybe_unused scd4x_resume(struct device *dev) return scd4x_send_command(state, CMD_START_MEAS); } -static __maybe_unused SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(scd4x_pm_ops, scd4x_suspend, scd4x_resume); static void scd4x_stop_meas(void *state) { @@ -688,7 +688,7 @@ static struct i2c_driver scd4x_i2c_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = scd4x_dt_ids, - .pm = &scd4x_pm_ops + .pm = pm_sleep_ptr(&scd4x_pm_ops), }, .probe = scd4x_probe, }; From patchwork Tue Jun 21 20:26:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889731 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CAB45C43334 for ; Tue, 21 Jun 2022 20:19:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354033AbiFUUTk (ORCPT ); Tue, 21 Jun 2022 16:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUTj (ORCPT ); Tue, 21 Jun 2022 16:19:39 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3B762613C for ; Tue, 21 Jun 2022 13:19:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 0F32CCE1C39 for ; Tue, 21 Jun 2022 20:19:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0EC99C341C4; Tue, 21 Jun 2022 20:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842775; bh=gRHf8QVxLTOp4IR+16PDiLQPXJOi9Sjm3BEQHvf9SZk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oHiRvUnVTNqoIUdRr9s6bA3BBSJOcbdA8zJlQX7XQ8KoxsIVZA9LccFEVhPcm3wvF utybZzjn8ann2WNDsfmFHdZMAj1/6zuCSj/FUz6/UTjCmT96EdclVnUlWRtx1+kfkk GB1tvijuRJqmQ3fAvSIVhf1RnF8uYNtqAVn62BFkoj3hP8GOZGsWTquek9+wbyrJcx OUvJa5IOw6JnONjdLUjJlQzHE4LAQ+f7x05z3Pla76nPdqbOdp3AKitnHlzRb/NH0x XyM/0RM1qMQqadTG+4E9P9wm86DnYH3qW9sfLbdALZAA3R7MOobvx0s781NqQKeVXp IX8unnAbhtfrQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 11/36] iio: dac: ds4424: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:54 +0100 Message-Id: <20220621202719.13644-12-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Ismail H. Kose --- drivers/iio/dac/ds4424.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/ds4424.c b/drivers/iio/dac/ds4424.c index 5a5e967b0be4..509394690bcc 100644 --- a/drivers/iio/dac/ds4424.c +++ b/drivers/iio/dac/ds4424.c @@ -171,7 +171,7 @@ static int ds4424_verify_chip(struct iio_dev *indio_dev) return ret; } -static int __maybe_unused ds4424_suspend(struct device *dev) +static int ds4424_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -189,7 +189,7 @@ static int __maybe_unused ds4424_suspend(struct device *dev) return ret; } -static int __maybe_unused ds4424_resume(struct device *dev) +static int ds4424_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -206,7 +206,7 @@ static int __maybe_unused ds4424_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ds4424_pm_ops, ds4424_suspend, ds4424_resume); static const struct iio_info ds4424_info = { .read_raw = ds4424_read_raw, @@ -312,7 +312,7 @@ static struct i2c_driver ds4424_driver = { .driver = { .name = "ds4424", .of_match_table = ds4424_of_match, - .pm = &ds4424_pm_ops, + .pm = pm_sleep_ptr(&ds4424_pm_ops), }, .probe = ds4424_probe, .remove = ds4424_remove, From patchwork Tue Jun 21 20:26:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889732 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6A600C43334 for ; Tue, 21 Jun 2022 20:19:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354050AbiFUUTp (ORCPT ); Tue, 21 Jun 2022 16:19:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUTo (ORCPT ); Tue, 21 Jun 2022 16:19:44 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1AFEB1CFCD for ; Tue, 21 Jun 2022 13:19:44 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id C5BE2B81809 for ; Tue, 21 Jun 2022 20:19:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF6C9C3411C; Tue, 21 Jun 2022 20:19:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842781; bh=oQVK8zu9RDGROfQmKal1LUbnVDhdKjLWODLPg13kPwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RM+k9jC2tvWSW/o/lG23zWtu/8OlQwWu2qR3Ip4HrAkv4un0SMDJp6qlSXTJaYpds 1lbjyRd97mmaZiLFXieqy7ym9OgqGRLgoi7tKyUvkq+e8Hm/VDpvVsgy3g9Z9DQopE ZAymCexpf8+HMQstnEmzNXoo7P/pl1SgX5B8qXKAIiVAdh4Sf4td6DsN0lo+A2Rqx9 AIIk31O60cKS0O0rmDjJXSl3x1mEdFs6KwIx2KOfXxdzJeISCzN3mNIlNVcHHrGkHr Hb0/212gk9kE2o68Th/PMjDulxK4oVl9QJ7yjcTe3BSbrZU+xIlRcdt+kt+cXUPp98 oMPTp0xek5ExQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 12/36] iio: dac: ltc1660: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:55 +0100 Message-Id: <20220621202719.13644-13-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Marcus Folkesson Reviewed-by: Marcus Folkesson --- drivers/iio/dac/ltc1660.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/ltc1660.c b/drivers/iio/dac/ltc1660.c index c76233c9bb72..2758fc8a5ad5 100644 --- a/drivers/iio/dac/ltc1660.c +++ b/drivers/iio/dac/ltc1660.c @@ -137,20 +137,21 @@ static const struct iio_info ltc1660_info = { .write_raw = <c1660_write_raw, }; -static int __maybe_unused ltc1660_suspend(struct device *dev) +static int ltc1660_suspend(struct device *dev) { struct ltc1660_priv *priv = iio_priv(spi_get_drvdata( to_spi_device(dev))); return regmap_write(priv->regmap, LTC1660_REG_SLEEP, 0x00); } -static int __maybe_unused ltc1660_resume(struct device *dev) +static int ltc1660_resume(struct device *dev) { struct ltc1660_priv *priv = iio_priv(spi_get_drvdata( to_spi_device(dev))); return regmap_write(priv->regmap, LTC1660_REG_WAKE, 0x00); } -static SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, ltc1660_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ltc1660_pm_ops, ltc1660_suspend, + ltc1660_resume); static int ltc1660_probe(struct spi_device *spi) { @@ -233,7 +234,7 @@ static struct spi_driver ltc1660_driver = { .driver = { .name = "ltc1660", .of_match_table = ltc1660_dt_ids, - .pm = <c1660_pm_ops, + .pm = pm_sleep_ptr(<c1660_pm_ops), }, .probe = ltc1660_probe, .remove = ltc1660_remove, From patchwork Tue Jun 21 20:26:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889733 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 97AD4C43334 for ; Tue, 21 Jun 2022 20:19:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354065AbiFUUTw (ORCPT ); Tue, 21 Jun 2022 16:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUTw (ORCPT ); Tue, 21 Jun 2022 16:19:52 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3DEA02613C for ; Tue, 21 Jun 2022 13:19:51 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id EAC70B81B24 for ; Tue, 21 Jun 2022 20:19:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA1F6C341C4; Tue, 21 Jun 2022 20:19:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842788; bh=0oSGiJpWCxBQCdZZZqvVuQT2Cw5szPuHbWL/hBhsH2E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kc1f2PJxhiGbZO4czhKfFDnnfhrbnLMGClHK3ujRm6IILi6Na5NjcppE8eCN/mIRn My4PNbQrxX6fIsQWRY3dXIJg0jGl5YdYTAsRdq9y1/MiRxiRIEJvuai0yYe1rXBFzy 1b7NKRSMV8YPI+Ip4009HMZmMiKy47PB1pGkmRBKeCoJ6eQp029woDzBemKfJ5v65s rmuuFnhrLp2mKQkUHF63qIVXmuEy6HL+266650GbR7z5Z1/CK2O/Wob9urLayyPxKu KlZoEHAkndVvZHsMBzR62CD3bBa6setU8DIhJzPs4xd/fFFnaomhrp5Ajr0n1wkmQ2 9kxC69CFk35nw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 13/36] iio: dac: max517: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:56 +0100 Message-Id: <20220621202719.13644-14-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Marcus Folkesson --- drivers/iio/dac/max517.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c index a6ef555153f4..373ce6ff83b7 100644 --- a/drivers/iio/dac/max517.c +++ b/drivers/iio/dac/max517.c @@ -100,21 +100,21 @@ static int max517_write_raw(struct iio_dev *indio_dev, return ret; } -static int __maybe_unused max517_suspend(struct device *dev) +static int max517_suspend(struct device *dev) { u8 outbuf = COMMAND_PD; return i2c_master_send(to_i2c_client(dev), &outbuf, 1); } -static int __maybe_unused max517_resume(struct device *dev) +static int max517_resume(struct device *dev) { u8 outbuf = 0; return i2c_master_send(to_i2c_client(dev), &outbuf, 1); } -static SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max517_pm_ops, max517_suspend, max517_resume); static const struct iio_info max517_info = { .read_raw = max517_read_raw, @@ -201,7 +201,7 @@ MODULE_DEVICE_TABLE(i2c, max517_id); static struct i2c_driver max517_driver = { .driver = { .name = MAX517_DRV_NAME, - .pm = &max517_pm_ops, + .pm = pm_sleep_ptr(&max517_pm_ops), }, .probe = max517_probe, .id_table = max517_id, From patchwork Tue Jun 21 20:26:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889734 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64E2AC43334 for ; Tue, 21 Jun 2022 20:20:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232397AbiFUUUB (ORCPT ); Tue, 21 Jun 2022 16:20:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354074AbiFUUUB (ORCPT ); Tue, 21 Jun 2022 16:20:01 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC54C27B16 for ; Tue, 21 Jun 2022 13:19:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 8F3F0B81B07 for ; Tue, 21 Jun 2022 20:19:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58010C3411C; Tue, 21 Jun 2022 20:19:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842797; bh=h5ecam/1HcRbl4PmcgXX9VUG/kll21fK5pRUgNPqSgM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=inqs8EmfPF6WGpB0tQmoJ6rp10+0XZtd0NvpilCJbHEDVop6/kL/XgsScpp4yS/FK FQSxPNcT3C5odRkZv5IudDTGsgb6twUs0Cm8qtEjmTk1j/uaTdaNuipyV/9lCzPohF 61Z7nx93aeW9o+WIWUE0gr5DtswsyJeu1snOhbKlYby19r7OGtc0mOH2tC0zMXz/rb 4AJ4jHuDbQ3X0o6q49t1rTFoggckHqGMwTcdypF/703DwEXsaHAfhGKJ7gmMDJRaOV +OUT68xm+IhtW/XAw/Y1Db0/9Y1Rezm6ulFtr9j6O2oqwC/qrGiXrWmmx887e6Mg7F bYERbrYTSUsrQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 14/36] iio: dac: max5821: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:57 +0100 Message-Id: <20220621202719.13644-15-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Philippe Reynes --- drivers/iio/dac/max5821.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/max5821.c b/drivers/iio/dac/max5821.c index 540f9ea7cada..e001b594d5b1 100644 --- a/drivers/iio/dac/max5821.c +++ b/drivers/iio/dac/max5821.c @@ -267,7 +267,7 @@ static int max5821_write_raw(struct iio_dev *indio_dev, } } -static int __maybe_unused max5821_suspend(struct device *dev) +static int max5821_suspend(struct device *dev) { u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE, MAX5821_EXTENDED_DAC_A | @@ -277,7 +277,7 @@ static int __maybe_unused max5821_suspend(struct device *dev) return i2c_master_send(to_i2c_client(dev), outbuf, 2); } -static int __maybe_unused max5821_resume(struct device *dev) +static int max5821_resume(struct device *dev) { u8 outbuf[2] = { MAX5821_EXTENDED_COMMAND_MODE, MAX5821_EXTENDED_DAC_A | @@ -287,7 +287,8 @@ static int __maybe_unused max5821_resume(struct device *dev) return i2c_master_send(to_i2c_client(dev), outbuf, 2); } -static SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, max5821_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(max5821_pm_ops, max5821_suspend, + max5821_resume); static const struct iio_info max5821_info = { .read_raw = max5821_read_raw, @@ -374,7 +375,7 @@ static struct i2c_driver max5821_driver = { .driver = { .name = "max5821", .of_match_table = max5821_of_match, - .pm = &max5821_pm_ops, + .pm = pm_sleep_ptr(&max5821_pm_ops), }, .probe = max5821_probe, .id_table = max5821_id, From patchwork Tue Jun 21 20:26:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889735 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B03A6C43334 for ; Tue, 21 Jun 2022 20:20:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354129AbiFUUUM (ORCPT ); Tue, 21 Jun 2022 16:20:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354074AbiFUUUJ (ORCPT ); Tue, 21 Jun 2022 16:20:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B977B1D31D for ; Tue, 21 Jun 2022 13:20:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 64B3BB81B07 for ; Tue, 21 Jun 2022 20:20:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2187C341C5; Tue, 21 Jun 2022 20:19:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842806; bh=9UABDwPS1KiPjY6BZQLOSKM6AFWWDu7EeUkin0n4Lss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Px/QcpumqBdxy2AKqdAvaADSSv+i3hS4oBcSqFoSLbgfpgwczhpbhbvWAPo8GbKNx UWYKtl4OdxjYL3AfVYv+e0bSLi/7kJhH8tUH2jSPHUrRo7Jdqgelg4n4zZwGLAZJLE InHpd8g0T6moT6E+tDS/6p0TpuEhggew2a8NtnufS97NwU/0ztT3+DV7+2fy7naXH0 FE94ph6RG8EZqIZ/uOCesCecFv9lkg4vicy/1asDgOS23gegt9rSPn0oqz9uEDa2rb 45U0xl3uFTNTY3pxqnzetPyF8eaxAHScHzW5Liy1R+r5HHtTW/P40ZV3/kT2lQWUJ6 L2UEyXVspygaA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 15/36] iio: dac: mcp4725: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:58 +0100 Message-Id: <20220621202719.13644-16-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Philippe Reynes --- drivers/iio/dac/mcp4725.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/mcp4725.c b/drivers/iio/dac/mcp4725.c index 7fcb86288823..bb4b85a7b95b 100644 --- a/drivers/iio/dac/mcp4725.c +++ b/drivers/iio/dac/mcp4725.c @@ -42,7 +42,7 @@ struct mcp4725_data { struct regulator *vref_reg; }; -static int __maybe_unused mcp4725_suspend(struct device *dev) +static int mcp4725_suspend(struct device *dev) { struct mcp4725_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -55,7 +55,7 @@ static int __maybe_unused mcp4725_suspend(struct device *dev) return i2c_master_send(data->client, outbuf, 2); } -static int __maybe_unused mcp4725_resume(struct device *dev) +static int mcp4725_resume(struct device *dev) { struct mcp4725_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -68,7 +68,8 @@ static int __maybe_unused mcp4725_resume(struct device *dev) return i2c_master_send(data->client, outbuf, 2); } -static SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, mcp4725_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(mcp4725_pm_ops, mcp4725_suspend, + mcp4725_resume); static ssize_t mcp4725_store_eeprom(struct device *dev, struct device_attribute *attr, const char *buf, size_t len) @@ -523,7 +524,7 @@ static struct i2c_driver mcp4725_driver = { .driver = { .name = MCP4725_DRV_NAME, .of_match_table = mcp4725_of_match, - .pm = &mcp4725_pm_ops, + .pm = pm_sleep_ptr(&mcp4725_pm_ops), }, .probe = mcp4725_probe, .remove = mcp4725_remove, From patchwork Tue Jun 21 20:26:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889736 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0999DCCA473 for ; Tue, 21 Jun 2022 20:20:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354135AbiFUUUS (ORCPT ); Tue, 21 Jun 2022 16:20:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354017AbiFUUUS (ORCPT ); Tue, 21 Jun 2022 16:20:18 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90E991CFCD for ; Tue, 21 Jun 2022 13:20:17 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D515B81B01 for ; Tue, 21 Jun 2022 20:20:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A270FC3411C; Tue, 21 Jun 2022 20:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842815; bh=gx3OXToTwHZJAkZhPcHr+o4hZMO/s0EU8/pBJa5XMyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P+SQf+m2zjw9BXH+FWN+KJX6Mi5LZep9RyESpU4Zw4U3r3Q5lNKaezgUAbtVXF4VJ Em9lycJAo09rgQYL40bsKBEmbliwVkjYd25z/y/dtLyq4Undx/uxxKjbpGjpJj07BW e1Km+b3ISQa7XQjKodsE+ClPlcPqcIDKQOf1uDDdRrp0t0OfzCfWRWqA5Nh1vHN773 6H7DRLSGnbCSU7/Z83WU39Il8Wpy6BgYIXNtLGqs32sLN9YYqaePDeUw/qI2GOV4NX ChPtw6L3txE/ZHUcI6HmCn2qrwu2ZQ+e8jtoA1hiDhuXD/U9N2ZSvuY4ynivTJZNuO QAKS4LiOJ+4AA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 16/36] iio: gyro: itg3200: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:26:59 +0100 Message-Id: <20220621202719.13644-17-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron --- drivers/iio/gyro/itg3200_core.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/gyro/itg3200_core.c b/drivers/iio/gyro/itg3200_core.c index a7f1bbb5f289..0491c64e1b32 100644 --- a/drivers/iio/gyro/itg3200_core.c +++ b/drivers/iio/gyro/itg3200_core.c @@ -364,7 +364,7 @@ static int itg3200_remove(struct i2c_client *client) return 0; } -static int __maybe_unused itg3200_suspend(struct device *dev) +static int itg3200_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct itg3200 *st = iio_priv(indio_dev); @@ -375,14 +375,15 @@ static int __maybe_unused itg3200_suspend(struct device *dev) ITG3200_SLEEP); } -static int __maybe_unused itg3200_resume(struct device *dev) +static int itg3200_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); return itg3200_initial_setup(indio_dev); } -static SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend, itg3200_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(itg3200_pm_ops, itg3200_suspend, + itg3200_resume); static const struct i2c_device_id itg3200_id[] = { { "itg3200", 0 }, @@ -400,7 +401,7 @@ static struct i2c_driver itg3200_driver = { .driver = { .name = "itg3200", .of_match_table = itg3200_of_match, - .pm = &itg3200_pm_ops, + .pm = pm_sleep_ptr(&itg3200_pm_ops), }, .id_table = itg3200_id, .probe = itg3200_probe, From patchwork Tue Jun 21 20:27:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889737 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 895E5C43334 for ; Tue, 21 Jun 2022 20:20:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354017AbiFUUU0 (ORCPT ); Tue, 21 Jun 2022 16:20:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354263AbiFUUUZ (ORCPT ); Tue, 21 Jun 2022 16:20:25 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62B721CFCD for ; Tue, 21 Jun 2022 13:20:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 00394617F4 for ; Tue, 21 Jun 2022 20:20:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C3DEC341C4; Tue, 21 Jun 2022 20:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842823; bh=a9COZF0+ZiVAqmNEfLj92B/D6i34BlC7qy9zHSzB3u4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZcNT3Qi17sSpwuMTzvE4MqvUGpN8Ic8c4BMEGzJWF8Q9/PPL4KG7mF5UFI81e4qbA A+R8QOJuwJ3eKUkVBUO1VvIKl93OtlPcf7Imn7GLGNWGQ1wlpJEHMHfhKHQ/729jSw fDAWy56RzkukAiM1p3wLyEeLCmQQDXSgPIwrMlehin6FVJkkcPkukV9VEgTtV/4aBu 6hy93Vsnj5LusfBTRLTqVB6R0oCSWHqr2hf0TYXro+S/yUTd8ui1ePJ3dREE/4LgBv CmEA40ZleC2AP1l8Cvvz5J1nazUUihLlh7A/0qchu6gBQ4o00y6kl+3icf+3y9+Adp 7L9moPfDE0ekQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 17/36] iio: health: afe4403: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:00 +0100 Message-Id: <20220621202719.13644-18-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron --- drivers/iio/health/afe4403.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/health/afe4403.c b/drivers/iio/health/afe4403.c index 856ec901b091..3bb4028c5d74 100644 --- a/drivers/iio/health/afe4403.c +++ b/drivers/iio/health/afe4403.c @@ -408,7 +408,7 @@ static const struct of_device_id afe4403_of_match[] = { }; MODULE_DEVICE_TABLE(of, afe4403_of_match); -static int __maybe_unused afe4403_suspend(struct device *dev) +static int afe4403_suspend(struct device *dev) { struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); struct afe4403_data *afe = iio_priv(indio_dev); @@ -429,7 +429,7 @@ static int __maybe_unused afe4403_suspend(struct device *dev) return 0; } -static int __maybe_unused afe4403_resume(struct device *dev) +static int afe4403_resume(struct device *dev) { struct iio_dev *indio_dev = spi_get_drvdata(to_spi_device(dev)); struct afe4403_data *afe = iio_priv(indio_dev); @@ -449,7 +449,8 @@ static int __maybe_unused afe4403_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend, afe4403_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(afe4403_pm_ops, afe4403_suspend, + afe4403_resume); static int afe4403_probe(struct spi_device *spi) { @@ -598,7 +599,7 @@ static struct spi_driver afe4403_spi_driver = { .driver = { .name = AFE4403_DRIVER_NAME, .of_match_table = afe4403_of_match, - .pm = &afe4403_pm_ops, + .pm = pm_sleep_ptr(&afe4403_pm_ops), }, .probe = afe4403_probe, .remove = afe4403_remove, From patchwork Tue Jun 21 20:27:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889738 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04C91C433EF for ; Tue, 21 Jun 2022 20:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354258AbiFUUUg (ORCPT ); Tue, 21 Jun 2022 16:20:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354256AbiFUUUf (ORCPT ); Tue, 21 Jun 2022 16:20:35 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5C0A1CFCD for ; Tue, 21 Jun 2022 13:20:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 98390B81B07 for ; Tue, 21 Jun 2022 20:20:33 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE8CEC3411C; Tue, 21 Jun 2022 20:20:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842832; bh=aNsWmTaWWnd1Gh7lA6RZjRrPyI4g7F6B3hrJztzlCJE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EybBLBqqI7217oAFeTUSS9E+YYeZhFI5dbpHHcJKd5RyHTUIh5SWzRpDITg6BkWKL jSF5Gbo6ts6INYuzV0I1VULf0dACO9+8ghhLtczNC8IMqY9A8qoiFL0kJIDaAXE8FB Jd+xqQksmTpL0lq1XugGVI7hzx83C7xwgmGlMvQFbtqlUQuI4em6EeHJ+Tgp0CmD+F BCN1dRvKVaD8UJW/ODwE2mgoZMqkdB/PP2BKJgbI596bg8cdIffcnYTNdnlEM9sKfQ XmbNHcpCsZKmzNbIOs0O2DQDDB8F2XPgxx9cDw8Cs3+AB0/g0JnMIok9AlHnn886QV O3vTeu8+rYqGQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 18/36] iio: health: afe4404: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:01 +0100 Message-Id: <20220621202719.13644-19-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron --- drivers/iio/health/afe4404.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/health/afe4404.c b/drivers/iio/health/afe4404.c index 1bb7de60f8ca..dd7800159051 100644 --- a/drivers/iio/health/afe4404.c +++ b/drivers/iio/health/afe4404.c @@ -415,7 +415,7 @@ static const struct of_device_id afe4404_of_match[] = { }; MODULE_DEVICE_TABLE(of, afe4404_of_match); -static int __maybe_unused afe4404_suspend(struct device *dev) +static int afe4404_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct afe4404_data *afe = iio_priv(indio_dev); @@ -436,7 +436,7 @@ static int __maybe_unused afe4404_suspend(struct device *dev) return 0; } -static int __maybe_unused afe4404_resume(struct device *dev) +static int afe4404_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct afe4404_data *afe = iio_priv(indio_dev); @@ -456,7 +456,8 @@ static int __maybe_unused afe4404_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend, afe4404_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(afe4404_pm_ops, afe4404_suspend, + afe4404_resume); static int afe4404_probe(struct i2c_client *client, const struct i2c_device_id *id) @@ -607,7 +608,7 @@ static struct i2c_driver afe4404_i2c_driver = { .driver = { .name = AFE4404_DRIVER_NAME, .of_match_table = afe4404_of_match, - .pm = &afe4404_pm_ops, + .pm = pm_sleep_ptr(&afe4404_pm_ops), }, .probe = afe4404_probe, .remove = afe4404_remove, From patchwork Tue Jun 21 20:27:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889739 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ABE42C433EF for ; Tue, 21 Jun 2022 20:20:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354263AbiFUUUm (ORCPT ); Tue, 21 Jun 2022 16:20:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354268AbiFUUUm (ORCPT ); Tue, 21 Jun 2022 16:20:42 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EA8828991 for ; Tue, 21 Jun 2022 13:20:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 16F6C6181B for ; Tue, 21 Jun 2022 20:20:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFE41C341C4; Tue, 21 Jun 2022 20:20:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842840; bh=STw9T+eCYKZGLNbBcQn9J3EcCT6QJXT4yOFXLuEzYTY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EGIHbP7u/tR/c9n8sE+Pj9hWzhTcrawEaXbREaVJUyTLQrNAvK2+Ea+qF3g0qtow/ 0sLBjqflU0dE/m8xFK+YtaKWoKmQsldoAXVDvW/f8q63OqkNyyCSNII7wxpXzSgk9Y rAtzI2qJU/lNUIdL7vo84YLBGeXS+NJqUA9dzb74O8K/dJKMvxCAmc7VgcgrYQmzra QBkdKAr1iniJpqgqXsaXJN6va9WlAFRbmWEiPNVm05L/IqV2cr4M9Vmkfw5iLhDlxv O7rCCYXMj0SY28B3SMfe6Dix/t78l5fgxiZuOlgTCJ4jbBvGv+nZaSQ+DSwaRxBPvX b/Zc2l0SBPsJw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 19/36] iio: light: al3010: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:02 +0100 Message-Id: <20220621202719.13644-20-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: David Heidelberg Reviewed-by: David Heidelberg --- drivers/iio/light/al3010.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/al3010.c b/drivers/iio/light/al3010.c index b4e9924094cd..ce5363845b22 100644 --- a/drivers/iio/light/al3010.c +++ b/drivers/iio/light/al3010.c @@ -200,17 +200,17 @@ static int al3010_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -static int __maybe_unused al3010_suspend(struct device *dev) +static int al3010_suspend(struct device *dev) { return al3010_set_pwr(to_i2c_client(dev), false); } -static int __maybe_unused al3010_resume(struct device *dev) +static int al3010_resume(struct device *dev) { return al3010_set_pwr(to_i2c_client(dev), true); } -static SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(al3010_pm_ops, al3010_suspend, al3010_resume); static const struct i2c_device_id al3010_id[] = { {"al3010", }, @@ -228,7 +228,7 @@ static struct i2c_driver al3010_driver = { .driver = { .name = AL3010_DRV_NAME, .of_match_table = al3010_of_match, - .pm = &al3010_pm_ops, + .pm = pm_sleep_ptr(&al3010_pm_ops), }, .probe = al3010_probe, .id_table = al3010_id, From patchwork Tue Jun 21 20:27:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889740 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D955C433EF for ; Tue, 21 Jun 2022 20:20:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354267AbiFUUU5 (ORCPT ); Tue, 21 Jun 2022 16:20:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354256AbiFUUU4 (ORCPT ); Tue, 21 Jun 2022 16:20:56 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6208D2613C for ; Tue, 21 Jun 2022 13:20:52 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 67589CE1C3A for ; Tue, 21 Jun 2022 20:20:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A9F6C3411C; Tue, 21 Jun 2022 20:20:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842848; bh=TzpDH/PTgvb4s6AAydwAOEf9PgL+gttUYXhnIpL7lRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfETOiUrwbzwkCNjqPdgUsEuZ2szpB/1luuWzsQhk13WJJYyqyTgdK+Jx0KMLc+F0 xm9DxMNIKupsOfLsDUrFTBxdC8PkI3EDciTgCusjOdalq19MdOs+21V4s3E1tmfVQJ 2tzjkqCpdf0ibezrOrerElIbgQt3IAhkVw0Rtml1TeubKLEevaR38VpbYWBnj/nvVw vZ2YVVpHxQG1zx19y4L4iQ5XSeJj7EAIjZbE5dxB3rmvZliPihx5tZUqW5GfpESrO/ CN/PnqxedFBZY28Bhgcv0qGCFr/ENqpFXhDBoMo671rSJBycMz/KHcYNYs8ZJ4g+UO Aepmrmd+6U/gQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 20/36] iio: light: al3320a: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:03 +0100 Message-Id: <20220621202719.13644-21-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: David Heidelberg Reviewed-by: David Heidelberg --- drivers/iio/light/al3320a.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/al3320a.c b/drivers/iio/light/al3320a.c index cc1407ccc10a..bc99179728ed 100644 --- a/drivers/iio/light/al3320a.c +++ b/drivers/iio/light/al3320a.c @@ -223,17 +223,18 @@ static int al3320a_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -static int __maybe_unused al3320a_suspend(struct device *dev) +static int al3320a_suspend(struct device *dev) { return al3320a_set_pwr(to_i2c_client(dev), false); } -static int __maybe_unused al3320a_resume(struct device *dev) +static int al3320a_resume(struct device *dev) { return al3320a_set_pwr(to_i2c_client(dev), true); } -static SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, al3320a_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(al3320a_pm_ops, al3320a_suspend, + al3320a_resume); static const struct i2c_device_id al3320a_id[] = { {"al3320a", 0}, @@ -251,7 +252,7 @@ static struct i2c_driver al3320a_driver = { .driver = { .name = AL3320A_DRV_NAME, .of_match_table = al3320a_of_match, - .pm = &al3320a_pm_ops, + .pm = pm_sleep_ptr(&al3320a_pm_ops), }, .probe = al3320a_probe, .id_table = al3320a_id, From patchwork Tue Jun 21 20:27:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889741 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C249C433EF for ; Tue, 21 Jun 2022 20:21:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354268AbiFUUU7 (ORCPT ); Tue, 21 Jun 2022 16:20:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354256AbiFUUU7 (ORCPT ); Tue, 21 Jun 2022 16:20:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99FBD1CFCD for ; Tue, 21 Jun 2022 13:20:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DBF4B81B07 for ; Tue, 21 Jun 2022 20:20:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4093AC341C4; Tue, 21 Jun 2022 20:20:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842856; bh=mFglGnZ2qq7YIYl4qcrkS1N+FnCS3345zhcCklI+Hbg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Mw31zysJolog4j4T23X3EnBy5D1Wa60sb40Va3CvpPQDww6qAuqbOo3iAHBRVQoL0 QxiOApUX+aY9VmmxRMKU+iJZlT+zzvCJx9Wz30h6nwDrahmoPUqB+Z9USEE9GsajCH zUxh6WclT9MnaiSe6t65KG5KGLZ+v3jkrzJC6f3byW26n9yj8LN9dCJAH/6QXP45XS veQJpxN0987hoNveskfbX+9nh9Kcwu1h/w/yadsXANfQvUCZ4RVMqime0diY+L4H97 KrYBSXePrcsV5RCUi43w7N5zaTWoukE2259HF/6jcigKCQpAzEUlujslgvJCs7dPmM qOdXIKKUpd1EA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 21/36] iio: light: as73211: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:04 +0100 Message-Id: <20220621202719.13644-22-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Christian Eggers Reviewed-by: Christian Eggers --- drivers/iio/light/as73211.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/as73211.c b/drivers/iio/light/as73211.c index 3ba2378df3dd..2307fc531752 100644 --- a/drivers/iio/light/as73211.c +++ b/drivers/iio/light/as73211.c @@ -755,21 +755,22 @@ static int as73211_probe(struct i2c_client *client) return devm_iio_device_register(dev, indio_dev); } -static int __maybe_unused as73211_suspend(struct device *dev) +static int as73211_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); return as73211_power(indio_dev, false); } -static int __maybe_unused as73211_resume(struct device *dev) +static int as73211_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); return as73211_power(indio_dev, true); } -static SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend, as73211_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(as73211_pm_ops, as73211_suspend, + as73211_resume); static const struct of_device_id as73211_of_match[] = { { .compatible = "ams,as73211" }, @@ -787,7 +788,7 @@ static struct i2c_driver as73211_driver = { .driver = { .name = AS73211_DRV_NAME, .of_match_table = as73211_of_match, - .pm = &as73211_pm_ops, + .pm = pm_sleep_ptr(&as73211_pm_ops), }, .probe_new = as73211_probe, .id_table = as73211_id, From patchwork Tue Jun 21 20:27:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889742 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE4FEC43334 for ; Tue, 21 Jun 2022 20:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354269AbiFUUVH (ORCPT ); Tue, 21 Jun 2022 16:21:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354256AbiFUUVG (ORCPT ); Tue, 21 Jun 2022 16:21:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28B8E2613C for ; Tue, 21 Jun 2022 13:21:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id DEE44B81B07 for ; Tue, 21 Jun 2022 20:21:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C7C7C341C6; Tue, 21 Jun 2022 20:20:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842862; bh=4nXMTIXPmZTLehtRlxc9hUBdnfHSp93MugvSXw6q7oE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MQumyHYl90RFjGD+tplBwRXteBPjTeE3qd2/VtfcUQ3XRmzsQcVxzezUTjdSW49Ey AbkIN/ggxyeHMIpvMQqnVI3WppoIRbO0B/QrbBSb7NbNhvX8ZlubkNX4kiM4VjfInB 97ALuQPEgrIRNc8GsedwBHWzL3XfvF8Tz/9FwShIpQGiqpIry7OEYMLfQoSqeC1meC sfYkzXSDTw4q4TpgEb9xSPrZc5zHaE9BjymdB0rPcKKAt31XPp2yXW8ZJZg+ttG368 xACE+guf4fiHkz/bwdrB5FSFlmAVmoJyzn8o/w/PHvOTldHJYcc0k0aAmyirrvLEO5 bOFXvEZXiTD5g== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 22/36] iio: light: bh1750: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:05 +0100 Message-Id: <20220621202719.13644-23-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Tomasz Duszynski --- drivers/iio/light/bh1750.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/bh1750.c b/drivers/iio/light/bh1750.c index 48484b9401b9..471985c220bb 100644 --- a/drivers/iio/light/bh1750.c +++ b/drivers/iio/light/bh1750.c @@ -277,7 +277,7 @@ static int bh1750_remove(struct i2c_client *client) return 0; } -static int __maybe_unused bh1750_suspend(struct device *dev) +static int bh1750_suspend(struct device *dev) { int ret; struct bh1750_data *data = @@ -294,7 +294,7 @@ static int __maybe_unused bh1750_suspend(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL); +static DEFINE_SIMPLE_DEV_PM_OPS(bh1750_pm_ops, bh1750_suspend, NULL); static const struct i2c_device_id bh1750_id[] = { { "bh1710", BH1710 }, @@ -320,7 +320,7 @@ static struct i2c_driver bh1750_driver = { .driver = { .name = "bh1750", .of_match_table = bh1750_of_match, - .pm = &bh1750_pm_ops, + .pm = pm_sleep_ptr(&bh1750_pm_ops), }, .probe = bh1750_probe, .remove = bh1750_remove, From patchwork Tue Jun 21 20:27:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889743 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF863CCA473 for ; Tue, 21 Jun 2022 20:21:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354277AbiFUUVP (ORCPT ); Tue, 21 Jun 2022 16:21:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57112 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVO (ORCPT ); Tue, 21 Jun 2022 16:21:14 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA54C1CFCD for ; Tue, 21 Jun 2022 13:21:13 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 577C0B81B07 for ; Tue, 21 Jun 2022 20:21:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2F871C341C5; Tue, 21 Jun 2022 20:21:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842871; bh=+3MfJvxPOfIpSBb1x+TBN4ba3dXoJ1Gf7lmS0DxkCg0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FUjivMIpRoeGx9L503BgW7zNE1/4a0nkbZp9VRLpKZ5EqIQifJMIS2R6CMJ5bSQDy NdRO4P6o1pWnQ7aYjLaO5zlOlVWPAaB+RRVCQGD1Qn+W56bMTvK+VNRnVr1aobEigJ KMmF9SLdmp1K292tr0VsHGOLeC36ifSzY3ZtLD6AclIV8PY2MnY1XFbh9jrQ0G9Ne7 P9tkU98MRj3fjCBMM5m9nRx1A3Uw8HgFRG/g3aY5PXGlKbFvr3aLbk2AYouTQfrqtn UAd31hSeYqGMujWyfP4A3F+GgtTbLN84cdE7wqvdg3rX/HbjSn+5+d/Mki0E2oDgJ9 IjXbhlcQBsDJg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 23/36] iio: light: cm3605: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:06 +0100 Message-Id: <20220621202719.13644-24-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3605.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/cm3605.c b/drivers/iio/light/cm3605.c index 50d34a98839c..c721b69d5095 100644 --- a/drivers/iio/light/cm3605.c +++ b/drivers/iio/light/cm3605.c @@ -278,7 +278,7 @@ static int cm3605_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused cm3605_pm_suspend(struct device *dev) +static int cm3605_pm_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct cm3605 *cm3605 = iio_priv(indio_dev); @@ -289,7 +289,7 @@ static int __maybe_unused cm3605_pm_suspend(struct device *dev) return 0; } -static int __maybe_unused cm3605_pm_resume(struct device *dev) +static int cm3605_pm_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct cm3605 *cm3605 = iio_priv(indio_dev); @@ -302,11 +302,8 @@ static int __maybe_unused cm3605_pm_resume(struct device *dev) return 0; } - -static const struct dev_pm_ops cm3605_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cm3605_pm_suspend, - cm3605_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(cm3605_dev_pm_ops, cm3605_pm_suspend, + cm3605_pm_resume); static const struct of_device_id cm3605_of_match[] = { {.compatible = "capella,cm3605"}, @@ -318,7 +315,7 @@ static struct platform_driver cm3605_driver = { .driver = { .name = "cm3605", .of_match_table = cm3605_of_match, - .pm = &cm3605_dev_pm_ops, + .pm = pm_sleep_ptr(&cm3605_dev_pm_ops), }, .probe = cm3605_probe, .remove = cm3605_remove, From patchwork Tue Jun 21 20:27:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889744 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F575C433EF for ; Tue, 21 Jun 2022 20:21:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354279AbiFUUVX (ORCPT ); Tue, 21 Jun 2022 16:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVX (ORCPT ); Tue, 21 Jun 2022 16:21:23 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B0BD1CFCD for ; Tue, 21 Jun 2022 13:21:22 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BA3D2B81B24 for ; Tue, 21 Jun 2022 20:21:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9024BC3411C; Tue, 21 Jun 2022 20:21:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842879; bh=P3EhNBqqUGGNk++I8lphjCVAqNPW/abwsn/04zhMlfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XTOZA9b0q48rRnxp9CyHYGKS5hjPa3pd829167BS9FVi1cUU+0ODS9Q9gOw1ao3dC cFAbNYI7rQz4iYQgeAPG+QwpdB1tTzr0zIswkdy0vHlzF1AxyESXgBuMKfcd1KTnSp TG3Vnzvn7C+mjYOZYvtgWYcrHmRN05H9BiqF8erUG2BMQf9ITcilS5BYqy7Fy7l1LG v4riPUFl3RfslSZN5mYiNsfebKuGrK8j48ArgP0InD48rFLz8sWihdFdsAhDLWfs8J mMS1t7QbckVcrWkQKvl+M1/wLcB1D1FsWJKPkII+ea4bcqnUQYBe/8KkGT2nvZR0d5 GWV9BwL6/Iwtg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 24/36] iio: proximity: cros_ec_mkbp: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:07 +0100 Message-Id: <20220621202719.13644-25-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Enric Balletbo i Serra Cc: Gwendal Grignou Cc: Stephen Boyd Reviewed-by: Gwendal Grignou --- drivers/iio/proximity/cros_ec_mkbp_proximity.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/proximity/cros_ec_mkbp_proximity.c b/drivers/iio/proximity/cros_ec_mkbp_proximity.c index 8213b0081713..571ea1812246 100644 --- a/drivers/iio/proximity/cros_ec_mkbp_proximity.c +++ b/drivers/iio/proximity/cros_ec_mkbp_proximity.c @@ -184,7 +184,7 @@ static const struct iio_info cros_ec_mkbp_proximity_info = { .write_event_config = cros_ec_mkbp_proximity_write_event_config, }; -static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev) +static int cros_ec_mkbp_proximity_resume(struct device *dev) { struct cros_ec_mkbp_proximity_data *data = dev_get_drvdata(dev); struct cros_ec_device *ec = data->ec; @@ -201,8 +201,8 @@ static __maybe_unused int cros_ec_mkbp_proximity_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL, - cros_ec_mkbp_proximity_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(cros_ec_mkbp_proximity_pm_ops, NULL, + cros_ec_mkbp_proximity_resume); static int cros_ec_mkbp_proximity_probe(struct platform_device *pdev) { @@ -260,7 +260,7 @@ static struct platform_driver cros_ec_mkbp_proximity_driver = { .driver = { .name = "cros-ec-mkbp-proximity", .of_match_table = cros_ec_mkbp_proximity_of_match, - .pm = &cros_ec_mkbp_proximity_pm_ops, + .pm = pm_sleep_ptr(&cros_ec_mkbp_proximity_pm_ops), }, .probe = cros_ec_mkbp_proximity_probe, .remove = cros_ec_mkbp_proximity_remove, From patchwork Tue Jun 21 20:27:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889745 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8DBE1C43334 for ; Tue, 21 Jun 2022 20:21:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354280AbiFUUVa (ORCPT ); Tue, 21 Jun 2022 16:21:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUV3 (ORCPT ); Tue, 21 Jun 2022 16:21:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0679A1D31D for ; Tue, 21 Jun 2022 13:21:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9790F61807 for ; Tue, 21 Jun 2022 20:21:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F0934C341C4; Tue, 21 Jun 2022 20:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842888; bh=lgmOBhm47bc5MlIZORAvhuPgQPvPdd7e85e0qwGalCY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=izl5urCQ3AGOaiwhiN0zldPEfKxKC+XUTPCsgW3FdbXtGMcbRF9hHlRWaP/88mhaY U/Cold1dvS/8g6Kt3SSMu/4PnaYkTqYfMTBHgfZBXrQY1v7R6QZHJvPve56J7WPHH3 TWdGsjLdMe/QJ4xkNKmmgo5cNsyuQTsJTVL7UdqFR1FnkR4STjL1DWB7QR0x6lHPe1 0CYjgqCH+Adx2xxHHrQoHZFpYjgRLVknhxxgMB6oneEfjOjsxmOWtGsAgNfmB7rDcH +G4eoYAL5hjdP/VyEBaf6KKAS9O6dpUYe9ai0RN/q1eed6QcdjbXaGcMsPAxumj2QY z/FPgKpdFAJeg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 25/36] iio: temperature: ltc2983: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Tue, 21 Jun 2022 21:27:08 +0100 Message-Id: <20220621202719.13644-26-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these newer macros allows the compiler to remove the unused structure and functions when !CONFIG_PM_SLEEP + removes the need to mark pm functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Nuno Sá Reviewed-by: Nuno Sá --- drivers/iio/temperature/ltc2983.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index 4b7f2b8a9758..b652d2b39bcf 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -1534,7 +1534,7 @@ static int ltc2983_probe(struct spi_device *spi) return devm_iio_device_register(&spi->dev, indio_dev); } -static int __maybe_unused ltc2983_resume(struct device *dev) +static int ltc2983_resume(struct device *dev) { struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev)); int dummy; @@ -1545,14 +1545,15 @@ static int __maybe_unused ltc2983_resume(struct device *dev) return ltc2983_setup(st, false); } -static int __maybe_unused ltc2983_suspend(struct device *dev) +static int ltc2983_suspend(struct device *dev) { struct ltc2983_data *st = spi_get_drvdata(to_spi_device(dev)); return regmap_write(st->regmap, LTC2983_STATUS_REG, LTC2983_SLEEP); } -static SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend, ltc2983_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend, + ltc2983_resume); static const struct spi_device_id ltc2983_id_table[] = { { "ltc2983" }, @@ -1570,7 +1571,7 @@ static struct spi_driver ltc2983_driver = { .driver = { .name = "ltc2983", .of_match_table = ltc2983_of_match, - .pm = <c2983_pm_ops, + .pm = pm_sleep_ptr(<c2983_pm_ops), }, .probe = ltc2983_probe, .id_table = ltc2983_id_table, From patchwork Tue Jun 21 20:27:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889746 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9A04AC43334 for ; Tue, 21 Jun 2022 20:21:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354287AbiFUUVl (ORCPT ); Tue, 21 Jun 2022 16:21:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57336 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVk (ORCPT ); Tue, 21 Jun 2022 16:21:40 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AED71D31D for ; Tue, 21 Jun 2022 13:21:39 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 08FCEB81B07 for ; Tue, 21 Jun 2022 20:21:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A83C2C3411C; Tue, 21 Jun 2022 20:21:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842896; bh=R2gsaiV4+lhilC5q8GSyNZWsyfrFLN7guWU0VpZnndU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d4DiiQfTOvQvrX3lL2z+UfHikeDGWPyRIG5oURlBdLxkUHVKq/HW5rJ2yjBqkdYFC TNOWBr1eljjXSgQb6N1cmZhkisO/ldonM5gvg+6mgTW4TenFjnncC57yZCSbNDVK9h 0TnJQ933eV3jMjBlsBw9EmqqzQWZAKY+Vcn5dxFwlBo/w1G1iH8H1LIfkLrLsY0Grh e/PTN4P2HXfqMqjhUy2k6n+3WslYyJs8H3S+kKS2O1pSSA94us4VxjH5pqOuVIBEua odGB3wCGjNH9cxqV7Lmqsl++c/GqPaBGYGVajuc8wQu+2CsOvA8yw+PoZvIMQzFX89 kaFKjaiegexnw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 26/36] iio: light: us5182: Switch from CONFIG_PM guards to pm_ptr() etc Date: Tue, 21 Jun 2022 21:27:09 +0100 Message-Id: <20220621202719.13644-27-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards. Removing instances of this approach from IIO also stops them being copied into new drivers. Very likely it would be safe to use DEFINE_RUNTIME_DEV_PM_OPS() here, but that would be a functional change. Signed-off-by: Jonathan Cameron --- drivers/iio/light/us5182d.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index cbd9978540fa..80d2299da561 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -922,7 +922,6 @@ static int us5182d_remove(struct i2c_client *client) return 0; } -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) static int us5182d_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -945,11 +944,10 @@ static int us5182d_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops us5182d_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) - SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) + SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) + RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) }; static const struct acpi_device_id us5182d_acpi_match[] = { @@ -975,7 +973,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match); static struct i2c_driver us5182d_driver = { .driver = { .name = US5182D_DRV_NAME, - .pm = &us5182d_pm_ops, + .pm = pm_ptr(&us5182d_pm_ops), .of_match_table = us5182d_of_match, .acpi_match_table = ACPI_PTR(us5182d_acpi_match), }, From patchwork Tue Jun 21 20:27:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889747 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8277C43334 for ; Tue, 21 Jun 2022 20:21:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354288AbiFUUVt (ORCPT ); Tue, 21 Jun 2022 16:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVs (ORCPT ); Tue, 21 Jun 2022 16:21:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916B21CFCD for ; Tue, 21 Jun 2022 13:21:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3A76FB81B07 for ; Tue, 21 Jun 2022 20:21:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FD82C341C4; Tue, 21 Jun 2022 20:21:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842904; bh=HbjaOA7TS98EFXbjcc9Y6vkfsmMhGl1nN8KOKQdKBOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vx5p+mo6CVx+YPnayjVrEWI9t1bWxNS3xKxX3vxnNrvUW7VYuLq15QNuxlKLk/3DQ CHTNa+3jRUzFyXT0MsJi4mE0VDzmvxIcnq7/sVLFGsrKU2+0mDze/o8CTDpNZmRV1l KFDGtxyAZ+FTVJ8rsJonHcxTrlFAMfGDae7J2jlknsLokOx6ETYqnS+ZsArA1YgtwP qEizP9zJVGYvG8wYazph+Id6D7jffa991yf1Ea9xDmOlOWcWBXfPG9iNvb7djuqZrO LymOeSfSkHJP+akHfhq1hYEeYBEOJXAYLsuwoFrWejg4F4ow661c5EguprT4QEuj8R c6D03aa9htjFg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 27/36] iio: adc: imx8qxp: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Date: Tue, 21 Jun 2022 21:27:10 +0100 Message-Id: <20220621202719.13644-28-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Switching to these newer macros allows the compiler to remove the unused functions and struct dev_pm_ops if !CONFIG_PM without the need to mark anything __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Cai Huoqing Reviewed-by: Haibo Chen --- drivers/iio/adc/imx8qxp-adc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/imx8qxp-adc.c b/drivers/iio/adc/imx8qxp-adc.c index e8c9a69e10eb..e48446784a0a 100644 --- a/drivers/iio/adc/imx8qxp-adc.c +++ b/drivers/iio/adc/imx8qxp-adc.c @@ -417,7 +417,7 @@ static int imx8qxp_adc_remove(struct platform_device *pdev) return 0; } -static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev) +static int imx8qxp_adc_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -431,7 +431,7 @@ static __maybe_unused int imx8qxp_adc_runtime_suspend(struct device *dev) return 0; } -static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev) +static int imx8qxp_adc_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct imx8qxp_adc *adc = iio_priv(indio_dev); @@ -468,10 +468,9 @@ static __maybe_unused int imx8qxp_adc_runtime_resume(struct device *dev) return ret; } -static const struct dev_pm_ops imx8qxp_adc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(imx8qxp_adc_runtime_suspend, imx8qxp_adc_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(imx8qxp_adc_pm_ops, + imx8qxp_adc_runtime_suspend, + imx8qxp_adc_runtime_resume, NULL); static const struct of_device_id imx8qxp_adc_match[] = { { .compatible = "nxp,imx8qxp-adc", }, @@ -485,7 +484,7 @@ static struct platform_driver imx8qxp_adc_driver = { .driver = { .name = ADC_DRIVER_NAME, .of_match_table = imx8qxp_adc_match, - .pm = &imx8qxp_adc_pm_ops, + .pm = pm_ptr(&imx8qxp_adc_pm_ops), }, }; From patchwork Tue Jun 21 20:27:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889748 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63503C433EF for ; Tue, 21 Jun 2022 20:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354299AbiFUUVz (ORCPT ); Tue, 21 Jun 2022 16:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVy (ORCPT ); Tue, 21 Jun 2022 16:21:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348BF2613C for ; Tue, 21 Jun 2022 13:21:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C519A6181D for ; Tue, 21 Jun 2022 20:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75E86C3411C; Tue, 21 Jun 2022 20:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842913; bh=eyyNvKFjiVDcdums7UNe2lOc28lwGs3At/OB42tTvyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mex9QNGTPEv7yZSR6xycGIrTeXtjc14WzDIhuSkx0jmw5+ZCLexgvKY8xD+hIq942 D6H8sOshRlwoHaIGZ/HuOhBQU7uf1bGfIPjzIDLO/x0g5Ht4wjgzrd17ytyq2ZAv2s Mi6jplzrx6D13IXlPBgpxDVJtFbmgt0U2EY1sTW93FQQmx2oJ1givQDrcOWz1XafYm T+zkwg54o9u4CUAADHWf7Ye3LIKyB0XkOg/ZrVEYSSnzQ3xTObL4UKuTY2czEttjWy ZJZFdT1lsGrRZGgWBs+3j6ZaVoi+yW98iuNENZyWXHID34EIk4DDCRdO/yGY54/NOu SteKYjpYKa/BA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 28/36] iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Date: Tue, 21 Jun 2022 21:27:11 +0100 Message-Id: <20220621202719.13644-29-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Switching to these newer macros allows use of pm_ptr() to remove the unused functions and structure if !CONFIG_PM without the need to mark anything __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Linus Walleij --- drivers/iio/light/gp2ap002.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c index c6d1d88d3775..e2707416f9a8 100644 --- a/drivers/iio/light/gp2ap002.c +++ b/drivers/iio/light/gp2ap002.c @@ -635,7 +635,7 @@ static int gp2ap002_remove(struct i2c_client *client) return 0; } -static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev) +static int gp2ap002_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); @@ -660,7 +660,7 @@ static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused gp2ap002_runtime_resume(struct device *dev) +static int gp2ap002_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); @@ -691,12 +691,8 @@ static int __maybe_unused gp2ap002_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops gp2ap002_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(gp2ap002_runtime_suspend, - gp2ap002_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(gp2ap002_dev_pm_ops, gp2ap002_runtime_suspend, + gp2ap002_runtime_resume, NULL); static const struct i2c_device_id gp2ap002_id_table[] = { { "gp2ap002", 0 }, @@ -715,7 +711,7 @@ static struct i2c_driver gp2ap002_driver = { .driver = { .name = "gp2ap002", .of_match_table = gp2ap002_of_match, - .pm = &gp2ap002_dev_pm_ops, + .pm = pm_ptr(&gp2ap002_dev_pm_ops), }, .probe = gp2ap002_probe, .remove = gp2ap002_remove, From patchwork Tue Jun 21 20:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889749 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3532AC433EF for ; Tue, 21 Jun 2022 20:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354305AbiFUUWE (ORCPT ); Tue, 21 Jun 2022 16:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUWD (ORCPT ); Tue, 21 Jun 2022 16:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829F01CFCD for ; Tue, 21 Jun 2022 13:22:02 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 016ED617AE for ; Tue, 21 Jun 2022 20:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E24DC341C4; Tue, 21 Jun 2022 20:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842921; bh=6CfOHPjWtsduNbXiKm+frnZBd7PJXxCS2DRjVgLx6B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjvjZVdmoUHl18B13B0h2pv1U4X9LxtILFkDvP5kyhoe9l4rwBfv+K+XnXTGBpd58 LT0BibWnkcGcY3TIgb8pJs1B4E3E5mcj+6sQXv+Xd1ZlGcfgoAqXDVHnPgXIl2BWcq 0eWRQjiHqD/bMD9JpnlawWMOt4cBzWCMdvytohDKKvCfFqXZStwGDg9JSVMt9+4y2D TsAzjcN2e/o/YwVRiSjuec8BKiczxzQ1JO5KRORDm3PN5mr4PPzyK745seXaw+Bp2G kwjCsDrfzRDz6N1WPV8TJwB5RSArWoVmOs7vdiPTbMFHUzJZrnnuqGpw3N5hz6Pktl 4zrzLnYMZhRNw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Date: Tue, 21 Jun 2022 21:27:12 +0100 Message-Id: <20220621202719.13644-30-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows removal of unused pm_ops structure and functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Brian Masney Reviewed-by: Brian Masney --- drivers/iio/light/isl29028.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c index 720fa83d44e0..4dde9707a52d 100644 --- a/drivers/iio/light/isl29028.c +++ b/drivers/iio/light/isl29028.c @@ -651,7 +651,7 @@ static int isl29028_remove(struct i2c_client *client) return 0; } -static int __maybe_unused isl29028_suspend(struct device *dev) +static int isl29028_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct isl29028_chip *chip = iio_priv(indio_dev); @@ -666,7 +666,7 @@ static int __maybe_unused isl29028_suspend(struct device *dev) return ret; } -static int __maybe_unused isl29028_resume(struct device *dev) +static int isl29028_resume(struct device *dev) { /** * The specific component (ALS/IR or proximity) will enable itself as @@ -676,11 +676,8 @@ static int __maybe_unused isl29028_resume(struct device *dev) return 0; } -static const struct dev_pm_ops isl29028_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend, + isl29028_resume, NULL); static const struct i2c_device_id isl29028_id[] = { {"isl29028", 0}, @@ -700,7 +697,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match); static struct i2c_driver isl29028_driver = { .driver = { .name = "isl29028", - .pm = &isl29028_pm_ops, + .pm = pm_ptr(&isl29028_pm_ops), .of_match_table = isl29028_of_match, }, .probe = isl29028_probe, From patchwork Tue Jun 21 20:27:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889750 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 288FEC433EF for ; Tue, 21 Jun 2022 20:22:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354270AbiFUUWN (ORCPT ); Tue, 21 Jun 2022 16:22:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354304AbiFUUWM (ORCPT ); Tue, 21 Jun 2022 16:22:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF6EA27B16 for ; Tue, 21 Jun 2022 13:22:10 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7C35E617AE for ; Tue, 21 Jun 2022 20:22:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id ECA8BC341C6; Tue, 21 Jun 2022 20:22:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842929; bh=DurTFcAz+aKG9GC5xupIAdPFyUQLGiRXw9+d7Z8M9i8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XtMQxP+y6ZOJaPnGnI6itGrtPYDoG/SC/Ddih831CZVJn3H1GqhK7TVHuKNOvSpMO QmxxsjSJepwjwFbOEZtAL48hYeFkXrVVOThoYiBJWztJ+L3Y2yYfqb2nnokSq1XS/s 9FzF9sw+TZx2FZh4Z/LUy76lLRwUhs9Tp4SR7dawuIg8wSna7BVJxG9bqs8tO5+u// Ml6GRAFsJEebIaV2Q/Ks6kj20Ji1ftAzeqAOiEiorIU3GVLqabiCU4tsv7EdLOHVQL 1ibOdLXfbmBHYKjDDMIRKBiNoI+NOdj+7IbP2UbeGgfZUZsaYpAX/+wiCZ61WpN7cf mUOLAq3jIlPdA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 30/36] iio: light: tsl2583: Use DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Date: Tue, 21 Jun 2022 21:27:13 +0100 Message-Id: <20220621202719.13644-31-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows removal of unused pm_ops structure and functions if !CONFIG_PM without the need to mark the function __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Brian Masney Reviewed-by: Brian Masney --- drivers/iio/light/tsl2583.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/tsl2583.c b/drivers/iio/light/tsl2583.c index efb3c13cfc87..82662dab87c0 100644 --- a/drivers/iio/light/tsl2583.c +++ b/drivers/iio/light/tsl2583.c @@ -888,7 +888,7 @@ static int tsl2583_remove(struct i2c_client *client) return 0; } -static int __maybe_unused tsl2583_suspend(struct device *dev) +static int tsl2583_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -903,7 +903,7 @@ static int __maybe_unused tsl2583_suspend(struct device *dev) return ret; } -static int __maybe_unused tsl2583_resume(struct device *dev) +static int tsl2583_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2583_chip *chip = iio_priv(indio_dev); @@ -918,11 +918,8 @@ static int __maybe_unused tsl2583_resume(struct device *dev) return ret; } -static const struct dev_pm_ops tsl2583_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(tsl2583_suspend, tsl2583_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(tsl2583_pm_ops, tsl2583_suspend, + tsl2583_resume, NULL); static const struct i2c_device_id tsl2583_idtable[] = { { "tsl2580", 0 }, @@ -944,7 +941,7 @@ MODULE_DEVICE_TABLE(of, tsl2583_of_match); static struct i2c_driver tsl2583_driver = { .driver = { .name = "tsl2583", - .pm = &tsl2583_pm_ops, + .pm = pm_ptr(&tsl2583_pm_ops), .of_match_table = tsl2583_of_match, }, .id_table = tsl2583_idtable, From patchwork Tue Jun 21 20:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889751 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DAFAC43334 for ; Tue, 21 Jun 2022 20:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354304AbiFUUWV (ORCPT ); Tue, 21 Jun 2022 16:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354306AbiFUUWU (ORCPT ); Tue, 21 Jun 2022 16:22:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE2F2613C for ; Tue, 21 Jun 2022 13:22:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3219A6181B for ; Tue, 21 Jun 2022 20:22:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B4C3C3411C; Tue, 21 Jun 2022 20:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842938; bh=eDSa5XRmRtAbQwRlcco6kCxP436UXxhfOsvBV70Btts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHN9LWCR1mJIJ6boV4qSh2ZhMYZXQ7Y2oDt9GdO3L4Ty+P5jqfdoy32CeXa4Xi9YF Qb6G/UDdOG2MfDYkmCy/y98BdsBmlaMd+Jd3TG159MIZbJyRom4pK8Zyvvv4blvZsZ xslIi5un72O/gFEO8420SlEOPMZXm5/MdQZmQSpsVXwPSuHIQzoc2ZqsNs+2g5Rn7S QPxjJMF3TbSZnybNdThdS0qKxRcXBDdvaJs8oPI0IPLOeXPcNltUer6s0jRyzSVYDd Y9iZu1+x2fjE/Ie4p3AOOUeQD39dciF757KwqEmi1sy5wfEk8v5L+MGRNgoTcz2NGZ XxR2w5mwfD/Fg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Date: Tue, 21 Jun 2022 21:27:14 +0100 Message-Id: <20220621202719.13644-32-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows removal of unused pm_ops structure and functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Joe Sandom --- drivers/iio/light/tsl2591.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c index 39e68d0c9d6a..e485a556e6da 100644 --- a/drivers/iio/light/tsl2591.c +++ b/drivers/iio/light/tsl2591.c @@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = { .read_avail = tsl2591_read_available, }; -static int __maybe_unused tsl2591_suspend(struct device *dev) +static int tsl2591_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct tsl2591_chip *chip = iio_priv(indio_dev); @@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev) return ret; } -static int __maybe_unused tsl2591_resume(struct device *dev) +static int tsl2591_resume(struct device *dev) { int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS; struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev) return ret; } -static const struct dev_pm_ops tsl2591_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend, + tsl2591_resume, NULL); static irqreturn_t tsl2591_event_handler(int irq, void *private) { @@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match); static struct i2c_driver tsl2591_driver = { .driver = { .name = "tsl2591", - .pm = &tsl2591_pm_ops, + .pm = pm_ptr(&tsl2591_pm_ops), .of_match_table = tsl2591_of_match, }, .probe_new = tsl2591_probe From patchwork Tue Jun 21 20:27:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889752 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B797DC43334 for ; Tue, 21 Jun 2022 20:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354307AbiFUUWa (ORCPT ); Tue, 21 Jun 2022 16:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354306AbiFUUW3 (ORCPT ); Tue, 21 Jun 2022 16:22:29 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB8D92613C for ; Tue, 21 Jun 2022 13:22:28 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 52B8A61830 for ; Tue, 21 Jun 2022 20:22:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 29EA0C341C4; Tue, 21 Jun 2022 20:22:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842947; bh=Leby3RQp5/W7wO9DRLmW+m06zCVbu4XKWtNpbfXEqi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CQhVUWG3DADZx3KVpRwrkxl3qazNgIS+jEYUN9sFFbDCOFbaZormaI1SSB8lUhqi6 Vy8Xyj6hBEN4rXy+frKdeYfyFF2N+9dEgNF2heYOvztv1UDebr9xAqcWjivMcHkoe2 QueCICEdgjWhehpjAXByr0UWR29TU9H6Lry3MgvSe86J2T0GpRyGeRV9cKKFGnk6VM 7enJEKok3+fzFR33ZcSRy1CYbDXABRw2WyZtmbiGfuU3nkFagf0q3Ncs9jGrh3/PLg VyWl0Gbs34HmZz8HrV676Ah13MDOu9e6nfv2Cms25IBenT86z0dtHZcpSm4NMjWuQX 0QQr8IluWU2Jg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 32/36] iio: light: vcnl4000: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:15 +0100 Message-Id: <20220621202719.13644-33-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Mathieu Othacehe --- drivers/iio/light/vcnl4000.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c index 947a41b86173..3db4e26731bb 100644 --- a/drivers/iio/light/vcnl4000.c +++ b/drivers/iio/light/vcnl4000.c @@ -1130,7 +1130,7 @@ static int vcnl4000_remove(struct i2c_client *client) return 0; } -static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev) +static int vcnl4000_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct vcnl4000_data *data = iio_priv(indio_dev); @@ -1138,7 +1138,7 @@ static int __maybe_unused vcnl4000_runtime_suspend(struct device *dev) return data->chip_spec->set_power_state(data, false); } -static int __maybe_unused vcnl4000_runtime_resume(struct device *dev) +static int vcnl4000_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct vcnl4000_data *data = iio_priv(indio_dev); @@ -1146,17 +1146,13 @@ static int __maybe_unused vcnl4000_runtime_resume(struct device *dev) return data->chip_spec->set_power_state(data, true); } -static const struct dev_pm_ops vcnl4000_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(vcnl4000_runtime_suspend, - vcnl4000_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4000_pm_ops, vcnl4000_runtime_suspend, + vcnl4000_runtime_resume, NULL); static struct i2c_driver vcnl4000_driver = { .driver = { .name = VCNL4000_DRV_NAME, - .pm = &vcnl4000_pm_ops, + .pm = pm_ptr(&vcnl4000_pm_ops), .of_match_table = vcnl_4000_of_match, }, .probe = vcnl4000_probe, From patchwork Tue Jun 21 20:27:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889753 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9272C433EF for ; Tue, 21 Jun 2022 20:22:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354306AbiFUUWj (ORCPT ); Tue, 21 Jun 2022 16:22:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354309AbiFUUWi (ORCPT ); Tue, 21 Jun 2022 16:22:38 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EC8D2613C for ; Tue, 21 Jun 2022 13:22:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id E03BA6181A for ; Tue, 21 Jun 2022 20:22:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 451C1C3411C; Tue, 21 Jun 2022 20:22:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842956; bh=W5reXVlBEQcF6oJ9QPZZfZVEedvFlWgvB9x4Shy2aH4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y2JRbS4Y6GpwMFzJHgIPk4XklqcHzSrasCsIceptLaQyJboa0XMuCl1cv4bKrSnP6 UXJZoNeQOZkoOLS7qpyyEPtPThnVgv+dwUrYVGV9XM4QuQejSoyqNosh7A03FIC+Ul FguZQvjaP8KpGG/eW2i/7bCqsrAO8bzIGem3jPRrUQxS961b7ntn3RiLLWnPG0E3PU dVxyEmR46+Psj0bvdLCragLtXFnxRePx1gaRYvGtGelZnpYOS1HBed/T+ckQeR1G9k o0mTPULyZJbFRNuKlx0rJ0tEwJWQA57dW+NBAnBkE9G9z5VqF8WYKh4cqMSM/3VGBx 7nkUWj9NZEafQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 33/36] iio: light: vcnl4035: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:16 +0100 Message-Id: <20220621202719.13644-34-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Parthiban Nallathambi --- drivers/iio/light/vcnl4035.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/vcnl4035.c b/drivers/iio/light/vcnl4035.c index 2aaec6bef64c..6a196cf2270b 100644 --- a/drivers/iio/light/vcnl4035.c +++ b/drivers/iio/light/vcnl4035.c @@ -620,7 +620,7 @@ static int vcnl4035_remove(struct i2c_client *client) return 0; } -static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev) +static int vcnl4035_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct vcnl4035_data *data = iio_priv(indio_dev); @@ -632,7 +632,7 @@ static int __maybe_unused vcnl4035_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused vcnl4035_runtime_resume(struct device *dev) +static int vcnl4035_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct vcnl4035_data *data = iio_priv(indio_dev); @@ -649,12 +649,8 @@ static int __maybe_unused vcnl4035_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops vcnl4035_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(vcnl4035_runtime_suspend, - vcnl4035_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(vcnl4035_pm_ops, vcnl4035_runtime_suspend, + vcnl4035_runtime_resume, NULL); static const struct i2c_device_id vcnl4035_id[] = { { "vcnl4035", 0 }, @@ -671,7 +667,7 @@ MODULE_DEVICE_TABLE(of, vcnl4035_of_match); static struct i2c_driver vcnl4035_driver = { .driver = { .name = VCNL4035_DRV_NAME, - .pm = &vcnl4035_pm_ops, + .pm = pm_ptr(&vcnl4035_pm_ops), .of_match_table = vcnl4035_of_match, }, .probe = vcnl4035_probe, From patchwork Tue Jun 21 20:27:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889754 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5288CC43334 for ; Tue, 21 Jun 2022 20:22:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354309AbiFUUWt (ORCPT ); Tue, 21 Jun 2022 16:22:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354308AbiFUUWs (ORCPT ); Tue, 21 Jun 2022 16:22:48 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 786271D31D for ; Tue, 21 Jun 2022 13:22:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 3D873B81B29 for ; Tue, 21 Jun 2022 20:22:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D8B22C341C4; Tue, 21 Jun 2022 20:22:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842965; bh=COIyJOlHk9/1x6wIq5rsVEGuj4vS01Dpz0i1T3e9PCc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NHQ+QkoCxOH0TdQEiMve7X7uMR53rGahg8Q/KODYLkilrlPz7UvnBKWFYEXFNTqem yXl7FwiPpvTrhSb586RLaNP2rpZhHzzwyagrMyRSwtJNzhHDSt4oRemtgjDoBcLk4D wii93kIQStFbo14GCOZUiN6mC84mKz29ii220MwChL+E31VRv26CMYXPXb8kqG+oy3 N6wO04PBa4R1fy3aR5JABu7c2QKjSWSos9Yn7Fo7dc3vJsA1DMQh/6roz7aLdMGnow s/f3nyOejVciGDTx5WhI6TgMMD4q2fueXtoxNIabhMDlO8//YLNim4QFKHFf9TpqNl U4ZLA8DyaI7NQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 34/36] iio: light: veml6030: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:17 +0100 Message-Id: <20220621202719.13644-35-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Rishi Gupta Reviewed-by: Rishi Gupta --- drivers/iio/light/veml6030.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/veml6030.c b/drivers/iio/light/veml6030.c index 3c937c55a10d..9a7800cdfee2 100644 --- a/drivers/iio/light/veml6030.c +++ b/drivers/iio/light/veml6030.c @@ -846,7 +846,7 @@ static int veml6030_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -static int __maybe_unused veml6030_runtime_suspend(struct device *dev) +static int veml6030_runtime_suspend(struct device *dev) { int ret; struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -859,7 +859,7 @@ static int __maybe_unused veml6030_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused veml6030_runtime_resume(struct device *dev) +static int veml6030_runtime_resume(struct device *dev) { int ret; struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -872,12 +872,8 @@ static int __maybe_unused veml6030_runtime_resume(struct device *dev) return ret; } -static const struct dev_pm_ops veml6030_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(veml6030_runtime_suspend, - veml6030_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(veml6030_pm_ops, veml6030_runtime_suspend, + veml6030_runtime_resume, NULL); static const struct of_device_id veml6030_of_match[] = { { .compatible = "vishay,veml6030" }, @@ -895,7 +891,7 @@ static struct i2c_driver veml6030_driver = { .driver = { .name = "veml6030", .of_match_table = veml6030_of_match, - .pm = &veml6030_pm_ops, + .pm = pm_ptr(&veml6030_pm_ops), }, .probe = veml6030_probe, .id_table = veml6030_id, From patchwork Tue Jun 21 20:27:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889755 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 55764C43334 for ; Tue, 21 Jun 2022 20:23:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354308AbiFUUW7 (ORCPT ); Tue, 21 Jun 2022 16:22:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354313AbiFUUW7 (ORCPT ); Tue, 21 Jun 2022 16:22:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CEA352AA for ; Tue, 21 Jun 2022 13:22:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 69FD86182F for ; Tue, 21 Jun 2022 20:22:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9086BC3411C; Tue, 21 Jun 2022 20:22:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842973; bh=hI8/aEZ8n/BgKYfuEImgmOFroAF6FKeZhyhqgBeqE/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cmNaUZ1t9MQoVucruDtGkB0yRu3emke9OX9v/2X2QCsGXIzrUmnH4ZwPmbu85PBW5 ibdcWaHB/MaDIceiX+QIk50nAxCT3eX/ZYTTEiBn0zvjmrteWi7nzz90sPcH8tQhlH NPwIxKv9Kpu6W7Zl/tChKGK/+RtQtdUAyrq0QzhNgI+ly/uvnFS1nGr9O+EUps5SSF yu/Fsd63VnS7UWpXeoRDIjBDKAXrLw3GZiCehEWlvpemncd5/szQw+qI13Val6vMJW LblFjhibF7dN/F9joqnuIeplHPxNQyzgP0zpdZbBHnHQFgjw3eDcirthNLet77A1RE 41lwx+X1oRazg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 35/36] iio: magnetometer: ak8974: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:18 +0100 Message-Id: <20220621202719.13644-36-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Linus Walleij --- drivers/iio/magnetometer/ak8974.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c index e54feacfb980..c89a91db0690 100644 --- a/drivers/iio/magnetometer/ak8974.c +++ b/drivers/iio/magnetometer/ak8974.c @@ -985,7 +985,7 @@ static int ak8974_remove(struct i2c_client *i2c) return 0; } -static int __maybe_unused ak8974_runtime_suspend(struct device *dev) +static int ak8974_runtime_suspend(struct device *dev) { struct ak8974 *ak8974 = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); @@ -996,7 +996,7 @@ static int __maybe_unused ak8974_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused ak8974_runtime_resume(struct device *dev) +static int ak8974_runtime_resume(struct device *dev) { struct ak8974 *ak8974 = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); @@ -1024,12 +1024,8 @@ static int __maybe_unused ak8974_runtime_resume(struct device *dev) return ret; } -static const struct dev_pm_ops ak8974_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(ak8974_runtime_suspend, - ak8974_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(ak8974_dev_pm_ops, ak8974_runtime_suspend, + ak8974_runtime_resume, NULL); static const struct i2c_device_id ak8974_id[] = { {"ami305", 0 }, @@ -1050,7 +1046,7 @@ MODULE_DEVICE_TABLE(of, ak8974_of_match); static struct i2c_driver ak8974_driver = { .driver = { .name = "ak8974", - .pm = &ak8974_dev_pm_ops, + .pm = pm_ptr(&ak8974_dev_pm_ops), .of_match_table = ak8974_of_match, }, .probe = ak8974_probe, From patchwork Tue Jun 21 20:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889756 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BAA6CC433EF for ; Tue, 21 Jun 2022 20:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354311AbiFUUXH (ORCPT ); Tue, 21 Jun 2022 16:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354312AbiFUUXG (ORCPT ); Tue, 21 Jun 2022 16:23:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1214721B5 for ; Tue, 21 Jun 2022 13:23:04 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A40CAB81B25 for ; Tue, 21 Jun 2022 20:23:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D75FC341C4; Tue, 21 Jun 2022 20:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842982; bh=Xa+cNxq53JCyAe2uR5kr94H6h1cVP2ioi28+JW89J14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yin20njpo1FD7EK4jO7Dc2Z64sUkmu9rWgnkMKmf6xc/8bfPh0XC8CQNx7W5VWG+z LioIMN9FUMb+ElLBZ4FL6KVfakeZcDq/sn9zGwiE2Q/m0V0FUPqeEB1VDitQcv0tqS jxk5fXb35qqcH/ag+dAaLWK2oAm+O3q8yWHSN6zm51oyjSymS9IDahJAxXaJpGYDNR gxaZ4Z2HpCXJnNUNEuaK8st67NWAxkc3ht4GiDSp6KC5pgUcWsj8/AF7rveJv5znT8 N6ska4ma696w6rFqWDFnE6fIn2bZMXryXhLC2SRYs4Kmv1wXl1+QKGvP8ZggDfN/cd VrZkmrzg3jFdw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 36/36] iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:19 +0100 Message-Id: <20220621202719.13644-37-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Linus Walleij --- drivers/iio/magnetometer/yamaha-yas530.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c index 9ff7b0e56cf6..e1f88e9bac38 100644 --- a/drivers/iio/magnetometer/yamaha-yas530.c +++ b/drivers/iio/magnetometer/yamaha-yas530.c @@ -965,7 +965,7 @@ static int yas5xx_remove(struct i2c_client *i2c) return 0; } -static int __maybe_unused yas5xx_runtime_suspend(struct device *dev) +static int yas5xx_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct yas5xx *yas5xx = iio_priv(indio_dev); @@ -976,7 +976,7 @@ static int __maybe_unused yas5xx_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused yas5xx_runtime_resume(struct device *dev) +static int yas5xx_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct yas5xx *yas5xx = iio_priv(indio_dev); @@ -1011,12 +1011,8 @@ static int __maybe_unused yas5xx_runtime_resume(struct device *dev) return ret; } -static const struct dev_pm_ops yas5xx_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(yas5xx_runtime_suspend, - yas5xx_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend, + yas5xx_runtime_resume, NULL); static const struct i2c_device_id yas5xx_id[] = { {"yas530", }, @@ -1038,7 +1034,7 @@ static struct i2c_driver yas5xx_driver = { .driver = { .name = "yas5xx", .of_match_table = yas5xx_of_match, - .pm = &yas5xx_dev_pm_ops, + .pm = pm_ptr(&yas5xx_dev_pm_ops), }, .probe = yas5xx_probe, .remove = yas5xx_remove,