From patchwork Sun Aug 7 18:56: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: 12938233 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 0A939C19F2A for ; Sun, 7 Aug 2022 18:46:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235601AbiHGSqL (ORCPT ); Sun, 7 Aug 2022 14:46:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiHGSqJ (ORCPT ); Sun, 7 Aug 2022 14:46:09 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 294F57671 for ; Sun, 7 Aug 2022 11:46: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 CBE5FB80DCF for ; Sun, 7 Aug 2022 18:46:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1BD9DC433D7; Sun, 7 Aug 2022 18:46:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897965; bh=FyaYCXTTx6pNWOhuBnlVDQC2D+JDuYQRCigKmAA/ACM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=otYoqcDfQ2LHrTPkNg+2Yc7Zhwcilb0AxTtgfQLadACpv8QcoIP1PqdhFgBr05wnc RA0j/+kyGw0twtKr2Gc0zumdNI+iL7DNDoJxS6FLKqytgBazEFSDOj1o5AtRv6ZJcp I16SpGfWpwnLxb2EhcNH4JtSZnzTa42Fk45XiCbH2zqa7mvJlGwQ8mIbLphIdOgq55 ErE9bTQr7J1Yvi4g6rbdt2b5lG7jQoqpfcchp9KiO71zu/qo/l+41uqOL6IRN1ZdDo mbxXnRrvGzikX4FHWi7HLieTiOqt+L53/QrU34O4RZO2Qy6Pe758dyP58Ee33cntUR nhI777uIcfMqQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 1/6] iio: proximity: sx9310: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Sun, 7 Aug 2022 19:56:13 +0100 Message-Id: <20220807185618.1038812-2-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron These new macros avoid the need for marking the callbacks __maybe_unused whilst ensuring both callbacks and structure may be dropped by the compiler if CONFIG_PM_SLEEP is not enabled. Signed-off-by: Jonathan Cameron Cc: Gwendal Grignou --- drivers/iio/proximity/sx9310.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/proximity/sx9310.c b/drivers/iio/proximity/sx9310.c index ea7318b508ea..0e4747ccd3cf 100644 --- a/drivers/iio/proximity/sx9310.c +++ b/drivers/iio/proximity/sx9310.c @@ -965,7 +965,7 @@ static int sx9310_probe(struct i2c_client *client) return sx_common_probe(client, &sx9310_chip_info, &sx9310_regmap_config); } -static int __maybe_unused sx9310_suspend(struct device *dev) +static int sx9310_suspend(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); u8 ctrl0; @@ -991,7 +991,7 @@ static int __maybe_unused sx9310_suspend(struct device *dev) return ret; } -static int __maybe_unused sx9310_resume(struct device *dev) +static int sx9310_resume(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); int ret; @@ -1013,7 +1013,7 @@ static int __maybe_unused sx9310_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(sx9310_pm_ops, sx9310_suspend, sx9310_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sx9310_pm_ops, sx9310_suspend, sx9310_resume); static const struct acpi_device_id sx9310_acpi_match[] = { { "STH9310", SX9310_WHOAMI_VALUE }, @@ -1041,7 +1041,7 @@ static struct i2c_driver sx9310_driver = { .name = "sx9310", .acpi_match_table = sx9310_acpi_match, .of_match_table = sx9310_of_match, - .pm = &sx9310_pm_ops, + .pm = pm_sleep_ptr(&sx9310_pm_ops), /* * Lots of i2c transfers in probe + over 200 ms waiting in From patchwork Sun Aug 7 18:56: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: 12938234 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 8180EC25B08 for ; Sun, 7 Aug 2022 18:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232582AbiHGSqN (ORCPT ); Sun, 7 Aug 2022 14:46:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235634AbiHGSqM (ORCPT ); Sun, 7 Aug 2022 14:46:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4373D9591 for ; Sun, 7 Aug 2022 11:46:11 -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 EA0F1B80DD0 for ; Sun, 7 Aug 2022 18:46:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 148B2C433C1; Sun, 7 Aug 2022 18:46:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897968; bh=+ryTB9MQAplWrOUsr/aqEnqdFOa9zCg5+5NEfsjqxbs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/+UAVAxyQh91eojsbKJuUzAfZGJpfjjrTyinU6vehP5rdpKKnAvhXjX++uBEOznl rf61WNNtRiJZ/N/8KYH38fHvm09VR8uLkHeGr98ML5l4fuNkD4pBkGhWdgvZtfl+mM DMnqFM2pTfoiFy1aOm+3HKz+5gR57cjmcjSLJk0980evFtxEaXtes/nqPBpsFoaTvy H3l40dUrdBE3/4s88x7t6uWgSNmKTRbDh/rnnQsZ/gK9O/3HKFaSiBK6KG2GZItiQ0 QVnREwMz5nwoYKajUqw1b2f3QkEregFK2wOhFyR/KWWCBCa47A1zbjZmznzKqqxl/i 12nYIY2tZXcvg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 2/6] iio: proximity: sx9324: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Sun, 7 Aug 2022 19:56:14 +0100 Message-Id: <20220807185618.1038812-3-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron These new macros avoid the need for marking the callbacks __maybe_unused whilst ensuring both callbacks and structure may be dropped by the compiler if CONFIG_PM_SLEEP is not enabled. Signed-off-by: Jonathan Cameron Cc: Gwendal Grignou --- drivers/iio/proximity/sx9324.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/proximity/sx9324.c b/drivers/iio/proximity/sx9324.c index edb5a2ce4e27..977cf17cec52 100644 --- a/drivers/iio/proximity/sx9324.c +++ b/drivers/iio/proximity/sx9324.c @@ -1073,7 +1073,7 @@ static int sx9324_probe(struct i2c_client *client) return sx_common_probe(client, &sx9324_chip_info, &sx9324_regmap_config); } -static int __maybe_unused sx9324_suspend(struct device *dev) +static int sx9324_suspend(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); unsigned int regval; @@ -1098,7 +1098,7 @@ static int __maybe_unused sx9324_suspend(struct device *dev) return ret; } -static int __maybe_unused sx9324_resume(struct device *dev) +static int sx9324_resume(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); int ret; @@ -1114,7 +1114,7 @@ static int __maybe_unused sx9324_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(sx9324_pm_ops, sx9324_suspend, sx9324_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sx9324_pm_ops, sx9324_suspend, sx9324_resume); static const struct acpi_device_id sx9324_acpi_match[] = { { "STH9324", SX9324_WHOAMI_VALUE }, @@ -1139,7 +1139,7 @@ static struct i2c_driver sx9324_driver = { .name = "sx9324", .acpi_match_table = sx9324_acpi_match, .of_match_table = sx9324_of_match, - .pm = &sx9324_pm_ops, + .pm = pm_sleep_ptr(&sx9324_pm_ops), /* * Lots of i2c transfers in probe + over 200 ms waiting in From patchwork Sun Aug 7 18:56: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: 12938235 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 8C051C19F2A for ; Sun, 7 Aug 2022 18:46:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231853AbiHGSqP (ORCPT ); Sun, 7 Aug 2022 14:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235603AbiHGSqP (ORCPT ); Sun, 7 Aug 2022 14:46:15 -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 3F7C765F3 for ; Sun, 7 Aug 2022 11:46:14 -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 EA95EB80DD0 for ; Sun, 7 Aug 2022 18:46:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D303C433B5; Sun, 7 Aug 2022 18:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897971; bh=VxC4Z2wVSbKteM6WBCSLw+7FQQcD4ALIS+uI0ALLZP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kb0wEwRnnS+auq8NG9rqoHOkT5jSqMNsCFWK1xGobNVpxBPGLWcoaKK5yEihm4gIm pL+YBiFUKONnU9OACugWUp6QqGfC6gsXEb3iH/r6UJ9HkWyM2mN6uUn1gavO7F8mmV XANX9Zl1L+125cdaapBpjkT6MTZRFFaZYacHpWDsW5RRhA8nQ/a97KFFFMcJOt7Rim wuluWr9F5+6V7twXFPyuOzP+TOw39rj1f0yLIxVfPWmdJmTEzq5Q6m7xkEkNx3X8gf f4bpSi+S367pd3lilaxP4gJQOhmm5UwwdgeXmlY7UGB1RwUsnFtwEqglgJC+opnvfU 766Fnt2ggKexQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 3/6] iio: proximity: sx9360: Switch to DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() Date: Sun, 7 Aug 2022 19:56:15 +0100 Message-Id: <20220807185618.1038812-4-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron These new macros avoid the need for marking the callbacks __maybe_unused whilst ensuring both callbacks and structure may be dropped by the compiler if CONFIG_PM_SLEEP is not enabled. Signed-off-by: Jonathan Cameron Cc: Gwendal Grignou --- drivers/iio/proximity/sx9360.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/iio/proximity/sx9360.c b/drivers/iio/proximity/sx9360.c index d9a12e6be6ca..7fa2213d23ba 100644 --- a/drivers/iio/proximity/sx9360.c +++ b/drivers/iio/proximity/sx9360.c @@ -819,7 +819,7 @@ static int sx9360_probe(struct i2c_client *client) return sx_common_probe(client, &sx9360_chip_info, &sx9360_regmap_config); } -static int __maybe_unused sx9360_suspend(struct device *dev) +static int sx9360_suspend(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); unsigned int regval; @@ -844,7 +844,7 @@ static int __maybe_unused sx9360_suspend(struct device *dev) return ret; } -static int __maybe_unused sx9360_resume(struct device *dev) +static int sx9360_resume(struct device *dev) { struct sx_common_data *data = iio_priv(dev_get_drvdata(dev)); int ret; @@ -861,7 +861,7 @@ static int __maybe_unused sx9360_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(sx9360_pm_ops, sx9360_suspend, sx9360_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(sx9360_pm_ops, sx9360_suspend, sx9360_resume); static const struct acpi_device_id sx9360_acpi_match[] = { { "STH9360", SX9360_WHOAMI_VALUE }, @@ -886,7 +886,7 @@ static struct i2c_driver sx9360_driver = { .name = "sx9360", .acpi_match_table = sx9360_acpi_match, .of_match_table = sx9360_of_match, - .pm = &sx9360_pm_ops, + .pm = pm_sleep_ptr(&sx9360_pm_ops), /* * Lots of i2c transfers in probe + over 200 ms waiting in From patchwork Sun Aug 7 18:56: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: 12938236 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 09B9BC25B0C for ; Sun, 7 Aug 2022 18:46:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235603AbiHGSqT (ORCPT ); Sun, 7 Aug 2022 14:46:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiHGSqS (ORCPT ); Sun, 7 Aug 2022 14:46:18 -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 8D4E12DFB for ; Sun, 7 Aug 2022 11:46: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 4160CB80DD0 for ; Sun, 7 Aug 2022 18:46:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4AB5DC433C1; Sun, 7 Aug 2022 18:46:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897975; bh=yHxom/j6lLU4c8f8dLH2Segi9W2UPZI6Bwb0VQ3qAyA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=deXdUDIFwyIH6P6j/2+mogTyTT9icJmrkjfZfA7qOsrQIxl9m0Z6FHpO4CnyPC8pa EIa2LLfE4wQYtOfYrY8Cj15jcMt6BML1Ar2/bc4OqtKp/2I7PW8kE6pH/yHb0gxe1E tw1VQp1glNHqqtilnNGI+3b9eH2cq618OXpeGdnzIogc1b39EexbffMjBDi+cbl/68 H/KkjYVs8BvCQ9OZHeXmuvdythbjQkh2syysnkrCxBp6hclumBN4xbDlwgckh53vE5 E5hLRLSB+tG5L8JZgWaA8ayckyvAl8mK2y/T5O+RKno0h6ovZIiIvla4XnLZvlSY3t ah6FD7dczSIYA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 4/6] iio: proximity: srf04: Use pm_ptr() to remove unused struct dev_pm_ops Date: Sun, 7 Aug 2022 19:56:16 +0100 Message-Id: <20220807185618.1038812-5-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron If CONFIG_PM is not set, the pm_ptr() will ensure that the struct dev_pm_ops and callbacks are removed without the need for __maybe_unused markings. In this case we can't simply use DEFINE_RUNTIME_DEV_PM_OPS() because that would provide suspend and resume functions without the checks the driver is doing before calling runtime_pm functions (whether the necessary GPIO is provided). It may be possible to clean that up in future by moving the checks into the callbacks. Signed-off-by: Jonathan Cameron Cc: Andreas Klinger --- drivers/iio/proximity/srf04.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/proximity/srf04.c b/drivers/iio/proximity/srf04.c index 05015351a34a..faf2f806ce80 100644 --- a/drivers/iio/proximity/srf04.c +++ b/drivers/iio/proximity/srf04.c @@ -359,7 +359,7 @@ static int srf04_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused srf04_pm_runtime_suspend(struct device *dev) +static int srf04_pm_runtime_suspend(struct device *dev) { struct platform_device *pdev = container_of(dev, struct platform_device, dev); @@ -371,7 +371,7 @@ static int __maybe_unused srf04_pm_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused srf04_pm_runtime_resume(struct device *dev) +static int srf04_pm_runtime_resume(struct device *dev) { struct platform_device *pdev = container_of(dev, struct platform_device, dev); @@ -385,8 +385,8 @@ static int __maybe_unused srf04_pm_runtime_resume(struct device *dev) } static const struct dev_pm_ops srf04_pm_ops = { - SET_RUNTIME_PM_OPS(srf04_pm_runtime_suspend, - srf04_pm_runtime_resume, NULL) + RUNTIME_PM_OPS(srf04_pm_runtime_suspend, + srf04_pm_runtime_resume, NULL) }; static struct platform_driver srf04_driver = { @@ -395,7 +395,7 @@ static struct platform_driver srf04_driver = { .driver = { .name = "srf04-gpio", .of_match_table = of_srf04_match, - .pm = &srf04_pm_ops, + .pm = pm_ptr(&srf04_pm_ops), }, }; From patchwork Sun Aug 7 18:56: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: 12938237 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 E45A6C19F2A for ; Sun, 7 Aug 2022 18:46:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235623AbiHGSqW (ORCPT ); Sun, 7 Aug 2022 14:46:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235627AbiHGSqV (ORCPT ); Sun, 7 Aug 2022 14:46:21 -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 B394D5FC2 for ; Sun, 7 Aug 2022 11:46:20 -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 6CF4AB80DD2 for ; Sun, 7 Aug 2022 18:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AF472C433D7; Sun, 7 Aug 2022 18:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897978; bh=gh9dAa4lU3KGG4qIFaxrhPbXW9+x3k+g1sB469It49k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IyOg/DXc/EcDFLluFnyOZdGoYn6fL1WztDjzYFHgllIW7lea6p0WYdqRO/1yNMtC1 fet0pCraS6XQtMAudUbGmxXHT5q85clQqe8WtB67ImkF5XKFY6ha5uKJrARZXQUFgf KyLc3eiMoY070Sng7EjVuZypLEMkXS4NF8dUJVh/Pwuty34ebxLIaQ6lX59mqjT2u4 c/ft+EgnuVYSVD7vzLS0vBjR0tW+lwnsTN0mD22c/NIHlE2mzdB32gsHQDxB8c1JHP CkTKkmQE7nmBz/NXGC4qg2kS2F527CeZPbZq9635JvFADDcyYOYTtFDWX+dowlICDm GjBYa6yA26nUw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 5/6] iio: accel: bmi088: Use EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS() and pm_ptr() Date: Sun, 7 Aug 2022 19:56:17 +0100 Message-Id: <20220807185618.1038812-6-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron These macros allow the compiler to remove unused pm ops functions without needing to mark them maybe unused. Signed-off-by: Jonathan Cameron Cc: LI Qingwu Cc: Mike Looijmans --- drivers/iio/accel/bmi088-accel-core.c | 15 ++++++--------- drivers/iio/accel/bmi088-accel-spi.c | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/iio/accel/bmi088-accel-core.c b/drivers/iio/accel/bmi088-accel-core.c index bca4cf98bf4d..84edcc78d796 100644 --- a/drivers/iio/accel/bmi088-accel-core.c +++ b/drivers/iio/accel/bmi088-accel-core.c @@ -606,7 +606,7 @@ void bmi088_accel_core_remove(struct device *dev) } EXPORT_SYMBOL_NS_GPL(bmi088_accel_core_remove, IIO_BMI088); -static int __maybe_unused bmi088_accel_runtime_suspend(struct device *dev) +static int bmi088_accel_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmi088_accel_data *data = iio_priv(indio_dev); @@ -614,7 +614,7 @@ static int __maybe_unused bmi088_accel_runtime_suspend(struct device *dev) return bmi088_accel_power_down(data); } -static int __maybe_unused bmi088_accel_runtime_resume(struct device *dev) +static int bmi088_accel_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmi088_accel_data *data = iio_priv(indio_dev); @@ -622,13 +622,10 @@ static int __maybe_unused bmi088_accel_runtime_resume(struct device *dev) return bmi088_accel_power_up(data); } -const struct dev_pm_ops bmi088_accel_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(bmi088_accel_runtime_suspend, - bmi088_accel_runtime_resume, NULL) -}; -EXPORT_SYMBOL_NS_GPL(bmi088_accel_pm_ops, IIO_BMI088); +EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(bmi088_accel_pm_ops, + bmi088_accel_runtime_suspend, + bmi088_accel_runtime_resume, NULL, + IIO_BMI088); MODULE_AUTHOR("Niek van Agt "); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/accel/bmi088-accel-spi.c b/drivers/iio/accel/bmi088-accel-spi.c index 9e2ed3bd5661..ee540edd8412 100644 --- a/drivers/iio/accel/bmi088-accel-spi.c +++ b/drivers/iio/accel/bmi088-accel-spi.c @@ -80,7 +80,7 @@ MODULE_DEVICE_TABLE(spi, bmi088_accel_id); static struct spi_driver bmi088_accel_driver = { .driver = { .name = "bmi088_accel_spi", - .pm = &bmi088_accel_pm_ops, + .pm = pm_ptr(&bmi088_accel_pm_ops), .of_match_table = bmi088_of_match, }, .probe = bmi088_accel_probe, From patchwork Sun Aug 7 18:56: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: 12938238 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 84E0DC19F2A for ; Sun, 7 Aug 2022 18:46:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235634AbiHGSqY (ORCPT ); Sun, 7 Aug 2022 14:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235629AbiHGSqX (ORCPT ); Sun, 7 Aug 2022 14:46:23 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0AA2DFB for ; Sun, 7 Aug 2022 11:46: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 dfw.source.kernel.org (Postfix) with ESMTPS id 29BC160FDE for ; Sun, 7 Aug 2022 18:46:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEF21C433C1; Sun, 7 Aug 2022 18:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659897981; bh=jepvhA4Llv74Rw5TsHdRp05MgBL7VyTTBmz/OLvGXEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCLgLzYaS9WajvzD2nKBlGfcTuVA/TWtYLR7wY6lft22ck2NhrRphcw+D5m4kYtSc 8zLe59H/AtrWNYKZgCr1K1z7pmKIereEpwGZh/68HgJT95sMUofEEDMPNyZWzc8EWy 087OgFqKeui2ItbigFeylkCKO3FhyU1DmaGSaRP197hWftXM+mcGvYqVPXgnGX6Dqc lKWO+obEyGaIb8gUZ1Fn1IwYLtTV7cw6RoopaC/DuB7J2SLVa6rMlZyQSml5+3AWdu mdHrPCxLIeyO8Va1EhHOLrP7gho2mCitfTPyfH5PDVkaEV9cPflWq9kNngU4zNaucs KzF2bcLmzAViQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Gwendal Grignou , Andreas Klinger , LI Qingwu , Mike Looijmans , Lorenzo Bianconi , Jonathan Cameron Subject: [PATCH 6/6] iio: light: st_uvis25: Use EXPORT_NS_SIMPLE_DEV_PM_OPS() Date: Sun, 7 Aug 2022 19:56:18 +0100 Message-Id: <20220807185618.1038812-7-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807185618.1038812-1-jic23@kernel.org> References: <20220807185618.1038812-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using this new macro removes the need to mark the callbacks __maybe_unused. One slightly complexity in this case is that the export will exist if CONFIG_PM is set, but only be used if CONFIG_PM_SLEEP is also set. This is harmless. Signed-off-by: Jonathan Cameron Cc: Lorenzo Bianconi --- drivers/iio/light/st_uvis25_core.c | 9 +++------ drivers/iio/light/st_uvis25_i2c.c | 2 +- drivers/iio/light/st_uvis25_spi.c | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/st_uvis25_core.c b/drivers/iio/light/st_uvis25_core.c index 3d4cc1180b6a..c737d3e193ae 100644 --- a/drivers/iio/light/st_uvis25_core.c +++ b/drivers/iio/light/st_uvis25_core.c @@ -325,7 +325,7 @@ int st_uvis25_probe(struct device *dev, int irq, struct regmap *regmap) } EXPORT_SYMBOL_NS(st_uvis25_probe, IIO_UVIS25); -static int __maybe_unused st_uvis25_suspend(struct device *dev) +static int st_uvis25_suspend(struct device *dev) { struct iio_dev *iio_dev = dev_get_drvdata(dev); struct st_uvis25_hw *hw = iio_priv(iio_dev); @@ -334,7 +334,7 @@ static int __maybe_unused st_uvis25_suspend(struct device *dev) ST_UVIS25_REG_ODR_MASK, 0); } -static int __maybe_unused st_uvis25_resume(struct device *dev) +static int st_uvis25_resume(struct device *dev) { struct iio_dev *iio_dev = dev_get_drvdata(dev); struct st_uvis25_hw *hw = iio_priv(iio_dev); @@ -346,10 +346,7 @@ static int __maybe_unused st_uvis25_resume(struct device *dev) return 0; } -const struct dev_pm_ops st_uvis25_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(st_uvis25_suspend, st_uvis25_resume) -}; -EXPORT_SYMBOL_NS(st_uvis25_pm_ops, IIO_UVIS25); +EXPORT_NS_SIMPLE_DEV_PM_OPS(st_uvis25_pm_ops, st_uvis25_suspend, st_uvis25_resume, IIO_UVIS25); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_DESCRIPTION("STMicroelectronics uvis25 sensor driver"); diff --git a/drivers/iio/light/st_uvis25_i2c.c b/drivers/iio/light/st_uvis25_i2c.c index b06d09af28a3..c982b0b255cf 100644 --- a/drivers/iio/light/st_uvis25_i2c.c +++ b/drivers/iio/light/st_uvis25_i2c.c @@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(i2c, st_uvis25_i2c_id_table); static struct i2c_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_i2c", - .pm = &st_uvis25_pm_ops, + .pm = pm_sleep_ptr(&st_uvis25_pm_ops), .of_match_table = st_uvis25_i2c_of_match, }, .probe = st_uvis25_i2c_probe, diff --git a/drivers/iio/light/st_uvis25_spi.c b/drivers/iio/light/st_uvis25_spi.c index 3a4dc6d7180c..86a232320d7d 100644 --- a/drivers/iio/light/st_uvis25_spi.c +++ b/drivers/iio/light/st_uvis25_spi.c @@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(spi, st_uvis25_spi_id_table); static struct spi_driver st_uvis25_driver = { .driver = { .name = "st_uvis25_spi", - .pm = &st_uvis25_pm_ops, + .pm = pm_sleep_ptr(&st_uvis25_pm_ops), .of_match_table = st_uvis25_spi_of_match, }, .probe = st_uvis25_spi_probe,