From patchwork Tue Jun 21 20:27:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12889749 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 3532AC433EF for ; Tue, 21 Jun 2022 20:22:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1354305AbiFUUWE (ORCPT ); Tue, 21 Jun 2022 16:22:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354270AbiFUUWD (ORCPT ); Tue, 21 Jun 2022 16:22:03 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 829F01CFCD for ; Tue, 21 Jun 2022 13:22:02 -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 016ED617AE for ; Tue, 21 Jun 2022 20:22:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E24DC341C4; Tue, 21 Jun 2022 20:21:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1655842921; bh=6CfOHPjWtsduNbXiKm+frnZBd7PJXxCS2DRjVgLx6B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjvjZVdmoUHl18B13B0h2pv1U4X9LxtILFkDvP5kyhoe9l4rwBfv+K+XnXTGBpd58 LT0BibWnkcGcY3TIgb8pJs1B4E3E5mcj+6sQXv+Xd1ZlGcfgoAqXDVHnPgXIl2BWcq 0eWRQjiHqD/bMD9JpnlawWMOt4cBzWCMdvytohDKKvCfFqXZStwGDg9JSVMt9+4y2D TsAzjcN2e/o/YwVRiSjuec8BKiczxzQ1JO5KRORDm3PN5mr4PPzyK745seXaw+Bp2G kwjCsDrfzRDz6N1WPV8TJwB5RSArWoVmOs7vdiPTbMFHUzJZrnnuqGpw3N5hz6Pktl 4zrzLnYMZhRNw== 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 29/36] iio: light: isl29028: Use DEFINE_RUNTIME_DEV_PM_OPS() and pm_ptr() Date: Tue, 21 Jun 2022 21:27:12 +0100 Message-Id: <20220621202719.13644-30-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: Brian Masney Reviewed-by: Brian Masney --- drivers/iio/light/isl29028.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/isl29028.c b/drivers/iio/light/isl29028.c index 720fa83d44e0..4dde9707a52d 100644 --- a/drivers/iio/light/isl29028.c +++ b/drivers/iio/light/isl29028.c @@ -651,7 +651,7 @@ static int isl29028_remove(struct i2c_client *client) return 0; } -static int __maybe_unused isl29028_suspend(struct device *dev) +static int isl29028_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct isl29028_chip *chip = iio_priv(indio_dev); @@ -666,7 +666,7 @@ static int __maybe_unused isl29028_suspend(struct device *dev) return ret; } -static int __maybe_unused isl29028_resume(struct device *dev) +static int isl29028_resume(struct device *dev) { /** * The specific component (ALS/IR or proximity) will enable itself as @@ -676,11 +676,8 @@ static int __maybe_unused isl29028_resume(struct device *dev) return 0; } -static const struct dev_pm_ops isl29028_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, - pm_runtime_force_resume) - SET_RUNTIME_PM_OPS(isl29028_suspend, isl29028_resume, NULL) -}; +static DEFINE_RUNTIME_DEV_PM_OPS(isl29028_pm_ops, isl29028_suspend, + isl29028_resume, NULL); static const struct i2c_device_id isl29028_id[] = { {"isl29028", 0}, @@ -700,7 +697,7 @@ MODULE_DEVICE_TABLE(of, isl29028_of_match); static struct i2c_driver isl29028_driver = { .driver = { .name = "isl29028", - .pm = &isl29028_pm_ops, + .pm = pm_ptr(&isl29028_pm_ops), .of_match_table = isl29028_of_match, }, .probe = isl29028_probe,