From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9497AC4345F for ; Wed, 24 Apr 2024 10:24:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xsgjIXtfVr9m8m0Q4+A0Muj1cq9tczaBL/gwfy61jXg=; b=rXr48YP+Dq6E99 0V98CqSR1w2vVQE+UyWWOUY1sfJBaDY9yN1fDx0dfdJi/qkOUVAVAz/70USc7+BcZetg5fBzAcS2P g2MM4AbJ/3+enIoPBmqfF9tasOs20Yyf+EgXzW/0o2I132ysC0HGUbEm9dfQcTx1f1mSq1G7FV2aZ qlnj4DFAAdJZChMbuE7zcvzfUmaZlOW15fEevUF0hm8tjpmYCxYPX70TX5CJSbVIjV6uOopUvUAD4 HdY9BXobS1B4nOwJbjbUhjc8xdboA4YjIyshr3GIw+wBCNMXZLPZlijSrh9kVpExFY9GhBICMv99L Gc44p+BFy0aVpquXpIHA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzZnt-00000003gIr-1fPX; Wed, 24 Apr 2024 10:24:41 +0000 Received: from relay3-d.mail.gandi.net ([2001:4b98:dc4:8::223]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rzZno-00000003gF1-3wBy for linux-arm-kernel@lists.infradead.org; Wed, 24 Apr 2024 10:24:39 +0000 Received: by mail.gandi.net (Postfix) with ESMTPSA id 8A89D6000A; Wed, 24 Apr 2024 10:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1713954267; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=OVEm7ob18VpKCaMTFhx5G9Kb6z4kp/qqC4mfGOtfzt0=; b=dyD6o43s+X70tu36CaPntCI9S7G6Mpdm4x7hO6BsSEu9+z36dVwBteNQBwwE6iaBeSsi3c QQheFRj/aPn5G/WMf+yvs9Pvyqlw7gnKvjlSXYYNjxagiLXQp4uGshTYl4sLZHiPtL+MgE s2qOhPMm2usFpwEyyFnNGPXX+zYMyEEpxGsYdUiMcsnGAPgIlfSO7rrotuYJf7jDr2Z2LT 1g/pbBPsm0EBBk46JMYX/O0CmzfZ9cFAdHFXn0O/JWxV0P9p7bE8I/DuzdVuwIkfxdKMdc Mi/GkwbyXIaSvZu9lxr4kZ1I7Da7PbFs5pHVPy69iriR07mtv50BcwN9qZbF3w== Message-ID: <8d49f316-bb17-4956-a62b-e64d460825d4@bootlin.com> Date: Wed, 24 Apr 2024 12:24:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 02/11] i2c: omap: wakeup the controller during suspend() callback To: Bjorn Helgaas Cc: Andi Shyti , Linus Walleij , Bartosz Golaszewski , Tony Lindgren , Aaro Koskinen , Janusz Krzysztofik , Vignesh R , Peter Rosin , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Siddharth Vadapalli , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-i2c@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, gregory.clement@bootlin.com, theo.lebrun@bootlin.com, thomas.petazzoni@bootlin.com, u-kumar1@ti.com, Wolfram Sang References: <20240422194423.GA414623@bhelgaas> Content-Language: en-US From: Thomas Richard In-Reply-To: <20240422194423.GA414623@bhelgaas> X-GND-Sasl: thomas.richard@bootlin.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240424_032437_462073_87714E50 X-CRM114-Status: GOOD ( 17.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 4/22/24 21:44, Bjorn Helgaas wrote: > On Mon, Apr 22, 2024 at 11:40:02AM +0200, Thomas Richard wrote: >> On 4/19/24 10:47, Andi Shyti wrote: >>> Hi Thomas, >>> >>>> +static int omap_i2c_suspend(struct device *dev) >>>> +{ >>>> + /* >>>> + * If the controller is autosuspended, there is no way to wakeup it once >>>> + * runtime pm is disabled (in suspend_late()). >>>> + * But a device may need the controller up during suspend_noirq() or >>>> + * resume_noirq(). >>>> + * Wakeup the controller while runtime pm is enabled, so it is available >>>> + * until its suspend_noirq(), and from resume_noirq(). >>>> + */ >>>> + return pm_runtime_resume_and_get(dev); >>>> +} >>>> + >>>> +static int omap_i2c_resume(struct device *dev) >>>> +{ >>>> + pm_runtime_mark_last_busy(dev); >>>> + pm_runtime_put_autosuspend(dev); >>>> + >>>> + return 0; >>>> +} >>>> + >>>> static const struct dev_pm_ops omap_i2c_pm_ops = { >>>> SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, >>>> pm_runtime_force_resume) >>>> + SET_SYSTEM_SLEEP_PM_OPS(omap_i2c_suspend, omap_i2c_resume) >>> >>> If you don't have CONFIG_PM_SLEEP, though, this doesn't compile. >> >> Hello Andi, >> >> Yes indeed, the __maybe_unused attribute is missing for >> omap_i2c_suspend() and omap_i2c_resume(). > > Isn't there a way to avoid having to use the __maybe_unused attribute? > > E.g., use DEFINE_SIMPLE_DEV_PM_OPS() as is done by these: > > 82f9cefadac4 ("serial: 8250_exar: switch to DEFINE_SIMPLE_DEV_PM_OPS()") > f243df0a0be0 ("media: platform: rzg2l-cru: rzg2l-csi2: Switch to RUNTIME_PM_OPS()") > 6ccc22a5afcb ("net: ravb: Switch to SYSTEM_SLEEP_PM_OPS()/RUNTIME_PM_OPS() and pm_ptr()") Yes you're right, I don't need the __maybe_unused attribute if I use NOIRQ_SYSTEM_SLEEP_PM_OPS(). By the way I can add a patch in the series to remove all the __maybe_unused attributes of this driver. Regards, -- Thomas Richard, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel