From patchwork Sun Feb 20 18:15: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: 12752810 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 EFEF2C433EF for ; Sun, 20 Feb 2022 18:08:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244478AbiBTSJK (ORCPT ); Sun, 20 Feb 2022 13:09:10 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:40700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237476AbiBTSJK (ORCPT ); Sun, 20 Feb 2022 13:09:10 -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 D63D9527E3 for ; Sun, 20 Feb 2022 10:08:48 -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 722AA60EA9 for ; Sun, 20 Feb 2022 18:08:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4BC73C340F3; Sun, 20 Feb 2022 18:08:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380527; bh=ZjcP+fAD4lesyu6D6XafiSMG8G9UoSOm58Q9T7rTJ/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HWq2SeTE2QB+dqOrVyIay+MylZe2yPjo+JyB4gvp7vnIS30t7MdCJnFD5tdgK30Yp JxlMSrRQrRL8s5aZFPQqvOesdVX1WiEDoSPfvodTJklLyOg/MdZTB/T3c3S+IDXWDB QCFx0/ldOsDrIsd+GVlqKDd50Ieu2J5jzlwlgpp/puUbMRW5uLoQ6gCQJ7s3B4VeIZ kivsQ2F1xyuy7AH872zBCT4GqN3T0+2GlyW+hn3fNoy0GSBvLiBdQBW0mNcYUjqBAR gJfIQ1LDmrCgN6/Sal6/VU43AEcWm0HH/XKPaxRn1KuylxfLuKaJwR8QCTmxcPatlR aglJVKj4WZTIw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 1/8] iio: chemical: scd30: Export dev_pm_ops instead of suspend() and resume() Date: Sun, 20 Feb 2022 18:15:15 +0000 Message-Id: <20220220181522.541718-2-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Whilst here move to the new infrastructure using pm_sleep_ptr() and EXPORT_DEV_PM_OPS() so as to let the compiler remove the unused code if CONFIG_SLEEP is not defined. Signed-off-by: Jonathan Cameron Cc: Tomasz Duszynski --- drivers/iio/chemical/scd30.h | 5 +---- drivers/iio/chemical/scd30_core.c | 8 ++++---- drivers/iio/chemical/scd30_i2c.c | 2 +- drivers/iio/chemical/scd30_serial.c | 2 +- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/drivers/iio/chemical/scd30.h b/drivers/iio/chemical/scd30.h index f60127bfe0f4..1ac9f3f79271 100644 --- a/drivers/iio/chemical/scd30.h +++ b/drivers/iio/chemical/scd30.h @@ -68,10 +68,7 @@ struct scd30_state { scd30_command_t command; }; -int scd30_suspend(struct device *dev); -int scd30_resume(struct device *dev); - -static __maybe_unused SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume); +extern const struct dev_pm_ops scd30_pm_ops; int scd30_probe(struct device *dev, int irq, const char *name, void *priv, scd30_command_t command); diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index 9fe6bbe9ee04..6c6c11c2772a 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -517,7 +517,7 @@ static const struct iio_chan_spec scd30_channels[] = { IIO_CHAN_SOFT_TIMESTAMP(3), }; -int __maybe_unused scd30_suspend(struct device *dev) +static int scd30_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct scd30_state *state = iio_priv(indio_dev); @@ -529,9 +529,8 @@ int __maybe_unused scd30_suspend(struct device *dev) return regulator_disable(state->vdd); } -EXPORT_SYMBOL(scd30_suspend); -int __maybe_unused scd30_resume(struct device *dev) +static int scd30_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct scd30_state *state = iio_priv(indio_dev); @@ -543,7 +542,8 @@ int __maybe_unused scd30_resume(struct device *dev) return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp); } -EXPORT_SYMBOL(scd30_resume); + +EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume); static void scd30_stop_meas(void *data) { diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c index 875892a070ee..7c332e4e8e46 100644 --- a/drivers/iio/chemical/scd30_i2c.c +++ b/drivers/iio/chemical/scd30_i2c.c @@ -128,7 +128,7 @@ static struct i2c_driver scd30_i2c_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = scd30_i2c_of_match, - .pm = &scd30_pm_ops, + .pm = pm_sleep_ptr(&scd30_pm_ops), }, .probe_new = scd30_i2c_probe, }; diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c index 568b34486c44..8664f3ce6b33 100644 --- a/drivers/iio/chemical/scd30_serial.c +++ b/drivers/iio/chemical/scd30_serial.c @@ -252,7 +252,7 @@ static struct serdev_device_driver scd30_serdev_driver = { .driver = { .name = KBUILD_MODNAME, .of_match_table = scd30_serdev_of_match, - .pm = &scd30_pm_ops, + .pm = pm_sleep_ptr(&scd30_pm_ops), }, .probe = scd30_serdev_probe, }; From patchwork Sun Feb 20 18:15: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: 12752811 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 5430CC433F5 for ; Sun, 20 Feb 2022 18:08:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237476AbiBTSJP (ORCPT ); Sun, 20 Feb 2022 13:09:15 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244482AbiBTSJO (ORCPT ); Sun, 20 Feb 2022 13:09:14 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5175C527E3 for ; Sun, 20 Feb 2022 10:08: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 ams.source.kernel.org (Postfix) with ESMTPS id 14B43B80DAD for ; Sun, 20 Feb 2022 18:08:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 896FBC340F0; Sun, 20 Feb 2022 18:08:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380530; bh=Vy/rE6jW/gLwIq9M04Ry+5g5a6fATgcJy2+KHhwSYPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X/DRQJnxACslKGYxERXr+b4k1NfOPUSWjY2mmj6orDbsHftinnvgisv94kDi0PoY2 e2El4/dUzx2anGxJIL9dpxxPIrIckXQRX444sMVIE1fapgw4L6VNb0PNoE5hUdmmn8 0mGzDoFztVgoPwHmjVLWzN76gD4ZMRJ/drH7jFFQA/0aPCmx8TeiJGBYQFlvZPOTLh aChCHdjY8LG8r7gTSNIxl2OCoHrqJqdEr9aY3ZR7x5sH6kQxPhQUZDwONQOipzKCoq J7HtZVgijg9U2GQ33IZNEH1k1tHrWn93BVBxUzrQhkRDVuJVYZgpnvIe4/TcpT3grg xu0WBmlkpekBg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron , "Rafael J . Wysocki" Subject: [PATCH 2/8] PM: core: Add NS varients of EXPORT[_GPL]_SIMPLE_DEV_PM_OPS and runtime pm equiv Date: Sun, 20 Feb 2022 18:15:16 +0000 Message-Id: <20220220181522.541718-3-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron As more drivers start to use namespaces, we need to have varients of these useful macros that allow the export to be in a particular namespace. Signed-off-by: Jonathan Cameron Cc: Paul Cercueil Cc: Rafael J. Wysocki --- include/linux/pm.h | 14 +++++++++----- include/linux/pm_runtime.h | 10 ++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/include/linux/pm.h b/include/linux/pm.h index f7d2be686359..112b8125d4be 100644 --- a/include/linux/pm.h +++ b/include/linux/pm.h @@ -368,13 +368,13 @@ const struct dev_pm_ops name = { \ #ifdef CONFIG_PM #define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \ - runtime_resume_fn, idle_fn, sec) \ + runtime_resume_fn, idle_fn, sec, ns) \ _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \ runtime_resume_fn, idle_fn); \ - _EXPORT_SYMBOL(name, sec) + __EXPORT_SYMBOL(name, sec, ns) #else #define _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, runtime_suspend_fn, \ - runtime_resume_fn, idle_fn, sec) \ + runtime_resume_fn, idle_fn, sec, ns) \ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \ resume_fn, runtime_suspend_fn, \ runtime_resume_fn, idle_fn) @@ -391,9 +391,13 @@ static __maybe_unused _DEFINE_DEV_PM_OPS(__static_##name, suspend_fn, \ _DEFINE_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL) #define EXPORT_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ - _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "") + _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", "") #define EXPORT_GPL_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ - _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl") + _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "_gpl", "") +#define EXPORT_NS_SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn, ns) \ + _EXPORT_DEV_PM_OPS(name, suspend_fn, resume_fn, NULL, NULL, NULL, "", #ns) +#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) /* Deprecated. Use DEFINE_SIMPLE_DEV_PM_OPS() instead. */ #define SIMPLE_DEV_PM_OPS(name, suspend_fn, resume_fn) \ diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 9f09601c465a..6a8b9551ecad 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -41,10 +41,16 @@ #define EXPORT_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \ - suspend_fn, resume_fn, idle_fn, "") + suspend_fn, resume_fn, idle_fn, "", "") #define EXPORT_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn) \ _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \ - suspend_fn, resume_fn, idle_fn, "_gpl") + suspend_fn, resume_fn, idle_fn, "_gpl", "") +#define EXPORT_NS_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \ + _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \ + suspend_fn, resume_fn, idle_fn, "", #ns) +#define EXPORT_NS_GPL_RUNTIME_DEV_PM_OPS(name, suspend_fn, resume_fn, idle_fn, ns) \ + _EXPORT_DEV_PM_OPS(name, pm_runtime_force_suspend, pm_runtime_force_resume, \ + suspend_fn, resume_fn, idle_fn, "_gpl", #ns) #ifdef CONFIG_PM extern struct workqueue_struct *pm_wq; From patchwork Sun Feb 20 18:15: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: 12752812 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 4DB17C433EF for ; Sun, 20 Feb 2022 18:08:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244485AbiBTSJR (ORCPT ); Sun, 20 Feb 2022 13:09:17 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41214 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244482AbiBTSJR (ORCPT ); Sun, 20 Feb 2022 13:09:17 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9547527E3 for ; Sun, 20 Feb 2022 10:08:55 -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 6FD05B801BC for ; Sun, 20 Feb 2022 18:08:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 698D0C340F4; Sun, 20 Feb 2022 18:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380533; bh=sgiBlcb8DRSoGepw38+5vb+HoqjBBxFIQNn38CWPE8A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pu8fCHbZqkcfU3/mnsyCx/9JSZA5UT2PcnIKdadCzzwTxSMg/dLT4dJTzXf13S9uJ clDhEhLhhxOyHhA6FKnTejb/VVPXvfcXLgXuKwGwJmLaCcGeZeBwGQZMvycNoP390n u05AQMh1s6MEpcK7+b9nUZQAmihkEVfnOu/Ouwa46jdYEU9HQj6L2ZgAku+CnV5NfB c1/MyUqW1haz29ZLmE0PX04qPSeE5oRGV1OP+SEWgOI6cV2Rko7rVS6gKuHi87gjpD Gh0APR4suTBD+aIEb3lupWwxEOISYmUGorJuS5u4MTqdfZPD3DvvIMZ+lpX64aBZpj JtHZesbgya0rQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 3/8] iio: chemical: scd30: Move symbol exports into IIO_SCD30 namespace Date: Sun, 20 Feb 2022 18:15:17 +0000 Message-Id: <20220220181522.541718-4-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Avoid unnecessary pollution of the global symbol namespace by moving library functions in to a specific namespace and import that into the drivers that make use of the functions. For more info: https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron Cc: Tomasz Duszynski --- drivers/iio/chemical/scd30_core.c | 4 ++-- drivers/iio/chemical/scd30_i2c.c | 1 + drivers/iio/chemical/scd30_serial.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c index 6c6c11c2772a..682fca39d14d 100644 --- a/drivers/iio/chemical/scd30_core.c +++ b/drivers/iio/chemical/scd30_core.c @@ -543,7 +543,7 @@ static int scd30_resume(struct device *dev) return scd30_command_write(state, CMD_START_MEAS, state->pressure_comp); } -EXPORT_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume); +EXPORT_NS_SIMPLE_DEV_PM_OPS(scd30_pm_ops, scd30_suspend, scd30_resume, IIO_SCD30); static void scd30_stop_meas(void *data) { @@ -759,7 +759,7 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv, return devm_iio_device_register(dev, indio_dev); } -EXPORT_SYMBOL(scd30_probe); +EXPORT_SYMBOL_NS(scd30_probe, IIO_SCD30); MODULE_AUTHOR("Tomasz Duszynski "); MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor core driver"); diff --git a/drivers/iio/chemical/scd30_i2c.c b/drivers/iio/chemical/scd30_i2c.c index 7c332e4e8e46..bae479a4721f 100644 --- a/drivers/iio/chemical/scd30_i2c.c +++ b/drivers/iio/chemical/scd30_i2c.c @@ -137,3 +137,4 @@ module_i2c_driver(scd30_i2c_driver); MODULE_AUTHOR("Tomasz Duszynski "); MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor i2c driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_SCD30); diff --git a/drivers/iio/chemical/scd30_serial.c b/drivers/iio/chemical/scd30_serial.c index 8664f3ce6b33..3c519103d30b 100644 --- a/drivers/iio/chemical/scd30_serial.c +++ b/drivers/iio/chemical/scd30_serial.c @@ -261,3 +261,4 @@ module_serdev_device_driver(scd30_serdev_driver); MODULE_AUTHOR("Tomasz Duszynski "); MODULE_DESCRIPTION("Sensirion SCD30 carbon dioxide sensor serial driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_SCD30); From patchwork Sun Feb 20 18:15:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12752813 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 BDB1CC433F5 for ; Sun, 20 Feb 2022 18:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244487AbiBTSJU (ORCPT ); Sun, 20 Feb 2022 13:09:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244483AbiBTSJU (ORCPT ); Sun, 20 Feb 2022 13:09:20 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44FF0527E4 for ; Sun, 20 Feb 2022 10:08:58 -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 02E72B80DB6 for ; Sun, 20 Feb 2022 18:08:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6C9DC340F0; Sun, 20 Feb 2022 18:08:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380535; bh=ZB+E68/y2Kg6QLc9ZngVDgd4utPwtOCAJ8s5gN4BIwM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bp9d0mFZHd8G5zEuyd0FdHPAorg/eF1fTZiJIeega6yDlB5ssDEu9v6Spqspr/Z88 /jpJqbtrTVbwUDp2erO4XPpnujQrL14UWliy2LKGUAkBMdAsZPcYge44HtsSy6InHL kpyHviwT0wE9id6JsNlfha15eigmTq3YV2etCCMTWcT9GxMSETYxlPMOgfSKVOWQi6 9yIjgPQxye+VfYIWuNpW6ZSzpGdy6P0vy7fAVb3JQiiv/umURVqTdvy4uepMsadTFz NyzqUj6D4hOqw85EwGFqYo7RBo+NoIGRe45jqzXSuEmCWfFu1C22pWHcNa/jjUibDT +N8DDuyBaI/hQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 4/8] iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() etc Date: Sun, 20 Feb 2022 18:15:18 +0000 Message-Id: <20220220181522.541718-5-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-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 | 11 ++--------- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c index c8dc52f11037..d57f264bd6c8 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 a06a3a273de7..3870334488a6 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 3975860331a6..ba99649fe195 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_NS(kxsd9_common_remove, IIO_KXSD9); -#ifdef CONFIG_PM static int kxsd9_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -508,15 +507,9 @@ 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) -}; -EXPORT_SYMBOL_NS(kxsd9_dev_pm_ops, IIO_KXSD9); +EXPORT_NS_RUNTIME_DEV_PM_OPS(kxsd9_dev_pm_ops, kxsd9_runtime_suspend, + kxsd9_runtime_resume, NULL, IIO_KXSD9); MODULE_AUTHOR("Jonathan Cameron "); MODULE_DESCRIPTION("Kionix KXSD9 driver"); From patchwork Sun Feb 20 18:15:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12752814 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 4DA50C433EF for ; Sun, 20 Feb 2022 18:09:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244483AbiBTSJV (ORCPT ); Sun, 20 Feb 2022 13:09:21 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41448 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244482AbiBTSJU (ORCPT ); Sun, 20 Feb 2022 13:09:20 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C84A1527E5 for ; Sun, 20 Feb 2022 10:08:58 -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 64A5D60EAD for ; Sun, 20 Feb 2022 18:08:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3BCDFC340F3; Sun, 20 Feb 2022 18:08:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380537; bh=2iXfLSnOGHN18cCAxfVu5mLWkvsET2SM53fEYfb7dQc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=De0MdeCW7iXEscCgmf9Nfdgo0CCZBLfM9aTmTBCFrVbfkMOGIxzcY3J5MrDUKT3fq THfawEh7jmqKXthJTfzoGb9uNVRjZ05/c6Kj/abeub5qXNLmnvEuQAvcg3Y2Ng586y rw6jz4VtYnKW8+LT1oOf17+S0AVoAE8oeTi2hitNS2K4kV31BRKgu0AU5QbQGxp/Ce xSKxgM33PzulGQVC7Og5AwlLHlLdNjWdgRO2Urohu5OSprz0s94NrwS0NiooQLAOhy a0ORU2rWna5U3j4hGQcqnVRG3REAJSNPu5MC8//Fg/OEw8+rmy5JS0oLfK6yPNR7OF D3XFyjnd3cO2w== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 5/8] iio: humidity: hts221: Use EXPORT_SIMPLE_DEV_PM_OPS() to allow compiler to remove dead code. Date: Sun, 20 Feb 2022 18:15:19 +0000 Message-Id: <20220220181522.541718-6-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron If CONFIG_PM_SLEEP is not defined using EXPORT_SIMPLE_DEV_PM_OPS() in conjunction with pm_sleep_ptr() allows the compiler to remove the unused code and data. This removes the need for __maybe_unused markings etc. Signed-off-by: Jonathan Cameron Cc: Lorenzo Bianconi --- drivers/iio/humidity/hts221_core.c | 9 +++------ drivers/iio/humidity/hts221_i2c.c | 2 +- drivers/iio/humidity/hts221_spi.c | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c index 6a39615b6961..da9c08432ef2 100644 --- a/drivers/iio/humidity/hts221_core.c +++ b/drivers/iio/humidity/hts221_core.c @@ -670,7 +670,7 @@ int hts221_probe(struct device *dev, int irq, const char *name, } EXPORT_SYMBOL(hts221_probe); -static int __maybe_unused hts221_suspend(struct device *dev) +static int hts221_suspend(struct device *dev) { struct iio_dev *iio_dev = dev_get_drvdata(dev); struct hts221_hw *hw = iio_priv(iio_dev); @@ -680,7 +680,7 @@ static int __maybe_unused hts221_suspend(struct device *dev) FIELD_PREP(HTS221_ENABLE_MASK, false)); } -static int __maybe_unused hts221_resume(struct device *dev) +static int hts221_resume(struct device *dev) { struct iio_dev *iio_dev = dev_get_drvdata(dev); struct hts221_hw *hw = iio_priv(iio_dev); @@ -694,10 +694,7 @@ static int __maybe_unused hts221_resume(struct device *dev) return err; } -const struct dev_pm_ops hts221_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(hts221_suspend, hts221_resume) -}; -EXPORT_SYMBOL(hts221_pm_ops); +EXPORT_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_DESCRIPTION("STMicroelectronics hts221 sensor driver"); diff --git a/drivers/iio/humidity/hts221_i2c.c b/drivers/iio/humidity/hts221_i2c.c index cab39c4756f8..933b05e4d972 100644 --- a/drivers/iio/humidity/hts221_i2c.c +++ b/drivers/iio/humidity/hts221_i2c.c @@ -62,7 +62,7 @@ MODULE_DEVICE_TABLE(i2c, hts221_i2c_id_table); static struct i2c_driver hts221_driver = { .driver = { .name = "hts221_i2c", - .pm = &hts221_pm_ops, + .pm = pm_sleep_ptr(&hts221_pm_ops), .of_match_table = hts221_i2c_of_match, .acpi_match_table = ACPI_PTR(hts221_acpi_match), }, diff --git a/drivers/iio/humidity/hts221_spi.c b/drivers/iio/humidity/hts221_spi.c index 729e86e433b1..888c5eab944c 100644 --- a/drivers/iio/humidity/hts221_spi.c +++ b/drivers/iio/humidity/hts221_spi.c @@ -55,7 +55,7 @@ MODULE_DEVICE_TABLE(spi, hts221_spi_id_table); static struct spi_driver hts221_driver = { .driver = { .name = "hts221_spi", - .pm = &hts221_pm_ops, + .pm = pm_sleep_ptr(&hts221_pm_ops), .of_match_table = hts221_spi_of_match, }, .probe = hts221_spi_probe, From patchwork Sun Feb 20 18:15:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12752815 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 85C46C433EF for ; Sun, 20 Feb 2022 18:09:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244482AbiBTSJY (ORCPT ); Sun, 20 Feb 2022 13:09:24 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244488AbiBTSJY (ORCPT ); Sun, 20 Feb 2022 13:09:24 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9CEF2527FB for ; Sun, 20 Feb 2022 10:09:02 -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 4A02AB80D9C for ; Sun, 20 Feb 2022 18:09:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6014AC340F0; Sun, 20 Feb 2022 18:08:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380540; bh=d0wPJssQ3/6yGjmPjbgos22DqYLXiNXaGgTbNCdWQYs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N18JUaOob0OjnvOPsyTyaTTpirrShBCyPH5cSqGYKWEtAHJft4cIQkSoWyGXD3+Tn fF5oxnnp9m7YBTITpYWVurSvBGSn8ROxYTTW74DLgWLYA2du2FS1FjfebjLcqHl2ys TGUNVz22qTANg9jFRvRy2C+SIzm8o8QZng1oKMU6MY38zUVqAy3LYwWH9SEDS2Xkhf CudR3JaBrvjoeOGx45PYnrY9DvcfKsbqeI4O1lQG4z/EhwmiUyKGG4vVOFE8zg9wv3 P8+hKkhRjfq5WQw1El3muRpicVuU2+S857CYsLuRvCM2FB2gL1GXQgeteEs/XmUlXj MhDWcxJ+pR27A== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 6/8] iio: humidity: hts221: Move symbol exports into IIO_HTS221 namespace Date: Sun, 20 Feb 2022 18:15:20 +0000 Message-Id: <20220220181522.541718-7-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Avoid unnecessary pollution of the global symbol namespace by moving library functions in to a specific namespace and import that into the drivers that make use of the functions. For more info: https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron Cc: Lorenzo Bianconi --- drivers/iio/humidity/hts221_core.c | 5 +++-- drivers/iio/humidity/hts221_i2c.c | 1 + drivers/iio/humidity/hts221_spi.c | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/iio/humidity/hts221_core.c b/drivers/iio/humidity/hts221_core.c index da9c08432ef2..517158307d8c 100644 --- a/drivers/iio/humidity/hts221_core.c +++ b/drivers/iio/humidity/hts221_core.c @@ -668,7 +668,7 @@ int hts221_probe(struct device *dev, int irq, const char *name, return devm_iio_device_register(hw->dev, iio_dev); } -EXPORT_SYMBOL(hts221_probe); +EXPORT_SYMBOL_NS(hts221_probe, IIO_HTS221); static int hts221_suspend(struct device *dev) { @@ -694,7 +694,8 @@ static int hts221_resume(struct device *dev) return err; } -EXPORT_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume); +EXPORT_NS_SIMPLE_DEV_PM_OPS(hts221_pm_ops, hts221_suspend, hts221_resume, + IIO_HTS221); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_DESCRIPTION("STMicroelectronics hts221 sensor driver"); diff --git a/drivers/iio/humidity/hts221_i2c.c b/drivers/iio/humidity/hts221_i2c.c index 933b05e4d972..afbc611f7712 100644 --- a/drivers/iio/humidity/hts221_i2c.c +++ b/drivers/iio/humidity/hts221_i2c.c @@ -74,3 +74,4 @@ module_i2c_driver(hts221_driver); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_DESCRIPTION("STMicroelectronics hts221 i2c driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_HTS221); diff --git a/drivers/iio/humidity/hts221_spi.c b/drivers/iio/humidity/hts221_spi.c index 888c5eab944c..fc4adb68faf6 100644 --- a/drivers/iio/humidity/hts221_spi.c +++ b/drivers/iio/humidity/hts221_spi.c @@ -66,3 +66,4 @@ module_spi_driver(hts221_driver); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_DESCRIPTION("STMicroelectronics hts221 spi driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_HTS221); From patchwork Sun Feb 20 18:15:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12752816 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 7F232C433EF for ; Sun, 20 Feb 2022 18:09:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244490AbiBTSJ3 (ORCPT ); Sun, 20 Feb 2022 13:09:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244489AbiBTSJ2 (ORCPT ); Sun, 20 Feb 2022 13:09:28 -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 3E726527E3 for ; Sun, 20 Feb 2022 10:09: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 CB98FB80D9C for ; Sun, 20 Feb 2022 18:09:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9DDE8C340F4; Sun, 20 Feb 2022 18:09:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380542; bh=ZxjMzJJikqH4l+DfN+MBGV4UeQhxj4P4Jh6x2AkWRDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ngDNrr3+BZoju0lFpVEAEemM6OsA3/SwJceESWbBWKE4elXhKFdFUd++ScWw4kfbx BmmIekpcDLqlZO0mJYbInHuzi2YUVFqd+fiR1IL2wg4foQzXZrJ67bVjZWBWcBBzz2 kFnCkHqq/VcNqFfHABxeLAQKbdMNtDJdOBVICAD9m/ROpg0ZcYVZQpNkdMoHUhvtlA FzzDehq3i/Y0JTSp6+n/UtS8tieTAg9my2plPDuCK/FL+sSLaGFMb8h5ojRfRv465Q GCbFhyjl3IVknwyCYD6TI/cPBMZ0SSsC+yJEn9bP6gYLMgvZkD4Md2RsUaKZ7/4GjO 0q6ZVkVISzN2g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 7/8] iio: imu: lsm6dsx: Use new pm_sleep_ptr() and EXPORT_SIMPLE_DEV_PM_OPS() Date: Sun, 20 Feb 2022 18:15:21 +0000 Message-Id: <20220220181522.541718-8-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron These new functions move the burden of removing unused code when CONFIG_PM_SLEEP is not defined onto the compiler rather than requiring the use of CONFIG_PM guards and similar. Signed-off-by: Jonathan Cameron --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 10 ++++------ drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c | 2 +- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 727b4b6ac696..0a86534bd1dd 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -2283,7 +2283,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, } EXPORT_SYMBOL(st_lsm6dsx_probe); -static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) +static int st_lsm6dsx_suspend(struct device *dev) { struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); struct st_lsm6dsx_sensor *sensor; @@ -2322,7 +2322,7 @@ static int __maybe_unused st_lsm6dsx_suspend(struct device *dev) return err; } -static int __maybe_unused st_lsm6dsx_resume(struct device *dev) +static int st_lsm6dsx_resume(struct device *dev) { struct st_lsm6dsx_hw *hw = dev_get_drvdata(dev); struct st_lsm6dsx_sensor *sensor; @@ -2358,10 +2358,8 @@ static int __maybe_unused st_lsm6dsx_resume(struct device *dev) return err; } -const struct dev_pm_ops st_lsm6dsx_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(st_lsm6dsx_suspend, st_lsm6dsx_resume) -}; -EXPORT_SYMBOL(st_lsm6dsx_pm_ops); +EXPORT_SIMPLE_DEV_PM_OPS(st_lsm6dsx_pm_ops, st_lsm6dsx_suspend, + st_lsm6dsx_resume); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_AUTHOR("Denis Ciocca "); diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c index 8b4fc2c15622..faf4e67f0f4c 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c @@ -129,7 +129,7 @@ MODULE_DEVICE_TABLE(i2c, st_lsm6dsx_i2c_id_table); static struct i2c_driver st_lsm6dsx_driver = { .driver = { .name = "st_lsm6dsx_i2c", - .pm = &st_lsm6dsx_pm_ops, + .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops), .of_match_table = st_lsm6dsx_i2c_of_match, }, .probe = st_lsm6dsx_i2c_probe, diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c index 8d4201b86e87..aaa6b29be3be 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c @@ -44,7 +44,7 @@ static int st_lsm6dsx_i3c_probe(struct i3c_device *i3cdev) static struct i3c_driver st_lsm6dsx_driver = { .driver = { .name = "st_lsm6dsx_i3c", - .pm = &st_lsm6dsx_pm_ops, + .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops), }, .probe = st_lsm6dsx_i3c_probe, .id_table = st_lsm6dsx_i3c_ids, diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c index e80110b6b280..6180110a1379 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c @@ -129,7 +129,7 @@ MODULE_DEVICE_TABLE(spi, st_lsm6dsx_spi_id_table); static struct spi_driver st_lsm6dsx_driver = { .driver = { .name = "st_lsm6dsx_spi", - .pm = &st_lsm6dsx_pm_ops, + .pm = pm_sleep_ptr(&st_lsm6dsx_pm_ops), .of_match_table = st_lsm6dsx_spi_of_match, }, .probe = st_lsm6dsx_spi_probe, From patchwork Sun Feb 20 18:15:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12752817 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 7F79DC433FE for ; Sun, 20 Feb 2022 18:09:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244489AbiBTSJ3 (ORCPT ); Sun, 20 Feb 2022 13:09:29 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:42004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244488AbiBTSJ3 (ORCPT ); Sun, 20 Feb 2022 13:09:29 -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 29470527E5 for ; Sun, 20 Feb 2022 10:09:07 -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 CA333B80DAE for ; Sun, 20 Feb 2022 18:09:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 006E8C36AE3; Sun, 20 Feb 2022 18:09:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1645380544; bh=N9/wJ5Y7mRYtOlnDVlD2jdSksLcjrjzsdCSt64BWsVw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IT0u/W1AuTo6KK2RbZW/xTnuF2KUybuPeo5De1DIKvZyD12ou8JKgG3vyfzCF4AUI u+vee9vTBKh6BnvDmm+YWl/St3S+/UTGrnlbUAFlDOqF25u5hV8K0/MppqWLAAvWtK Z8aCEGuJzCwJclY859g+ciCXX2dDXvMjIu0otEw2a2jSEx6JuQqAR8t1u7INR5oIPT C0gqRrMJYEPCTqWtptzA9A5Kk2+JNzax5S7QOGfzOaACTxEMurSUq28hD2nLzE+3X6 ePUWpNvdc52u6+Cg+ARuVYyaQfPH9mbsnW06JyBl7MoMhYE4WakINgSw19+T9ubRAu 5kM7yccaU2lYg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Paul Cercueil , "Rafael J . Wysocki" , Lorenzo Bianconi , Tomasz Duszynski , Jonathan Cameron Subject: [PATCH 8/8] iio: imu: lsm6dsx: Move exported symbols to the IIO_LSM6DSX namespace Date: Sun, 20 Feb 2022 18:15:22 +0000 Message-Id: <20220220181522.541718-9-jic23@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220220181522.541718-1-jic23@kernel.org> References: <20220220181522.541718-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Avoid unnecessary pollution of the global symbol namespace by moving library functions in to a specific namespace and import that into the drivers that make use of the functions. For more info: https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 6 +++--- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c | 1 + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c | 1 + drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index 0a86534bd1dd..03f3bc62e27b 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -2281,7 +2281,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, return 0; } -EXPORT_SYMBOL(st_lsm6dsx_probe); +EXPORT_SYMBOL_NS(st_lsm6dsx_probe, IIO_LSM6DSX); static int st_lsm6dsx_suspend(struct device *dev) { @@ -2358,8 +2358,8 @@ static int st_lsm6dsx_resume(struct device *dev) return err; } -EXPORT_SIMPLE_DEV_PM_OPS(st_lsm6dsx_pm_ops, st_lsm6dsx_suspend, - st_lsm6dsx_resume); +EXPORT_NS_SIMPLE_DEV_PM_OPS(st_lsm6dsx_pm_ops, st_lsm6dsx_suspend, + st_lsm6dsx_resume, IIO_LSM6DSX); MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_AUTHOR("Denis Ciocca "); diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c index faf4e67f0f4c..7ea12ae66afe 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i2c.c @@ -141,3 +141,4 @@ MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_AUTHOR("Denis Ciocca "); MODULE_DESCRIPTION("STMicroelectronics st_lsm6dsx i2c driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_LSM6DSX); diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c index aaa6b29be3be..ecf592e4150b 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_i3c.c @@ -54,3 +54,4 @@ module_i3c_driver(st_lsm6dsx_driver); MODULE_AUTHOR("Vitor Soares "); MODULE_DESCRIPTION("STMicroelectronics st_lsm6dsx i3c driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_LSM6DSX); diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c index 6180110a1379..55e0f9c204ef 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_spi.c @@ -141,3 +141,4 @@ MODULE_AUTHOR("Lorenzo Bianconi "); MODULE_AUTHOR("Denis Ciocca "); MODULE_DESCRIPTION("STMicroelectronics st_lsm6dsx spi driver"); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(IIO_LSM6DSX);