Skip to contentSkip to conversation

backports: devcoredump: make patch apply

PATCH In review Johannes Berg 2 participants 6 messages Feb 6, 2017 – Feb 7, 2017 Arm STM32

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 backports: devcoredump: make patch apply

From: Johannes Berg <[email protected]>

Just make the patch apply again - the next commits will auto-generate the necessary backport code.

Change-Id I2b25ccbaadf1d49b9fdd229b3eaf1ecb7a9cf9ce
---
 patches/backport-adjustments/devcoredump.patch | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
patches/backport-adjustments/devcoredump.patch +1 -1
index b840adc145f7..315ffd57e3bf 100644
@@ -62,7 +62,7 @@
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
  	.dev_groups	= devcd_dev_groups,
 +#endif
- 	.class_attrs	= devcd_class_attrs,
+ 	.class_groups	= devcd_class_groups,
  };
  
 @@ -270,6 +281,11 @@ void dev_coredumpm(struct device *dev, s
Signature · 4 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#1 lore raw

PATCH 2/3 backports: restrict group_attr spatch properly

From: Johannes Berg <[email protected]>

Change-Id I8881dab783fe69a85f833c96f0a4abd3ab062e84
---
 .../0001-group-attr/0001-group_attr_class.cocci       | 18 ++++++++++++------
 .../generic/0001-group-attr/0002-group_attr_bus.cocci | 19 ++++++++++++-------
 2 files changed, 24 insertions(+), 13 deletions(-)
patches/collateral-evolutions/generic/0001-group-attr/0001-group_attr_class.cocci +12 -6
index ea2e7039f50c..a9c84651eedc 100644
@@ -33,9 +33,15 @@ declarer name ATTRIBUTE_GROUPS;
 
 ATTRIBUTE_GROUPS(group);
 
-@ class_group depends on attribute_group @
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ class_group @
 identifier group_class;
-expression groups;
+identifier attribute_groups_name.groups;
 fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
 @@
 
@@ -47,9 +53,9 @@ struct class group_class = {
 +#endif
 };
 
-@ attribute_group_mod depends on attribute_group && class_group @
+@ attribute_group_mod depends on class_group @
 declarer name ATTRIBUTE_GROUPS_BACKPORT;
-identifier group;
+identifier attribute_group.group;
 @@
 
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
@@ -59,10 +65,10 @@ ATTRIBUTE_GROUPS(group);
 +ATTRIBUTE_GROUPS_BACKPORT(group);
 +#endif
 
-@ class_registering depends on class_group && attribute_group_mod @
+@ class_registering @
 identifier class_register, ret;
 identifier class_group.group_class;
-fresh identifier group_class_init = "init_" ## attribute_group_mod.group ## "_attrs";
+fresh identifier group_class_init = "init_" ## attribute_group.group ## "_attrs";
 @@
 
 (
patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci +12 -7
index b01da875083b..c19e9d7f3eda 100644
@@ -31,9 +31,15 @@ declarer name ATTRIBUTE_GROUPS;
 
 ATTRIBUTE_GROUPS(group);
 
-@ bus_group depends on attribute_group @
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ bus_group @
 identifier group_bus;
-expression groups;
+identifier attribute_groups_name.groups;
 fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
 @@
 
@@ -45,9 +51,9 @@ struct bus_type group_bus = {
 +#endif
 };
 
-@ attribute_group_mod depends on attribute_group && bus_group @
+@ attribute_group_mod depends on bus_group @
 declarer name ATTRIBUTE_GROUPS_BACKPORT;
-identifier group;
+identifier attribute_group.group;
 @@
 
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
@@ -57,10 +63,10 @@ ATTRIBUTE_GROUPS(group);
 +ATTRIBUTE_GROUPS_BACKPORT(group);
 +#endif
 
-@ bus_registering depends on bus_group && attribute_group_mod @
+@ bus_registering @
 identifier bus_register, ret;
 identifier bus_group.group_bus;
-fresh identifier group_bus_init = "init_" ## attribute_group_mod.group ## "_attrs";
+fresh identifier group_bus_init = "init_" ## attribute_group.group ## "_attrs";
 @@
 
 (
@@ -70,4 +76,3 @@ fresh identifier group_bus_init = "init_" ## attribute_group_mod.group ## "_attr
 +       group_bus_init();
         ret = bus_register(&group_bus);
 )
-
Signature · 4 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#2 lore raw

Re: [PATCH 2/3] backports: restrict group_attr spatch properly

Quoted 1 line · Johannes Berg

From: Johannes Berg <[email protected]>

Maybe explain what went wrong here. I had email discussion with Julia about this one (on cocci list), but glad you picked it up ;-)

Regards,
Arend

Quoted 103 lines
Change-Id I8881dab783fe69a85f833c96f0a4abd3ab062e84
---
 .../0001-group-attr/0001-group_attr_class.cocci       | 18 ++++++++++++------
 .../generic/0001-group-attr/0002-group_attr_bus.cocci | 19 ++++++++++++-------
 2 files changed, 24 insertions(+), 13 deletions(-)
patches/collateral-evolutions/generic/0001-group-attr/0001-group_attr_class.cocci +12 -6
index ea2e7039f50c..a9c84651eedc 100644
@@ -33,9 +33,15 @@ declarer name ATTRIBUTE_GROUPS;
 
 ATTRIBUTE_GROUPS(group);
 
-@ class_group depends on attribute_group @
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ class_group @
 identifier group_class;
-expression groups;
+identifier attribute_groups_name.groups;
 fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
 @@
 
@@ -47,9 +53,9 @@ struct class group_class = {
 +#endif
 };
 
-@ attribute_group_mod depends on attribute_group && class_group @
+@ attribute_group_mod depends on class_group @
 declarer name ATTRIBUTE_GROUPS_BACKPORT;
-identifier group;
+identifier attribute_group.group;
 @@
 
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,11,0)
@@ -59,10 +65,10 @@ ATTRIBUTE_GROUPS(group);
 +ATTRIBUTE_GROUPS_BACKPORT(group);
 +#endif
 
