Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp213151lqp; Mon, 10 Jun 2024 01:20:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWv5UHbbKoGxby04uQ4z8/xYKCq8KHdxzh7bkGuzNS2VjDaUo4dCuUy6pUvW558sxKfu6Po/YqLU8bs+eP+VAekQ7j9iHaqzm5MyeBGfw== X-Google-Smtp-Source: AGHT+IE7dlhe5VqE4qsziXjp2MIwTBfael4T/+utE+Ak/QHTk+TlEO8G1ih7kIFtfClqGJarb5Ox X-Received: by 2002:a17:902:e802:b0:1f2:fbda:8671 with SMTP id d9443c01a7336-1f6d02d6275mr94010965ad.6.1718007626954; Mon, 10 Jun 2024 01:20:26 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718007626; cv=pass; d=google.com; s=arc-20160816; b=YQPQeV09Qq5jbQb1kHXXlcCHucITzHTKa5g8p+jRlId5tTuPuguYmc5yJKxL7k5ITf nbr52DbnaoCQLSKQFz32B2xCU7GZINfQsz77BlvmMtNAtVL+wJ1xZJkSdagBLlucEkez XO1Fuil+rHvhRmIt46S9j/d8BA3+Dsk9f0MwvM6tkceoE5DbudHJIwHTCDUN9EMmqN5/ uD2hR8pQ8QrHUfeQbBCAy13IdxwkxmR7VHYkWbfgQver1XcA8+cuv+nXFQv6Plgt9vtR JKOWb2RAnUHxCziwFij+tMCDLGjahRtEBHCc89Ro4MYAA7AtG71VlheAS9iXLsHlBWzH ZPcw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:lines:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=UBu5OcjDDlWYUbXdzll2bI2RD4KRsCkdAxrNVXDo+TM=; fh=NWbVn7slhiajb39Eozjto9JsZkshXAvW/u8oYuwVRY0=; b=aMdyDu8Sl+Smn/upHagfGGyCXh84V90sxA+tFucyA/fEPMe6S4hsyOkS9c8h09PU7c gyoJgo3cYN7xLwWstdbqcpVPnEjZpaXatwKmC5AEHTRbmfcoj9jRhS8dW2JSM+gB6rpB Io8pg03I3VIrA97lmLfFdc5hjArqpu6Gx+j2xYU3H3olC1osD0uy1QB6TDj+7RTVXP68 zIv80qVO8WZ4KdCK0nxaS5QOq2bLAoZ9IrcnvXua+KgQ5ARbBDACURMqwnmD92eLq6em BYoLNvesmJh17PrkETk9Cs+q04u68TnnaxeQAtkkJAa06AKhSXLDYwSXqTnZDAc8XLxj oCKA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pj7IFzhJ; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-207833-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207833-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f7226ec415si174615ad.598.2024.06.10.01.20.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 01:20:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207833-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pj7IFzhJ; arc=pass (i=1 dkim=pass dkdomain=linuxfoundation.org); spf=pass (google.com: domain of linux-kernel+bounces-207833-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207833-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 94C63281F68 for ; Mon, 10 Jun 2024 08:20:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BFF326BFA5; Mon, 10 Jun 2024 08:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="pj7IFzhJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D6C8B5FBB1; Mon, 10 Jun 2024 08:20:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718007617; cv=none; b=gP9HgN1bgb0b48mqP8pIIWDwejTU1DgK0wf64XEXC9IaHvyansvdKHgUE1wPocFH1QXn9Z6Xd+l5abfjt2cd1RIEaw//sI60tOq71SnfnEuezghIHfwphkQz/6wcHpL7PLUTuHkYqP2T4F/5HAQYvFkr8BZYhp0BvltqqxEFoPI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718007617; c=relaxed/simple; bh=5VmHzrPdC/CIGGKylU0d9hH6o72bK54XNQDQJIirotE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=JVXLVyqbafXeH23AI5DRkILi67Tn1m0YTSF/Nvq9zHtzopnXtaouwx1iQFHyUXxh06NGolEsJjt/WabNurHGBogyT7lrdIgmAl2DBXissFxv48ngcALk10Kolye2zxEr0POrVj/YHe7NGrLP6j7cvkfQvoK4VYcCeGFRz4akkYg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=pj7IFzhJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE1DAC2BBFC; Mon, 10 Jun 2024 08:20:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718007616; bh=5VmHzrPdC/CIGGKylU0d9hH6o72bK54XNQDQJIirotE=; h=From:To:Cc:Subject:Date:From; b=pj7IFzhJOdf4S5BJSMuPtAAJdqLMuLQ4mVKIBMBOMlsyZwnKzF20RX97zqRiGxWAF qBNVSCWgN8d+nei52/EI/LCCZJTexkJfSdXphhuhFd0h9EOGYhg5EKa6ekC699urnM CwOTYFlBZOrVn33Kfap1yd1xJ9H4Cu5CGtSTnnr8= From: Greg Kroah-Hartman To: linux-pci@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Lorenzo Pieralisi , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas Subject: [PATCH] PCI: endpoint: make pci_epc_class constant Date: Mon, 10 Jun 2024 10:20:12 +0200 Message-ID: <2024061011-citable-herbicide-1095@gregkh> X-Mailer: git-send-email 2.45.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Lines: 74 X-Developer-Signature: v=1; a=openpgp-sha256; l=2396; i=gregkh@linuxfoundation.org; h=from:subject:message-id; bh=5VmHzrPdC/CIGGKylU0d9hH6o72bK54XNQDQJIirotE=; b=owGbwMvMwCRo6H6F97bub03G02pJDGlp2633nuvS1ktzDV3P/1xjbfihlLY9OqH+cyPLrq2p5 z/66OObjlgWBkEmBlkxRZYv23iO7q84pOhlaHsaZg4rE8gQBi5OAZjIN36GBVMM+/O8X/jduvG6 aGEE15IOzbRNDxkWbC6dGXn0oGizK9NmFYVmA8+SusQvAA== X-Developer-Key: i=gregkh@linuxfoundation.org; a=openpgp; fpr=F4B60CC5BF78C2214A313DCB3147D40DDB2DFB29 Content-Transfer-Encoding: 8bit Now that the driver core allows for struct class to be in read-only memory, we should make all 'class' structures declared at build time placing them into read-only memory, instead of having to be dynamically allocated at runtime. Cc: Lorenzo Pieralisi Cc: "Krzysztof WilczyƄski" Cc: Manivannan Sadhasivam Cc: Kishon Vijay Abraham I Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/pci/endpoint/pci-epc-core.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 47d27ec7439d..ed038dd77f83 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -14,7 +14,9 @@ #include #include -static struct class *pci_epc_class; +static const struct class pci_epc_class = { + .name = "pci_epc", +}; static void devm_pci_epc_release(struct device *dev, void *res) { @@ -60,7 +62,7 @@ struct pci_epc *pci_epc_get(const char *epc_name) struct device *dev; struct class_dev_iter iter; - class_dev_iter_init(&iter, pci_epc_class, NULL, NULL); + class_dev_iter_init(&iter, &pci_epc_class, NULL, NULL); while ((dev = class_dev_iter_next(&iter))) { if (strcmp(epc_name, dev_name(dev))) continue; @@ -867,7 +869,7 @@ __pci_epc_create(struct device *dev, const struct pci_epc_ops *ops, INIT_LIST_HEAD(&epc->pci_epf); device_initialize(&epc->dev); - epc->dev.class = pci_epc_class; + epc->dev.class = &pci_epc_class; epc->dev.parent = dev; epc->dev.release = pci_epc_release; epc->ops = ops; @@ -927,20 +929,13 @@ EXPORT_SYMBOL_GPL(__devm_pci_epc_create); static int __init pci_epc_init(void) { - pci_epc_class = class_create("pci_epc"); - if (IS_ERR(pci_epc_class)) { - pr_err("failed to create pci epc class --> %ld\n", - PTR_ERR(pci_epc_class)); - return PTR_ERR(pci_epc_class); - } - - return 0; + return class_register(&pci_epc_class); } module_init(pci_epc_init); static void __exit pci_epc_exit(void) { - class_destroy(pci_epc_class); + class_unregister(&pci_epc_class); } module_exit(pci_epc_exit); -- 2.45.2