Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp694136lqp; Wed, 12 Jun 2024 13:20:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWnngSNGVfV6UfGhRDciBZMvYTAdmFhYbeSksKsK7hIAcF6WaE4jA2oCrVGt/v1FLl37ZHLvo7xYUW7tcs/YJF0Y+AAc6LqzXoUNjZcEQ== X-Google-Smtp-Source: AGHT+IHxAhxvt/M+1/dVnpqm5Hjf5HtjCS1ErsL3eCgLuWl76rG6kab95Nt0Et1XN2Pm7EZLHcY5 X-Received: by 2002:a17:902:d2ca:b0:1f6:7ee8:8942 with SMTP id d9443c01a7336-1f83b697bb4mr37656405ad.40.1718223654833; Wed, 12 Jun 2024 13:20:54 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718223654; cv=pass; d=google.com; s=arc-20160816; b=eOzjSfgRJRoc+ZjtGP5eNZdGX5OEJPcaTowxOCn1TDGTCTf6dUPv4ENYA+tps3se4R whq3CNFZSaEBLG9VYyI46SPYRR4CU4hlZuXantNMEBicu2HCk3NeJMOAyxRtMmQzLhHn CRukvWuzRe2uqATggwhRtGcGMbY8WOR6l1tDuX90endHKKsg8/PsADCvFfH2JLKQj3YZ iEBko7AM1sJTYP5+YiR+7rYBb6ykvBSHGr09NDaM74bYqB0DzCQIkq9en3mZ1TgKdfN3 E1rFZiLl4zNFYKCZ+dWp/7s7zoLt7URvfd8GRRAr8qCepPo4hXLKZGd642uZUtSz1SQp CeSg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:subject:cc:to:from:date:dkim-signature; bh=isL7w6YY4rYbgBKl83J+Kl8oAovmTLKLBCA2eooJ/dI=; fh=2kLyy/cUqlbGg9xh8QnTDdHdNyxirB5tYVy0kLaJ5AU=; b=frYKPKsCEYfun52q2ML5ZARwkqVgAgRXytxALvkijd2sUjWbkQCWhlP4LfGtTLxFQl ugeCZS6Y/7TQTNKHFYPtDLgMn4O67Tt3dUsUsCOqt041Q4xZQ44t2CVc2yIMgWn20vMQ vkq47FEplwY1kzCLaDz5gVrLzQmUUTqcvPpEGZjCJfFi9ptHKABO6G1suRHdD8arNLi9 yNGTsSF+flcbdWBuXOPTU+oeeOxgW6OwNmIaDrukbhEZsMs4c2gmGn36SLMoQn7WIWOh A8axLenqOiVXrrDMfSXsIlO1sFsniHJ7HXv6cBGvTqYWxnFKC9IhbwR22XSrV7gaGSZL 7P+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qay0gEo/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f719c1a829si58830525ad.94.2024.06.12.13.20.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 13:20:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-212203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="qay0gEo/"; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-212203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-212203-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.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 6E1D02872AD for ; Wed, 12 Jun 2024 20:20:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 90E9084D08; Wed, 12 Jun 2024 20:20:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="qay0gEo/" 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 B488B55C08; Wed, 12 Jun 2024 20:20:45 +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=1718223645; cv=none; b=nvVBnlGLbmKspsqTj8Fb+9vSoWmwk39KRL1jBb3MLPiCUmTNLiGhWE86HLvKdS6H2GP4w5QGAYrnETRXk5TyqyBt0eXypAV7eFD6W+xmOTCz344k6lk3f+1gz8262r++IAO1fayeu+dj9N6z1CvlDaGW4LQA9EqJQ5uXJg0Wk4M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718223645; c=relaxed/simple; bh=XBpigFK488BpUSYT5s0FHcdoB1pg3lKFZCYWjmNb4HE=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=rmBS4LFDQ7ZbT3GFPjvoKfc4TDav3OS/AGcRJYzuFPDugguGK9rYsFGyuj108T3CivUg5pUtsgU58Pj0M6eNzob4kX6ykeDL2ie0Mxgw4u0aowyTmEy+rCP4hlYYm5/MPusP6jToxzhbX3onDa+YdYZ9oz9/hn9lezhML41WxC8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qay0gEo/; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 18A6AC116B1; Wed, 12 Jun 2024 20:20:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718223645; bh=XBpigFK488BpUSYT5s0FHcdoB1pg3lKFZCYWjmNb4HE=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=qay0gEo/8xVWF2qx7h5/bZgKFxIXuRDfY+jnZjFGBOao8JMYCdEA8s92G88jmUCL0 HhE9h/xcewebQkwro0bn+p/yJh1tpBZBiMguZ43ENdRw5sNDMiMyJsGV9wwL4q3amf qQ1Q37k3TF8z+Frnv4q3PV1bxMKT/LWqBBBxW16JcpS46Uylu7LssxO/OUYUcLdYgM dmzzG9LRbskjsSD6TJI6pXwh0nOblvIex4oddYFzmGaiHS5DyNvzIO30Pr1wONu6VL Fq32FRflwqmZul30ZvV0OPuVb978f/Xf+J9fcz/6p3K7Mq1cdcbT0mt5ldyrVqtpf/ E8VxPwCcmi1OA== Date: Wed, 12 Jun 2024 15:20:43 -0500 From: Bjorn Helgaas To: Greg Kroah-Hartman Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Manivannan Sadhasivam , Kishon Vijay Abraham I , Bjorn Helgaas Subject: Re: [PATCH] PCI: endpoint: make pci_epc_class constant Message-ID: <20240612202043.GA1036897@bhelgaas> 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 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2024061011-citable-herbicide-1095@gregkh> On Mon, Jun 10, 2024 at 10:20:12AM +0200, Greg Kroah-Hartman wrote: > 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 Applied to pci/endpoint for v6.11, thanks! > --- > 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 >