From patchwork Sun Jan 2 12:55:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702215 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 79347C433F5 for ; Sun, 2 Jan 2022 12:50:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231651AbiABMu6 (ORCPT ); Sun, 2 Jan 2022 07:50:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMu5 (ORCPT ); Sun, 2 Jan 2022 07:50:57 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 919A4C061574 for ; Sun, 2 Jan 2022 04:50:56 -0800 (PST) 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 326BD60E9A for ; Sun, 2 Jan 2022 12:50:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7E3C36AF2; Sun, 2 Jan 2022 12:50:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127855; bh=GGLKlY71b9znJlNqlXiFzrK38BHRaq5JEPG1QTp+wf8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ryRywvqR7GNTcdNhjLOFiZWdQKWxqNnMtn0M3kwQzpbPMeYk3HXu+K5zA35Wg9kJK fujXt1Fc/ClIYYyeg+x6D0P9be3WfwyHzhCxAKXfGS1xlEz/gvu7HHA4zqenJADbj1 JI9mE4mjuoEeHOuKOpduKBPsKRUp+E3zK20P4yXAGpFYMeE8oXenF4xlee2xL8L4gW Y1Z+uAhkDvh1s19rG+Y9gYoknK6DLRJGOdlds69yjocolYUlteWPdMiNVaKu2WLzg4 FYPvUJVrKSDTk+DwuQPSSAXxFuT9gu9LPb04bJGMbTHHzteBStQpGtiJygD1+4QGKL 7bw7HwUARN4Ow== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 01/51] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:27 +0000 Message-Id: <20220102125617.1259804-2-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/da311.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/da311.c b/drivers/iio/accel/da311.c index 04e13487e706..a239ec5b5089 100644 --- a/drivers/iio/accel/da311.c +++ b/drivers/iio/accel/da311.c @@ -256,7 +256,6 @@ static int da311_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int da311_suspend(struct device *dev) { return da311_enable(to_i2c_client(dev), false); @@ -266,9 +265,8 @@ static int da311_resume(struct device *dev) { return da311_enable(to_i2c_client(dev), true); } -#endif -static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); +DEFINE_SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); static const struct i2c_device_id da311_i2c_id[] = { {"da311", 0}, @@ -279,7 +277,7 @@ MODULE_DEVICE_TABLE(i2c, da311_i2c_id); static struct i2c_driver da311_driver = { .driver = { .name = "da311", - .pm = &da311_pm_ops, + .pm = pm_sleep_ptr(&da311_pm_ops), }, .probe = da311_probe, .id_table = da311_i2c_id, From patchwork Sun Jan 2 12:55:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702216 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 000B3C433F5 for ; Sun, 2 Jan 2022 12:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232354AbiABMvA (ORCPT ); Sun, 2 Jan 2022 07:51:00 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50102 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMvA (ORCPT ); Sun, 2 Jan 2022 07:51:00 -0500 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 2FB23B80CFC for ; Sun, 2 Jan 2022 12:50:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3027AC36AEE; Sun, 2 Jan 2022 12:50:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127857; bh=CVadK/vpnpagtOE8zLmFBZnFI4hufQM28CZEH0u/Tcg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dEJCJngTceC+DVKexIAL4mbRhcdO5fDLGebb3QYgGAI3RvGDGVJAiNAzpo1k9vq7t umNcJLXFbJS9TL/g7HWOM9+Ya9Dc1xddMnJ8AxF1I43YhBjmUsIdMdI0Gw/V8IdOPr xvlShV1C9F9tBfW9ondJDMklUq5qXi2JaB3haLOMhIwue+drBr7d5ZoX+XcSuTwYrz c+g3cBBbp2Ch6vrP1WYmopaFm0KruRkgTlls4yo79zImXjhsltJvhQJrIX746zSaYv Nlg0Hb87P8SOPr6k7eQ6oo/hp71Eo/W+uAkd8esbDQkc14LiY/IFydJb1cfUaZLt3V bJmfAFcywm/Xg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 02/51] iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:28 +0000 Message-Id: <20220102125617.1259804-3-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/da280.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c index 9633bdae5fd4..10fdaaa54c40 100644 --- a/drivers/iio/accel/da280.c +++ b/drivers/iio/accel/da280.c @@ -153,7 +153,6 @@ static int da280_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int da280_suspend(struct device *dev) { return da280_enable(to_i2c_client(dev), false); @@ -163,9 +162,8 @@ static int da280_resume(struct device *dev) { return da280_enable(to_i2c_client(dev), true); } -#endif -static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); +DEFINE_SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); static const struct acpi_device_id da280_acpi_match[] = { {"MIRAACC", da280}, @@ -184,7 +182,7 @@ static struct i2c_driver da280_driver = { .driver = { .name = "da280", .acpi_match_table = ACPI_PTR(da280_acpi_match), - .pm = &da280_pm_ops, + .pm = pm_sleep_ptr(&da280_pm_ops), }, .probe = da280_probe, .id_table = da280_i2c_id, From patchwork Sun Jan 2 12:55:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702217 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 2D996C433EF for ; Sun, 2 Jan 2022 12:51:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbiABMvD (ORCPT ); Sun, 2 Jan 2022 07:51:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMvD (ORCPT ); Sun, 2 Jan 2022 07:51:03 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D36AC061574 for ; Sun, 2 Jan 2022 04:51:03 -0800 (PST) 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 CAE38B80D61 for ; Sun, 2 Jan 2022 12:51:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6DC2CC36AF0; Sun, 2 Jan 2022 12:50:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127860; bh=f0rZhwLDQvWiN8GiNtPw4ETQwa+5czed31gj7xg2GJw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VPwMw8i6eejKFo92CKhkU0+90M5Xx3V46KcQ1vg+sdMehPruU4fYBA5xV2bGmwuhm EtBAJDcceJt1rVjmjJ/FJbwS1k1VAivTY7jsrFHb+1BeJTYlnPNNWmZrPYL1r2Vq4/ mhaGazGt+rX5fDXe3xY14rP6o0FNPht7fF9NmuCXpWO+lubE1HqwvJmdEI2i/3UDnP xPZsKMKTnczRgDzqmjf9Kkm48TGCAhTFBvPV+8idMNuK7lvlK6ry7UziOzo9KMIaZo P3Dz4MDzcAOjNoTTFDVC9jcjX3SUYmjil/ENIayKbaszGnWKvKOy6ue8yCo1F25Zdr C7JEcZXFKmryg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 03/51] iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:29 +0000 Message-Id: <20220102125617.1259804-4-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/dmard06.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/dmard06.c b/drivers/iio/accel/dmard06.c index de2868c28d95..ab9cd6a5369b 100644 --- a/drivers/iio/accel/dmard06.c +++ b/drivers/iio/accel/dmard06.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -170,7 +171,6 @@ static int dmard06_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int dmard06_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -199,11 +199,7 @@ static int dmard06_resume(struct device *dev) return 0; } -static SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume); -#define DMARD06_PM_OPS (&dmard06_pm_ops) -#else -#define DMARD06_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume); static const struct i2c_device_id dmard06_id[] = { { "dmard05", 0 }, @@ -227,7 +223,7 @@ static struct i2c_driver dmard06_driver = { .driver = { .name = DMARD06_DRV_NAME, .of_match_table = dmard06_of_match, - .pm = DMARD06_PM_OPS, + .pm = pm_sleep_ptr(&dmard06_pm_ops), }, }; module_i2c_driver(dmard06_driver); From patchwork Sun Jan 2 12:55:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702218 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 4839BC433EF for ; Sun, 2 Jan 2022 12:51:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232356AbiABMvG (ORCPT ); Sun, 2 Jan 2022 07:51:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44760 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMvF (ORCPT ); Sun, 2 Jan 2022 07:51:05 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8480EC061574 for ; Sun, 2 Jan 2022 04:51:05 -0800 (PST) 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 4CED7B80D61 for ; Sun, 2 Jan 2022 12:51:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B755C36AEE; Sun, 2 Jan 2022 12:51:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127863; bh=o7lqiSwj9bEqy5RTn/pCfP4IzoQ2vcNtSOCLIJZCZpU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jTcENiGvZP1q+xowH0RkDEgy1KWFV8jftToUoT5MVsFA704lNeI8gB200r8kxDUl9 Gn7dkzoBIQGJbxx2z3qv3ZdGtLmM1lJmYTQ4pOaa7+Lt2DfKsaRULqa8ULkc7M184n JICd0tbgFzXntpzGrW99Vi4k8BLuHObMpO2CN19R5Gb2KRxCoXF66aKoDtJlJAx5UV 8AiLUDLPOlH2RgBKZNboNQBlc/yAtkuCyF5O0LmWQ+O5NkGPa9h2jMltVADsBGjzOd 7M4x+FxI9WYBcbNwZ4neK0kVH4kuiLgocRl6zvypklTqaEcnWEGVe6+2YhsZUtV+a1 YG7Xw/ULG0VKg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 04/51] iio:accel:dmard10: Switch from CONFIG_PM guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:30 +0000 Message-Id: <20220102125617.1259804-5-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/dmard10.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/dmard10.c b/drivers/iio/accel/dmard10.c index f9f173eec202..bef21aa2aeb5 100644 --- a/drivers/iio/accel/dmard10.c +++ b/drivers/iio/accel/dmard10.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -218,7 +219,6 @@ static int dmard10_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int dmard10_suspend(struct device *dev) { return dmard10_shutdown(to_i2c_client(dev)); @@ -228,9 +228,8 @@ static int dmard10_resume(struct device *dev) { return dmard10_reset(to_i2c_client(dev)); } -#endif -static SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume); +DEFINE_SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume); static const struct i2c_device_id dmard10_i2c_id[] = { {"dmard10", 0}, @@ -241,7 +240,7 @@ MODULE_DEVICE_TABLE(i2c, dmard10_i2c_id); static struct i2c_driver dmard10_driver = { .driver = { .name = "dmard10", - .pm = &dmard10_pm_ops, + .pm = pm_sleep_ptr(&dmard10_pm_ops), }, .probe = dmard10_probe, .id_table = dmard10_i2c_id, From patchwork Sun Jan 2 12:55:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702219 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 8C225C433EF for ; Sun, 2 Jan 2022 12:51:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232359AbiABMvJ (ORCPT ); Sun, 2 Jan 2022 07:51:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMvI (ORCPT ); Sun, 2 Jan 2022 07:51:08 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4DA17C061574 for ; Sun, 2 Jan 2022 04:51:08 -0800 (PST) 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 0ECB7B80D63 for ; Sun, 2 Jan 2022 12:51:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C1BFC36AE7; Sun, 2 Jan 2022 12:51:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127865; bh=J9oO+je7d9RNkd2uZILlh3K7YF6mQhwBZjNY6JmOd8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P3valWOeNb+DEmBE+ZmRPPcUm5TfvvIwVSEo0Wt78ZwLBUsPoh/UuASzKfz78sh4M 7ORAuAKd3J9Ba7M7UklRlkjou4gKYXtR288IZ9kitYxDbG9agiAeLVwr3nfXBDXlyr Z21uJm3YFy1jXKAfXeNRH6lJhB52xj5qOv1iw51UPBj9QdpplK3RgaFnAn/rRFmHod 92Fj/Wd5QK7GTOrSFuUvAuj2epBJ/ZaAQlqyMRPy+iWWkeHygk8HDYen/CMiupLqqX L0H3Lu+XfJ6oJpQu71yvfo6VqGvpZmdWd9taHGjkC8P35+e0rUnZ5uZnj0VSQ7EVi2 i6q6hJHfOBr+Q== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Hans de Goede Subject: [PATCH v2 05/51] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:31 +0000 Message-Id: <20220102125617.1259804-6-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Reviewed-by: Hans de Goede --- drivers/iio/accel/mc3230.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c index 735002b716f3..09647706756a 100644 --- a/drivers/iio/accel/mc3230.c +++ b/drivers/iio/accel/mc3230.c @@ -160,7 +160,6 @@ static int mc3230_remove(struct i2c_client *client) return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY); } -#ifdef CONFIG_PM_SLEEP static int mc3230_suspend(struct device *dev) { struct mc3230_data *data; @@ -178,9 +177,8 @@ static int mc3230_resume(struct device *dev) return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE); } -#endif -static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); +DEFINE_SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); static const struct i2c_device_id mc3230_i2c_id[] = { {"mc3230", 0}, @@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id); static struct i2c_driver mc3230_driver = { .driver = { .name = "mc3230", - .pm = &mc3230_pm_ops, + .pm = pm_sleep_ptr(&mc3230_pm_ops), }, .probe = mc3230_probe, .remove = mc3230_remove, From patchwork Sun Jan 2 12:55:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702220 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 8DBBFC433FE for ; Sun, 2 Jan 2022 12:51:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232365AbiABMvK (ORCPT ); Sun, 2 Jan 2022 07:51:10 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44778 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229658AbiABMvJ (ORCPT ); Sun, 2 Jan 2022 07:51:09 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 912F8C061574 for ; Sun, 2 Jan 2022 04:51:09 -0800 (PST) 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 1C23B60E9A for ; Sun, 2 Jan 2022 12:51:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6AD4BC36AF0; Sun, 2 Jan 2022 12:51:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127868; bh=V2zaxYNHfWbCB6anYSxNpCPTjwhmh1N7jMTHXMR8Qco=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niPZy0d5tt2nlGxA008gjGWxFiORAJYeCnaDMG/TAdCk6+2HtEVbHM0Sk1hGNAUMg I9S8RAYfr7VhxeeaSUlB2gdnip9ZpFeF0O6nZQo1l34Ht92+MHTVc+Asn4TnZN8Dxw ZXvlWz2LuJCC5NgY05SRuKpK2MUDC2w6WizHP6aOXUTaaSMOh5iv+DV0wI6PpROiFC tCTbpknGsRUQll4s1L8yWvIk3jTSN1TSH+btcqKDDBhQd/iKVabI/UWcIln8GdIwVK Z4+CZS0IRir8ZMR2+Lj5CmVC38WTdvuG9NQd0xMm1Sw4S/3ddsmb63YQzMpfF/C80q KxqFzd62+cXiA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 06/51] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sun, 2 Jan 2022 12:55:32 +0000 Message-Id: <20220102125617.1259804-7-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma7660.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c index 24b83ccdb950..0dec40ca4fd4 100644 --- a/drivers/iio/accel/mma7660.c +++ b/drivers/iio/accel/mma7660.c @@ -222,7 +222,6 @@ static int mma7660_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int mma7660_suspend(struct device *dev) { struct mma7660_data *data; @@ -241,12 +240,7 @@ static int mma7660_resume(struct device *dev) return mma7660_set_mode(data, MMA7660_MODE_ACTIVE); } -static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); - -#define MMA7660_PM_OPS (&mma7660_pm_ops) -#else -#define MMA7660_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); static const struct i2c_device_id mma7660_i2c_id[] = { {"mma7660", 0}, @@ -270,7 +264,7 @@ MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id); static struct i2c_driver mma7660_driver = { .driver = { .name = "mma7660", - .pm = MMA7660_PM_OPS, + .pm = pm_sleep_ptr(&mma7660_pm_ops), .of_match_table = mma7660_of_match, .acpi_match_table = ACPI_PTR(mma7660_acpi_id), }, From patchwork Sun Jan 2 12:55:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702221 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 6C1E6C433F5 for ; Sun, 2 Jan 2022 12:51:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229658AbiABMvP (ORCPT ); Sun, 2 Jan 2022 07:51:15 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50232 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbiABMvN (ORCPT ); Sun, 2 Jan 2022 07:51:13 -0500 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 8FB3EB80CFC for ; Sun, 2 Jan 2022 12:51:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4B599C36AF1; Sun, 2 Jan 2022 12:51:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127871; bh=LZetR1ZDWzR2JgV6qL0ug7vm2mNft1irvtNXOZ42yK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YmsgsbgLHui5lvm49PCpG95F9McJhu8CrSNYQjhVelc1bdff0XTSskWCkOeH4e16W JyAllBg2n2VSzocwxLR0uM8eUMl+JbAQFzQBbpBzwWcHarDoZ5pIogMbth+SstpKLH kGfZ7LH1LfJdjDgo3XpenI707HaMvbQXkfQBRS5YkeHw19UguLuvuf4PXcCZKkd6gT ptDnlo/2Ew0JEHJ0wos6zdG8znEui+RhHVNdbtkHJBGTIcKuxxmSyLHBtZ3LzNCGWR 3TNrk3NKBU+lkYclydlzOEVzJIs/PZL6ww/SlkumzujPSC856ckkESbk4nURrV5dRk jPwdl7VN0cwtA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 07/51] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:33 +0000 Message-Id: <20220102125617.1259804-8-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma9551.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c index 4c359fb05480..fb9c8fac5911 100644 --- a/drivers/iio/accel/mma9551.c +++ b/drivers/iio/accel/mma9551.c @@ -523,7 +523,6 @@ static int mma9551_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM static int mma9551_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -555,9 +554,7 @@ static int mma9551_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static int mma9551_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -583,12 +580,10 @@ static int mma9551_resume(struct device *dev) return ret; } -#endif static const struct dev_pm_ops mma9551_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume) - SET_RUNTIME_PM_OPS(mma9551_runtime_suspend, - mma9551_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume) + RUNTIME_PM_OPS(mma9551_runtime_suspend, mma9551_runtime_resume, NULL) }; static const struct acpi_device_id mma9551_acpi_match[] = { @@ -609,7 +604,7 @@ static struct i2c_driver mma9551_driver = { .driver = { .name = MMA9551_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9551_acpi_match), - .pm = &mma9551_pm_ops, + .pm = pm_ptr(&mma9551_pm_ops), }, .probe = mma9551_probe, .remove = mma9551_remove, From patchwork Sun Jan 2 12:55:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702222 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 A0EECC433EF for ; Sun, 2 Jan 2022 12:51:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231494AbiABMvR (ORCPT ); Sun, 2 Jan 2022 07:51:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbiABMvQ (ORCPT ); Sun, 2 Jan 2022 07:51:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C98BC061574 for ; Sun, 2 Jan 2022 04:51:16 -0800 (PST) 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 E2997B80D63 for ; Sun, 2 Jan 2022 12:51:14 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC442C36AEE; Sun, 2 Jan 2022 12:51:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127873; bh=rHMK/ACxe3+nkt7jIewrKxcZNlE5XVcXlFI1gHcyfSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DQzsUIJLdM1j/FAxslQtxsQjp/VMn1wm4tCo/8n3yk2/Gd534fFcwl5UuWINzroT0 DPBTNjMXunR5e4Vxhz3WFYhfCFn4SHJxh4Xf4irh8fmJPgqjwb6uFjauLZH6hpWfyU EhSXWQOgnsHaA2QdADdYECzGaMYwN8qXSnEIznFoF/MiCUotKB82onS++Q2aSp2XDd UOb7qQ4a4REBifOYH2FFbAB7k1Eft6uBiUuX6bIk9OFjXQ/HncVxqe7KGFH5vj7EtU EytIM7Jl4bc9R7IR/5PCiFweq8opa9W9Ui4ro26KukTDy5Xs/QGVlWg7v0AhkU0FSr KdW6ys24428Gg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 08/51] iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:34 +0000 Message-Id: <20220102125617.1259804-9-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma9553.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index 0570ab1cc064..673e5c4beefe 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -1162,7 +1162,6 @@ static int mma9553_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM static int mma9553_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -1194,9 +1193,7 @@ static int mma9553_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP static int mma9553_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -1222,12 +1219,10 @@ static int mma9553_resume(struct device *dev) return ret; } -#endif static const struct dev_pm_ops mma9553_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) - SET_RUNTIME_PM_OPS(mma9553_runtime_suspend, - mma9553_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) + RUNTIME_PM_OPS(mma9553_runtime_suspend, mma9553_runtime_resume, NULL) }; static const struct acpi_device_id mma9553_acpi_match[] = { @@ -1248,7 +1243,7 @@ static struct i2c_driver mma9553_driver = { .driver = { .name = MMA9553_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9553_acpi_match), - .pm = &mma9553_pm_ops, + .pm = pm_ptr(&mma9553_pm_ops), }, .probe = mma9553_probe, .remove = mma9553_remove, From patchwork Sun Jan 2 12:55:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702223 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 7AF4CC433F5 for ; Sun, 2 Jan 2022 12:51:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231454AbiABMvR (ORCPT ); Sun, 2 Jan 2022 07:51:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvR (ORCPT ); Sun, 2 Jan 2022 07:51:17 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EE21C061574 for ; Sun, 2 Jan 2022 04:51:17 -0800 (PST) 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 C037960E9A for ; Sun, 2 Jan 2022 12:51:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 36422C36AEF; Sun, 2 Jan 2022 12:51:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127876; bh=92xmStm+o1tIGFa1+nE5CbFAFHHHqxb+4qlu8mFBtaY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bd9hQfI5qP+aB0F3yO1YPemAQp+gpiQDKcpTFS9S+4B6Pud38WrDVhYdeZmu4n9r/ 5m0WCGFjTbcDO5NSqVzzgQgCINeATj+/eslBdcAlAwMENArFXWrpzvEM2LliNlcm2l LzQpKLwuAvP/kY+G6nG1j49qVo5ot3nnmL7roQrWdtkYcSqJVbm5EP58itmsVx1Be9 rOa0/1BZ/uqZCVzFjTCSIIAlHfJz0QvboDu3vMZK5TsyFbVY6ZjSftwcpCHF8dbS5g tQVwgZByuGwkg7yS8AkdMj4f1im0E02649WWvPyQST8lenC6xhj7H5ZHZEre8dJj73 ZIAYjYacl4Lgg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 09/51] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:35 +0000 Message-Id: <20220102125617.1259804-10-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 517c57ed9e94..0c86cefbe2e2 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -504,7 +504,6 @@ static int stk8ba50_remove(struct i2c_client *client) return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); } -#ifdef CONFIG_PM_SLEEP static int stk8ba50_suspend(struct device *dev) { struct stk8ba50_data *data; @@ -523,12 +522,7 @@ static int stk8ba50_resume(struct device *dev) return stk8ba50_set_power(data, STK8BA50_MODE_NORMAL); } -static SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume); - -#define STK8BA50_PM_OPS (&stk8ba50_pm_ops) -#else -#define STK8BA50_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume); static const struct i2c_device_id stk8ba50_i2c_id[] = { {"stk8ba50", 0}, @@ -546,7 +540,7 @@ MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id); static struct i2c_driver stk8ba50_driver = { .driver = { .name = "stk8ba50", - .pm = STK8BA50_PM_OPS, + .pm = pm_sleep_ptr(&stk8ba50_pm_ops), .acpi_match_table = ACPI_PTR(stk8ba50_acpi_id), }, .probe = stk8ba50_probe, From patchwork Sun Jan 2 12:55:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702224 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 F2AE7C433EF for ; Sun, 2 Jan 2022 12:51:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232198AbiABMvV (ORCPT ); Sun, 2 Jan 2022 07:51:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvV (ORCPT ); Sun, 2 Jan 2022 07:51:21 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82C0C061574 for ; Sun, 2 Jan 2022 04:51:20 -0800 (PST) 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 B4829B80D61 for ; Sun, 2 Jan 2022 12:51:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BE869C36AEE; Sun, 2 Jan 2022 12:51:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127878; bh=t2ujGpt3T2sdyU2QyGPTc3eLz7u4hEGwzQs1uTbmnv4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X9kZ1SKEZ97DrOuuitU3OUk1DrzvrnlFr9aAsSZ0mkOlCT531IgMVL09lnSguOC/J RdtvPOPdespLc+SmyawRII0/Mi/PbDnEMVIvRexpKbwbUMUe5TrsW/6xN4jf6xfi3G MRzG2VR4oX7GkYpqs+DoH5rmFPCQc3eHy7jvjDg1HHrJQOCO7/MTjDyApAqELfovMg dNsgD2UXYE2lWz+lVFBvPd+GJMhbxbwQ8HWSxdlHEp43dc2xBwT0FtyANMTAVSXlOq xUBxpOo9ERtZZDHAGlAj6dOr+jtizAccqUKlG5K/WQpzAKCeJMrqX9dahgiK12gLD2 F9HGZPIC+Z4xw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 10/51] iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:36 +0000 Message-Id: <20220102125617.1259804-11-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 ++------ 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c index 274b41a6e603..ffe8066b4025 100644 --- a/drivers/iio/accel/kxsd9-i2c.c +++ b/drivers/iio/accel/kxsd9-i2c.c @@ -55,7 +55,7 @@ static struct i2c_driver kxsd9_i2c_driver = { .driver = { .name = "kxsd9", .of_match_table = kxsd9_of_match, - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), }, .probe = kxsd9_i2c_probe, .remove = kxsd9_i2c_remove, diff --git a/drivers/iio/accel/kxsd9-spi.c b/drivers/iio/accel/kxsd9-spi.c index 441e6b764281..44edf39fc5ff 100644 --- a/drivers/iio/accel/kxsd9-spi.c +++ b/drivers/iio/accel/kxsd9-spi.c @@ -54,7 +54,7 @@ MODULE_DEVICE_TABLE(of, kxsd9_of_match); static struct spi_driver kxsd9_spi_driver = { .driver = { .name = "kxsd9", - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), .of_match_table = kxsd9_of_match, }, .probe = kxsd9_spi_probe, diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index 552eba5e8b4f..39059ddca441 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c @@ -492,7 +492,6 @@ void kxsd9_common_remove(struct device *dev) } EXPORT_SYMBOL(kxsd9_common_remove); -#ifdef CONFIG_PM static int kxsd9_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -508,13 +507,10 @@ static int kxsd9_runtime_resume(struct device *dev) return kxsd9_power_up(st); } -#endif /* CONFIG_PM */ const struct dev_pm_ops kxsd9_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(kxsd9_runtime_suspend, - kxsd9_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + RUNTIME_PM_OPS(kxsd9_runtime_suspend, kxsd9_runtime_resume, NULL) }; EXPORT_SYMBOL(kxsd9_dev_pm_ops); From patchwork Sun Jan 2 12:55:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702225 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 4B64DC433EF for ; Sun, 2 Jan 2022 12:51:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232229AbiABMvY (ORCPT ); Sun, 2 Jan 2022 07:51:24 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50320 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvY (ORCPT ); Sun, 2 Jan 2022 07:51:24 -0500 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 21172B80D61 for ; Sun, 2 Jan 2022 12:51:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 52E6FC36AF0; Sun, 2 Jan 2022 12:51:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127881; bh=HbnEPVVgQ9Kvb7yZUMoAWMuzKm8i0gC/eDb9lq2ikvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/X2JfQHInpluwmPBoweZ7cum0JR4VJbKyr0CLc2YJeQgKjdjFOhuEcE1qbw+vHoo AxFhzVRp8ThwIZaJUo5AA0NT0f1v0b6Vf5xVfV1xlCTK7nMCVKv2oyigAVl+Ysd7f3 xNTsrKobhX9/0Y0bP/eXitlQ2atljBbXH3tgvbGswE/gFIHHfKe4qr8vw3Nm5Qgd4g LyyMYXC9RxvAuhBu+1TL5rDknCoRr2a3FbWGeyLVNzOuv9QiRU5GiRrtkvLVTBq9Mh 3RXHTWMH1ljR7IOZsSj9Nh6UVy2eOb3x6ouvh4m/kaybT1HjLxPE+G0htr0ya7gu2P yPL5bu3ySO6FQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Linus Walleij Subject: [PATCH v2 11/51] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:37 +0000 Message-Id: <20220102125617.1259804-12-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron Reviewed-by: Linus Walleij --- drivers/iio/adc/ab8500-gpadc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c index 4c46a201d4ef..e0b19e8221eb 100644 --- a/drivers/iio/adc/ab8500-gpadc.c +++ b/drivers/iio/adc/ab8500-gpadc.c @@ -942,7 +942,6 @@ static const struct iio_info ab8500_gpadc_info = { .read_raw = ab8500_gpadc_read_raw, }; -#ifdef CONFIG_PM static int ab8500_gpadc_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev) return ret; } -#endif /** * ab8500_gpadc_parse_channel() - process devicetree channel configuration @@ -1200,11 +1198,9 @@ static int ab8500_gpadc_remove(struct platform_device *pdev) } static const struct dev_pm_ops ab8500_gpadc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, - ab8500_gpadc_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, + ab8500_gpadc_runtime_resume, NULL) }; static struct platform_driver ab8500_gpadc_driver = { @@ -1212,7 +1208,7 @@ static struct platform_driver ab8500_gpadc_driver = { .remove = ab8500_gpadc_remove, .driver = { .name = "ab8500-gpadc", - .pm = &ab8500_gpadc_pm_ops, + .pm = pm_ptr(&ab8500_gpadc_pm_ops), }, }; builtin_platform_driver(ab8500_gpadc_driver); From patchwork Sun Jan 2 12:55:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702226 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 0597DC433F5 for ; Sun, 2 Jan 2022 12:51:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232280AbiABMv2 (ORCPT ); Sun, 2 Jan 2022 07:51:28 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50340 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMv1 (ORCPT ); Sun, 2 Jan 2022 07:51:27 -0500 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 4D862B80D61 for ; Sun, 2 Jan 2022 12:51:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4FC30C36AEE; Sun, 2 Jan 2022 12:51:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127885; bh=PIw1uSJeYEE6U37w5+RAEELwEPcxZiLbx6Bn9BcGMss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NG1LDFzBw9WeOHGM+4Uy7MUl8Y42LZSCVSDEsa2VjTRR9GqFLQK82HBTxTRK4q5uv wJ2SRuog1rBXFTKHpXaWz3mdf0JJUzKMP/7i4wgOFRlDNkledekB3qUwvoS/4rIbpD wzIi4MAArmFeGQE9AmuLbvo9Y86Jt+O6ZJf8nNcZS2EB5Mpg+oN9C+v9/XKz1Nm6He 7cTN17zTdgM0wFcYlt4yiD1nz7nNMymrZQNEhRRbDGvbS41bfsQXGJZWHmGS9Wrqya MeuhGGiOMYw/wgL62IZhWhalrCxvznkgA1xJcnO32FTJCRF3OLjCoQruLI06XJKVSb 5vkXnN/j558LQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Alexandre Belloni , Ludovic Desroches Subject: [PATCH v2 12/51] iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:38 +0000 Message-Id: <20220102125617.1259804-13-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Reviewed-by: Alexandre Belloni Signed-off-by: Jonathan Cameron Cc: Ludovic Desroches --- drivers/iio/adc/at91_adc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 5a7d3a3a5fa8..4ec1586ea0a0 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -1234,7 +1234,6 @@ static int at91_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int at91_adc_suspend(struct device *dev) { struct iio_dev *idev = dev_get_drvdata(dev); @@ -1256,9 +1255,8 @@ static int at91_adc_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); +DEFINE_SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); static const struct at91_adc_trigger at91sam9260_triggers[] = { { .name = "timer-counter-0", .value = 0x1 }, @@ -1386,7 +1384,7 @@ static struct platform_driver at91_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = at91_adc_dt_ids, - .pm = &at91_adc_pm_ops, + .pm = pm_sleep_ptr(&at91_adc_pm_ops), }, }; From patchwork Sun Jan 2 12:55:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702227 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 C7233C433EF for ; Sun, 2 Jan 2022 12:51:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232284AbiABMvb (ORCPT ); Sun, 2 Jan 2022 07:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMva (ORCPT ); Sun, 2 Jan 2022 07:51:30 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 76851C061574 for ; Sun, 2 Jan 2022 04:51:30 -0800 (PST) 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 31472B80D62 for ; Sun, 2 Jan 2022 12:51:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F14AC36AEF; Sun, 2 Jan 2022 12:51:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127887; bh=ataQ0/NG715KiJXcZnH0xXTgucOdo1SjJj0JC6r7EM0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EeWQeW6o2hjZs5R99kyNJbrl7gkeHFqi+PgdTaxZMAV4ItSNEoNms13lXIAowQgw2 rNoE645qksMNR1VyXOUmNCt4T0Nz/F2fcybxBCHL0XzepTr67mbvANImtCM6hxP6Ma Ub++uowO6JWwp9d+IsC6LleSJoPCyeGZxcvovLKGk8qITzvkzvINa/S5+eQwnxW56j mu8riUo3urVBvWqqKn8NlCFlk8+rovGhkb5n81+fnyWDzSB403wKM+lMY9mdsgzZVp Pqzz6PC8PEO26t0vYecaiFDfoe1md038BHfjSGtVz19+0nlWldIXFafZOgAlV6RUwi /VlFvT9oM4jpg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Krzysztof Kozlowski Subject: [PATCH v2 13/51] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sun, 2 Jan 2022 12:55:39 +0000 Message-Id: <20220102125617.1259804-14-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Jonathan Cameron --- drivers/iio/adc/exynos_adc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 3b3868aa2533..166a6436e36f 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -968,7 +968,6 @@ static int exynos_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int exynos_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -1001,11 +1000,10 @@ static int exynos_adc_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, - exynos_adc_suspend, - exynos_adc_resume); +DEFINE_SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, + exynos_adc_suspend, + exynos_adc_resume); static struct platform_driver exynos_adc_driver = { .probe = exynos_adc_probe, @@ -1013,7 +1011,7 @@ static struct platform_driver exynos_adc_driver = { .driver = { .name = "exynos-adc", .of_match_table = exynos_adc_match, - .pm = &exynos_adc_pm_ops, + .pm = pm_sleep_ptr(&exynos_adc_pm_ops), }, }; From patchwork Sun Jan 2 12:55:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702228 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 28AC8C433EF for ; Sun, 2 Jan 2022 12:51:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232303AbiABMvd (ORCPT ); Sun, 2 Jan 2022 07:51:33 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50416 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvc (ORCPT ); Sun, 2 Jan 2022 07:51:32 -0500 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 A51DCB80CFC for ; Sun, 2 Jan 2022 12:51:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EF20C36AE7; Sun, 2 Jan 2022 12:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127890; bh=Z6RFNiEAUiFuHZEi26BB2FYS2FkecMuqX6mAxKfmueE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FZB/Kb2w5Dj88S+WokjZKwFxgK0hWd9XGoAyavqYv0/kt3PaKppeuG1Y6aje+pexf J2EkYnabnT1C/7cqeNp1xHw1U7UKZVfQUbBagn1Z4xPYX2LMeUWQq3Mbb2/F9IUelZ 5TCjfA7seAiqiLaHbMDHDWkLPMJySd+ppGH5lt4Ph92nrjaVg2XVZyx5JnculFqEEB 9L8dkW7Yd2YzJr5ZPkVgDU2nECmUi483dPsm8TdexqOvq+S73ryFufdi87rStItmcz PPqQ9WmKpWqqdGjWLwfypOmIX4QWPPlCxJ8u1+/F8MU3HHyYJPwQrWs2Jy8lmAdbwo zR56z+V/HcH0A== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 14/51] iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sun, 2 Jan 2022 12:55:40 +0000 Message-Id: <20220102125617.1259804-15-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. In this case SIMPLE_DEV_PM_OPS() could have been used previously. Now we have DEFINE_SIMPLE_DEV_PM_OPS() which also deals with letting the compiler remove the structure and functions so use that instead. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/palmas_gpadc.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index f9c8385c72d3..a8febe487b2b 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -653,7 +653,6 @@ static int palmas_gpadc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) { int adc_period, conv; @@ -822,12 +821,9 @@ static int palmas_gpadc_resume(struct device *dev) return 0; }; -#endif -static const struct dev_pm_ops palmas_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(palmas_gpadc_suspend, - palmas_gpadc_resume) -}; +DEFINE_SIMPLE_DEV_PM_OPS(palmas_pm_ops, palmas_gpadc_suspend, + palmas_gpadc_resume); static const struct of_device_id of_palmas_gpadc_match_tbl[] = { { .compatible = "ti,palmas-gpadc", }, @@ -840,7 +836,7 @@ static struct platform_driver palmas_gpadc_driver = { .remove = palmas_gpadc_remove, .driver = { .name = MOD_NAME, - .pm = &palmas_pm_ops, + .pm = pm_sleep_ptr(&palmas_pm_ops), .of_match_table = of_palmas_gpadc_match_tbl, }, }; From patchwork Sun Jan 2 12:55:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702229 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 644E7C433EF for ; Sun, 2 Jan 2022 12:51:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232326AbiABMvg (ORCPT ); Sun, 2 Jan 2022 07:51:36 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50442 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvf (ORCPT ); Sun, 2 Jan 2022 07:51:35 -0500 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 AC38CB80D63 for ; Sun, 2 Jan 2022 12:51:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE973C36AEE; Sun, 2 Jan 2022 12:51:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127893; bh=q7cVSAUQ/xFgnIBCJzRwFHWnmeiVZureIoe1bh4nnuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LLE0eDrrBYt5SLzqCqd5rGHCppEkLhxLmAZdAlFF4Hl6OSwvByz/mSj3rMyjnneJf /CUG2l0YHnoVmRzqZdAZ37bw6o8+iUmFUejO9BOSbY0SMCR75UCvZ3SCynW75F61ys kgoqES3lEury7KdTXAkPc8+B2vmYKqzPSKLjEF+slAyNm5VXCKdWdtmA4bvuwmk1sY mR2iCk4WLfuBeWhMeBnnTHmOB/Q7SMK8SlFzg34cMJhP/7EUSuVll9Z1t4Eu8MjPtP li/e4FDCN9vADdQXFC5R7Xu4fmJXzE8xKtPhL3ehJoyLZjPbw0jDNFk9L9BmjHQjMC U0tNJ9M3VkJ8g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Fabrice Gasnier , Olivier Moysan Subject: [PATCH v2 15/51] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() Date: Sun, 2 Jan 2022 12:55:41 +0000 Message-Id: <20220102125617.1259804-16-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Reviewed-by: Fabrice Gasnier Signed-off-by: Jonathan Cameron Cc: Olivier Moysan --- drivers/iio/adc/stm32-adc-core.c | 13 +++++-------- drivers/iio/adc/stm32-adc.c | 12 ++++-------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index b6e18eb101f7..c506dd558958 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -763,7 +763,6 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM) static int stm32_adc_core_runtime_suspend(struct device *dev) { stm32_adc_core_hw_stop(dev); @@ -782,14 +781,12 @@ static int stm32_adc_core_runtime_idle(struct device *dev) return 0; } -#endif static const struct dev_pm_ops stm32_adc_core_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend, - stm32_adc_core_runtime_resume, - stm32_adc_core_runtime_idle) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend, + stm32_adc_core_runtime_resume, + stm32_adc_core_runtime_idle) }; static const struct stm32_adc_priv_cfg stm32f4_adc_priv_cfg = { @@ -836,7 +833,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc-core", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_core_pm_ops, + .pm = pm_ptr(&stm32_adc_core_pm_ops), }, }; module_platform_driver(stm32_adc_driver); diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 897166d9e45c..a68ecbda6480 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -2352,7 +2352,6 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM_SLEEP) static int stm32_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -2382,9 +2381,7 @@ static int stm32_adc_resume(struct device *dev) return stm32_adc_buffer_postenable(indio_dev); } -#endif -#if defined(CONFIG_PM) static int stm32_adc_runtime_suspend(struct device *dev) { return stm32_adc_hw_stop(dev); @@ -2394,12 +2391,11 @@ static int stm32_adc_runtime_resume(struct device *dev) { return stm32_adc_hw_start(dev); } -#endif static const struct dev_pm_ops stm32_adc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) - SET_RUNTIME_PM_OPS(stm32_adc_runtime_suspend, stm32_adc_runtime_resume, - NULL) + SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) + RUNTIME_PM_OPS(stm32_adc_runtime_suspend, stm32_adc_runtime_resume, + NULL) }; static const struct stm32_adc_cfg stm32f4_adc_cfg = { @@ -2453,7 +2449,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_pm_ops, + .pm = pm_ptr(&stm32_adc_pm_ops), }, }; module_platform_driver(stm32_adc_driver); From patchwork Sun Jan 2 12:55:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702230 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 193A6C433EF for ; Sun, 2 Jan 2022 12:51:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232361AbiABMvi (ORCPT ); Sun, 2 Jan 2022 07:51:38 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50468 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvi (ORCPT ); Sun, 2 Jan 2022 07:51:38 -0500 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 51A19B80D61 for ; Sun, 2 Jan 2022 12:51:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 155A1C36AF0; Sun, 2 Jan 2022 12:51:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127896; bh=j0VmH+iuAGeL4CIMed+zLG7HtqEOQ4rth/BZgPt/s+w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pr6AHrss4l+KmuLVwDdmhjeN64DeKvXdRl+ngNX1RipHJVSsFcannsq/G2fGEpDyi CixedSgw4R+o520dkSsdwcbYLoxF786t4OMKFRtmYAzHun4qHI4Mi0NSXlqwH/Ttb3 ocW30puRyGHQ6dyck5iFyPJMMmUkGeKcWSMMHZv4RTlplD4gt/ZvGlBMB0Xf+LaLKb JoyFFF/hyvWTuE7qhLsmaDT99qYsD8+0kNjfdQedpeBNs0o8J5eQ6FrAU4qP3M4Yjy 6a84rI+TM40lU2scEVZSGz7dHgrZHKUO5J3OC0yXpmkrTVKDmSLm3vNc5whpoMUNIN 1WppPZ7hnQ8cA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 16/51] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:42 +0000 Message-Id: <20220102125617.1259804-17-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/rcar-gyroadc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c index 727ea6c68049..27d9e147b4b7 100644 --- a/drivers/iio/adc/rcar-gyroadc.c +++ b/drivers/iio/adc/rcar-gyroadc.c @@ -577,7 +577,6 @@ static int rcar_gyroadc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM) static int rcar_gyroadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -597,10 +596,9 @@ static int rcar_gyroadc_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rcar_gyroadc_pm_ops = { - SET_RUNTIME_PM_OPS(rcar_gyroadc_suspend, rcar_gyroadc_resume, NULL) + RUNTIME_PM_OPS(rcar_gyroadc_suspend, rcar_gyroadc_resume, NULL) }; static struct platform_driver rcar_gyroadc_driver = { @@ -609,7 +607,7 @@ static struct platform_driver rcar_gyroadc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = rcar_gyroadc_match, - .pm = &rcar_gyroadc_pm_ops, + .pm = pm_ptr(&rcar_gyroadc_pm_ops), }, }; From patchwork Sun Jan 2 12:55:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702231 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 6FF00C433EF for ; Sun, 2 Jan 2022 12:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232366AbiABMvo (ORCPT ); Sun, 2 Jan 2022 07:51:44 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50486 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232135AbiABMvl (ORCPT ); Sun, 2 Jan 2022 07:51:41 -0500 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 899F4B80CFC for ; Sun, 2 Jan 2022 12:51:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84BD1C36AEF; Sun, 2 Jan 2022 12:51:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127899; bh=eIs1J8MT69pQSI5JTRfa0fp9eweSLFmIgygPNXSUiSQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YSk9+REouxsD1irFj3FaVNyaNweJKP2uYkkS5JIVbZPPb/MqjHoAv6DNNQZ1FARKP 6ybfQYQkC6+wJlaBs4GcvYElPUGQC+8klPxEXgbYgzqqo0jeuvy/HDqAPMxctmhSt3 D5oH3Ke0CkfZ8PW3pOi1cjqnP17Mf++as0S1nwiBL6I9PRTitA9OcoGNtxBvjPmdH3 tF5ZVxv+Vws7uOu9n34Qhv0gzrbWlzzRdSdZmvFJl42Iny4JSaMexwRVDC2RDHW7he w5DutZMSBNlKNqwqrT5rZxfPqdoWhds0mQm2Fz/BejsPZXzTe8lwE4J5xfuI0b2bVW bcSbbKrPO9meA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Heiko Stuebner Subject: [PATCH v2 17/51] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:43 +0000 Message-Id: <20220102125617.1259804-18-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Heiko Stuebner --- drivers/iio/adc/rockchip_saradc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 14b8df4ca9c8..62315df14873 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -481,7 +481,6 @@ static int rockchip_saradc_probe(struct platform_device *pdev) return devm_iio_device_register(&pdev->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int rockchip_saradc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -514,9 +513,8 @@ static int rockchip_saradc_resume(struct device *dev) return ret; } -#endif -static SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, +DEFINE_SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, rockchip_saradc_suspend, rockchip_saradc_resume); static struct platform_driver rockchip_saradc_driver = { @@ -524,7 +522,7 @@ static struct platform_driver rockchip_saradc_driver = { .driver = { .name = "rockchip-saradc", .of_match_table = rockchip_saradc_match, - .pm = &rockchip_saradc_pm_ops, + .pm = pm_sleep_ptr(&rockchip_saradc_pm_ops), }, }; From patchwork Sun Jan 2 12:55: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: 12702232 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 BDE2DC433FE for ; Sun, 2 Jan 2022 12:51:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232135AbiABMvp (ORCPT ); Sun, 2 Jan 2022 07:51:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232374AbiABMvn (ORCPT ); Sun, 2 Jan 2022 07:51:43 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1531C061574 for ; Sun, 2 Jan 2022 04:51:42 -0800 (PST) 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 61CB660E98 for ; Sun, 2 Jan 2022 12:51:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E11FAC36AEE; Sun, 2 Jan 2022 12:51:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127901; bh=uepRjTFk3uHk6O1UwSyI6dErEOVeIPmlsNZ8aL10gmM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=psxQ/WVipRERBtQK7FBoaJ4wzDL62Dv+cjx7gKP4mMv9OMUpcQpwtJQURv62t9r01 DWdMaj1yK9K3XqSNfEqXzW3WZcgjIKHxu75zhKeJ0hJbHvBE2fyhcYBE1zB+GpmFwr FKujQTyhIvh4v9RnD/3Lnc+AHeUkFo5YCJLowVbkAT6rVQy5Ri7MBf7tlO0isXBMO+ pNTJ+IXhZHg/sI/LvjQPmSou+w3vd6LqG57v/DzRtKDnQVhgw4O4MJ8+Vl45bNfBaG qaQBymFg6eVdM658mNZ72Cbg9F5WRUeSBTFj1XTM8r+WVQgTVnBSXocR+JlPesevfu CgjvJz0eizHPQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 18/51] iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:44 +0000 Message-Id: <20220102125617.1259804-19-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index afdb59e0b526..a7cf41c82b46 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -944,7 +944,6 @@ static int twl6030_gpadc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int twl6030_gpadc_suspend(struct device *pdev) { int ret; @@ -968,17 +967,16 @@ static int twl6030_gpadc_resume(struct device *pdev) return 0; }; -#endif -static SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend, - twl6030_gpadc_resume); +DEFINE_SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend, + twl6030_gpadc_resume); static struct platform_driver twl6030_gpadc_driver = { .probe = twl6030_gpadc_probe, .remove = twl6030_gpadc_remove, .driver = { .name = DRIVER_NAME, - .pm = &twl6030_gpadc_pm_ops, + .pm = pm_sleep_ptr(&twl6030_gpadc_pm_ops), .of_match_table = of_twl6030_match_tbl, }, }; From patchwork Sun Jan 2 12:55: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: 12702233 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 E0105C433F5 for ; Sun, 2 Jan 2022 12:51:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232310AbiABMvq (ORCPT ); Sun, 2 Jan 2022 07:51:46 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42142 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232333AbiABMvp (ORCPT ); Sun, 2 Jan 2022 07:51:45 -0500 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 27FAA60DB7 for ; Sun, 2 Jan 2022 12:51:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D930C36AEF; Sun, 2 Jan 2022 12:51:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127904; bh=wfLuY9IJCthJwZ6emwUuF0rr+yB2hBxGYbDXsYhtv2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCOaocqUiDSBotKLN9YsAwaJkuqUsboBoaACJRUmoOz5QwMZkhJqPzYIEyKILwYu+ BmjuCYSV0qkJurSuqy+CvKtLjy4RzMSGkEUbHPupngrBgUmgLn7Pp+qX9q/nQONdur YacnSVa3gP7YN+oq8b47FJGblYlNMX3n4wWEVQHl7E+C0L8mwWMWAj3p6cGDcUZjlE UhwPGa+yf6K56BmP0EarPpOIyuqZPeoySC5kmNXnbZdJJJed2ZIg1Pnl8s0EdCes/V 0heUlbM+tOOiVuS2qcBv3RVsRD2+E1zzbQhP1tKR28iFJeeW0N0Ig4DXif9yxM9MRz ChjRhunJUXa5Q== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Stefan-Gabriel Mirea Subject: [PATCH v2 19/51] iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:45 +0000 Message-Id: <20220102125617.1259804-20-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Stefan-Gabriel Mirea --- drivers/iio/adc/vf610_adc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index fd57fc43e8e5..6f10b265a481 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -912,7 +912,6 @@ static int vf610_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int vf610_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -952,9 +951,8 @@ static int vf610_adc_resume(struct device *dev) regulator_disable(info->vref); return ret; } -#endif -static SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, vf610_adc_resume); +DEFINE_SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, vf610_adc_resume); static struct platform_driver vf610_adc_driver = { .probe = vf610_adc_probe, @@ -962,7 +960,7 @@ static struct platform_driver vf610_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = vf610_adc_match, - .pm = &vf610_adc_pm_ops, + .pm = pm_sleep_ptr(&vf610_adc_pm_ops), }, }; From patchwork Sun Jan 2 12:55: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: 12702234 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 D5FEFC433EF for ; Sun, 2 Jan 2022 12:51:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232312AbiABMvt (ORCPT ); Sun, 2 Jan 2022 07:51:49 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50548 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232274AbiABMvt (ORCPT ); Sun, 2 Jan 2022 07:51:49 -0500 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 05A31B80D62 for ; Sun, 2 Jan 2022 12:51:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0A574C36AF0; Sun, 2 Jan 2022 12:51:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127906; bh=/JVqu38T1aKbmD/oofqmgNQwJprkWJS/IEjXMG3GsVc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lpIrTQDaAke4qDRDE+5JvvBUM3K8KfmZecFVjfpB4NDz2N444l093F8EWbPC1yY/S 0Sx0ebSMgwQKXCPsWFQf68+OVMSF01/79A8MzL4zCVOeSWTd9nQAnlRacmCw8BuKde nIuo6gzdhQRLY8UMGmVFBO0ycOmm9FMIk1S0iuBlp9rIxzA2vJ4bLCJNeLjHo1DO+f jdPeqtEoeqEfE6u0fK6d0jKLLotbs6IZ8MK6MGu6v0pPpCCHXbyiJw5RNg+KcxHggM KZxt8BGB03tksxvU10osC15T5pxe3CLLQ9F0w7NPqWWqmZ8DNXeMoOhzcW6pLShBHC U0OVqbCYgPAcQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 20/51] iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:46 +0000 Message-Id: <20220102125617.1259804-21-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP support is simpler and less error prone than the use of ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than open coding the structure. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron --- drivers/iio/common/ssp_sensors/ssp_dev.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 1aee87100038..d1aba8deff7f 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -612,7 +612,6 @@ static int ssp_remove(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP static int ssp_suspend(struct device *dev) { int ret; @@ -661,17 +660,14 @@ static int ssp_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops ssp_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) -}; +DEFINE_SIMPLE_DEV_PM_OPS(ssp_pm_ops, ssp_suspend, ssp_resume); static struct spi_driver ssp_driver = { .probe = ssp_probe, .remove = ssp_remove, .driver = { - .pm = &ssp_pm_ops, + .pm = pm_sleep_ptr(&ssp_pm_ops), .of_match_table = of_match_ptr(ssp_of_match), .name = "sensorhub" }, From patchwork Sun Jan 2 12:55: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: 12702235 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 E9ED8C433EF for ; Sun, 2 Jan 2022 12:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232274AbiABMvw (ORCPT ); Sun, 2 Jan 2022 07:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232333AbiABMvw (ORCPT ); Sun, 2 Jan 2022 07:51:52 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E254CC061574 for ; Sun, 2 Jan 2022 04:51:51 -0800 (PST) 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 A3651B80D62 for ; Sun, 2 Jan 2022 12:51:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 629DCC36AEF; Sun, 2 Jan 2022 12:51:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127909; bh=WspfA/RlQHDLMQ5QvroT9uNUHmG7w9deaaKaBafsW5U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G89BErdvmL8qgjhF91qgJsoAlZx23BWxnPAa9xSPd6+6d64yruNBuvhmj2gF6pw0n nWNopgHKK1A6fvzVxpZXKIIl8Lnc6YV+6EWQa/SBhg58y0oEWixRFB/MZNho2Bkr3W vBaZjL3o7j8Gsby/4Kdc74RnARaGtSzistJKE4Xmp+Pq1gSrWv34FMipBpKHycgVhw SGaV7F/qowfv0T9pTYBjkti1t5dx3bWyYAAFSzLmM9+uu8NtQuCK7g0MG4LB9LcDAJ VGJLDz9RScyLAZPAAE8jNMVRbe03blQLGn4QhZ1TPKoH5wSXyH+hwzngnleqLeddC5 DvxOu/1YrzkMA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 21/51] iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:47 +0000 Message-Id: <20220102125617.1259804-22-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/dac/vf610_dac.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c index 636b4009f763..8f937d1b3c56 100644 --- a/drivers/iio/dac/vf610_dac.c +++ b/drivers/iio/dac/vf610_dac.c @@ -242,7 +242,6 @@ static int vf610_dac_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int vf610_dac_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -268,9 +267,8 @@ static int vf610_dac_resume(struct device *dev) return 0; } -#endif -static SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, vf610_dac_resume); +DEFINE_SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, vf610_dac_resume); static struct platform_driver vf610_dac_driver = { .probe = vf610_dac_probe, @@ -278,7 +276,7 @@ static struct platform_driver vf610_dac_driver = { .driver = { .name = "vf610-dac", .of_match_table = vf610_dac_match, - .pm = &vf610_dac_pm_ops, + .pm = pm_sleep_ptr(&vf610_dac_pm_ops), }, }; module_platform_driver(vf610_dac_driver); From patchwork Sun Jan 2 12:55: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: 12702236 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 7173EC433FE for ; Sun, 2 Jan 2022 12:51:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232333AbiABMvy (ORCPT ); Sun, 2 Jan 2022 07:51:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232340AbiABMvx (ORCPT ); Sun, 2 Jan 2022 07:51:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C1AEC061574 for ; Sun, 2 Jan 2022 04:51:53 -0800 (PST) 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 CBD3A60E98 for ; Sun, 2 Jan 2022 12:51:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 41FE5C36AEE; Sun, 2 Jan 2022 12:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127912; bh=Fwlcn5rhlXyW5tMX7641kM2AdBqt/ktY68zN480QONo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p7+cOqwe0Mb0vVxzZOlnAxr0KdjWxKNlIM5ZiZ3rR3sdJu/9HHFdskvxWUYjUSiPT 7+4PdrCmAfoAlAnfnCBSfGj9l/Yw8ii1B4FhsiTqHMRZHVJkHTDq6ZzNJVw7EYOU46 Rnq1TtyhvPKMQJp8mm8VvloQzMS1SDBN3vzvEW3OcEouEyGJaTnxNv2f9HJaWWuek0 C8QrhMPlsYE4f/OUl8seei00QJ5OxZiy8p4KtCPorZ8zASoBByc2Uwq73PiBp5Pf5D T2sgfd+xD9mm86/U8FxDUo4rxQizlNOU7Pz9bwhFutbtfF9FZrykcaxxeqszV3xvsz Wxf9ZknfIu5AA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 22/51] iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:48 +0000 Message-Id: <20220102125617.1259804-23-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/apds9300.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c index baaf202dce05..b1e36e0954de 100644 --- a/drivers/iio/light/apds9300.c +++ b/drivers/iio/light/apds9300.c @@ -466,7 +466,6 @@ static int apds9300_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int apds9300_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -493,11 +492,7 @@ static int apds9300_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, apds9300_resume); -#define APDS9300_PM_OPS (&apds9300_pm_ops) -#else -#define APDS9300_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, apds9300_resume); static const struct i2c_device_id apds9300_id[] = { { APDS9300_DRV_NAME, 0 }, @@ -509,7 +504,7 @@ MODULE_DEVICE_TABLE(i2c, apds9300_id); static struct i2c_driver apds9300_driver = { .driver = { .name = APDS9300_DRV_NAME, - .pm = APDS9300_PM_OPS, + .pm = pm_sleep_ptr(&apds9300_pm_ops), }, .probe = apds9300_probe, .remove = apds9300_remove, From patchwork Sun Jan 2 12:55: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: 12702237 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 E89C9C433F5 for ; Sun, 2 Jan 2022 12:51:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbiABMv4 (ORCPT ); Sun, 2 Jan 2022 07:51:56 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42272 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232340AbiABMvz (ORCPT ); Sun, 2 Jan 2022 07:51:55 -0500 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 7FBF660E9C for ; Sun, 2 Jan 2022 12:51:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0843C36AEF; Sun, 2 Jan 2022 12:51:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127914; bh=ckVlIuSt9Q2kgcuFb4ii83R8VsoTYoCMzmjYcR8P1Q8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U+VSfiAWM5Ih6nS89LF3hjzf86K/HWZXoK/gLd5sqADGxnyo92WZyTIco7U1f7OaR IeYwIWmPsr0HArZvi8OQogdOPW5dqa2YWyV9148crHvdcVOWgJ8VfD9iDuw7wGZMC6 oZUTjTHGexWqOIdW1Uf21n1guz/y4Qwvonou6hfHA/P2ApoVBBt7LycnzudpJ3N29D DhszvbFqe+vYaJdIIHW+RyyVZ5nhOsN+7tG0xAD9A4Xtr0T95r2Co6HTZZXqFpvpFT WAlCrWeAN5n8CcFai+WVcgbmOsfMxzgXC4ljnzDrxKdAgB49zKuIfdfAqEMG2Ww460 IXS72MhVJ/0eA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Linus Walleij Subject: [PATCH v2 23/51] iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:55:49 +0000 Message-Id: <20220102125617.1259804-24-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Reviewed-by: Linus Walleij Signed-off-by: Jonathan Cameron --- drivers/iio/light/bh1780.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c index abbf2e662e7d..e30f0bb4e6ca 100644 --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c @@ -221,7 +221,6 @@ static int bh1780_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM static int bh1780_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -256,13 +255,10 @@ static int bh1780_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ static const struct dev_pm_ops bh1780_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(bh1780_runtime_suspend, - bh1780_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + RUNTIME_PM_OPS(bh1780_runtime_suspend, bh1780_runtime_resume, NULL) }; static const struct i2c_device_id bh1780_id[] = { @@ -284,7 +280,7 @@ static struct i2c_driver bh1780_driver = { .id_table = bh1780_id, .driver = { .name = "bh1780", - .pm = &bh1780_dev_pm_ops, + .pm = pm_ptr(&bh1780_dev_pm_ops), .of_match_table = of_bh1780_match, }, }; From patchwork Sun Jan 2 12:55: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: 12702238 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 3B807C433F5 for ; Sun, 2 Jan 2022 12:51:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232340AbiABMv6 (ORCPT ); Sun, 2 Jan 2022 07:51:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42300 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiABMv6 (ORCPT ); Sun, 2 Jan 2022 07:51:58 -0500 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 4321860E9C for ; Sun, 2 Jan 2022 12:51:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9008BC36AEE; Sun, 2 Jan 2022 12:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127917; bh=OsR4uLiflqXTOkVbxayRoG124ge6ry+RgvKPUAosPIY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m+EYfOgjVXAD/Fa1BpYNK8Fz6mQdsxiSAmqEKp9VnKET2BKLAlbzSLpWR+QkkULUY AVLV1aMVam35Y0dM7BEGLTp7USMQLzLyeTW/y0mC8PzUoE8Vvtcs26rxi/rxlb1v3p EVxK14c8eFf/ZUqEIZ/9tPgGSXH16pe84yTMBmK13OPuKV+zANyw28cpOTYhmmJ5ym 21pNCjcefhW24Tmz42FYMphku9HsE9qDoKAErYi/67MTfWX0Cvz68IYfCm95lgm4CN GKP4lHwnGGR+2ds30/TYeb1XzLzRwN22gsmQF+9Wvo8FsMagc8x01QFcKXdSk0W/3T g5PheS6wWqTzg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 24/51] iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:50 +0000 Message-Id: <20220102125617.1259804-25-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than opencoding the same. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3232.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index 18a410340dc5..122130f1a683 100644 --- a/drivers/iio/light/cm3232.c +++ b/drivers/iio/light/cm3232.c @@ -374,7 +374,6 @@ static const struct i2c_device_id cm3232_id[] = { {} }; -#ifdef CONFIG_PM_SLEEP static int cm3232_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -403,9 +402,7 @@ static int cm3232_resume(struct device *dev) return ret; } -static const struct dev_pm_ops cm3232_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cm3232_suspend, cm3232_resume)}; -#endif +DEFINE_SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume); MODULE_DEVICE_TABLE(i2c, cm3232_id); @@ -419,9 +416,7 @@ static struct i2c_driver cm3232_driver = { .driver = { .name = "cm3232", .of_match_table = cm3232_of_match, -#ifdef CONFIG_PM_SLEEP - .pm = &cm3232_pm_ops, -#endif + .pm = pm_sleep_ptr(&cm3232_pm_ops), }, .id_table = cm3232_id, .probe = cm3232_probe, From patchwork Sun Jan 2 12:55: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: 12702239 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 3B69DC433EF for ; Sun, 2 Jan 2022 12:52:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232364AbiABMwC (ORCPT ); Sun, 2 Jan 2022 07:52:02 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42340 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiABMwB (ORCPT ); Sun, 2 Jan 2022 07:52:01 -0500 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 86E4760DB7 for ; Sun, 2 Jan 2022 12:52:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 56555C36AE7; Sun, 2 Jan 2022 12:51:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127921; bh=VwKHBsYNgk6zhXh5Mdfub28BjLcmEIcmSBaPveL8B2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sIyD1ab2jxaPi8xzwEjTAlVCY9x2P4NyJkLVaHSuKrXUkir9xV1pyVk941ZH96H/a QHaDLBwUp6PMjjHPndaGlfVzD8riwdoqi2gxYtuVLPqHXEv8VSukjMg2xZPKmMvwH2 5uSWcZlpljexaqbsXatVyRypbQcOMVfLpnY6+jmRjpMjmmq2S77NtMc86pRQbL/iyb ///KiQWhM9NxwqNgyyV7pBGqqfliswXcXdIuQ1Xio4jvK08YTEy8wrIWBbXRX4qWRp sRCOy+UT2lCMRPL1usnDq2Fj4Zaj7nBpoI57Hmb2p0sejKA0c38jO/8P1u8sPcg+J/ e60S2gHNagVFA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Anson Huang , Brian Masney Subject: [PATCH v2 25/51] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() Date: Sun, 2 Jan 2022 12:55:51 +0000 Message-Id: <20220102125617.1259804-26-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Anson Huang Cc: Brian Masney --- drivers/iio/light/isl29018.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 2689867467a8..55d068940e9f 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -784,7 +784,6 @@ static int isl29018_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int isl29018_suspend(struct device *dev) { struct isl29018_chip *chip = iio_priv(dev_get_drvdata(dev)); @@ -830,11 +829,7 @@ static int isl29018_resume(struct device *dev) return err; } -static SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); -#define ISL29018_PM_OPS (&isl29018_pm_ops) -#else -#define ISL29018_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); #ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] = { @@ -866,7 +861,7 @@ static struct i2c_driver isl29018_driver = { .driver = { .name = "isl29018", .acpi_match_table = ACPI_PTR(isl29018_acpi_match), - .pm = ISL29018_PM_OPS, + .pm = pm_sleep_ptr(&isl29018_pm_ops), .of_match_table = isl29018_of_match, }, .probe = isl29018_probe, From patchwork Sun Jan 2 12:55: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: 12702240 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 2F54BC433EF for ; Sun, 2 Jan 2022 12:52:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232341AbiABMwG (ORCPT ); Sun, 2 Jan 2022 07:52:06 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50728 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229555AbiABMwG (ORCPT ); Sun, 2 Jan 2022 07:52:06 -0500 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 06515B80CFC for ; Sun, 2 Jan 2022 12:52:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B30D5C36AEF; Sun, 2 Jan 2022 12:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127923; bh=VwPk5H64KUpKe+x0yB3Zc0wFvDFV6P5KJxSj7sBMFgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aWXBs7w+1o1bdPAWt8xSDgiWxZerYQHwFpA3NW+BMFDdbcEIbFT4kqiVPoYWGBq9S RkorO9NdlfJK6mE05/XLS6SC9Zzr3ku2u7bTny9Li8THv5ueC7/maqQRQRJyFFTfpT 6Dpm6dSnGEiNL91d2KNvDT0A+gNtoxkhbfMf7CJ3LCNF1XkzAhYyJm2fG+ceow3/l1 tXHSLVqPV01QjSB57gpDfnn7/ltJGPlQpCPkK6S8/rf81zniDTJKZWfEyA7pwGjOHD mCHmlxiJpYYKbHxSoxjVC2NR7DU9l4BzyqgtBgwnuOcP34mVHLXX4qpsDs2+MDRWy3 k/ir/0fTuQlxg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 26/51] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:52 +0000 Message-Id: <20220102125617.1259804-27-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/isl29125.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index ba53b50d711a..756015b5cfd6 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -311,7 +311,6 @@ static int isl29125_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int isl29125_suspend(struct device *dev) { struct isl29125_data *data = iio_priv(i2c_get_clientdata( @@ -326,9 +325,8 @@ static int isl29125_resume(struct device *dev) return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, data->conf1); } -#endif -static SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume); +DEFINE_SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume); static const struct i2c_device_id isl29125_id[] = { { "isl29125", 0 }, @@ -339,7 +337,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id); static struct i2c_driver isl29125_driver = { .driver = { .name = ISL29125_DRV_NAME, - .pm = &isl29125_pm_ops, + .pm = pm_sleep_ptr(&isl29125_pm_ops), }, .probe = isl29125_probe, .remove = isl29125_remove, From patchwork Sun Jan 2 12:55: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: 12702241 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 DFC87C433F5 for ; Sun, 2 Jan 2022 12:52:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229555AbiABMwJ (ORCPT ); Sun, 2 Jan 2022 07:52:09 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50776 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiABMwJ (ORCPT ); Sun, 2 Jan 2022 07:52:09 -0500 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 1C4FBB80D63 for ; Sun, 2 Jan 2022 12:52:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 608DEC36AEE; Sun, 2 Jan 2022 12:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127926; bh=crSk727opMIIZWe11Sihtf/JhL+JKMx8ihuRL+wXMB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UPdYI2tFHEy4KjKcBRAlaF1vLPVmlQ0vCImf/CotcHTQ46WZQQC3YTyEGrgzjFdGo fnSFniwCxo+O5Ykihho8/fVXI2hgSlNEUH5iaMZi3deS70p1lzREEsv7joHovZ3O0d mlsBCjhmpChlPMDb6eTSGOKLY2upiAtmzJ+4os7RRNnPGOklOYWSc3qUZ7cIXui5gl qWA/ph4xcEGYhXkf7Al8W+5rqmjbtbb9qam16pyfaOwhw716sIoKe3psGrPqB/ONhX Axv04JLk3nbfdJWpYspbEPmdCx4nDRFlCW2a2ePEF48MsSD9R9QvMdeMdZdZRfutU0 yjzXnupzvE4mw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 27/51] iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:53 +0000 Message-Id: <20220102125617.1259804-28-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/jsa1212.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/jsa1212.c b/drivers/iio/light/jsa1212.c index 724a0ec9f35c..4bf899337384 100644 --- a/drivers/iio/light/jsa1212.c +++ b/drivers/iio/light/jsa1212.c @@ -383,7 +383,6 @@ static int jsa1212_remove(struct i2c_client *client) return jsa1212_power_off(data); } -#ifdef CONFIG_PM_SLEEP static int jsa1212_suspend(struct device *dev) { struct jsa1212_data *data; @@ -421,12 +420,7 @@ static int jsa1212_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, jsa1212_resume); - -#define JSA1212_PM_OPS (&jsa1212_pm_ops) -#else -#define JSA1212_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, jsa1212_resume); static const struct acpi_device_id jsa1212_acpi_match[] = { {"JSA1212", 0}, @@ -443,7 +437,7 @@ MODULE_DEVICE_TABLE(i2c, jsa1212_id); static struct i2c_driver jsa1212_driver = { .driver = { .name = JSA1212_DRIVER_NAME, - .pm = JSA1212_PM_OPS, + .pm = pm_sleep_ptr(&jsa1212_pm_ops), .acpi_match_table = ACPI_PTR(jsa1212_acpi_match), }, .probe = jsa1212_probe, From patchwork Sun Jan 2 12:55: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: 12702242 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 A28C6C433EF for ; Sun, 2 Jan 2022 12:52:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232369AbiABMwM (ORCPT ); Sun, 2 Jan 2022 07:52:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232363AbiABMwL (ORCPT ); Sun, 2 Jan 2022 07:52:11 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C75C061574 for ; Sun, 2 Jan 2022 04:52:11 -0800 (PST) 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 6EF8BB80D61 for ; Sun, 2 Jan 2022 12:52:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 40622C36AF0; Sun, 2 Jan 2022 12:52:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127929; bh=9NnJ2ODFpPcmHDmuc4kajl0/dcmK4qqhOi2wuxxJugI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UcZ8rMibw1ndXMJORYF5e5gcPHZLIHJPKVesdoXh289L/TquL9vxkMNhy0xZOclq7 c1slgpZl5oyw69GoE+ucw/tNmNrUutA3cb5f02pmqQa33pS0PagSD6aGLpieqtw1Sq j3To8eI1s2NgXBWqJjqWzyqtEdd6k8y60LsP0Ya3IpMJeH21RriD2+lUaEn1A4YZsK mrUtQcdXrxbIkyijHo7DAQGcDp5+qxn3BPx0Z7ryOyyTzSL8au2Hd7k7xWi4MtldUt yHefQrG6quaFoFGmFl02JC9rv+tSD3V6/Fwep4dNZBR0MOsBZR8W0rrpM87KfvvvWK OkyC6GHDkRIog== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Maslov Dmitry Subject: [PATCH v2 28/51] iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:54 +0000 Message-Id: <20220102125617.1259804-29-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Maslov Dmitry --- drivers/iio/light/ltr501.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index 47d61ec2bb50..08d03101653f 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1611,7 +1611,6 @@ static int ltr501_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int ltr501_suspend(struct device *dev) { struct ltr501_data *data = iio_priv(i2c_get_clientdata( @@ -1627,9 +1626,8 @@ static int ltr501_resume(struct device *dev) return ltr501_write_contr(data, data->als_contr, data->ps_contr); } -#endif -static SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume); +DEFINE_SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume); static const struct acpi_device_id ltr_acpi_match[] = { {"LTER0501", ltr501}, @@ -1661,7 +1659,7 @@ static struct i2c_driver ltr501_driver = { .driver = { .name = LTR501_DRV_NAME, .of_match_table = ltr501_of_match, - .pm = <r501_pm_ops, + .pm = pm_sleep_ptr(<r501_pm_ops), .acpi_match_table = ACPI_PTR(ltr_acpi_match), }, .probe = ltr501_probe, From patchwork Sun Jan 2 12:55: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: 12702243 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 4011DC433EF for ; Sun, 2 Jan 2022 12:52:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232363AbiABMwO (ORCPT ); Sun, 2 Jan 2022 07:52:14 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50822 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbiABMwO (ORCPT ); Sun, 2 Jan 2022 07:52:14 -0500 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 82474B80CFC for ; Sun, 2 Jan 2022 12:52:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 982E1C36AEF; Sun, 2 Jan 2022 12:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127932; bh=OYXPc+gRbfWU+eZ65WIQfsD549fa2w+MG+zmau1eB4w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vI8oxpPajPmwj+QoTS2WSreOt4hh5e++ETWkaVb30dP7ukXu1I8ItKOEbh9K1RKgW 1xZ6fF3SeezjvzuaS+k4P035VEgBUUqf73Oa1wp+uU14y9T4GeflwkJ7zbPqHEOsRB O8Lm5t5sqqR/NdVs3MMo6IebaER9Erj6eJcQrt3Yoyc12LBmvjxH/A4+ToyBVZccWV 481pz19gJYr4AJW/nWPT2zeuRiHoQgDXwkUGsYJtXjLcKW4b+iQWRjTtEWTzXGZKGA BVq312+1h1yad5OOV36qSmmTd0NjXhd69sg10hjrk8y8PwFzqfHhgYKYzMr6unR53l MxMj9eRPlLYwQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Icenowy Zheng , Luca Weiss , Martijn Braam Subject: [PATCH v2 29/51] iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:55 +0000 Message-Id: <20220102125617.1259804-30-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Icenowy Zheng Cc: Luca Weiss Cc: Martijn Braam --- drivers/iio/light/stk3310.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index fc63856ed54d..36f8227ac800 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -632,7 +632,6 @@ static int stk3310_remove(struct i2c_client *client) return stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY); } -#ifdef CONFIG_PM_SLEEP static int stk3310_suspend(struct device *dev) { struct stk3310_data *data; @@ -656,12 +655,7 @@ static int stk3310_resume(struct device *dev) return stk3310_set_state(data, state); } -static SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); - -#define STK3310_PM_OPS (&stk3310_pm_ops) -#else -#define STK3310_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); static const struct i2c_device_id stk3310_i2c_id[] = { {"STK3310", 0}, @@ -692,7 +686,7 @@ static struct i2c_driver stk3310_driver = { .driver = { .name = "stk3310", .of_match_table = stk3310_of_match, - .pm = STK3310_PM_OPS, + .pm = pm_sleep_ptr(&stk3310_pm_ops), .acpi_match_table = ACPI_PTR(stk3310_acpi_id), }, .probe = stk3310_probe, From patchwork Sun Jan 2 12:55: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: 12702244 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 25287C433F5 for ; Sun, 2 Jan 2022 12:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232371AbiABMwP (ORCPT ); Sun, 2 Jan 2022 07:52:15 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42510 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbiABMwP (ORCPT ); Sun, 2 Jan 2022 07:52:15 -0500 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 28B1260DB7 for ; Sun, 2 Jan 2022 12:52:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A88F0C36AEE; Sun, 2 Jan 2022 12:52:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127934; bh=WnlP3Vb44vJMXTs8gAC08Z8FdES2VCfcNz5QDCKAVJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Jayjra7dO334s1Apg5KciIn8iciy85kE0eMm2ROrkmHOXZ2C5RWTRCRD+4G+yFF68 UKFKwU1Nb84fUF94yooQFYhQgj56u4qBqak2urpwKN10A7P6hMoj6OD0xbl5wVm97x 2NvHe2cociMXbexC0EcdwZy4BWjAI79P+qA1EvIuRzU0fuMaBUaGfNwsEtmLfwyPhF FVvtGM8qEkV3mD+32RHG27rDbKMlPQAiCOSgXR5CCzsjK0XyaQpAwz1f0EXrre+FWh 3FmR7nLtbbCOFJs0vCr7mS15cZvQJSoINwrBo87RDeLranlc3RqT8wRUqoyZNvQkAS 7LS/kA1sfXZbQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 30/51] iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:56 +0000 Message-Id: <20220102125617.1259804-31-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tcs3414.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c index b87222141429..3e0944c3e36f 100644 --- a/drivers/iio/light/tcs3414.c +++ b/drivers/iio/light/tcs3414.c @@ -345,7 +345,6 @@ static int tcs3414_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tcs3414_suspend(struct device *dev) { struct tcs3414_data *data = iio_priv(i2c_get_clientdata( @@ -360,9 +359,8 @@ static int tcs3414_resume(struct device *dev) return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL, data->control); } -#endif -static SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume); +DEFINE_SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume); static const struct i2c_device_id tcs3414_id[] = { { "tcs3414", 0 }, @@ -373,7 +371,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3414_id); static struct i2c_driver tcs3414_driver = { .driver = { .name = TCS3414_DRV_NAME, - .pm = &tcs3414_pm_ops, + .pm = pm_sleep_ptr(&tcs3414_pm_ops), }, .probe = tcs3414_probe, .id_table = tcs3414_id, From patchwork Sun Jan 2 12:55: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: 12702245 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 BE271C433F5 for ; Sun, 2 Jan 2022 12:52:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232262AbiABMwS (ORCPT ); Sun, 2 Jan 2022 07:52:18 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42532 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbiABMwS (ORCPT ); Sun, 2 Jan 2022 07:52:18 -0500 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 A79E660DB7 for ; Sun, 2 Jan 2022 12:52:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38ABFC36AE7; Sun, 2 Jan 2022 12:52:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127937; bh=Bf/pd/fiOKd/DtOINUcGbJE/viay5VGBRp0xOn+FqNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OH4otGdEkvTpyPFLM6OXc1sI0ZLLYNmkDjiZmZAUpq0e6Jq9G+d88HqHeM+IsOMwj zFqFPwQKdK1B/V7Qgzd6TwTVOrVRfmUjbSmMSJODLubGF4in+/TkyQKPitHB27abX0 gwkjU0/AAJWVvSFyrCYeu8XlI2PEwX78PGyJ6S222H+F1L9f5kQG2kz466XRhd0hTA Rg8QHBV82sDfPF0zv7Szfovs/SxAj0w0KcNkYY0LlQzFEc0xWHSUOMKDgwIVuSGBY3 UZPSRi2dXay943BBAHiu6UZVEObQVMH9uYIJQydEl6UtJOy7WmSPauqt4ZSTuqb/kd 4cHLC4ojf5QuQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 31/51] iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:57 +0000 Message-Id: <20220102125617.1259804-32-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tcs3472.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c index 371c6a39a165..a886b1cd11ce 100644 --- a/drivers/iio/light/tcs3472.c +++ b/drivers/iio/light/tcs3472.c @@ -572,7 +572,6 @@ static int tcs3472_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int tcs3472_suspend(struct device *dev) { struct tcs3472_data *data = iio_priv(i2c_get_clientdata( @@ -598,9 +597,8 @@ static int tcs3472_resume(struct device *dev) return ret; } -#endif -static SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume); +DEFINE_SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume); static const struct i2c_device_id tcs3472_id[] = { { "tcs3472", 0 }, @@ -611,7 +609,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3472_id); static struct i2c_driver tcs3472_driver = { .driver = { .name = TCS3472_DRV_NAME, - .pm = &tcs3472_pm_ops, + .pm = pm_sleep_ptr(&tcs3472_pm_ops), }, .probe = tcs3472_probe, .remove = tcs3472_remove, From patchwork Sun Jan 2 12:55: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: 12702246 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 16B13C433F5 for ; Sun, 2 Jan 2022 12:52:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232372AbiABMwV (ORCPT ); Sun, 2 Jan 2022 07:52:21 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42574 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbiABMwU (ORCPT ); Sun, 2 Jan 2022 07:52:20 -0500 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 9195E60E98 for ; Sun, 2 Jan 2022 12:52:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B08D1C36AF0; Sun, 2 Jan 2022 12:52:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127940; bh=/Z1TG5WRwvD6r/g9w+mv+ybatRDs4GbcGq34P7E0Onc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eTCQd6Z+Vk7Zz8TCIoBJ/BxfvQAsBDN8e0hjwVokjS0hEQV3ZsCu7pe76kW9XKWwj b4v6np/xer5o6s7OUHb7ChMaydEScTLPZ9XR2MVkrSdj3t2YS5fzB50e3r77UUF1iT A7B2AdyR15oamrsPHmUg4wsoTsM/gGlQCqDEmIIfidyTXjtrjnOYbe5X8JsDcnYAAm qDD2jgRh6W4GzbCQ/3tG5xXyNCS2aiuyjuVOx6IlFTc8QBeWgkFunWfW3xhNyK495h By1rX98voM7BdVurL9/AJy0httcVdE4V0IxSkktas0tTZv9uEYa0FtHCFoXvnLCqXh ECFRVJq9SJTJA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Vaishnav M A Subject: [PATCH v2 32/51] iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:58 +0000 Message-Id: <20220102125617.1259804-33-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Vaishnav M A --- drivers/iio/light/tsl2563.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index 5bf2bfbc5379..f3ad3158b199 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c @@ -814,7 +814,6 @@ static int tsl2563_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int tsl2563_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -857,11 +856,7 @@ static int tsl2563_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume); -#define TSL2563_PM_OPS (&tsl2563_pm_ops) -#else -#define TSL2563_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume); static const struct i2c_device_id tsl2563_id[] = { { "tsl2560", 0 }, @@ -885,7 +880,7 @@ static struct i2c_driver tsl2563_i2c_driver = { .driver = { .name = "tsl2563", .of_match_table = tsl2563_of_match, - .pm = TSL2563_PM_OPS, + .pm = pm_sleep_ptr(&tsl2563_pm_ops), }, .probe = tsl2563_probe, .remove = tsl2563_remove, From patchwork Sun Jan 2 12:55: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: 12702247 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 E5E68C433F5 for ; Sun, 2 Jan 2022 12:52:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232373AbiABMwZ (ORCPT ); Sun, 2 Jan 2022 07:52:25 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:50904 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbiABMwZ (ORCPT ); Sun, 2 Jan 2022 07:52:25 -0500 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 26030B80D61 for ; Sun, 2 Jan 2022 12:52:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8C605C36AEF; Sun, 2 Jan 2022 12:52:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127943; bh=hIk0ywvsDdMP/BkbsNBlWATUD+l01AY93ob+96I9Duc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HahNv9CaTvZbE1JyzwmGWTNi001ivmhD8GaSPENK195L4yCiIpcVmpmdCa/DvM6IS l+1sq+x1F5zETbdU3j/BbIv+tw7DgjgHyyLH1E7C+ULmYq5p+coSKd4k7k2GwJVilB aMoOiDGLD0SakqCOL1mcINH6GGgvp7JVv9E0GpsNd0zq8LJlw/T8M/44jaAttSyoPK m0Vu9CGwB5VNd1aYkQq5avKX3LUW+Z8bhammVxF3CEUjlVyqLPwB6nXmyUmZWODN0x vGhepVIwKaZ9EusB30hDdpQIu2tfemCVUDgpquim6bXc3dEfFTRWul34WDHDvpOjWM Y/ms9UUgxDjKw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 33/51] iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:55:59 +0000 Message-Id: <20220102125617.1259804-34-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tsl4531.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c index 70505ba6d858..637ae1a765fb 100644 --- a/drivers/iio/light/tsl4531.c +++ b/drivers/iio/light/tsl4531.c @@ -215,7 +215,6 @@ static int tsl4531_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int tsl4531_suspend(struct device *dev) { return tsl4531_powerdown(to_i2c_client(dev)); @@ -227,11 +226,7 @@ static int tsl4531_resume(struct device *dev) TSL4531_MODE_NORMAL); } -static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); -#define TSL4531_PM_OPS (&tsl4531_pm_ops) -#else -#define TSL4531_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); static const struct i2c_device_id tsl4531_id[] = { { "tsl4531", 0 }, @@ -242,7 +237,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id); static struct i2c_driver tsl4531_driver = { .driver = { .name = TSL4531_DRV_NAME, - .pm = TSL4531_PM_OPS, + .pm = pm_sleep_ptr(&tsl4531_pm_ops), }, .probe = tsl4531_probe, .remove = tsl4531_remove, From patchwork Sun Jan 2 12:56: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: 12702248 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 6E200C433EF for ; Sun, 2 Jan 2022 12:52:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232374AbiABMw1 (ORCPT ); Sun, 2 Jan 2022 07:52:27 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42642 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232279AbiABMw0 (ORCPT ); Sun, 2 Jan 2022 07:52:26 -0500 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 8361360DB7 for ; Sun, 2 Jan 2022 12:52:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7263C36AEE; Sun, 2 Jan 2022 12:52:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127946; bh=L8aHmyGD1HHVsREoZBI8NyJXu2QqgRt8FB6TZa5fteg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A84b+pYQenP0fedj/DSd7wvtfaGmrm4XbRg7FjC7EI5fmwwMfkGD2aIoXhVKuhzWL buHOEWd6VVqD82BSrkagnCW8pZh3awJ79kn9qlFGqJ861ZMzpcmuEmawSsGtzSajnu K2BhN7M3gaIwzFm6QTcCFq55azuW7jU7MUCmqk1oBjdFseRlMDlxpKSVvtGMYGeoif V3d7y3LdCoBZtoZwGvPCkwWtgUqx9q5SFIbJF1+giqz+Lk4YQpS2uylwlHsNoovmNt hDpJnpewwLM1Ujozdp/cAZZsIHbWWEvhcbW7Sx1oi9FmE1JLBVxt004LpAi6BGSrsA NsW5kxsI3+bmA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 34/51] iio:light:us5182: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:00 +0000 Message-Id: <20220102125617.1259804-35-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. 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 96e4a66ddf28..fdabf601d15e 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -916,7 +916,6 @@ static int us5182d_remove(struct i2c_client *client) return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); } -#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)); @@ -939,11 +938,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[] = { @@ -969,7 +967,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 Sun Jan 2 12:56: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: 12702249 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 2E91EC433F5 for ; Sun, 2 Jan 2022 12:52:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232279AbiABMwa (ORCPT ); Sun, 2 Jan 2022 07:52:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45076 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbiABMwa (ORCPT ); Sun, 2 Jan 2022 07:52:30 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34198C061574 for ; Sun, 2 Jan 2022 04:52:30 -0800 (PST) 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 CAEAF60E9B for ; Sun, 2 Jan 2022 12:52:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7ED94C36AF0; Sun, 2 Jan 2022 12:52:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127949; bh=+DJy83NSRGQhELyr2F69FbnstrJALz6NHbLXCMjy+/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mnJUwzXPxJpunvWJYbyBUAA1PKJT+vbrppBOysz7I0Z1C2cxPZmVsxmWmRSw0i+Cv D7iLzQZDTrEDUJ4Dkv1LsF5yd21GBD2xbGTcF+/4rePgR6Nt5JJPVMVmogAkf6jzZD cF/cBgzHM4aAr5PSSVLZ2G3ujYaFNMCAH/+HhYG1P7M/neW0zPuKfj7mMrPUzVGe9T 7So3CavcxKB3+KfHLiX04+uUQvTXJE4Qq7EQ3/jFCAXGWJ4l5cmqfOG/GM7oS742nY zFf1r3WIkj1X8mx7temvjz0JYP+I5gtr+I9ktiC6epMHb7z+HYga+0gUwtvOKBWLSp dCF8HQGm/97Rg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Matt Ranostay , Jonathan Albrieux , Linus Walleij Subject: [PATCH v2 35/51] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:01 +0000 Message-Id: <20220102125617.1259804-36-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Acked-by: Matt Ranostay Signed-off-by: Jonathan Cameron Cc: Jonathan Albrieux Cc: Linus Walleij --- drivers/iio/magnetometer/ak8975.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 55879a20ae52..103d2f751c9f 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -1033,7 +1033,6 @@ static int ak8975_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM static int ak8975_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -1074,13 +1073,10 @@ static int ak8975_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ static const struct dev_pm_ops ak8975_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(ak8975_runtime_suspend, - ak8975_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) + RUNTIME_PM_OPS(ak8975_runtime_suspend, ak8975_runtime_resume, NULL) }; static const struct i2c_device_id ak8975_id[] = { @@ -1113,7 +1109,7 @@ MODULE_DEVICE_TABLE(of, ak8975_of_match); static struct i2c_driver ak8975_driver = { .driver = { .name = "ak8975", - .pm = &ak8975_dev_pm_ops, + .pm = pm_ptr(&ak8975_dev_pm_ops), .of_match_table = ak8975_of_match, .acpi_match_table = ak_acpi_match, }, From patchwork Sun Jan 2 12:56: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: 12702250 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 162F1C433EF for ; Sun, 2 Jan 2022 12:52:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232375AbiABMwd (ORCPT ); Sun, 2 Jan 2022 07:52:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwd (ORCPT ); Sun, 2 Jan 2022 07:52:33 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EEB8C061574 for ; Sun, 2 Jan 2022 04:52:33 -0800 (PST) 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 A3A1E60DB7 for ; Sun, 2 Jan 2022 12:52:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F343CC36AE7; Sun, 2 Jan 2022 12:52:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127952; bh=M3Xm2SSNVNIjG86rcehOAZ8bZP3L/TMpj/DRiK0S5h8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eG6uLYlIUVfo5lIjCsKoNqv0l4elVgmkwvIT4bSLGVdot1GvnSjVYPz3kKsT+ujMs gFKGuzzsYLuXjiV7bueHjKg3MHrJqZvX/RyctGLCBADJW6cWvjICzEt7o/7yn8PJsf pRW/fhKXLrCF8bZZagnZqg6W9ZiQbEhVcIQPIUsT+Wo0zGldzCvWSOUS/qEyOGYTiz Pyts2DjjsXutUz+muCEhBi1M5EuUmgyVhUXsYUFY5mXdvqyKvsR75S6NofOk/+iBxv HSC5dpR8MDC7YHFF6YHZajaVeW3/lfAkhlefmasrshpOJnpgJodmZpk4yFMI1ieRBo 0DZHbv8JaZbjg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 36/51] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:02 +0000 Message-Id: <20220102125617.1259804-37-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mag3110.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c index 17c62d806218..7d4b87da29ef 100644 --- a/drivers/iio/magnetometer/mag3110.c +++ b/drivers/iio/magnetometer/mag3110.c @@ -573,7 +573,6 @@ static int mag3110_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int mag3110_suspend(struct device *dev) { struct mag3110_data *data = iio_priv(i2c_get_clientdata( @@ -623,11 +622,7 @@ static int mag3110_resume(struct device *dev) data->ctrl_reg1); } -static SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, mag3110_resume); -#define MAG3110_PM_OPS (&mag3110_pm_ops) -#else -#define MAG3110_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, mag3110_resume); static const struct i2c_device_id mag3110_id[] = { { "mag3110", 0 }, @@ -645,7 +640,7 @@ static struct i2c_driver mag3110_driver = { .driver = { .name = "mag3110", .of_match_table = mag3110_of_match, - .pm = MAG3110_PM_OPS, + .pm = pm_sleep_ptr(&mag3110_pm_ops), }, .probe = mag3110_probe, .remove = mag3110_remove, From patchwork Sun Jan 2 12:56: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: 12702251 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 419B8C433EF for ; Sun, 2 Jan 2022 12:52:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232376AbiABMwh (ORCPT ); Sun, 2 Jan 2022 07:52:37 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwh (ORCPT ); Sun, 2 Jan 2022 07:52:37 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63BDFC061574 for ; Sun, 2 Jan 2022 04:52:37 -0800 (PST) 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 1C982B80D62 for ; Sun, 2 Jan 2022 12:52:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AF7C36AEF; Sun, 2 Jan 2022 12:52:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127954; bh=iNnu+j6fhP+XT63LueJNlA6oGTuAnsesnFdh75UX5Uo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffparIASoEdv88jRU2EsxzPgGcE2NW5Yinao99T7cqsg407ZT5gjcFyukF7L2qrPb gJTxJdWflBCb1/8BJN2KvZryceOMlZ2ykZIYhnQlj0XbkSmxaSSjpSV3g4U+nTnH97 Gd58SxdujCELwTUVWrIH50TLrQV+Vx5suAkVY95vQztKsOyJ97v9/HqiDlZ/X1ZIzN JIkbOLzbWWhCaTUVh+64Y2hv73FaOKs0DQJsaGcpbranhlQgtjbCcsZM45xEj7Y4YB b1KMJO0dGbyb/DO6j4BbeGCTTwOCBbk05FiFCMJOEtHaOGo76C1/NAB6onDDCpTVe+ P6NZUAntAjAEQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 37/51] iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:03 +0000 Message-Id: <20220102125617.1259804-38-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also use SIMPLE_DEV_PM_OPS instead of open-coding the equivalent. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mmc35240.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 65f3d1ed0d59..97af02dc6245 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -521,7 +521,6 @@ static int mmc35240_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int mmc35240_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -548,11 +547,8 @@ static int mmc35240_resume(struct device *dev) return 0; } -#endif -static const struct dev_pm_ops mmc35240_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume) -}; +DEFINE_SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend, mmc35240_resume); static const struct of_device_id mmc35240_of_match[] = { { .compatible = "memsic,mmc35240", }, @@ -576,7 +572,7 @@ static struct i2c_driver mmc35240_driver = { .driver = { .name = MMC35240_DRV_NAME, .of_match_table = mmc35240_of_match, - .pm = &mmc35240_pm_ops, + .pm = pm_sleep_ptr(&mmc35240_pm_ops), .acpi_match_table = ACPI_PTR(mmc35240_acpi_match), }, .probe = mmc35240_probe, From patchwork Sun Jan 2 12:56: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: 12702252 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 A9FAEC433F5 for ; Sun, 2 Jan 2022 12:52:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232377AbiABMwk (ORCPT ); Sun, 2 Jan 2022 07:52:40 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:51056 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwk (ORCPT ); Sun, 2 Jan 2022 07:52:40 -0500 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 00047B80D63 for ; Sun, 2 Jan 2022 12:52:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 677B7C36AF0; Sun, 2 Jan 2022 12:52:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127957; bh=0cijYQo/NuB1+IvljjUKrjSxG4oYxAf34FLMjdK5nK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aExMEuRjbql08fBddxpO4CDUI19pQ09cJw+w1nJs4uw+IK8oxvldUFaeA2ifqwrf5 SU20aeV6ikmuHWxUGlCVBQwTTOnowwfnFV987jEVx6bjZ6SwaIHdGnArqhY04Tm2BV ac73OGCRQUWcsWpDOk0iHEmBd0mcZdXnfoXF9ZHiYqQRECRJu0ALvhw/2Iecgq1o2Q gYYylpO5B78h+5iJ/IKIMKPU7v7uR8J6wCuO305qDEA6f8xQy+NEzhlqZg+CSUqKhx X87i2Zj8FnXQlgreuXlvGLGBMZPN5TZSYs2LEmegapRYugCSy+cKkFp6c0O2JjFzxg iD4dS6hSBXmNw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 38/51] iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:04 +0000 Message-Id: <20220102125617.1259804-39-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/pressure/mpl3115.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c index e95b9a5475b4..e118d3067228 100644 --- a/drivers/iio/pressure/mpl3115.c +++ b/drivers/iio/pressure/mpl3115.c @@ -301,7 +301,6 @@ static int mpl3115_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int mpl3115_suspend(struct device *dev) { return mpl3115_standby(iio_priv(i2c_get_clientdata( @@ -317,11 +316,7 @@ static int mpl3115_resume(struct device *dev) data->ctrl_reg1); } -static SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume); -#define MPL3115_PM_OPS (&mpl3115_pm_ops) -#else -#define MPL3115_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume); static const struct i2c_device_id mpl3115_id[] = { { "mpl3115", 0 }, @@ -339,7 +334,7 @@ static struct i2c_driver mpl3115_driver = { .driver = { .name = "mpl3115", .of_match_table = mpl3115_of_match, - .pm = MPL3115_PM_OPS, + .pm = pm_sleep_ptr(&mpl3115_pm_ops), }, .probe = mpl3115_probe, .remove = mpl3115_remove, From patchwork Sun Jan 2 12:56: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: 12702253 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 383A0C433EF for ; Sun, 2 Jan 2022 12:52:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232378AbiABMwl (ORCPT ); Sun, 2 Jan 2022 07:52:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42832 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwl (ORCPT ); Sun, 2 Jan 2022 07:52:41 -0500 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 3100C60DB7 for ; Sun, 2 Jan 2022 12:52:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 483A3C36AEF; Sun, 2 Jan 2022 12:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127960; bh=AtYr1ZOo/ebcDefxLRUYJiT4S6AyOcE3IM5O0OparHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Va8sd8pmbaEGSjrQvVJz+2xeuw5V1YZo2ek1F+PKdMHUAeZLNjNUFJUF5b7LbHEzp AU9OouWPK1v39jT3OAfOamDiwAPnopdU5oEpDWzS1ApCuS+wChSE6bxSi5Vji/tGk4 lWO9dO4cCOiycjdmYwL0jtleI5CpWedO/7CMT2mvJtS62tD77cYVjaFFzv+SR1Yvi4 ZhAfa5EyMpbK3svWzhN/ctg5ZhIc8A3/rYyI2rMeUvTN6qcNJqLHPjVMjojY+ENmch 2K2+wGKvLAGOQYirfGT+ID0DINZFzTeEqc9RF771EyVd3rPQ147S7sAJmDYNlGmNQA xBH0nqMWkiKGw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Matt Ranostay Subject: [PATCH v2 39/51] iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:05 +0000 Message-Id: <20220102125617.1259804-40-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Acked-by: Matt Ranostay Signed-off-by: Jonathan Cameron Reviewed-by: Gwendal Grignou --- drivers/iio/proximity/as3935.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index 51f4f92ae84a..5716048e228c 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -295,7 +295,6 @@ static void calibrate_as3935(struct as3935_state *st) as3935_write(st, AS3935_NFLWDTH, st->nflwdth_reg); } -#ifdef CONFIG_PM_SLEEP static int as3935_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -337,12 +336,7 @@ static int as3935_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); -#define AS3935_PM_OPS (&as3935_pm_ops) - -#else -#define AS3935_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); static void as3935_stop_work(void *data) { @@ -472,7 +466,7 @@ static struct spi_driver as3935_driver = { .driver = { .name = "as3935", .of_match_table = as3935_of_match, - .pm = AS3935_PM_OPS, + .pm = pm_sleep_ptr(&as3935_pm_ops), }, .probe = as3935_probe, .id_table = as3935_id, From patchwork Sun Jan 2 12:56: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: 12702254 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 59F88C433EF for ; Sun, 2 Jan 2022 12:52:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232380AbiABMwo (ORCPT ); Sun, 2 Jan 2022 07:52:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwo (ORCPT ); Sun, 2 Jan 2022 07:52:44 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F841C061574 for ; Sun, 2 Jan 2022 04:52:44 -0800 (PST) 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 2068E60E98 for ; Sun, 2 Jan 2022 12:52:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 28612C36AF0; Sun, 2 Jan 2022 12:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127963; bh=OXH0/L9EFNfLVRZrQcq9nvs1DS+gwcC5JwTlBZPFF2w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sopTctIGec4JFzcteED9fzGs0caXqYj43oci3kxKzT5gUcfZJBcO0u0gVZOWJ3Wsb UnPK1CaqP5TRsagvArho8kg7a/RknXWQmIIjLg2r+lKKf69kaM8YJQqMshe+/cq+eg eop5/bm4IZ+ZnyATXpRG43H52qjXZc33gYSPMo1ADKSSiA1fnCQFZ7yejlQx6iL2zM J+0s205wr+zxW7FHVWklLpT7INnmQx5CgE1JGEGGK1vs2Hw8anWewAi8nzMC4p2wl2 KbbGVtJ17dPkXMukFcRpImS3rh1KsQyjsn4SJ3vHw78g6UfEvP3ieqmmTVg3WcYDeh 9XfN/HRk1/SzA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Matt Ranostay Subject: [PATCH v2 40/51] iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:06 +0000 Message-Id: <20220102125617.1259804-41-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Acked-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c index 27026c060ab9..648ae576d6fa 100644 --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c @@ -338,7 +338,6 @@ static const struct of_device_id lidar_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, lidar_dt_ids); -#ifdef CONFIG_PM static int lidar_pm_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -358,18 +357,16 @@ static int lidar_pm_runtime_resume(struct device *dev) return ret; } -#endif static const struct dev_pm_ops lidar_pm_ops = { - SET_RUNTIME_PM_OPS(lidar_pm_runtime_suspend, - lidar_pm_runtime_resume, NULL) + RUNTIME_PM_OPS(lidar_pm_runtime_suspend, lidar_pm_runtime_resume, NULL) }; static struct i2c_driver lidar_driver = { .driver = { .name = LIDAR_DRV_NAME, .of_match_table = lidar_dt_ids, - .pm = &lidar_pm_ops, + .pm = pm_ptr(&lidar_pm_ops), }, .probe = lidar_probe, .remove = lidar_remove, From patchwork Sun Jan 2 12:56: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: 12702255 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 BE204C433EF for ; Sun, 2 Jan 2022 12:52:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232382AbiABMws (ORCPT ); Sun, 2 Jan 2022 07:52:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwr (ORCPT ); Sun, 2 Jan 2022 07:52:47 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E776C061574 for ; Sun, 2 Jan 2022 04:52:47 -0800 (PST) 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 1DD3A60E98 for ; Sun, 2 Jan 2022 12:52:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F1E4C36AEF; Sun, 2 Jan 2022 12:52:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127966; bh=ewQh+yXqUqKE2qnkFV0FY5ol9QNzNU+E907FU2VBWNk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cvcd4+fAlwdqprXky0oCrH365rFwNGb1KzcLKQhJbcoV2SS9HZW1cKqot4vk0TD8M 6AJDMdWmGXfZeeOZURovEtd0nunOd/LdHZXLCi4bgWW1eMKvAIOdlrKAZv/8AZwe/j zTxKs0iF91YcLj9VJ5sTLkTw4imE0VZNXfPu2BAQJ58urLuh+8g27WWg6TJX1vYtm2 NZJggEcmwnfiYKMu5xQojMckdLUJFUVFz5uoB7qPKn3K8wjU9CZsHXzLHuMdyiI5Pw yaFWqN6nEakspcQQ2QbP/kJ4My0d6DY+iOUHAU4Mst0J1Pl0Tb87SL8CBIsv39zvxM 3+KkjRzj1CZdg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 41/51] iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:07 +0000 Message-Id: <20220102125617.1259804-42-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/proximity/rfd77402.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/proximity/rfd77402.c b/drivers/iio/proximity/rfd77402.c index 8c06d02139b6..4f594d71f15d 100644 --- a/drivers/iio/proximity/rfd77402.c +++ b/drivers/iio/proximity/rfd77402.c @@ -295,7 +295,6 @@ static int rfd77402_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int rfd77402_suspend(struct device *dev) { return rfd77402_powerdown(to_i2c_client(dev)); @@ -305,9 +304,8 @@ static int rfd77402_resume(struct device *dev) { return rfd77402_init(to_i2c_client(dev)); } -#endif -static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume); +DEFINE_SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume); static const struct i2c_device_id rfd77402_id[] = { { "rfd77402", 0}, @@ -318,7 +316,7 @@ MODULE_DEVICE_TABLE(i2c, rfd77402_id); static struct i2c_driver rfd77402_driver = { .driver = { .name = RFD77402_DRV_NAME, - .pm = &rfd77402_pm_ops, + .pm = pm_sleep_ptr(&rfd77402_pm_ops), }, .probe = rfd77402_probe, .id_table = rfd77402_id, From patchwork Sun Jan 2 12:56:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12702256 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 74207C433FE for ; Sun, 2 Jan 2022 12:52:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232381AbiABMwu (ORCPT ); Sun, 2 Jan 2022 07:52:50 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:42912 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwu (ORCPT ); Sun, 2 Jan 2022 07:52:50 -0500 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 2BA4060E98 for ; Sun, 2 Jan 2022 12:52:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 38F00C36AEF; Sun, 2 Jan 2022 12:52:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127969; bh=jT8yJlHLU6OsRfS6vM3QNXbyNLBjmK+bc7qZ3JI8xd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jfgqrU1RwZXD+c1onfVrYMlqJHB6Sli8tEGUQ7pdF0xxUeNlGKm1vGV61Dbt2LvY3 ovsdFO2gf80ri3rkrB8uavWAHJcJHQuuCD0twUfPEt4kHx1AhDoCPXiI8vNGpXz9r0 OEhMb/UG3tziYwL36hb7/JbKwAqNxdeuCCs71evYlGdNKRV/Jt1uBeURNAp8sIGraK p9jmAEKbbyZEtUyqXAmg04vG3UtOvamSF7oj51mZqGxEWPTO8HasTylCcmWH4WhhdV wHK8WCR5vhwMUIZq211ksvtblaCsjhhPp7HLvMYNbmpJIJMOLlYFQ+VKuU5KCl902Y Ojp6SKqmdiVSA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 42/51] iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:08 +0000 Message-Id: <20220102125617.1259804-43-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Reviewed-by: Gwendal Grignou --- drivers/iio/proximity/sx9500.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c index 3e4ddb2e8c2b..01bfd748d820 100644 --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c @@ -993,7 +993,6 @@ static int sx9500_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int sx9500_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -1030,11 +1029,8 @@ static int sx9500_resume(struct device *dev) return ret; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops sx9500_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume) -}; +DEFINE_SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume); static const struct acpi_device_id sx9500_acpi_match[] = { {"SSX9500", 0}, @@ -1060,7 +1056,7 @@ static struct i2c_driver sx9500_driver = { .name = SX9500_DRIVER_NAME, .acpi_match_table = ACPI_PTR(sx9500_acpi_match), .of_match_table = of_match_ptr(sx9500_of_match), - .pm = &sx9500_pm_ops, + .pm = pm_sleep_ptr(&sx9500_pm_ops), }, .probe = sx9500_probe, .remove = sx9500_remove, From patchwork Sun Jan 2 12:56: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: 12702257 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 1351DC433F5 for ; Sun, 2 Jan 2022 12:52:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232383AbiABMwx (ORCPT ); Sun, 2 Jan 2022 07:52:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMwx (ORCPT ); Sun, 2 Jan 2022 07:52:53 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39DFEC061574 for ; Sun, 2 Jan 2022 04:52:53 -0800 (PST) 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 CCCB060E9A for ; Sun, 2 Jan 2022 12:52:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 107EAC36AE7; Sun, 2 Jan 2022 12:52:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127972; bh=xfezNELutGTcG0K7t65QpD6LYBCoR8xNK/wZfk4v2g8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J6+GD1A78BbKg0XgS55Fa9iyOIQ2NKqDDkAFSI4aBDwnB1HHOJROmDTzsI6rV1TvC 8ge/uh/scOY9mWboole54ecD3sqt662jJgquXNoCCf8vsOfsx8Tn740toVE/yYTSyV QGC0pQVlbkzAV9KDWu7hvBqMc9N6EKIRRLOmF4/bLabBUhXMyb6aKAyE2ZpTGgir7L 8D5N9lzGi2Rzs45549ZHGRzxr8XLNCZuBeSjkdYQ2kglpgBIir2Yy7jKGKisRCy7CL EvsX9ku3Yh8CCN+A2bHrf5Q4d+xLzw781F0mtJxNU4iUFbBSR+yVhLWoe6qOaFXOi4 u8f3OP2Q9GP1Q== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 43/51] iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:09 +0000 Message-Id: <20220102125617.1259804-44-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/temperature/tmp006.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index e4943a0bc9aa..bb72df22d63b 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -261,7 +261,6 @@ static int tmp006_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tmp006_suspend(struct device *dev) { return tmp006_power(dev, false); @@ -271,9 +270,8 @@ static int tmp006_resume(struct device *dev) { return tmp006_power(dev, true); } -#endif -static SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); +DEFINE_SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); static const struct i2c_device_id tmp006_id[] = { { "tmp006", 0 }, @@ -284,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id); static struct i2c_driver tmp006_driver = { .driver = { .name = "tmp006", - .pm = &tmp006_pm_ops, + .pm = pm_sleep_ptr(&tmp006_pm_ops), }, .probe = tmp006_probe, .id_table = tmp006_id, From patchwork Sun Jan 2 12:56: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: 12702258 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 48F64C433F5 for ; Sun, 2 Jan 2022 12:52:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232384AbiABMw4 (ORCPT ); Sun, 2 Jan 2022 07:52:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMw4 (ORCPT ); Sun, 2 Jan 2022 07:52:56 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684C5C061574 for ; Sun, 2 Jan 2022 04:52:56 -0800 (PST) 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 0656960E9A for ; Sun, 2 Jan 2022 12:52:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B211DC36AEE; Sun, 2 Jan 2022 12:52:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127975; bh=RTGuq52F8z6ExADzGunQn3KRLpzrAb/KpNyG7Otixlw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c/C1oe8dMLsoMNFuZRpb9efR7mAx6SUD5l+fbApF7mP0f96th7IRGZIgj26Te6LEy DNP7JIKs2IxfDmO+mPveDlUG9ctyIfQptJVpgon0VUJBA62KinkHk7qaUBYD0H0FVG gySD/+uZdlVugCaJQJfzy+SdVA5WqTj9pNZPYvLJDAAJYSU9brjcgSLatag38EL+dD XZBArNG9mwETp0LRiABISjwzGCa7VVdETJrqqyuofoybrBibuRBzDR4FQ8SSzJfKIo /dflgNWbwg8iqaWee2jjDQq1XL4iWrz/rZG+cu1VFT2Bu8Mpwu/J11hy1UsZ7ClVUf xToa/rKraWezQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Manivannan Sadhasivam Subject: [PATCH v2 44/51] iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:10 +0000 Message-Id: <20220102125617.1259804-45-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Manivannan Sadhasivam Acked-by: Manivannan Sadhasivam --- drivers/iio/temperature/tmp007.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/temperature/tmp007.c b/drivers/iio/temperature/tmp007.c index b422371a4674..f7a040f0ee4c 100644 --- a/drivers/iio/temperature/tmp007.c +++ b/drivers/iio/temperature/tmp007.c @@ -537,7 +537,6 @@ static int tmp007_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP static int tmp007_suspend(struct device *dev) { struct tmp007_data *data = iio_priv(i2c_get_clientdata( @@ -554,9 +553,8 @@ static int tmp007_resume(struct device *dev) return i2c_smbus_write_word_swapped(data->client, TMP007_CONFIG, data->config | TMP007_CONFIG_CONV_EN); } -#endif -static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); +DEFINE_SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); static const struct of_device_id tmp007_of_match[] = { { .compatible = "ti,tmp007", }, @@ -574,7 +572,7 @@ static struct i2c_driver tmp007_driver = { .driver = { .name = "tmp007", .of_match_table = tmp007_of_match, - .pm = &tmp007_pm_ops, + .pm = pm_sleep_ptr(&tmp007_pm_ops), }, .probe = tmp007_probe, .id_table = tmp007_id, From patchwork Sun Jan 2 12:56: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: 12702259 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 67F44C433F5 for ; Sun, 2 Jan 2022 12:53:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232233AbiABMxB (ORCPT ); Sun, 2 Jan 2022 07:53:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45204 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxA (ORCPT ); Sun, 2 Jan 2022 07:53:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64C19C061574 for ; Sun, 2 Jan 2022 04:53:00 -0800 (PST) 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 20D77B80CFC for ; Sun, 2 Jan 2022 12:52:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DC8BDC36AF1; Sun, 2 Jan 2022 12:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127977; bh=lA3Ngi7s/856LrQ5xGdzJnLsQjiAr4PRqnBU1S6Sc84=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ft5sDpgTzEuFbCAdxsvPDUJ1jK+qDPvGf0SFRi9sQoNSsrm/9bYxp/nFByHGl3nhZ 80E1V4oCDHTLEM7CC9CSX8kBY8DvkUJbNZLLv+JqqFAFJybGpGKNMZ1pTsjppgs3qD M9ycnIvDu/8p+YmyJxX0+9D2DLirsnjmW+cxN/PeljuVfEO/jWQL/l9RzQnGn+05Th FtUGenUGJ2rdAN4S1DbZTTYtZmePGe90bkyyLsA/YTaA2LwUvA/PM9aa077loG1Thl guwfJfKgyiOLJusi2xntB3ZAl+kkT6oEOgkad2ijMkE6KLcDoLOGIMCAohHZYM09GN Ak2Xw5vSz4QJw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Matt Ranostay Subject: [PATCH v2 45/51] iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:11 +0000 Message-Id: <20220102125617.1259804-46-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Acked-by: Matt Ranostay Signed-off-by: Jonathan Cameron --- drivers/iio/chemical/atlas-sensor.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 04b44a327614..c489d5593ba0 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -737,7 +737,6 @@ static int atlas_remove(struct i2c_client *client) return atlas_set_powermode(data, 0); } -#ifdef CONFIG_PM static int atlas_runtime_suspend(struct device *dev) { struct atlas_data *data = @@ -753,18 +752,16 @@ static int atlas_runtime_resume(struct device *dev) return atlas_set_powermode(data, 1); } -#endif static const struct dev_pm_ops atlas_pm_ops = { - SET_RUNTIME_PM_OPS(atlas_runtime_suspend, - atlas_runtime_resume, NULL) + RUNTIME_PM_OPS(atlas_runtime_suspend, atlas_runtime_resume, NULL) }; static struct i2c_driver atlas_driver = { .driver = { .name = ATLAS_DRV_NAME, .of_match_table = atlas_dt_ids, - .pm = &atlas_pm_ops, + .pm = pm_ptr(&atlas_pm_ops), }, .probe = atlas_probe, .remove = atlas_remove, From patchwork Sun Jan 2 12:56: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: 12702260 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 BF4E4C433FE for ; Sun, 2 Jan 2022 12:53:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbiABMxC (ORCPT ); Sun, 2 Jan 2022 07:53:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45208 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxB (ORCPT ); Sun, 2 Jan 2022 07:53:01 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88D94C061574 for ; Sun, 2 Jan 2022 04:53:01 -0800 (PST) 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 2817F60DB7 for ; Sun, 2 Jan 2022 12:53:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 725E1C36AE7; Sun, 2 Jan 2022 12:52:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127980; bh=bnWvFctZXx/SWLo2yWO3MfCmGW7XgjkIULl4o+2FpkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CRNe9036YOpBXnuEBWihDoARwLW0CO72qa43ERmC862btZbHkbUFj5FWXIVDP3tm9 hVGdUawgY0yGtDFv5Thv7vlwvwukCJ5wKBrDVxeTTnFsa2tCLY8Zj0KSWJqPZq76l/ mduEBwSREjAH3Pf++erjthTpnKtUmsDijz8aBbqUti4HTvI4YNnVJBMSB+becR5xQS o63GnYsTk5qGawS/jJcGoG+76R/Q6LQg2KTzGsWYDhsguYRE8wrA9YBHg6LS5n0NQJ PHP6k8O/1Ofv2Zn/wsfrO2b59kfvaK7E1jHTczlBILja1zdB6ZRJVWKnRxUpxKJqHh hkKLyDvp0bSUA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 46/51] iio:accel:stk8312: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:12 +0000 Message-Id: <20220102125617.1259804-47-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8312.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/stk8312.c b/drivers/iio/accel/stk8312.c index de0cdf8c1f94..48d9090862e0 100644 --- a/drivers/iio/accel/stk8312.c +++ b/drivers/iio/accel/stk8312.c @@ -611,7 +611,6 @@ static int stk8312_remove(struct i2c_client *client) return stk8312_set_mode(data, STK8312_MODE_STANDBY); } -#ifdef CONFIG_PM_SLEEP static int stk8312_suspend(struct device *dev) { struct stk8312_data *data; @@ -630,12 +629,7 @@ static int stk8312_resume(struct device *dev) return stk8312_set_mode(data, data->mode | STK8312_MODE_ACTIVE); } -static SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, stk8312_resume); - -#define STK8312_PM_OPS (&stk8312_pm_ops) -#else -#define STK8312_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(stk8312_pm_ops, stk8312_suspend, stk8312_resume); static const struct i2c_device_id stk8312_i2c_id[] = { /* Deprecated in favour of lowercase form */ @@ -648,7 +642,7 @@ MODULE_DEVICE_TABLE(i2c, stk8312_i2c_id); static struct i2c_driver stk8312_driver = { .driver = { .name = STK8312_DRIVER_NAME, - .pm = STK8312_PM_OPS, + .pm = pm_sleep_ptr(&stk8312_pm_ops), }, .probe = stk8312_probe, .remove = stk8312_remove, From patchwork Sun Jan 2 12: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: 12702261 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 DCBB6C433EF for ; Sun, 2 Jan 2022 12:53:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229699AbiABMxE (ORCPT ); Sun, 2 Jan 2022 07:53:04 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:43092 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxD (ORCPT ); Sun, 2 Jan 2022 07:53:03 -0500 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 93C4460E9A for ; Sun, 2 Jan 2022 12:53:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1EF8AC36AEF; Sun, 2 Jan 2022 12:53:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127983; bh=EBKsbqi/xnSuX+xKn8qJJDhcpjMG4aDqCZs4UXVnHMM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UpqAvqrFmR2As39WAiOp1I27iVFlBK321tqT0zGSGg8Dg29ecnN0brA/BAdLcjqTf aNPVWsxAk+6aeNl23Vn75pFuIR/Rp9eC2Lv3aIsuGgHVVNK2wR8pScfgL7SHNT6y0m PglhSXKX2QIBrhIfGkvuBrgxozJoZRWR97sqpweA6+C8t8MYHgv11tcvxTiszrbW02 wG7j23qdmohf8lUH0Wl58GLxGj9y6v94+aujXRdtmPUSg2NbqFG9zQGSKqOR6VHC1f JmTr3h3L3Y3pPvAW1GQKchhYSMjGdfZBrdYzpI8TjOLT+Dw0qES8+/NEK6Kgd3zzzC 4iZTHw4qdZ0rg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 47/51] iio:accel:bma180: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:13 +0000 Message-Id: <20220102125617.1259804-48-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/bma180.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c index d8a454c266d5..4d99c61bec82 100644 --- a/drivers/iio/accel/bma180.c +++ b/drivers/iio/accel/bma180.c @@ -1065,7 +1065,6 @@ static int bma180_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int bma180_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -1092,11 +1091,7 @@ static int bma180_resume(struct device *dev) return ret; } -static SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); -#define BMA180_PM_OPS (&bma180_pm_ops) -#else -#define BMA180_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(bma180_pm_ops, bma180_suspend, bma180_resume); static const struct i2c_device_id bma180_ids[] = { { "bma023", BMA023 }, @@ -1137,7 +1132,7 @@ MODULE_DEVICE_TABLE(of, bma180_of_match); static struct i2c_driver bma180_driver = { .driver = { .name = "bma180", - .pm = BMA180_PM_OPS, + .pm = pm_sleep_ptr(&bma180_pm_ops), .of_match_table = bma180_of_match, }, .probe = bma180_probe, From patchwork Sun Jan 2 12: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: 12702262 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 2A68BC433EF for ; Sun, 2 Jan 2022 12:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232388AbiABMxH (ORCPT ); Sun, 2 Jan 2022 07:53:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxH (ORCPT ); Sun, 2 Jan 2022 07:53:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D750C061574 for ; Sun, 2 Jan 2022 04:53:06 -0800 (PST) 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 0BEDB60E98 for ; Sun, 2 Jan 2022 12:53:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75CADC36AE7; Sun, 2 Jan 2022 12:53:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127985; bh=iVNVOB5dBCjaDkLRpeqAFeMbwTFjhUuwPDEV/AhmVw0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lci1gFqMraQcwVnrU18pHqvZ4LcqIdBFl+KKWudIoBTHc6cC+CahhTk/YpB+JTgYL ez7yXGzWnuW0b+GnQPyQB4CYgjKYYG6TBfYvOO3dkwGe6G61+wlmL/y7UiQVSugZ9C Solu6o/JtvKzNi2CryaKcBfHV5DUwV9EmApYwGPC4loGWahXaSJtCSqUqTrSHQc3hW H8vvad1Cq84/6biqN+s3i9bOqxFSjw3fH8wtlCjqYxg66UHc0c9g4JOxBMuQawcQe3 02fdlHKlOMwbsN5Y/E4f2ABOFPOc6A64vL9REG+XYdzDmdSXgUykfX5SIwslW91ef8 cksnT9T8rQ/4w== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 48/51] iio:dac:m62332: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr() etc Date: Sun, 2 Jan 2022 12:56:14 +0000 Message-Id: <20220102125617.1259804-49-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/dac/m62332.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c index 225b1a374dc1..4a413936fabb 100644 --- a/drivers/iio/dac/m62332.c +++ b/drivers/iio/dac/m62332.c @@ -124,7 +124,6 @@ static int m62332_write_raw(struct iio_dev *indio_dev, return -EINVAL; } -#ifdef CONFIG_PM_SLEEP static int m62332_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -156,11 +155,7 @@ static int m62332_resume(struct device *dev) return m62332_set_value(indio_dev, data->save[1], 1); } -static SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume); -#define M62332_PM_OPS (&m62332_pm_ops) -#else -#define M62332_PM_OPS NULL -#endif +DEFINE_SIMPLE_DEV_PM_OPS(m62332_pm_ops, m62332_suspend, m62332_resume); static const struct iio_info m62332_info = { .read_raw = m62332_read_raw, @@ -246,7 +241,7 @@ MODULE_DEVICE_TABLE(i2c, m62332_id); static struct i2c_driver m62332_driver = { .driver = { .name = "m62332", - .pm = M62332_PM_OPS, + .pm = pm_sleep_ptr(&m62332_pm_ops), }, .probe = m62332_probe, .remove = m62332_remove, From patchwork Sun Jan 2 12: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: 12702263 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 1A604C433F5 for ; Sun, 2 Jan 2022 12:53:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbiABMxL (ORCPT ); Sun, 2 Jan 2022 07:53:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxK (ORCPT ); Sun, 2 Jan 2022 07:53:10 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88EF4C061574 for ; Sun, 2 Jan 2022 04:53:10 -0800 (PST) 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 479E5B80D63 for ; Sun, 2 Jan 2022 12:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E72D8C36AEE; Sun, 2 Jan 2022 12:53:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127988; bh=DtfF42whwQdM0j8CLapkd97awWHo0IOCpOukAxl7rYY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gxvahdJtc7TK6Ifq3zd+usU0yonhux6RAtX1zKewLM5sF58wwrD7JsewBZ5KlIbqI HEXOlG1DlAdsy5v0hYfRM9OVQxSdtvMIjeVDO4Z2NXlLlrv+1i7iMsBBHrWHduN6os /vaTa3fGEsUUs8xcTzKeEb0tuoKtR2cqFxnaqdqVVCRqa55tMkFvpSK1UDdw6ysgRK euSiXSztxG3prd+s+EqcVrGYq9G9dfC4UOKR9RnXWrkOci5Dr0D6Rgw7stn19kxv6Y 1fv5jSnv4vI78xBWLz2+ERXuY34LwScZpYHXoQOUFwGxBuYwEcKSV+1suTTcCFoD2S tGKA/lSuneeyw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron Subject: [PATCH v2 49/51] iio:imu:kmx61: Switch from CONFIG_PM* guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:15 +0000 Message-Id: <20220102125617.1259804-50-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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 one or more of CONFIG_PM/CONFIG_PM_SLEEP 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. Signed-off-by: Jonathan Cameron --- drivers/iio/imu/kmx61.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/iio/imu/kmx61.c b/drivers/iio/imu/kmx61.c index 1dabfd615dab..20ac1b4c8923 100644 --- a/drivers/iio/imu/kmx61.c +++ b/drivers/iio/imu/kmx61.c @@ -1440,7 +1440,6 @@ static int kmx61_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP static int kmx61_suspend(struct device *dev) { int ret; @@ -1466,9 +1465,7 @@ static int kmx61_resume(struct device *dev) return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true); } -#endif -#ifdef CONFIG_PM static int kmx61_runtime_suspend(struct device *dev) { struct kmx61_data *data = i2c_get_clientdata(to_i2c_client(dev)); @@ -1493,11 +1490,10 @@ static int kmx61_runtime_resume(struct device *dev) return kmx61_set_mode(data, stby, KMX61_ACC | KMX61_MAG, true); } -#endif static const struct dev_pm_ops kmx61_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume) - SET_RUNTIME_PM_OPS(kmx61_runtime_suspend, kmx61_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(kmx61_suspend, kmx61_resume) + RUNTIME_PM_OPS(kmx61_runtime_suspend, kmx61_runtime_resume, NULL) }; static const struct acpi_device_id kmx61_acpi_match[] = { @@ -1518,7 +1514,7 @@ static struct i2c_driver kmx61_driver = { .driver = { .name = KMX61_DRV_NAME, .acpi_match_table = ACPI_PTR(kmx61_acpi_match), - .pm = &kmx61_pm_ops, + .pm = pm_ptr(&kmx61_pm_ops), }, .probe = kmx61_probe, .remove = kmx61_remove, From patchwork Sun Jan 2 12: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: 12702264 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 DF79AC433EF for ; Sun, 2 Jan 2022 12:53:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232398AbiABMxN (ORCPT ); Sun, 2 Jan 2022 07:53:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxN (ORCPT ); Sun, 2 Jan 2022 07:53:13 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5234FC061574 for ; Sun, 2 Jan 2022 04:53:12 -0800 (PST) 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 DF6FC60E9A for ; Sun, 2 Jan 2022 12:53:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DDA29C36AEF; Sun, 2 Jan 2022 12:53:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127991; bh=HRvI0cl6UM+KucQWgJJglscbV/wtlWnz1xOOGJipHVY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aaOm4L7UAeVCGoUS+ML2e+kHODiAJ6cgUaRPiBwfumKD6JqA5PNiqNJ3vSdu9duBx KEuy9ZbKKDkQguYdhKFhtnpyqP6fOGUnLSgTZ51r5dNOUhS2CliOd7gu4xwGHXaaUx TzJlnbJ+yQcGdmMrZ6y2h2JoJce0z1PvgDQO8lpeWHdKEVM9iNnLy6SPqqsG9T9I5m pelaBqjXNCNdpQiK9PE8NyquN6d7VRKSa1MCjgkt0Pt279zhFdvNTDwo9LG9pi4sKB JvStm3eBV3wBYLMYive8EdOePsWtToNhGiTjkOI7PafNjVQogBapUbqziUrE160SlY iJ7mMZKo+0MRw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Mikko Koivunen Subject: [PATCH v2 50/51] iio:light:rpr0521: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:16 +0000 Message-Id: <20220102125617.1259804-51-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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. Signed-off-by: Jonathan Cameron Cc: Mikko Koivunen --- drivers/iio/light/rpr0521.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/rpr0521.c b/drivers/iio/light/rpr0521.c index c2dd8a3d4217..dabdd05f0e2c 100644 --- a/drivers/iio/light/rpr0521.c +++ b/drivers/iio/light/rpr0521.c @@ -1055,7 +1055,6 @@ static int rpr0521_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM static int rpr0521_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -1101,11 +1100,9 @@ static int rpr0521_runtime_resume(struct device *dev) return 0; } -#endif static const struct dev_pm_ops rpr0521_pm_ops = { - SET_RUNTIME_PM_OPS(rpr0521_runtime_suspend, - rpr0521_runtime_resume, NULL) + RUNTIME_PM_OPS(rpr0521_runtime_suspend, rpr0521_runtime_resume, NULL) }; static const struct acpi_device_id rpr0521_acpi_match[] = { @@ -1124,7 +1121,7 @@ MODULE_DEVICE_TABLE(i2c, rpr0521_id); static struct i2c_driver rpr0521_driver = { .driver = { .name = RPR0521_DRV_NAME, - .pm = &rpr0521_pm_ops, + .pm = pm_ptr(&rpr0521_pm_ops), .acpi_match_table = ACPI_PTR(rpr0521_acpi_match), }, .probe = rpr0521_probe, From patchwork Sun Jan 2 12: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: 12702265 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 A5984C433F5 for ; Sun, 2 Jan 2022 12:53:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232392AbiABMxR (ORCPT ); Sun, 2 Jan 2022 07:53:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229800AbiABMxQ (ORCPT ); Sun, 2 Jan 2022 07:53:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 976DBC061574 for ; Sun, 2 Jan 2022 04:53:16 -0800 (PST) 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 53388B80CFC for ; Sun, 2 Jan 2022 12:53:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF721C36AEE; Sun, 2 Jan 2022 12:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1641127994; bh=NXGCqhpA4V02FvHV/HtPTdxXUoCgs599E1Ecxm7h+2M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=P8Q3bAyOK3gmYc1pveXXs2DE4rMXbXy+efOafBD83tuNNY7Bm9l30ZRjHt/oKono2 SJtSGDVhEFDynjII+mdqoXeR5XzlLID4BU7d+Z0Wtf67Zj6IKm3L/eIW+1hJ1OXuwh 3VNbM2fLrf/8/Qwz8X3rKWteSPCAHf+cYh6AplQZBt4Lywyf8BlNLmsr3TsxiKTu1I szEa3TvYpeQOXlxjQg4Rrug17jYgXhIoimfkdXnxCJIIob+oPseBsEhsMwoZJt2tuf +WKpSsJWYavMotSaNcwC6ZjWDlhSB4WrAmVrtwRvaCHmij5UJQiA6BPR7aFEdvpJ9F TJJpsMlsvkEnQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , Arnd Bergmann , "Rafael J . Wysocki" , Gwendal Grignou , Jonathan Cameron , Crt Mori Subject: [PATCH v2 51/51] iio:temperature:mlx90614: Switch from CONFIG_PM* guards to pm_ptr() etc Date: Sun, 2 Jan 2022 12:56:17 +0000 Message-Id: <20220102125617.1259804-52-jic23@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220102125617.1259804-1-jic23@kernel.org> References: <20220102125617.1259804-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 one or more of CONFIG_PM/CONFIG_PM_SLEEP 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. Signed-off-by: Jonathan Cameron Cc: Crt Mori --- drivers/iio/temperature/mlx90614.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/temperature/mlx90614.c b/drivers/iio/temperature/mlx90614.c index afcb10ea7c44..c253a5315988 100644 --- a/drivers/iio/temperature/mlx90614.c +++ b/drivers/iio/temperature/mlx90614.c @@ -600,7 +600,6 @@ static const struct of_device_id mlx90614_of_match[] = { }; MODULE_DEVICE_TABLE(of, mlx90614_of_match); -#ifdef CONFIG_PM_SLEEP static int mlx90614_pm_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -630,9 +629,7 @@ static int mlx90614_pm_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM static int mlx90614_pm_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); @@ -648,19 +645,18 @@ static int mlx90614_pm_runtime_resume(struct device *dev) return mlx90614_wakeup(data); } -#endif static const struct dev_pm_ops mlx90614_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) - SET_RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend, - mlx90614_pm_runtime_resume, NULL) + SYSTEM_SLEEP_PM_OPS(mlx90614_pm_suspend, mlx90614_pm_resume) + RUNTIME_PM_OPS(mlx90614_pm_runtime_suspend, + mlx90614_pm_runtime_resume, NULL) }; static struct i2c_driver mlx90614_driver = { .driver = { .name = "mlx90614", .of_match_table = mlx90614_of_match, - .pm = &mlx90614_pm_ops, + .pm = pm_ptr(&mlx90614_pm_ops), }, .probe = mlx90614_probe, .remove = mlx90614_remove,