{"id":2234813,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2234813/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260508043543.217179-24-kwilczynski@kernel.org/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260508043543.217179-24-kwilczynski@kernel.org>","list_archive_url":null,"date":"2026-05-08T04:35:42","name":"[v7,23/24] PCI/sysfs: Remove pci_create_legacy_files() and pci_sysfs_init()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"d63f8bb74481714fa326708a5f2b363e6a4187f4","submitter":{"id":86709,"url":"http://patchwork.ozlabs.org/api/1.2/people/86709/?format=json","name":"Krzysztof Wilczyński","email":"kwilczynski@kernel.org"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260508043543.217179-24-kwilczynski@kernel.org/mbox/","series":[{"id":503321,"url":"http://patchwork.ozlabs.org/api/1.2/series/503321/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=503321","date":"2026-05-08T04:35:19","name":"PCI: Convert all dynamic sysfs attributes to static","version":7,"mbox":"http://patchwork.ozlabs.org/series/503321/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2234813/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2234813/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-54216-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=s6lutonw;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c15:e001:75::12fc:5321; helo=sin.lore.kernel.org;\n envelope-from=linux-pci+bounces-54216-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"s6lutonw\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201"],"Received":["from sin.lore.kernel.org (sin.lore.kernel.org\n [IPv6:2600:3c15:e001:75::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4gBbtz2MBYz1yJq\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 08 May 2026 14:37:15 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sin.lore.kernel.org (Postfix) with ESMTP id 3D534300C3AB\n\tfor <incoming@patchwork.ozlabs.org>; Fri,  8 May 2026 04:37:14 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id BF1C61D9663;\n\tFri,  8 May 2026 04:37:12 +0000 (UTC)","from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 9C82217A2FC;\n\tFri,  8 May 2026 04:37:12 +0000 (UTC)","by smtp.kernel.org (Postfix) with ESMTPSA id 3C829C2BCF4;\n\tFri,  8 May 2026 04:37:09 +0000 (UTC)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1778215032; cv=none;\n b=naP1LSebsqzdFzg9MyMcSMAp3WscBJpWa3ZAG4ADS2lL+UypuOZZ1YQzKhwop5B0dUXqluTbYc+8k9umKNoa4rYhJ70bNAbJvUgECTBG1jg+IRRXvNaIoWG0l/ghATQXMOFXIpvFL4KIZDIfKPdS3uX/ju76kfxOlXHfTe9a4dE=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1778215032; c=relaxed/simple;\n\tbh=xWVzvI9FOeYYG3CBU/uLs6QgPon/uyfwYK1AxYqoIQc=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=KaBocz33PeEdFmNix28lslEjpQpL2+rz4rJYcKlmK3q+fRMuLpn3gJ+oGR3usJ3yPGxSR+Qi9hGpRO+cP97hfNMGJ9HP4n4uBoxMDdD9ilfrhFnYUWx8Y5BDaFo3NI09LGBLdUzBwDW0L71CTNmYEUTPzljBE+Ouy1rCKaVSASY=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=s6lutonw; arc=none smtp.client-ip=10.30.226.201","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1778215032;\n\tbh=xWVzvI9FOeYYG3CBU/uLs6QgPon/uyfwYK1AxYqoIQc=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=s6lutonwg8xbLt2azBt45m2/c7EmGSr6EADCodjprG+SuJjmoaBtM8UiVGqaZC92y\n\t 8M4vAJSMQu9YpGRHpcIDJ81CT8IZw0XmFbiAZv+sWa+2YvlZ59lwFwwjqsTQt+rsRQ\n\t GnPPB9+f/WFUetjVovr9vd+ukQqMsXTlFpePzXlip6/mruPBKU6o8UEIR6BU7At6mj\n\t T882Fi5KINVbGI9AxeWAWJ5nIkCKK+U17lAtanYA4GnbVm9+toCfHNTvwU7HZJfAPO\n\t 9kGa0F4riSzvTGtxJGXcFo9BjUlHEaj2gXB/v0CQW+TvfGY19hm173z9RwehYS+KYG\n\t v3yk9PHj4rYsA==","From":"=?utf-8?q?Krzysztof_Wilczy=C5=84ski?= <kwilczynski@kernel.org>","To":"Bjorn Helgaas <bhelgaas@google.com>","Cc":"Bjorn Helgaas <helgaas@kernel.org>,\n Manivannan Sadhasivam <mani@kernel.org>,\n Lorenzo Pieralisi <lpieralisi@kernel.org>,\n Alex Williamson <alex@shazbot.org>, Magnus Lindholm <linmag7@gmail.com>,\n Matt Turner <mattst88@gmail.com>,\n Richard Henderson <richard.henderson@linaro.org>,\n Christophe Leroy <chleroy@kernel.org>,\n Madhavan Srinivasan <maddy@linux.ibm.com>,\n Michael Ellerman <mpe@ellerman.id.au>, Nicholas Piggin <npiggin@gmail.com>,\n Dexuan Cui <decui@microsoft.com>,\n =?utf-8?q?Krzysztof_Ha=C5=82asa?= <khalasa@piap.pl>,\n Lukas Wunner <lukas@wunner.de>, \"Oliver O'Halloran\" <oohall@gmail.com>,\n Saurabh Singh Sengar <ssengar@microsoft.com>,\n Shuan He <heshuan@bytedance.com>, Srivatsa Bhat <srivatsabhat@microsoft.com>,\n\t=?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>,\n linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org,\n linuxppc-dev@lists.ozlabs.org","Subject":"[PATCH v7 23/24] PCI/sysfs: Remove pci_create_legacy_files() and\n pci_sysfs_init()","Date":"Fri,  8 May 2026 04:35:42 +0000","Message-ID":"<20260508043543.217179-24-kwilczynski@kernel.org>","X-Mailer":"git-send-email 2.54.0","In-Reply-To":"<20260508043543.217179-1-kwilczynski@kernel.org>","References":"<20260508043543.217179-1-kwilczynski@kernel.org>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"8bit"},"content":"Currently, pci_create_legacy_files() and pci_remove_legacy_files() are\nno-op stubs.  With legacy attributes now handled by static groups\nregistered via pcibus_groups[], no call site needs them.\n\nRemove both functions, their declarations, and the call sites in\npci_register_host_bridge(), pci_alloc_child_bus(), and pci_remove_bus().\n\nRemove the pci_sysfs_init() late_initcall and sysfs_initialized.  The\nlate_initcall originally existed to create all the dynamic PCI sysfs\nfiles, but with both resource and legacy attributes now handled by\nstatic groups, it is no longer needed.\n\nRemove the legacy_io and legacy_mem fields from struct pci_bus which\nwere used to track the dynamically allocated legacy attributes.\n\nTested-by: Shivaprasad G Bhat <sbhat@linux.ibm.com>\nSigned-off-by: Krzysztof Wilczyński <kwilczynski@kernel.org>\n---\n drivers/pci/pci-sysfs.c | 21 ---------------------\n drivers/pci/pci.h       |  8 --------\n drivers/pci/probe.c     |  6 ------\n drivers/pci/remove.c    |  2 --\n include/linux/pci.h     |  2 --\n 5 files changed, 39 deletions(-)","diff":"diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c\nindex 868b42420358..f5427bcfb0cc 100644\n--- a/drivers/pci/pci-sysfs.c\n+++ b/drivers/pci/pci-sysfs.c\n@@ -37,10 +37,6 @@\n #define ARCH_PCI_DEV_GROUPS\n #endif\n \n-#ifdef HAVE_PCI_LEGACY\n-static int sysfs_initialized;\t/* = 0 */\n-#endif\n-\n /* show configuration fields */\n #define pci_config_attr(field, format_string)\t\t\t\t\\\n static ssize_t\t\t\t\t\t\t\t\t\\\n@@ -1094,8 +1090,6 @@ static const struct attribute_group pci_legacy_mem_sparse_group = {\n \t.is_bin_visible = pci_legacy_mem_sparse_is_visible,\n };\n \n-void pci_create_legacy_files(struct pci_bus *b) { }\n-void pci_remove_legacy_files(struct pci_bus *b) { }\n #endif /* HAVE_PCI_LEGACY */\n \n const struct attribute_group *pcibus_groups[] = {\n@@ -1782,21 +1776,6 @@ static const struct attribute_group pci_dev_resource_resize_attr_group = {\n \t.is_visible = resource_resize_attr_is_visible,\n };\n \n-#ifdef HAVE_PCI_LEGACY\n-static int __init pci_sysfs_init(void)\n-{\n-\tstruct pci_bus *pbus = NULL;\n-\n-\tsysfs_initialized = 1;\n-\n-\twhile ((pbus = pci_find_next_bus(pbus)))\n-\t\tpci_create_legacy_files(pbus);\n-\n-\treturn 0;\n-}\n-late_initcall(pci_sysfs_init);\n-#endif\n-\n static struct attribute *pci_dev_dev_attrs[] = {\n \t&dev_attr_boot_vga.attr,\n \t&dev_attr_serial_number.attr,\ndiff --git a/drivers/pci/pci.h b/drivers/pci/pci.h\nindex c64c7f5f0bcf..4d17dab4662c 100644\n--- a/drivers/pci/pci.h\n+++ b/drivers/pci/pci.h\n@@ -358,14 +358,6 @@ static inline int pci_proc_detach_bus(struct pci_bus *bus) { return 0; }\n int pci_hp_add_bridge(struct pci_dev *dev);\n bool pci_hp_spurious_link_change(struct pci_dev *pdev);\n \n-#if defined(CONFIG_SYSFS) && defined(HAVE_PCI_LEGACY)\n-void pci_create_legacy_files(struct pci_bus *bus);\n-void pci_remove_legacy_files(struct pci_bus *bus);\n-#else\n-static inline void pci_create_legacy_files(struct pci_bus *bus) { }\n-static inline void pci_remove_legacy_files(struct pci_bus *bus) { }\n-#endif\n-\n /* Lock for read/write access to pci device and bus lists */\n extern struct rw_semaphore pci_bus_sem;\n extern struct mutex pci_slot_mutex;\ndiff --git a/drivers/pci/probe.c b/drivers/pci/probe.c\nindex b63cd0c310bc..748c7a198262 100644\n--- a/drivers/pci/probe.c\n+++ b/drivers/pci/probe.c\n@@ -1073,9 +1073,6 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)\n \t\t\tdev_err(&bus->dev, \"failed to add bus: %d\\n\", err);\n \t}\n \n-\t/* Create legacy_io and legacy_mem files for this bus */\n-\tpci_create_legacy_files(bus);\n-\n \tif (parent)\n \t\tdev_info(parent, \"PCI host bridge to bus %s\\n\", name);\n \telse\n@@ -1281,9 +1278,6 @@ static struct pci_bus *pci_alloc_child_bus(struct pci_bus *parent,\n \t\t\tdev_err(&child->dev, \"failed to add bus: %d\\n\", ret);\n \t}\n \n-\t/* Create legacy_io and legacy_mem files for this bus */\n-\tpci_create_legacy_files(child);\n-\n \treturn child;\n }\n \ndiff --git a/drivers/pci/remove.c b/drivers/pci/remove.c\nindex 6e796dbc5b29..d8bffa21498a 100644\n--- a/drivers/pci/remove.c\n+++ b/drivers/pci/remove.c\n@@ -65,8 +65,6 @@ void pci_remove_bus(struct pci_bus *bus)\n \tlist_del(&bus->node);\n \tpci_bus_release_busn_res(bus);\n \tup_write(&pci_bus_sem);\n-\tpci_remove_legacy_files(bus);\n-\n \tif (bus->ops->remove_bus)\n \t\tbus->ops->remove_bus(bus);\n \ndiff --git a/include/linux/pci.h b/include/linux/pci.h\nindex e37677a8dd3c..74b767012766 100644\n--- a/include/linux/pci.h\n+++ b/include/linux/pci.h\n@@ -726,8 +726,6 @@ struct pci_bus {\n \tpci_bus_flags_t bus_flags;\t/* Inherited by child buses */\n \tstruct device\t\t*bridge;\n \tstruct device\t\tdev;\n-\tstruct bin_attribute\t*legacy_io;\t/* Legacy I/O for this bus */\n-\tstruct bin_attribute\t*legacy_mem;\t/* Legacy mem */\n \tunsigned int\t\tis_added:1;\n \tunsigned int\t\tunsafe_warn:1;\t/* warned about RW1C config write */\n \tunsigned int\t\tflit_mode:1;\t/* Link in Flit mode */\n","prefixes":["v7","23/24"]}