Skip to contentSkip to conversation

coccinelle: api: add device_attr_show script

PATCH Markus Elfring 2 participants 3 messages Jun 15, 2020 Kernel janitors

lore
Share & tools
lore
#0 lore raw
Quoted 1 line

+// Confidence: High

Would you like to add any suggestion for a possible patch message?

…

Review

Quoted 4 lines
(quoted diff) +4 -0
+virtual report
+virtual org
+virtual context
+virtual patch

+virtual report, org, context, patch

Is such a SmPL code variant more succinct?

…

Review

Quoted 6 lines
(quoted diff) +6 -0
+ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	<...
+*	return snprintf@p(...);
+	...>
+}

I suggest to reconsider the selection of the SmPL nest construct.
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L783

Can the construct “<+... … ...+>” become relevant here?

Would you like to consider any further software design consequences around the safe application of the asterisk functionality in rules for the semantic patch language?

Regards,
Markus

#1 lore raw
Quoted 6 lines · Markus Elfring
Quoted 1 line

+// Confidence: High

Would you like to add any suggestion for a possible patch message?

…

Quoted 8 lines

Review

Quoted 4 lines
(quoted diff) +4 -0
+virtual report
+virtual org
+virtual context
+virtual patch

+virtual report, org, context, patch

Is such a SmPL code variant more succinct?

This doens't matter.

Quoted 13 lines

…

Review

Quoted 6 lines
(quoted diff) +6 -0
+ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	<...
+*	return snprintf@p(...);
+	...>
+}

I suggest to reconsider the selection of the SmPL nest construct.
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L783

Quoted 1 line

Can the construct “<+... … ...+>” become relevant here?

<... ...> is fine if the only thing that will be used afterwards is what is inside the <... ...>

julia

Quoted 9 lines

Would you like to consider any further software design consequences around the safe application of the asterisk functionality in rules for the semantic patch language?

Regards,
Markus

#2 lore raw
Quoted 5 lines
Quoted 3 lines

+virtual report, org, context, patch

Is such a SmPL code variant more succinct?

This doens't matter.

Can less duplicate code be a bit nicer?

Quoted 10 lines
Quoted 10 lines

Review

Quoted 6 lines
(quoted diff) +6 -0
+ssize_t show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+	<...
+*	return snprintf@p(...);
+	...>
+}

I suggest to reconsider the selection of the SmPL nest construct.
https://github.com/coccinelle/coccinelle/blob/e06b9156dfa02a28cf3cbf0913a10513f3d163ab/docs/manual/cocci_syntax.tex#L783

Quoted 4 lines
Quoted 1 line

Can the construct “<+... … ...+>” become relevant here?

<... ...> is fine if the only thing that will be used afterwards is what is inside the <... ...>

I propose once more to distinguish better if the shown return statement may be really treated as optional for such a source code search approach (or not).

Regards,
Markus