-@ class_registering depends on class_group && attribute_group_mod @
+@ class_registering @
 identifier class_register, ret;
 identifier class_group.group_class;
-fresh identifier group_class_init = "init_" ## attribute_group_mod.group ## "_attrs";
+fresh identifier group_class_init = "init_" ## attribute_group.group ## "_attrs";
 @@
 
 (
patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci +12 -6
index b01da875083b..c19e9d7f3eda 100644
@@ -31,9 +31,15 @@ declarer name ATTRIBUTE_GROUPS;
 
 ATTRIBUTE_GROUPS(group);
 
-@ bus_group depends on attribute_group @
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ bus_group @
 identifier group_bus;
-expression groups;
+identifier attribute_groups_name.groups;
 fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
 @@
 
@@ -45,9 +51,9 @@ struct bus_type group_bus = {
 +#endif
 };
 
-@ attribute_group_mod depends on attribute_group && bus_group @
+@ attribute_group_mod depends on bus_group @
 declarer name ATTRIBUTE_GROUPS_BACKPORT;
-identifier group;
+identifier attribute_group.group;
 @@
 
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0)
@@ -57,10 +63,10 @@ ATTRIBUTE_GROUPS(group);
 +ATTRIBUTE_GROUPS_BACKPORT(group);
 +#endif
 
-@ bus_registering depends on bus_group && attribute_group_mod @
+@ bus_registering @
 identifier bus_register, ret;
 identifier bus_group.group_bus;
-fresh identifier group_bus_init = "init_" ## attribute_group_mod.group ## "_attrs";
+fresh identifier group_bus_init = "init_" ## attribute_group.group ## "_attrs";
 @@
 
 (

patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci fresh identifier group_bus_init = "init_" ## attribute_group_mod.group ## "_attr · line 73

Quoted 4 lines
patches/collateral-evolutions/generic/0001-group-attr/0002-group_attr_bus.cocci +0 -1
@@ -70,4 +76,3 @@ fresh identifier group_bus_init = "init_" ## attribute_group_mod.group ## "_attr
 +       group_bus_init();
         ret = bus_register(&group_bus);
 )
-

--
To unsubscribe from this list: send the line "unsubscribe backports" in

#3 lore raw

