From patchwork Tue Jun 21 20:27: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: 12889756 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 BAA6CC433EF for ; Tue, 21 Jun 2022 20:23:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354311AbiFUUXH (ORCPT ); Tue, 21 Jun 2022 16:23:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354312AbiFUUXG (ORCPT ); Tue, 21 Jun 2022 16:23:06 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1214721B5 for ; Tue, 21 Jun 2022 13:23:04 -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 A40CAB81B25 for ; Tue, 21 Jun 2022 20:23:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D75FC341C4; Tue, 21 Jun 2022 20:22:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842982; bh=Xa+cNxq53JCyAe2uR5kr94H6h1cVP2ioi28+JW89J14=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yin20njpo1FD7EK4jO7Dc2Z64sUkmu9rWgnkMKmf6xc/8bfPh0XC8CQNx7W5VWG+z LioIMN9FUMb+ElLBZ4FL6KVfakeZcDq/sn9zGwiE2Q/m0V0FUPqeEB1VDitQcv0tqS jxk5fXb35qqcH/ag+dAaLWK2oAm+O3q8yWHSN6zm51oyjSymS9IDahJAxXaJpGYDNR gxaZ4Z2HpCXJnNUNEuaK8st67NWAxkc3ht4GiDSp6KC5pgUcWsj8/AF7rveJv5znT8 N6ska4ma696w6rFqWDFnE6fIn2bZMXryXhLC2SRYs4Kmv1wXl1+QKGvP8ZggDfN/cd VrZkmrzg3jFdw== From: Jonathan Cameron To: linux-iio@vger.kernel.org, Paul Cercueil Cc: Alexandre Belloni , Brian Masney , David Heidelberg , Cai Huoqing , Christian Eggers , Enric Balletbo i Serra , Eugen Hristev , Gwendal Grignou , Haibo Chen , Hui Liu , Joe Sandom , "Ismail H . Kose" , Lars-Peter Clausen , Linus Walleij , Ludovic Desroches , Nicolas Ferre , Marcus Folkesson , Martin Blumenstingl , Mathieu Othacehe , Michal Simek , Miquel Raynal , =?utf-8?q?Nuno_S=C3=A1?= , Parthiban Nallathambi , Philippe Reynes , Philippe Schenker , Rishi Gupta , Roan van Dijk , Stephen Boyd , Tomasz Duszynski , Zhiyong Tao , Jonathan Cameron Subject: [PATCH 36/36] iio: magn: yas530: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() macros Date: Tue, 21 Jun 2022 21:27:19 +0100 Message-Id: <20220621202719.13644-37-jic23@kernel.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621202719.13644-1-jic23@kernel.org> References: <20220621202719.13644-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Using these new macros allows the compiler to remove the unused dev_pm_ops structure and related functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Linus Walleij --- drivers/iio/magnetometer/yamaha-yas530.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c index 9ff7b0e56cf6..e1f88e9bac38 100644 --- a/drivers/iio/magnetometer/yamaha-yas530.c +++ b/drivers/iio/magnetometer/yamaha-yas530.c @@ -965,7 +965,7 @@ static int yas5xx_remove(struct i2c_client *i2c) return 0; } -static int __maybe_unused yas5xx_runtime_suspend(struct device *dev) +static int yas5xx_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct yas5xx *yas5xx = iio_priv(indio_dev); @@ -976,7 +976,7 @@ static int __maybe_unused yas5xx_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused yas5xx_runtime_resume(struct device *dev) +static int yas5xx_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct yas5xx *yas5xx = iio_priv(indio_dev); @@ -1011,12 +1011,8 @@ static int __maybe_unused yas5xx_runtime_resume(struct device *dev) return ret; } -static const struct dev_pm_ops yas5xx_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(yas5xx_runtime_suspend, - yas5xx_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(yas5xx_dev_pm_ops, yas5xx_runtime_suspend, + yas5xx_runtime_resume, NULL); static const struct i2c_device_id yas5xx_id[] = { {"yas530", }, @@ -1038,7 +1034,7 @@ static struct i2c_driver yas5xx_driver = { .driver = { .name = "yas5xx", .of_match_table = yas5xx_of_match, - .pm = &yas5xx_dev_pm_ops, + .pm = pm_ptr(&yas5xx_dev_pm_ops), }, .probe = yas5xx_probe, .remove = yas5xx_remove,