* [PATCH] dlm: constify kset_uevent_ops structure
@ 2017-07-29 8:51 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-07-29 8:51 UTC (permalink / raw)
To: Christine Caulfield
Cc: bhumirks, kernel-janitors, David Teigland, cluster-devel, linux-kernel
The kset_uevent_ops structure is only passed as the second argument
to kset_create_and_add, which is declared as const. Thus the
kset_uevent_ops structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct kset_uevent_ops i@p = { ... };
@ok1@
identifier r.i;
expression e;
position p;
@@
kset_create_and_add(e,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct kset_uevent_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct kset_uevent_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/dlm/lockspace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 9ebfa05..78a7c85 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -235,7 +235,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
return 0;
}
-static struct kset_uevent_ops dlm_uevent_ops = {
+static const struct kset_uevent_ops dlm_uevent_ops = {
.uevent = dlm_uevent,
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] dlm: constify kset_uevent_ops structure
@ 2017-07-29 8:51 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-07-29 8:51 UTC (permalink / raw)
To: Christine Caulfield
Cc: bhumirks, kernel-janitors, David Teigland, cluster-devel, linux-kernel
The kset_uevent_ops structure is only passed as the second argument
to kset_create_and_add, which is declared as const. Thus the
kset_uevent_ops structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct kset_uevent_ops i@p = { ... };
@ok1@
identifier r.i;
expression e;
position p;
@@
kset_create_and_add(e,&i@p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct kset_uevent_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct kset_uevent_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/dlm/lockspace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 9ebfa05..78a7c85 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -235,7 +235,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
return 0;
}
-static struct kset_uevent_ops dlm_uevent_ops = {
+static const struct kset_uevent_ops dlm_uevent_ops = {
.uevent = dlm_uevent,
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [Cluster-devel] [PATCH] dlm: constify kset_uevent_ops structure
@ 2017-07-29 8:51 ` Julia Lawall
0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2017-07-29 8:51 UTC (permalink / raw)
To: cluster-devel.redhat.com
The kset_uevent_ops structure is only passed as the second argument
to kset_create_and_add, which is declared as const. Thus the
kset_uevent_ops structure itself can be const.
Done with the help of Coccinelle.
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct kset_uevent_ops i at p = { ... };
@ok1@
identifier r.i;
expression e;
position p;
@@
kset_create_and_add(e,&i at p,...)
@bad@
position p != {r.p,ok1.p};
identifier r.i;
struct kset_uevent_ops e;
@@
e at i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct kset_uevent_ops i = { ... };
// </smpl>
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
---
fs/dlm/lockspace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 9ebfa05..78a7c85 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -235,7 +235,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
return 0;
}
-static struct kset_uevent_ops dlm_uevent_ops = {
+static const struct kset_uevent_ops dlm_uevent_ops = {
.uevent = dlm_uevent,
};
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] dlm: constify kset_uevent_ops structure
@ 2017-07-28 13:19 Bhumika Goyal
0 siblings, 0 replies; 4+ messages in thread
From: Bhumika Goyal @ 2017-07-28 13:19 UTC (permalink / raw)
To: julia.lawall, ccaulfie, teigland, cluster-devel, linux-kernel
Cc: Bhumika Goyal
Declare kset_uevent_ops structure as const as it is only passed as an
argument to the function kset_create_and_add. This argument is of type
const, so declare the structure as const.
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
---
fs/dlm/lockspace.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 9ebfa05..78a7c85 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -235,7 +235,7 @@ static int dlm_uevent(struct kset *kset, struct kobject *kobj,
return 0;
}
-static struct kset_uevent_ops dlm_uevent_ops = {
+static const struct kset_uevent_ops dlm_uevent_ops = {
.uevent = dlm_uevent,
};
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-29 9:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-29 8:51 [PATCH] dlm: constify kset_uevent_ops structure Julia Lawall
2017-07-29 8:51 ` [Cluster-devel] " Julia Lawall
2017-07-29 8:51 ` Julia Lawall
-- strict thread matches above, loose matches on Subject: below --
2017-07-28 13:19 Bhumika Goyal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.