From nobody Thu Oct 2 06:21:35 2025 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C95BD22A4F1 for ; Fri, 19 Sep 2025 16:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299526; cv=none; b=sYErC88WRLvsO2nbFX2YmGNLa7s3JfLZxOSxQqWrL2pDu/Zephp8LpwzMrH0v17f0o3DL0J67t8yh1eeYxDe3YEEBQUu9Jc1sfHBkOtKg4Wcqai/6c5ruCMpmxotn1Yex52aTIs3SRNHANq7YqgFhUfk99vnTN4eR3V3xQ022kE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299526; c=relaxed/simple; bh=e7IXqqSXjA70wXHBKc8FNg5mgO6PvRnRSD3P3qjKTmE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QOAQzXXXpS8HcqvF7we56UwXrng56EXld1Z/nqnIS0z1sRXhwPUUe3kNpoq8GQYNPe7QDDqSyIbkp3p19Z4ECG04hR/VLGGPq29FgG3ZPugR5yN6xodxucS+aKb04dyoSIPH5r6F315JfJqYCQd6kBhCeparbIGNMkQE6jo6/Rc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=qXjMYOPb; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=R+n/ZcKh; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=m2z+VB18; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Na8T5o/L; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="qXjMYOPb"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="R+n/ZcKh"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="m2z+VB18"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Na8T5o/L" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id EF5611F7E9; Fri, 19 Sep 2025 16:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1nuIMA25UdHui+sNTNPrg7l3hF6XOJR1S/KLkQxYk=; b=qXjMYOPbEkoveM64Qmo4yBmLKtPWuPBtNxviq0BX7r/HoILaMCdU6ZS/LcKxIylFuawoDN Btpb7d8QZ3bCbumTxosIv5S21qFmF0WKiEmq2LFiV6HOw+yha5FgsK1Q7/RxG7HFTJ3iml mLZ6JBJvuJsY8W2S2RPPrSxQqJDay84= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1nuIMA25UdHui+sNTNPrg7l3hF6XOJR1S/KLkQxYk=; b=R+n/ZcKhI9mpuICeyZGWiG12l38LqKQ8jHnPbCN4K81t1dmdkO9jQiRRQtS4qhWucX59y1 SjcgtIYV78WnAUAQ== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=m2z+VB18; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="Na8T5o/L" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299522; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1nuIMA25UdHui+sNTNPrg7l3hF6XOJR1S/KLkQxYk=; b=m2z+VB18l+BbFkJYgborRcGosHWhOzfW409kGXfYrw/ul6WRERMtVM5qHyTMy/YSBz7tOU CxHM9MbJqJTSfyXFQmreduFX6f/rG5mg5VA88F8nGo7umm1u66O8mJQ2ug8IGGnqHAG240 91jlKnxazVVdCf5XwFHy/zxWM+aUMZY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299522; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SL1nuIMA25UdHui+sNTNPrg7l3hF6XOJR1S/KLkQxYk=; b=Na8T5o/Lxgs5l3Ab/NGs4d0wYMzEQVC2ME9g0KrMy/m/vIgoR1OP1v4Ee/azywnLJqV4BC yrvvEIKcRU3avfDQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id BB31013AB1; Fri, 19 Sep 2025 16:32:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2H5ULIKFzWg3UwAAD6G6ig (envelope-from ); Fri, 19 Sep 2025 16:32:02 +0000 From: Takashi Iwai To: "Rafael J . Wysocki" Cc: linux-pm@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] PM: runtime: Define class helpers for automatic PM runtime cleanup Date: Fri, 19 Sep 2025 18:31:42 +0200 Message-ID: <20250919163147.4743-2-tiwai@suse.de> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250919163147.4743-1-tiwai@suse.de> References: <20250919163147.4743-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; MIME_TRACE(0.00)[0:+]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_DN_SOME(0.00)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; FROM_EQ_ENVFROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_FIVE(0.00)[5]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:mid,suse.de:dkim,suse.de:email] X-Spam-Flag: NO X-Spam-Level: X-Rspamd-Queue-Id: EF5611F7E9 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spam-Score: -3.01 Content-Type: text/plain; charset="utf-8" From: "Rafael J. Wysocki" This patch adds two CLASS macros for the easier use of the auto-cleanup feature to manage the runtime PM get/put pairs. With the CLASS macro, pm_runtime_put() (or *_autosuspend) is called automatically at its scope exit, so you can remove the explicit pm_runtime_put() call. Simply put, a code like below ret =3D pm_runtime_resume_and_get(dev); if (ret < 0) return ret; ..... pm_runtime_put(dev); return 0; can be simplified with CLASS() like: CLASS(pm_runtime_resume_and_get, pm)(dev); if (IS_ERR(pm)) return PTR_ERR(pm); ..... return 0; (see pm_runtime_put() call is gone). When the original code calls pm_runtime_put_autosuspend(), use CLASS(pm_runtime_resume_and_get_auto) variant, instead. e.g. a code like: ret =3D pm_runtime_resume_and_get(dev); if (ret < 0) return ret; ..... pm_runtime_put_autosuspend(dev); return 0; will be like: CLASS(pm_runtime_resume_and_get_auto, pm)(dev); if (IS_ERR(pm)) return PTR_ERR(pm); ..... return 0; Note that there is no CLASS macro defined for pm_runtime_get_sync(). With the auto-cleanup, we can unify both usages. You can use CLASS(pm_runtime_resume_and_get) but simply skip the error check; so a code like below: pm_runtime_get_sync(dev); ..... pm_runtime_put(dev); return 0; will become like: CLASS(pm_runtime_resume_and_get, pm)(dev); ..... return 0; Link: https://lore.kernel.org/878qimv24u.wl-tiwai@suse.de Signed-off-by: Takashi Iwai --- include/linux/pm_runtime.h | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index d88d6b6ccf5b..637bfda9c2cd 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -532,6 +532,30 @@ static inline int pm_runtime_resume_and_get(struct dev= ice *dev) return 0; } =20 +/** + * pm_runtime_resume_and_get_dev - Resume device and bump up its usage cou= nter. + * @dev: Target device. + * + * Resume @dev synchronously and if that is successful, increment its runt= ime + * PM usage counter. + * + * Return: + * * 0 if the runtime PM usage counter of @dev has been incremented. + * * Negative error code otherwise. + */ +static inline struct device *pm_runtime_resume_and_get_dev(struct device *= dev) +{ + int ret; + + ret =3D __pm_runtime_resume(dev, RPM_GET_PUT); + if (ret < 0) { + pm_runtime_put_noidle(dev); + return ERR_PTR(ret); + } + + return dev; +} + /** * pm_runtime_put - Drop device usage counter and queue up "idle check" if= 0. * @dev: Target device. @@ -606,6 +630,25 @@ static inline int pm_runtime_put_autosuspend(struct de= vice *dev) return __pm_runtime_put_autosuspend(dev); } =20 +/* + * The way to use the classes defined below is to define a class variable = and + * use it going forward for representing the target device until it goes o= ut of + * the scope. For example: + * + * CLASS(pm_runtime_resume_and_get, active_dev)(dev); + * if (IS_ERR(active_dev)) + * return PTR_ERR(active_dev); + * + * ... do something with active_dev (which is guaranteed to never suspend)= ... + */ +DEFINE_CLASS(pm_runtime_resume_and_get, struct device *, + if (!IS_ERR_OR_NULL(_T)) pm_runtime_put(_T), + pm_runtime_resume_and_get_dev(dev), struct device *dev) + +DEFINE_CLASS(pm_runtime_resume_and_get_auto, struct device *, + if (!IS_ERR_OR_NULL(_T)) pm_runtime_put_autosuspend(_T), + pm_runtime_resume_and_get_dev(dev), struct device *dev) + /** * pm_runtime_put_sync - Drop device usage counter and run "idle check" if= 0. * @dev: Target device. --=20 2.50.1 From nobody Thu Oct 2 06:21:35 2025 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFA3222D7B5 for ; Fri, 19 Sep 2025 16:32:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299528; cv=none; b=mYuFHdu1DZyXtSUngPBIminWSHx043HNo9MwRb++ViwHxhQ0uZuK9Uv+9jKqJYoIB2OuBnSNeuc09/6yDdtNt0mcFgYLB2BcNBWG9Vbgx3TU4FTLE+4eFzgMZ1trowye45zVoG3Sd0DODmSo2YpI9RntUuR8lxM1UEJfGDmDV0Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299528; c=relaxed/simple; bh=vw8OS8C1PnD7jjQp/x3X7l/ZLVMQnrHUTB1C7ieWDNM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fyfkuqcHocGtIAmA+sZMfhERKSQyslrgxbbwQxw1vobbjSvQRy6+YXvb7NxMClCNa3F9SJzcbO+7T4q9JEg8ZaYcagcOu4HN5P/pUQdAYIacjUpjP+ukWHqkUvpTwwkj+GgXBrK9fIm2AE+ZsOjml++mQkhv2x8+fM3n2vHQ2Bc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=j3R9Hs4Q; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=+uAzxoCJ; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=j3R9Hs4Q; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=+uAzxoCJ; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="j3R9Hs4Q"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="+uAzxoCJ"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="j3R9Hs4Q"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="+uAzxoCJ" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 465DC21254; Fri, 19 Sep 2025 16:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oeu8Ku2rvkIi8sWxYCKlM50eGDdg+VzqEacYc38VvmY=; b=j3R9Hs4QV+ZqVlXQUUCiOAz6jSTXbiTUd+1CbFqLGEOu/IyBOaKIbHhHm/7OP68WoBr3fk b/E92cu+EwhCVw1skt37xlj5+PVEVg5S8PfTCFjJ1EuYa/tSX9HP/sPR+ZSAmHbP+3mb0/ w7uqyDbOzEi9uPvjHfToqf72okzbR/o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oeu8Ku2rvkIi8sWxYCKlM50eGDdg+VzqEacYc38VvmY=; b=+uAzxoCJ1OJ1peg8D4O6nCPD/hbwxU64GVQA3VdedlQbKuG3qKRSC3iuGfNuv8fmICwEtP 6Ev2XPnQRnBZfKBw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oeu8Ku2rvkIi8sWxYCKlM50eGDdg+VzqEacYc38VvmY=; b=j3R9Hs4QV+ZqVlXQUUCiOAz6jSTXbiTUd+1CbFqLGEOu/IyBOaKIbHhHm/7OP68WoBr3fk b/E92cu+EwhCVw1skt37xlj5+PVEVg5S8PfTCFjJ1EuYa/tSX9HP/sPR+ZSAmHbP+3mb0/ w7uqyDbOzEi9uPvjHfToqf72okzbR/o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oeu8Ku2rvkIi8sWxYCKlM50eGDdg+VzqEacYc38VvmY=; b=+uAzxoCJ1OJ1peg8D4O6nCPD/hbwxU64GVQA3VdedlQbKuG3qKRSC3iuGfNuv8fmICwEtP 6Ev2XPnQRnBZfKBw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F29D513AB2; Fri, 19 Sep 2025 16:32:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id MNb2OYKFzWg3UwAAD6G6ig (envelope-from ); Fri, 19 Sep 2025 16:32:02 +0000 From: Takashi Iwai To: "Rafael J . Wysocki" Cc: linux-pm@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] PCI: Use PM runtime class macro for the auto cleanup Date: Fri, 19 Sep 2025 18:31:43 +0200 Message-ID: <20250919163147.4743-3-tiwai@suse.de> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250919163147.4743-1-tiwai@suse.de> References: <20250919163147.4743-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email,suse.de:mid]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 Content-Type: text/plain; charset="utf-8" Use the newly introduced class macro to simplify the code. Also, add the proper error handling for the PM runtime get errors, too. Signed-off-by: Takashi Iwai --- drivers/pci/pci-sysfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 5eea14c1f7f5..08e5cf2ba73e 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c @@ -1475,8 +1475,9 @@ static ssize_t reset_method_store(struct device *dev, return count; } =20 - pm_runtime_get_sync(dev); - struct device *pmdev __free(pm_runtime_put) =3D dev; + CLASS(pm_runtime_resume_and_get, pmdev)(dev); + if (IS_ERR(pmdev)) + return -ENXIO; =20 if (sysfs_streq(buf, "default")) { pci_init_reset_methods(pdev); --=20 2.50.1 From nobody Thu Oct 2 06:21:35 2025 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEC3222D7B5 for ; Fri, 19 Sep 2025 16:32:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299533; cv=none; b=K7fQo0cvl+/+O84W83jwNdSTdTtOlojtAM7jeaQmFNLYQDwGvatfnhGjpUh8MSQsdQM2StYqDVd7LxA+S1DCRWcKNV3Pec4GydZvQR5CAqdWDXRvPABn6Ir6y2GRST6PSQSiqNbz+sI8jx7R5mT4fpMlj++889/ZPiJd7nZ3Ig8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758299533; c=relaxed/simple; bh=6kjlxtAaKEKwqWPYADldDQV55pMUahCcj4KCt6px5ag=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ezGDH3S6GDGW30PmtzFm6n/foQOMVmBAkOg0QyoZx63h3BMyGgpRm4Yg2Km/yFsBtF/7iXD3XghpR4HRczgY8/SFw/i5NteN5vk4GRcLqBqJxRW61GUJXu2jSiKPKwNW7M426btXd/6n8tmPh/cbjKGKY8xawFR/is+mPzpXfSk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=NJTT3WXf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=+QCKOQv9; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=NJTT3WXf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=+QCKOQv9; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NJTT3WXf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="+QCKOQv9"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="NJTT3WXf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="+QCKOQv9" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 867441F7E0; Fri, 19 Sep 2025 16:32:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTG2gaW2eoTvDCKZNxhXHU5hoiL6obDkARwhNAllDqQ=; b=NJTT3WXfjUp8b4R7PSK5CcMsykG0mZM8/T7PZZxlfIvt76kWa1wJLJu0MtfETVkjsfK2kd jfq1Um0P0+ahAr/VPf+ZTODnDfOZK8Apqr48z9+l3X+WgZm8HSfAoSSn0rHfNz6yHY/KWP ihCKSmPm9GSOWFozx8GLW2Zwk06/zW0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTG2gaW2eoTvDCKZNxhXHU5hoiL6obDkARwhNAllDqQ=; b=+QCKOQv9fgJ/ZMrNk1BVfeu3P+rLFGoP3pGRa5Q1mOM/b5hXudKNYKu9SkISdu7zhU0z9W VLYUF30n8AUjzdBA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTG2gaW2eoTvDCKZNxhXHU5hoiL6obDkARwhNAllDqQ=; b=NJTT3WXfjUp8b4R7PSK5CcMsykG0mZM8/T7PZZxlfIvt76kWa1wJLJu0MtfETVkjsfK2kd jfq1Um0P0+ahAr/VPf+ZTODnDfOZK8Apqr48z9+l3X+WgZm8HSfAoSSn0rHfNz6yHY/KWP ihCKSmPm9GSOWFozx8GLW2Zwk06/zW0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1758299523; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gTG2gaW2eoTvDCKZNxhXHU5hoiL6obDkARwhNAllDqQ=; b=+QCKOQv9fgJ/ZMrNk1BVfeu3P+rLFGoP3pGRa5Q1mOM/b5hXudKNYKu9SkISdu7zhU0z9W VLYUF30n8AUjzdBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 44EE413AB1; Fri, 19 Sep 2025 16:32:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8JlrD4OFzWg3UwAAD6G6ig (envelope-from ); Fri, 19 Sep 2025 16:32:03 +0000 From: Takashi Iwai To: "Rafael J . Wysocki" Cc: linux-pm@vger.kernel.org, Bjorn Helgaas , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] PM: runtime: Drop unused pm_runtime_free __free() definition Date: Fri, 19 Sep 2025 18:31:44 +0200 Message-ID: <20250919163147.4743-4-tiwai@suse.de> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250919163147.4743-1-tiwai@suse.de> References: <20250919163147.4743-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; TO_DN_SOME(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:mid,imap1.dmz-prg2.suse.org:helo]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_RATELIMITED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_TLS_ALL(0.00)[] X-Spam-Flag: NO X-Spam-Score: -2.80 Content-Type: text/plain; charset="utf-8" Since the introduction of CLASS macros for pm_runtime_get/put and the conversion with it, there is no user of __free(pm_runtime_put) any longer. Let's clean it up. Signed-off-by: Takashi Iwai --- include/linux/pm_runtime.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/linux/pm_runtime.h b/include/linux/pm_runtime.h index 637bfda9c2cd..29d746f57f98 100644 --- a/include/linux/pm_runtime.h +++ b/include/linux/pm_runtime.h @@ -579,8 +579,6 @@ static inline int pm_runtime_put(struct device *dev) return __pm_runtime_idle(dev, RPM_GET_PUT | RPM_ASYNC); } =20 -DEFINE_FREE(pm_runtime_put, struct device *, if (_T) pm_runtime_put(_T)) - /** * __pm_runtime_put_autosuspend - Drop device usage counter and queue auto= suspend if 0. * @dev: Target device. --=20 2.50.1