From patchwork Sun Aug 7 19:20: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: 12938261 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 031EFC25B0D for ; Sun, 7 Aug 2022 19:10:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230425AbiHGTK2 (ORCPT ); Sun, 7 Aug 2022 15:10:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiHGTK1 (ORCPT ); Sun, 7 Aug 2022 15:10:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ECC49E9; Sun, 7 Aug 2022 12:10:26 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 623126106B; Sun, 7 Aug 2022 19:10:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B46BAC43140; Sun, 7 Aug 2022 19:10:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899425; bh=QTLLlefCz5Z9OfH0nMDPg+o3+GK31K/bzh/ApDlfM6w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DneIk8fBikzhBbedqT34anNO+pffCZtTbxi28swwo7b3iatEUjqed+WyhmDv1ivXr wi5t2+o84pC0bNnKnuouoqMOBXO/kuV0O6p9IZs2Z6bxHkXq1Y7q4UMwLDKLjNe0QO zk+8RAoQk/FqGwZTehmqjAqDw6JdoN3OCoFSggo4mfkIUYv7qmkF+Vr74JiNnm3LEs pEa3zv1rnV6Y24ZvaDYDq/vMgBuCBetTNGqQ3rzNSFMz/yGg8FN+RJPrwBmXxcfW7L cKN/n9oyzhPSbTdl4Ee492M5of0xHGhSnYBeFfv5WYZq4Sn8KvAWU/2uhAN4UWN0eR xJ7ZjE8EcBaAA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Paul Cercueil , Sean Nyekjaer , Rui Miguel Silva , Jean-Baptiste Maneyrol , Linus Walleij , Jonathan Cameron , "Rafael J . Wysocki" Subject: [PATCH 1/5] PM: core: Add EXPORT_NS_GPL_DEV_PM_OPS to avoid drivers rolling own. Date: Sun, 7 Aug 2022 20:20:34 +0100 Message-Id: <20220807192038.1039771-2-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org> References: <20220807192038.1039771-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Jonathan Cameron A driver wishing to export a struct dev_pm_ops with both suspend and runtime ops provided could use _EXPORT_DEV_PM_OPS() directly but that macro is not intended for use in drivers and requires non intuitive aspect such as passing "_gpl" as one parameter and the namespace as a string. As such just provide a macro to cover the GPL and NS case in a fashion that is in line with similar macros. Signed-off-by: Jonathan Cameron Cc: Paul Cercueil Cc: Rafael J. Wysocki --- include/linux/pm.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/pm.h b/include/linux/pm.h index 871c9c49ec9d..18856e0d23ac 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -407,6 +407,11 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \ #define EXPORT_NS_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \ _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", #ns) +#define EXPORT_NS_GPL_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \ + runtime_resume_fn, idle_fn, ns) \ + _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \ + runtime_resume_fn, idle_fn, "_gpl", #ns) + /* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */ #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ const struct dev_pm_ops __maybe_unused name = { \ From patchwork Sun Aug 7 19:20: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: 12938263 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 E139BC3F6B0 for ; Sun, 7 Aug 2022 19:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231137AbiHGTKf (ORCPT ); Sun, 7 Aug 2022 15:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229468AbiHGTKe (ORCPT ); Sun, 7 Aug 2022 15:10:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12C26E9; Sun, 7 Aug 2022 12:10:31 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 0F15CB80881; Sun, 7 Aug 2022 19:10:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 35E29C433D7; Sun, 7 Aug 2022 19:10:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899428; bh=SWYmC+RXEqVAhfGvwxF8wxf+4TJ1kWJbu7Ijmml8yxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpYWoK9vsVsQL2Koai5IUtVNTqCviehdshzBEjVvuz68N4YPBuPmws/FC3rLbnF4H XMdV5XW0tyAolg1eRHpznEAYY5k1GjumyHke0P8PytLbGOv6X/JIAmZsGCn5OH0PND l7RAyKqKZm47018PBIBlXWrUgsbIaBTL4A0YPhlLn9ATNCwKZydMMhzMCwDJhmLWw3 sUGZjpOj0k3dVANxOy+pPd9wG3tXQHhABHmEveB1tZU3sJcPDHNd177pZ4YBOkVLNv xO6a28hJed+1twTzfbSbGUoByeozW0pUu1Wbh2NZ6PqRVDtLKv0svKNiBNtBR7WYIB UiEE6FCHNKBkQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Paul Cercueil , Sean Nyekjaer , Rui Miguel Silva , Jean-Baptiste Maneyrol , Linus Walleij , Jonathan Cameron Subject: [PATCH 2/5] iio: accel: fxls8962af: Use new EXPORT_NS_GPL_DEV_PM_OPS() Date: Sun, 7 Aug 2022 20:20:35 +0100 Message-Id: <20220807192038.1039771-3-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org> References: <20220807192038.1039771-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Jonathan Cameron Using this macro allows the compiler to remove unused structures and callbacks if we are not building with CONFIG_PM* without needing __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Sean Nyekjaer Acked-by: Sean Nyekjaer --- drivers/iio/accel/fxls8962af-core.c | 17 +++++++---------- drivers/iio/accel/fxls8962af-i2c.c | 2 +- drivers/iio/accel/fxls8962af-spi.c | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/iio/accel/fxls8962af-core.c b/drivers/iio/accel/fxls8962af-core.c index 8874d6d61725..6c7dde4a1af9 100644 --- a/drivers/iio/accel/fxls8962af-core.c +++ b/drivers/iio/accel/fxls8962af-core.c @@ -1241,7 +1241,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq) } EXPORT_SYMBOL_NS_GPL(fxls8962af_core_probe, IIO_FXLS8962AF); -static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) +static int fxls8962af_runtime_suspend(struct device *dev) { struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); int ret; @@ -1255,14 +1255,14 @@ static int __maybe_unused fxls8962af_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused fxls8962af_runtime_resume(struct device *dev) +static int fxls8962af_runtime_resume(struct device *dev) { struct fxls8962af_data *data = iio_priv(dev_get_drvdata(dev)); return fxls8962af_active(data); } -static int __maybe_unused fxls8962af_suspend(struct device *dev) +static int fxls8962af_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct fxls8962af_data *data = iio_priv(indio_dev); @@ -1283,7 +1283,7 @@ static int __maybe_unused fxls8962af_suspend(struct device *dev) return 0; } -static int __maybe_unused fxls8962af_resume(struct device *dev) +static int fxls8962af_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct fxls8962af_data *data = iio_priv(indio_dev); @@ -1300,12 +1300,9 @@ static int __maybe_unused fxls8962af_resume(struct device *dev) return 0; } -const struct dev_pm_ops fxls8962af_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(fxls8962af_suspend, fxls8962af_resume) - SET_RUNTIME_PM_OPS(fxls8962af_runtime_suspend, - fxls8962af_runtime_resume, NULL) -}; -EXPORT_SYMBOL_NS_GPL(fxls8962af_pm_ops, IIO_FXLS8962AF); +EXPORT_NS_GPL_DEV_PM_OPS(fxls8962af_pm_ops, fxls8962af_suspend, fxls8962af_resume, + fxls8962af_runtime_suspend, fxls8962af_runtime_resume, NULL, + IIO_FXLS8962AF); MODULE_AUTHOR("Sean Nyekjaer "); MODULE_DESCRIPTION("NXP FXLS8962AF/FXLS8964AF accelerometer driver"); diff --git a/drivers/iio/accel/fxls8962af-i2c.c b/drivers/iio/accel/fxls8962af-i2c.c index 8fbadfea1620..22640eaebac7 100644 --- a/drivers/iio/accel/fxls8962af-i2c.c +++ b/drivers/iio/accel/fxls8962af-i2c.c @@ -45,7 +45,7 @@ static struct i2c_driver fxls8962af_driver = { .driver = { .name = "fxls8962af_i2c", .of_match_table = fxls8962af_of_match, - .pm = &fxls8962af_pm_ops, + .pm = pm_ptr(&fxls8962af_pm_ops), }, .probe_new = fxls8962af_probe, .id_table = fxls8962af_id, diff --git a/drivers/iio/accel/fxls8962af-spi.c b/drivers/iio/accel/fxls8962af-spi.c index 885b3ab7fcb5..a0d192211839 100644 --- a/drivers/iio/accel/fxls8962af-spi.c +++ b/drivers/iio/accel/fxls8962af-spi.c @@ -44,7 +44,7 @@ MODULE_DEVICE_TABLE(spi, fxls8962af_spi_id_table); static struct spi_driver fxls8962af_driver = { .driver = { .name = "fxls8962af_spi", - .pm = &fxls8962af_pm_ops, + .pm = pm_ptr(&fxls8962af_pm_ops), .of_match_table = fxls8962af_spi_of_match, }, .probe = fxls8962af_probe, From patchwork Sun Aug 7 19:20: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: 12938262 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 862FEC25B0C for ; Sun, 7 Aug 2022 19:10:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231274AbiHGTKf (ORCPT ); Sun, 7 Aug 2022 15:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231137AbiHGTKe (ORCPT ); Sun, 7 Aug 2022 15:10:34 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 382341AA; Sun, 7 Aug 2022 12:10:33 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C06A56104E; Sun, 7 Aug 2022 19:10:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26B4EC4314E; Sun, 7 Aug 2022 19:10:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899432; bh=pirJ+ql1B1CAfCYbpYqMg2PeXk7Wv/vK7QJQDYfM07U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bKANGeHJ/BQaudLikd0mgSFPdkZMOXJLB9rvQkJA30VlfoplirGPD/1xOiKDdygab JPmVgHS1tfydP6RLNs/kagndyPAaaX/TJLHPCjzhBJ11H9Mq7lxwRme5IC7C1e7HgX Tb37uEuhVAnBR7RAI5OAOmjfzff1MsRqhpzbzifJtKDGIbcg8ywFgzB+mc/2qRO7hN Ew65e48ukZA/7pKQWSdR/V8sycydNc1fxbrJZKmp3q6iR8bJ0jLGevXOp3YV9Nnl5/ Zbad1ydI++/6f2FSom6jCzAvMShEY9CxZV0hwClr4KGTSjvvy7FCxYjfV0gQdw/AQd nM7mTS2Y54fxg== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Paul Cercueil , Sean Nyekjaer , Rui Miguel Silva , Jean-Baptiste Maneyrol , Linus Walleij , Jonathan Cameron Subject: [PATCH 3/5] iio: gyro: fxas210002c: Move exports to IIO_FXAS210002C namespace. Date: Sun, 7 Aug 2022 20:20:36 +0100 Message-Id: <20220807192038.1039771-4-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org> References: <20220807192038.1039771-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Jonathan Cameron Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that brings by allowing the compiler to remove unused struct dev_pm_ops and callbacks without needing explicit __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Rui Miguel Silva Acked-by: Rui Miguel Silva --- drivers/iio/gyro/fxas21002c_core.c | 21 +++++++++------------ drivers/iio/gyro/fxas21002c_i2c.c | 3 ++- drivers/iio/gyro/fxas21002c_spi.c | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/iio/gyro/fxas21002c_core.c b/drivers/iio/gyro/fxas21002c_core.c index a36d71d9e3ea..9aee9096363f 100644 --- a/drivers/iio/gyro/fxas21002c_core.c +++ b/drivers/iio/gyro/fxas21002c_core.c @@ -998,7 +998,7 @@ int fxas21002c_core_probe(struct device *dev, struct regmap *regmap, int irq, return ret; } -EXPORT_SYMBOL_GPL(fxas21002c_core_probe); +EXPORT_SYMBOL_NS_GPL(fxas21002c_core_probe, IIO_FXAS21002C); void fxas21002c_core_remove(struct device *dev) { @@ -1009,9 +1009,9 @@ void fxas21002c_core_remove(struct device *dev) pm_runtime_disable(dev); pm_runtime_set_suspended(dev); } -EXPORT_SYMBOL_GPL(fxas21002c_core_remove); +EXPORT_SYMBOL_NS_GPL(fxas21002c_core_remove, IIO_FXAS21002C); -static int __maybe_unused fxas21002c_suspend(struct device *dev) +static int fxas21002c_suspend(struct device *dev) { struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); @@ -1021,7 +1021,7 @@ static int __maybe_unused fxas21002c_suspend(struct device *dev) return 0; } -static int __maybe_unused fxas21002c_resume(struct device *dev) +static int fxas21002c_resume(struct device *dev) { struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); int ret; @@ -1033,26 +1033,23 @@ static int __maybe_unused fxas21002c_resume(struct device *dev) return fxas21002c_mode_set(data, data->prev_mode); } -static int __maybe_unused fxas21002c_runtime_suspend(struct device *dev) +static int fxas21002c_runtime_suspend(struct device *dev) { struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); return fxas21002c_mode_set(data, FXAS21002C_MODE_READY); } -static int __maybe_unused fxas21002c_runtime_resume(struct device *dev) +static int fxas21002c_runtime_resume(struct device *dev) { struct fxas21002c_data *data = iio_priv(dev_get_drvdata(dev)); return fxas21002c_mode_set(data, FXAS21002C_MODE_ACTIVE); } -const struct dev_pm_ops fxas21002c_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(fxas21002c_suspend, fxas21002c_resume) - SET_RUNTIME_PM_OPS(fxas21002c_runtime_suspend, - fxas21002c_runtime_resume, NULL) -}; -EXPORT_SYMBOL_GPL(fxas21002c_pm_ops); +EXPORT_NS_GPL_DEV_PM_OPS(fxas21002c_pm_ops, fxas21002c_suspend, + fxas21002c_resume, fxas21002c_runtime_suspend, + fxas21002c_runtime_resume, NULL, IIO_FXAS21002C); MODULE_AUTHOR("Rui Miguel Silva "); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/gyro/fxas21002c_i2c.c b/drivers/iio/gyro/fxas21002c_i2c.c index a7807fd97483..241401a9dfea 100644 --- a/drivers/iio/gyro/fxas21002c_i2c.c +++ b/drivers/iio/gyro/fxas21002c_i2c.c @@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(of, fxas21002c_i2c_of_match); static struct i2c_driver fxas21002c_i2c_driver = { .driver = { .name = "fxas21002c_i2c", - .pm = &fxas21002c_pm_ops, + .pm = pm_ptr(&fxas21002c_pm_ops), .of_match_table = fxas21002c_i2c_of_match, }, .probe_new = fxas21002c_i2c_probe, @@ -67,3 +67,4 @@ module_i2c_driver(fxas21002c_i2c_driver); MODULE_AUTHOR("Rui Miguel Silva "); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("FXAS21002C I2C Gyro driver"); +MODULE_IMPORT_NS(IIO_FXAS21002C); diff --git a/drivers/iio/gyro/fxas21002c_spi.c b/drivers/iio/gyro/fxas21002c_spi.c index c3ac169facf9..4f633826547c 100644 --- a/drivers/iio/gyro/fxas21002c_spi.c +++ b/drivers/iio/gyro/fxas21002c_spi.c @@ -54,7 +54,7 @@ MODULE_DEVICE_TABLE(of, fxas21002c_spi_of_match); static struct spi_driver fxas21002c_spi_driver = { .driver = { .name = "fxas21002c_spi", - .pm = &fxas21002c_pm_ops, + .pm = pm_ptr(&fxas21002c_pm_ops), .of_match_table = fxas21002c_spi_of_match, }, .probe = fxas21002c_spi_probe, @@ -66,3 +66,4 @@ module_spi_driver(fxas21002c_spi_driver); MODULE_AUTHOR("Rui Miguel Silva "); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("FXAS21002C SPI Gyro driver"); +MODULE_IMPORT_NS(IIO_FXAS21002C); From patchwork Sun Aug 7 19:20: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: 12938265 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 B0619C3F6B0 for ; Sun, 7 Aug 2022 19:10:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234121AbiHGTKr (ORCPT ); Sun, 7 Aug 2022 15:10:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234789AbiHGTKj (ORCPT ); Sun, 7 Aug 2022 15:10:39 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B53DFE9; Sun, 7 Aug 2022 12:10:37 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 65538B80B84; Sun, 7 Aug 2022 19:10:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4028C433D6; Sun, 7 Aug 2022 19:10:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899435; bh=4u3tuq6QE45CRWWudKG3wLPtrd4o8hv7arsU7yB12/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QnY+1uKDQiRzZVzAOoV3JTxPJMBcwGmL3e2TZ6CAC3EQMHnCblchn4nrlPQ8Xnw2T HGdMuZYBUUll5Is9/QuDtjqCar8RHFashkEDkOot6BIJrTSjWtNbu8EcMdst9XVCLj qGqAPvBr/RnmNBYsizt7CTXv5DdW4y1Ut+DzJIjHPl3exisASRZnsxgCXMOZdvLvcj cQsiwAsiUkAjWMTzwUKG5J2TXr4yeXdK13P6MHe9wVdRoZ2k1+2vY+KY/d1PuB+e91 72SjUWOLk94z0/S9YhfMlwcyyvEOP5YqEbWVMVg+dUqeFot/f4DdyubTPRAT/VGoQB AwVFoTfGechVA== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Paul Cercueil , Sean Nyekjaer , Rui Miguel Silva , Jean-Baptiste Maneyrol , Linus Walleij , Jonathan Cameron Subject: [PATCH 4/5] iio: imu: inv_icm42600: Move exports to IIO_ICM42600 namespace Date: Sun, 7 Aug 2022 20:20:37 +0100 Message-Id: <20220807192038.1039771-5-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org> References: <20220807192038.1039771-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Jonathan Cameron As these exports are only relevant to core module and users in the bus specific modules, move them out of the main kernel namespace. Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that brings by allowing the compiler to remove unused struct dev_pm_ops and callbacks without needing explicit __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Jean-Baptiste Maneyrol --- .../iio/imu/inv_icm42600/inv_icm42600_core.c | 21 ++++++++----------- .../iio/imu/inv_icm42600/inv_icm42600_i2c.c | 3 ++- .../iio/imu/inv_icm42600/inv_icm42600_spi.c | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c index ca85fccc9839..2dce708e6272 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c @@ -41,7 +41,7 @@ const struct regmap_config inv_icm42600_regmap_config = { .ranges = inv_icm42600_regmap_ranges, .num_ranges = ARRAY_SIZE(inv_icm42600_regmap_ranges), }; -EXPORT_SYMBOL_GPL(inv_icm42600_regmap_config); +EXPORT_SYMBOL_NS_GPL(inv_icm42600_regmap_config, IIO_ICM42600); struct inv_icm42600_hw { uint8_t whoami; @@ -660,13 +660,13 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq, return devm_add_action_or_reset(dev, inv_icm42600_disable_pm, dev); } -EXPORT_SYMBOL_GPL(inv_icm42600_core_probe); +EXPORT_SYMBOL_NS_GPL(inv_icm42600_core_probe, IIO_ICM42600); /* * Suspend saves sensors state and turns everything off. * Check first if runtime suspend has not already done the job. */ -static int __maybe_unused inv_icm42600_suspend(struct device *dev) +static int inv_icm42600_suspend(struct device *dev) { struct inv_icm42600_state *st = dev_get_drvdata(dev); int ret; @@ -706,7 +706,7 @@ static int __maybe_unused inv_icm42600_suspend(struct device *dev) * System resume gets the system back on and restores the sensors state. * Manually put runtime power management in system active state. */ -static int __maybe_unused inv_icm42600_resume(struct device *dev) +static int inv_icm42600_resume(struct device *dev) { struct inv_icm42600_state *st = dev_get_drvdata(dev); int ret; @@ -739,7 +739,7 @@ static int __maybe_unused inv_icm42600_resume(struct device *dev) } /* Runtime suspend will turn off sensors that are enabled by iio devices. */ -static int __maybe_unused inv_icm42600_runtime_suspend(struct device *dev) +static int inv_icm42600_runtime_suspend(struct device *dev) { struct inv_icm42600_state *st = dev_get_drvdata(dev); int ret; @@ -761,7 +761,7 @@ static int __maybe_unused inv_icm42600_runtime_suspend(struct device *dev) } /* Sensors are enabled by iio devices, no need to turn them back on here. */ -static int __maybe_unused inv_icm42600_runtime_resume(struct device *dev) +static int inv_icm42600_runtime_resume(struct device *dev) { struct inv_icm42600_state *st = dev_get_drvdata(dev); int ret; @@ -774,12 +774,9 @@ static int __maybe_unused inv_icm42600_runtime_resume(struct device *dev) return ret; } -const struct dev_pm_ops inv_icm42600_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(inv_icm42600_suspend, inv_icm42600_resume) - SET_RUNTIME_PM_OPS(inv_icm42600_runtime_suspend, - inv_icm42600_runtime_resume, NULL) -}; -EXPORT_SYMBOL_GPL(inv_icm42600_pm_ops); +EXPORT_NS_GPL_DEV_PM_OPS(inv_icm42600_pm_ops, inv_icm42600_suspend, + inv_icm42600_resume, inv_icm42600_runtime_suspend, + inv_icm42600_runtime_resume, NULL, IIO_ICM42600); MODULE_AUTHOR("InvenSense, Inc."); MODULE_DESCRIPTION("InvenSense ICM-426xx device driver"); diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c index d4a692b838d0..4f96989ddf4a 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c @@ -93,7 +93,7 @@ static struct i2c_driver inv_icm42600_driver = { .driver = { .name = "inv-icm42600-i2c", .of_match_table = inv_icm42600_of_matches, - .pm = &inv_icm42600_pm_ops, + .pm = pm_ptr(&inv_icm42600_pm_ops), }, .probe_new = inv_icm42600_probe, }; @@ -102,3 +102,4 @@ module_i2c_driver(inv_icm42600_driver); MODULE_AUTHOR("InvenSense, Inc."); MODULE_DESCRIPTION("InvenSense ICM-426xx I2C driver"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(IIO_ICM42600); diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c index e6305e5fa975..486b46e53113 100644 --- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c +++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c @@ -89,7 +89,7 @@ static struct spi_driver inv_icm42600_driver = { .driver = { .name = "inv-icm42600-spi", .of_match_table = inv_icm42600_of_matches, - .pm = &inv_icm42600_pm_ops, + .pm = pm_ptr(&inv_icm42600_pm_ops), }, .probe = inv_icm42600_probe, }; @@ -98,3 +98,4 @@ module_spi_driver(inv_icm42600_driver); MODULE_AUTHOR("InvenSense, Inc."); MODULE_DESCRIPTION("InvenSense ICM-426xx SPI driver"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(IIO_ICM42600); From patchwork Sun Aug 7 19:20: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: 12938264 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 6F0BAC25B0C for ; Sun, 7 Aug 2022 19:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231890AbiHGTKq (ORCPT ); Sun, 7 Aug 2022 15:10:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234924AbiHGTKl (ORCPT ); Sun, 7 Aug 2022 15:10:41 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE037E9; Sun, 7 Aug 2022 12:10:40 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7EB9FB80DD0; Sun, 7 Aug 2022 19:10:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 838F2C433D7; Sun, 7 Aug 2022 19:10:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659899438; bh=9rg7R3Rqz04Tp0YCZJt9Ddj6gzPV5rJdfyKyf8ZZknY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jC4q9svuGITmI4V5Wyz+8A9ilFS6JjUcn9BGXY5Xq9/+pE5k8tdmsC8PhV+p/aok3 SROYuNrBdGbWNHgPRlCH7u20uLMtpScw34r0N6n6LXtg/PUSUo6s5oGy/a64Bg2W9a YVUM14GiW7ysQAUkybBHFK83ZVUl9KY3bg+ZYHSPtsn3sqog3Gmt5s4i02ucKBJIgF LULIujQbTgmpGOB5nCYfqsahcbt8tsQUUBMn39Pz0Mo1PqT8/i7lmp130lUvw5oQnQ gGtovT1+ADARkvLPHU8XFAIgQ5ZO9T2u3+z7eKvZYoGGPqpvNo2EUsoC5WIeyVW50T ZFzQqCZspujPQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org, "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Paul Cercueil , Sean Nyekjaer , Rui Miguel Silva , Jean-Baptiste Maneyrol , Linus Walleij , Jonathan Cameron Subject: [PATCH 5/5] iio: imu: inv_mpu: Move exports to IIO_MPU6050 namespace Date: Sun, 7 Aug 2022 20:20:38 +0100 Message-Id: <20220807192038.1039771-6-jic23@kernel.org> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220807192038.1039771-1-jic23@kernel.org> References: <20220807192038.1039771-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Jonathan Cameron As these exports are only relevant to core module and users in the bus specific modules, move them out of the main kernel namespace. Includes using EXPORT_NS_GPL_DEV_PM_OPS() and the simplifications that brings by allowing the compiler to remove unused struct dev_pm_ops and callbacks without needing explicit __maybe_unused markings. Signed-off-by: Jonathan Cameron Cc: Jean-Baptiste Maneyrol Cc: Linus Walleij Reviewed-by: Linus Walleij --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 18 ++++++++---------- drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c | 3 ++- drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c | 3 ++- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c index 86fbbe904050..27cbc07d6369 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1653,9 +1653,9 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name, inv_mpu6050_set_power_itg(st, false); return result; } -EXPORT_SYMBOL_GPL(inv_mpu_core_probe); +EXPORT_SYMBOL_NS_GPL(inv_mpu_core_probe, IIO_MPU6050); -static int __maybe_unused inv_mpu_resume(struct device *dev) +static int inv_mpu_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct inv_mpu6050_state *st = iio_priv(indio_dev); @@ -1687,7 +1687,7 @@ static int __maybe_unused inv_mpu_resume(struct device *dev) return result; } -static int __maybe_unused inv_mpu_suspend(struct device *dev) +static int inv_mpu_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct inv_mpu6050_state *st = iio_priv(indio_dev); @@ -1730,7 +1730,7 @@ static int __maybe_unused inv_mpu_suspend(struct device *dev) return result; } -static int __maybe_unused inv_mpu_runtime_suspend(struct device *dev) +static int inv_mpu_runtime_suspend(struct device *dev) { struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev)); unsigned int sensors; @@ -1755,7 +1755,7 @@ static int __maybe_unused inv_mpu_runtime_suspend(struct device *dev) return ret; } -static int __maybe_unused inv_mpu_runtime_resume(struct device *dev) +static int inv_mpu_runtime_resume(struct device *dev) { struct inv_mpu6050_state *st = iio_priv(dev_get_drvdata(dev)); int ret; @@ -1767,11 +1767,9 @@ static int __maybe_unused inv_mpu_runtime_resume(struct device *dev) return inv_mpu6050_set_power_itg(st, true); } -const struct dev_pm_ops inv_mpu_pmops = { - SET_SYSTEM_SLEEP_PM_OPS(inv_mpu_suspend, inv_mpu_resume) - SET_RUNTIME_PM_OPS(inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL) -}; -EXPORT_SYMBOL_GPL(inv_mpu_pmops); +EXPORT_NS_GPL_DEV_PM_OPS(inv_mpu_pmops, inv_mpu_suspend, inv_mpu_resume, + inv_mpu_runtime_suspend, inv_mpu_runtime_resume, NULL, + IIO_MPU6050); MODULE_AUTHOR("Invensense Corporation"); MODULE_DESCRIPTION("Invensense device MPU6050 driver"); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c index 2aa647704a79..f89164fabf4b 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_i2c.c @@ -269,7 +269,7 @@ static struct i2c_driver inv_mpu_driver = { .of_match_table = inv_of_match, .acpi_match_table = inv_acpi_match, .name = "inv-mpu6050-i2c", - .pm = &inv_mpu_pmops, + .pm = pm_ptr(&inv_mpu_pmops), }, }; @@ -278,3 +278,4 @@ module_i2c_driver(inv_mpu_driver); MODULE_AUTHOR("Invensense Corporation"); MODULE_DESCRIPTION("Invensense device MPU6050 driver"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(IIO_MPU6050); diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c index e6107b0cc38f..89f46c2f213d 100644 --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_spi.c @@ -154,7 +154,7 @@ static struct spi_driver inv_mpu_driver = { .of_match_table = inv_of_match, .acpi_match_table = inv_acpi_match, .name = "inv-mpu6000-spi", - .pm = &inv_mpu_pmops, + .pm = pm_ptr(&inv_mpu_pmops), }, }; @@ -163,3 +163,4 @@ module_spi_driver(inv_mpu_driver); MODULE_AUTHOR("Adriana Reus "); MODULE_DESCRIPTION("Invensense device MPU6000 driver"); MODULE_LICENSE("GPL"); +MODULE_IMPORT_NS(IIO_MPU6050);