From nobody Sat Feb 7 11:16:38 2026 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 2A943C38A2D for ; Tue, 25 Oct 2022 20:39:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229875AbiJYUjX (ORCPT ); Tue, 25 Oct 2022 16:39:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232539AbiJYUjG (ORCPT ); Tue, 25 Oct 2022 16:39:06 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3254BD019A; Tue, 25 Oct 2022 13:39:06 -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 sin.source.kernel.org (Postfix) with ESMTPS id 9B630CE1ED2; Tue, 25 Oct 2022 20:39:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D1D08C433D6; Tue, 25 Oct 2022 20:39:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1666730343; bh=MvbJy3JxdO3ShsrhkWcJG0ADbJX6DM/ql5rIFpCUTAw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MRJFtTL3yE5rbOVqjRdQwIY+nvkQweZHqDhluMjuI+hY4L2YO6v1JrH0q5KB9Hvsj OEkJmdpI7YSMNZ5N04fesYTqbHp1N0JiCnRwSQjbAfo0y6ALvFaIG7sMGGsogYJRYY 7cCP1sCMOWWX7VOza9Bj5hatOelFi5JFSati+L+6NUFOCKnLBabkkIDSx+ySFAZRn7 zYZc46w71OSDkWRVTzypggKvowHjlOtXFeCsljVl7PvbKto4k43qCPVOjVpj+YSuvL KpsEDwspvDMxLIS1JjHAhqsBjlPy1XMkbycWf+iZwlmNUUztQ0towjJ+gmuoxtDCCW N6IRxVPDOskaw== From: Bjorn Helgaas To: David Airlie Cc: =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , "Rafael J . Wysocki" , Vaibhav Gupta , dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas Subject: [PATCH v2 2/8] agp/intel: Convert to generic power management Date: Tue, 25 Oct 2022 15:38:46 -0500 Message-Id: <20221025203852.681822-3-helgaas@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221025203852.681822-1-helgaas@kernel.org> References: <20221025203852.681822-1-helgaas@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Bjorn Helgaas Convert agpgart-intel from legacy PCI power management to the generic power management framework. Previously agpgart-intel used legacy PCI power management, and agp_intel_resume() was responsible for both device-specific things and generic PCI things like saving and restoring config space and managing power state. In this case, agp_intel_suspend() was empty, and agp_intel_resume() already did only device-specific things, so simply convert it to take a struct device * instead of a struct pci_dev *. Based on 0aeddbd0cb07 ("via-agp: convert to generic power management") by Vaibhav Gupta . Signed-off-by: Bjorn Helgaas --- drivers/char/agp/intel-agp.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 9e4f27a6cb5a..c518b3a9db04 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c @@ -817,16 +817,15 @@ static void agp_intel_remove(struct pci_dev *pdev) agp_put_bridge(bridge); } =20 -#ifdef CONFIG_PM -static int agp_intel_resume(struct pci_dev *pdev) +static int agp_intel_resume(struct device *dev) { + struct pci_dev *pdev =3D to_pci_dev(dev); struct agp_bridge_data *bridge =3D pci_get_drvdata(pdev); =20 bridge->driver->configure(); =20 return 0; } -#endif =20 static const struct pci_device_id agp_intel_pci_table[] =3D { #define ID(x) \ @@ -895,14 +894,14 @@ static const struct pci_device_id agp_intel_pci_table= [] =3D { =20 MODULE_DEVICE_TABLE(pci, agp_intel_pci_table); =20 +static DEFINE_SIMPLE_DEV_PM_OPS(agp_intel_pm_ops, NULL, agp_intel_resume); + static struct pci_driver agp_intel_pci_driver =3D { .name =3D "agpgart-intel", .id_table =3D agp_intel_pci_table, .probe =3D agp_intel_probe, .remove =3D agp_intel_remove, -#ifdef CONFIG_PM - .resume =3D agp_intel_resume, -#endif + .driver.pm =3D &agp_intel_pm_ops, }; =20 static int __init agp_intel_init(void) --=20 2.25.1