From patchwork Tue Jun 21 20:27: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: 12889748 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 63503C433EF for ; Tue, 21 Jun 2022 20:21:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354299AbiFUUVz (ORCPT ); Tue, 21 Jun 2022 16:21:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUVy (ORCPT ); Tue, 21 Jun 2022 16:21:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 348BF2613C for ; Tue, 21 Jun 2022 13:21:54 -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 C519A6181D for ; Tue, 21 Jun 2022 20:21:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75E86C3411C; Tue, 21 Jun 2022 20:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842913; bh=eyyNvKFjiVDcdums7UNe2lOc28lwGs3At/OB42tTvyw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mex9QNGTPEv7yZSR6xycGIrTeXtjc14WzDIhuSkx0jmw5+ZCLexgvKY8xD+hIq942 D6H8sOshRlwoHaIGZ/HuOhBQU7uf1bGfIPjzIDLO/x0g5Ht4wjgzrd17ytyq2ZAv2s Mi6jplzrx6D13IXlPBgpxDVJtFbmgt0U2EY1sTW93FQQmx2oJ1givQDrcOWz1XafYm T+zkwg54o9u4CUAADHWf7Ye3LIKyB0XkOg/ZrVEYSSnzQ3xTObL4UKuTY2czEttjWy ZJZFdT1lsGrRZGgWBs+3j6ZaVoi+yW98iuNENZyWXHID34EIk4DDCRdO/yGY54/NOu SteKYjpYKa/BA== 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 28/36] iio: light: gp2ap002: Switch to DEFINE_RUNTIME_DEV_PM_OPS and pm_ptr() Date: Tue, 21 Jun 2022 21:27:11 +0100 Message-Id: <20220621202719.13644-29-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 Switching to these newer macros allows use of pm_ptr() to remove the unused functions and structure if !CONFIG_PM without the need to mark anything __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Linus Walleij --- drivers/iio/light/gp2ap002.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/gp2ap002.c b/drivers/iio/light/gp2ap002.c index c6d1d88d3775..e2707416f9a8 100644 --- a/drivers/iio/light/gp2ap002.c +++ b/drivers/iio/light/gp2ap002.c @@ -635,7 +635,7 @@ static int gp2ap002_remove(struct i2c_client *client) return 0; } -static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev) +static int gp2ap002_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); @@ -660,7 +660,7 @@ static int __maybe_unused gp2ap002_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused gp2ap002_runtime_resume(struct device *dev) +static int gp2ap002_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct gp2ap002 *gp2ap002 = iio_priv(indio_dev); @@ -691,12 +691,8 @@ static int __maybe_unused gp2ap002_runtime_resume(struct device *dev) return 0; } -static const struct dev_pm_ops gp2ap002_dev_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(gp2ap002_runtime_suspend, - gp2ap002_runtime_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(gp2ap002_dev_pm_ops, gp2ap002_runtime_suspend, + gp2ap002_runtime_resume, NULL); static const struct i2c_device_id gp2ap002_id_table[] = { { "gp2ap002", 0 }, @@ -715,7 +711,7 @@ static struct i2c_driver gp2ap002_driver = { .driver = { .name = "gp2ap002", .of_match_table = gp2ap002_of_match, - .pm = &gp2ap002_dev_pm_ops, + .pm = pm_ptr(&gp2ap002_dev_pm_ops), }, .probe = gp2ap002_probe, .remove = gp2ap002_remove,