From patchwork Tue Jun 21 20:27:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889751 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 6DAFAC43334 for ; Tue, 21 Jun 2022 20:22:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354304AbiFUUWV (ORCPT ); Tue, 21 Jun 2022 16:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354306AbiFUUWU (ORCPT ); Tue, 21 Jun 2022 16:22:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EE2F2613C for ; Tue, 21 Jun 2022 13:22:19 -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 3219A6181B for ; Tue, 21 Jun 2022 20:22:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B4C3C3411C; Tue, 21 Jun 2022 20:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842938; bh=eDSa5XRmRtAbQwRlcco6kCxP436UXxhfOsvBV70Btts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CHN9LWCR1mJIJ6boV4qSh2ZhMYZXQ7Y2oDt9GdO3L4Ty+P5jqfdoy32CeXa4Xi9YF Qb6G/UDdOG2MfDYkmCy/y98BdsBmlaMd+Jd3TG159MIZbJyRom4pK8Zyvvv4blvZsZ xslIi5un72O/gFEO8420SlEOPMZXm5/MdQZmQSpsVXwPSuHIQzoc2ZqsNs+2g5Rn7S QPxjJMF3TbSZnybNdThdS0qKxRcXBDdvaJs8oPI0IPLOeXPcNltUer6s0jRyzSVYDd Y9iZu1+x2fjE/Ie4p3AOOUeQD39dciF757KwqEmi1sy5wfEk8v5L+MGRNgoTcz2NGZ XxR2w5mwfD/Fg== 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 31/36] iio: light: tsl2591: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Date: Tue, 21 Jun 2022 21:27:14 +0100 Message-Id: <20220621202719.13644-32-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 removal of unused pm_ops structure and functions if !CONFIG_PM without the need to mark the functions __maybe_unused. Signed-off-by: Jonathan Cameron Cc: Joe Sandom --- drivers/iio/light/tsl2591.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c index 39e68d0c9d6a..e485a556e6da 100644 --- a/drivers/iio/light/tsl2591.c +++ b/drivers/iio/light/tsl2591.c @@ -1019,7 +1019,7 @@ static const struct iio_info tsl2591_info_no_irq = { .read_avail = tsl2591_read_available, }; -static int __maybe_unused tsl2591_suspend(struct device *dev) +static int tsl2591_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct tsl2591_chip *chip = iio_priv(indio_dev); @@ -1032,7 +1032,7 @@ static int __maybe_unused tsl2591_suspend(struct device *dev) return ret; } -static int __maybe_unused tsl2591_resume(struct device *dev) +static int tsl2591_resume(struct device *dev) { int power_state = TSL2591_PWR_ON | TSL2591_ENABLE_ALS; struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -1049,10 +1049,8 @@ static int __maybe_unused tsl2591_resume(struct device *dev) return ret; } -static const struct dev_pm_ops tsl2591_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(tsl2591_suspend, tsl2591_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(tsl2591_pm_ops, tsl2591_suspend, + tsl2591_resume, NULL); static irqreturn_t tsl2591_event_handler(int irq, void *private) { @@ -1213,7 +1211,7 @@ MODULE_DEVICE_TABLE(of, tsl2591_of_match); static struct i2c_driver tsl2591_driver = { .driver = { .name = "tsl2591", - .pm = &tsl2591_pm_ops, + .pm = pm_ptr(&tsl2591_pm_ops), .of_match_table = tsl2591_of_match, }, .probe_new = tsl2591_probe