Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1697921 > unrolled thread

[PATCH 2/5] mm: slub: constify attribute_group structures.

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-07-27 14:10 +0200
Last post2017-07-27 16:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 2/5] mm: slub: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-27 14:10 +0200
    Re: [PATCH 2/5] mm: slub: constify attribute_group structures. Christopher Lameter <cl@linux.com> - 2017-07-27 16:40 +0200

#1697921 — [PATCH 2/5] mm: slub: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-27 14:10 +0200
Subject[PATCH 2/5] mm: slub: constify attribute_group structures.
Message-ID<u7PM5-5VR-9@gated-at.bofh.it>
attribute_group are not supposed to change at runtime. All functions
working with attribute_group provided by <linux/sysfs.h> work with
const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 1d3f983..72af363 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5423,7 +5423,7 @@ static void clear_stat(struct kmem_cache *s, enum stat_item si)
 	NULL
 };
 
-static struct attribute_group slab_attr_group = {
+static const struct attribute_group slab_attr_group = {
 	.attrs = slab_attrs,
 };
 
-- 
1.9.1

[toc] | [next] | [standalone]


#1698039

FromChristopher Lameter <cl@linux.com>
Date2017-07-27 16:40 +0200
Message-ID<u7S7g-7g8-33@gated-at.bofh.it>
In reply to#1697921
On Thu, 27 Jul 2017, Arvind Yadav wrote:

> attribute_group are not supposed to change at runtime. All functions
> working with attribute_group provided by <linux/sysfs.h> work with
> const attribute_group. So mark the non-const structs as const.

Acked-by: Christoph Lameter <cl@linux.com>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web