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,