PATCH 3/3 backports: support class_groups

In reply to Johannes Berg

From: Johannes Berg <[email protected]>

Add a new semantic patch just like for dev_groups to support class_groups.

Change-Id I114e1a6ed8db901b3aa738a5052721d1da45cae4
---
 .../0001-group-attr/0003-class_groups.cocci        | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci
patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci new file +54 -0
new file mode 100644
index 000000000000..a4694dd75763
@@ -0,0 +1,54 @@
+/* see upstream commit ced6473e74867 */
+
+@ attribute_group @
+identifier group;
+declarer name ATTRIBUTE_GROUPS;
+@@
+
+ATTRIBUTE_GROUPS(group);
+
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ class_group @
+identifier group_class;
+identifier attribute_groups_name.groups;
+fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";
+@@
+
+struct class group_class = {
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+	.class_groups = groups,
++#else
++	.class_attrs = group_dev_attr,
++#endif
+};
+
+@ attribute_group_mod depends on class_group @
+declarer name ATTRIBUTE_GROUPS_BACKPORT;
+identifier attribute_group.group;
+@@
+
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0)
+ATTRIBUTE_GROUPS(group);
++#else
++#define BP_ATTR_GRP_STRUCT class_attribute
++ATTRIBUTE_GROUPS_BACKPORT(group);
++#endif
+
+@ class_registering @
+identifier class_register, ret;
+identifier class_group.group_class;
+fresh identifier group_class_init = "init_" ## attribute_group.group ## "_attrs";
+@@
+
+(
++	group_class_init();
+	return class_register(&group_class);
+|
++	group_class_init();
+	ret = class_register(&group_class);
+)
Signature · 4 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe backports" in
#4 lore raw

Re: [PATCH 3/3] backports: support class_groups

Quoted 6 lines · Johannes Berg

From: Johannes Berg <[email protected]>

Add a new semantic patch just like for dev_groups to support class_groups.

Change-Id: I114e1a6ed8db901b3aa738a5052721d1da45cae4

Does it make sense to keep the Change-Id: things here?

Quoted 21 lines
---
 .../0001-group-attr/0003-class_groups.cocci        | 54 ++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci
patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci new file +9 -0
new file mode 100644
index 000000000000..a4694dd75763
@@ -0,0 +1,54 @@
+/* see upstream commit ced6473e74867 */
+
+@ attribute_group @
+identifier group;
+declarer name ATTRIBUTE_GROUPS;
+@@
+
+ATTRIBUTE_GROUPS(group);
+

patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci line 19

Quoted 10 lines
patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci new file +10 -0
+@script:python attribute_groups_name@
+group << attribute_group.group;
+groups;
+@@
+coccinelle.groups = group + "_groups"
+
+@ class_group @
+identifier group_class;
+identifier attribute_groups_name.groups;
+fresh identifier group_dev_attr = attribute_group.group ## "_dev_attrs";

So how will this work wrt naming scheme. Can we be sure all class_attrs occurrences in the files we copy are named as such, ie. with _dev_attrs post-fix?

Regards,
Arend
--
To unsubscribe from this list: send the line "unsubscribe backports" in

#5 lore raw

Re: [PATCH 3/3] backports: support class_groups

Quoted 4 lines
Quoted 2 lines

Change-Id: I114e1a6ed8db901b3aa738a5052721d1da45cae4

Does it make sense to keep the Change-Id: things here?

Not really. But eventually I got lazy. I've now removed the auto- generation for my tree, which means I'll have to add it manually internally, but whatever :)

Quoted 9 lines
Quoted 5 lines

+@ class_group @

patches/collateral-evolutions/generic/0001-group-attr/0003-class_groups.cocci new file +3 -0
+identifier group_class;
+identifier attribute_groups_name.groups;
+fresh identifier group_dev_attr = attribute_group.group ##

"_dev_attrs";

So how will this work wrt naming scheme. Can we be sure all class_attrs occurrences in the files we copy are named as such, ie. with _dev_attrs post-fix?

No no, that's not what happens here. The _dev_attrs postfix is generated by the ATTRIBUTE_GROUPS_BACKPORT() macro.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in