Message ID | 20230216-kobj_type-pci-v1-1-46a63c8612b5@weissschuh.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp41327wrn; Wed, 15 Feb 2023 17:36:45 -0800 (PST) X-Google-Smtp-Source: AK7set+ftjZT3wnq6O1dEa9SMDqZ+RphIKm76/uOSji3jRR8/3eJ6jDf69li+oUhcnJypuZRetKY X-Received: by 2002:a17:906:194a:b0:8ae:f19f:609e with SMTP id b10-20020a170906194a00b008aef19f609emr3902258eje.66.1676511405385; Wed, 15 Feb 2023 17:36:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676511405; cv=none; d=google.com; s=arc-20160816; b=n1EbHoJ4HOJ6BSN3AEzZsfors5vHgnghPZiOCdyYTrD9mg8Lb19w63u/NQZ9kcRpFy NkhQwXlyFODIxL6MPIDtogUxC9E+b4YAjBYH1uZU2eNxRu1gUjgzECo5uNoQxjVVI+UN 3roaH79FhcnNgU8UrjUVWvyWJ192WF2MxYPeKYX5m/mmr0VcSdH2FeSUly5+oWTKkSLe ChKNfnLBNG35sP71/7N3M3uU9T+LjRHDTJ+JOZlvVBm3J8NJ7tKbBJJx7uzq3adV36oU b33rgavX3o60NdjYVQUMHX/TNnL0tNsWXmDq9MfNvfnKk2VzUMsc8Z9LXVDo5TQ4j7Ka s+aA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:dkim-signature:from; bh=msnrPUWUwcKKEt0kDUVuimGrpAWhxuVCoPyTHLdsQ9Y=; b=ZwHSHqV6tFT9acIPY7Evi1XbCyPP95rhQi+m1IJXaV+BJzR89pW2SlM+PKnFl5Fqk9 uz0Bf9t1EH+2BM8s4ewg4B3ixQOymUxj1cDY3mCWbg9RKgTyL2kYd8wv3QmSLIzFNKxk OqueyJTM7MA/A2iG5Se+HmxqG3wuN/21psTkfsQzoeTE/qaHOURWsh5zFLdFlR5z7L9Z IBTOSHn/Ks3Aid4rkAA1PDofexXx0DGawYdtpc8Iyc6ISBDHZ/EO1hAdd3EtJNqDbm0N 2XzUsqktumYpn8mEEBUnA5qusPNOflJUvAwqpIv0BhgKcxyfOzTeLt/2ZCq1gUgi+6QX dIPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=MJgsD76E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t27-20020a170906c39b00b008b13beeac0fsi295166ejz.506.2023.02.15.17.36.20; Wed, 15 Feb 2023 17:36:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@weissschuh.net header.s=mail header.b=MJgsD76E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229686AbjBPBMb (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Wed, 15 Feb 2023 20:12:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229664AbjBPBM3 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Feb 2023 20:12:29 -0500 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EC4E2D14D; Wed, 15 Feb 2023 17:12:29 -0800 (PST) From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= <linux@weissschuh.net> DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=weissschuh.net; s=mail; t=1676509947; bh=kc10ysum1fgE8G0TGJD9iTwul53Fadc9NPF5PzVzIRg=; h=From:Date:Subject:To:Cc:From; b=MJgsD76EQTYHTItU7zHR1kL/6enTjHlZGnXC59lcJwKs5Y6lK9aAZsAmmInnHm3Mu xAvtegaZtP6snFbMBDX7knQ5jIyMqRUahZ8k9NpJ+JOBWrbsBNppib3j9dS/HgJ2qz Xh+6wo1SKdpPCm6NoNsSpCEafDmAl/YRQPjGqC+w= Date: Thu, 16 Feb 2023 01:12:25 +0000 Subject: [PATCH] PCI/sysfs: Make kobj_type structure constant MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20230216-kobj_type-pci-v1-1-46a63c8612b5@weissschuh.net> X-B4-Tracking: v=1; b=H4sIAPiC7WMC/x2N0QqDMAwAf0XyvEDbMR/2K2OMJsYZlVpaNybiv y/4eAfH7VClqFS4NzsU+WrVJRn4SwM8xPQW1M4YggtXF3yL00Lja92yYGbFW+uDY8+OmMAailW QSkw8WJU+82wyF+n1d04ez+P4A/z6ttt0AAAA To: Bjorn Helgaas <bhelgaas@google.com> Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Thoma?= =?utf-8?q?s_Wei=C3=9Fschuh?= <linux@weissschuh.net> X-Mailer: b4 0.12.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1676509945; l=1024; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=kc10ysum1fgE8G0TGJD9iTwul53Fadc9NPF5PzVzIRg=; b=nBHSR5OXBM+Ng6q1iZbSBbnSSPh+rCujb5zkRIerfTPKT+OzqAlXXmmtbDGf0SARS07Eo2HLr nfuywLpMy4ADY0GoGdYoDcnpN9crUYoYBY4/lstsHHTXniWZooFG5dH X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1757949623401491610?= X-GMAIL-MSGID: =?utf-8?q?1757949623401491610?= |
Series |
PCI/sysfs: Make kobj_type structure constant
|
|
Commit Message
Thomas Weißschuh
Feb. 16, 2023, 1:12 a.m. UTC
Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.")
the driver core allows the usage of const struct kobj_type.
Take advantage of this to constify the structure definition to prevent
modification at runtime.
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
drivers/pci/slot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf
change-id: 20230216-kobj_type-pci-56120c1c0bcb
Best regards,
Comments
On Thu, Feb 16, 2023 at 01:12:25AM +0000, Thomas Weißschuh wrote: > Since commit ee6d3dd4ed48 ("driver core: make kobj_type constant.") > the driver core allows the usage of const struct kobj_type. > > Take advantage of this to constify the structure definition to prevent > modification at runtime. > > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Applied to pci/misc for v6.13, thanks, Thomas! > --- > drivers/pci/slot.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c > index a0c67191a8b9..0f87cade10f7 100644 > --- a/drivers/pci/slot.c > +++ b/drivers/pci/slot.c > @@ -98,7 +98,7 @@ static struct attribute *pci_slot_default_attrs[] = { > }; > ATTRIBUTE_GROUPS(pci_slot_default); > > -static struct kobj_type pci_slot_ktype = { > +static const struct kobj_type pci_slot_ktype = { > .sysfs_ops = &pci_slot_sysfs_ops, > .release = &pci_slot_release, > .default_groups = pci_slot_default_groups, > > --- > base-commit: 033c40a89f55525139fd5b6342281b09b97d05bf > change-id: 20230216-kobj_type-pci-56120c1c0bcb > > Best regards, > -- > Thomas Weißschuh <linux@weissschuh.net> >
diff --git a/drivers/pci/slot.c b/drivers/pci/slot.c index a0c67191a8b9..0f87cade10f7 100644 --- a/drivers/pci/slot.c +++ b/drivers/pci/slot.c @@ -98,7 +98,7 @@ static struct attribute *pci_slot_default_attrs[] = { }; ATTRIBUTE_GROUPS(pci_slot_default); -static struct kobj_type pci_slot_ktype = { +static const struct kobj_type pci_slot_ktype = { .sysfs_ops = &pci_slot_sysfs_ops, .release = &pci_slot_release, .default_groups = pci_slot_default_groups,