Skip to contentSkip to conversation

staging: most: dim2: remove volatile qualifier from struct int_ch_state

PATCH In review Paulo Tomé 2 participants 2 messages Jul 24 – Jul 25

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: most: dim2: remove volatile qualifier from struct int_ch_state

Remove the 'volatile' type qualifiers from request_counter and service_counter in struct int_ch_state.

According to Documentation/process/volatile-considered-harmful.rst, using volatile type qualifiers for structure members is discouraged in the kernel. Kernel locking and synchronization primitives or explicit accessors should be used instead of relying on compiler volatile semantics.

---
 drivers/staging/most/dim2/hal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/most/dim2/hal.h +2 -2
index 5d69a5e7d299..bc04bd9451af 100644
@@ -34,10 +34,10 @@ struct dim_ch_state {
 
 struct int_ch_state {
 	/* changed only in interrupt context */
-	volatile int request_counter;
+	int request_counter;
 
 	/* changed only in task context */
-	volatile int service_counter;
+	int service_counter;
 
 	u8 idx1;
 	u8 idx2;
Signature · 1 line
2.47.3
#1 lore raw
Quoted 34 lines · Paulo Tomé

Remove the 'volatile' type qualifiers from request_counter and service_counter in struct int_ch_state.

According to Documentation/process/volatile-considered-harmful.rst, using volatile type qualifiers for structure members is discouraged in the kernel. Kernel locking and synchronization primitives or explicit accessors should be used instead of relying on compiler volatile semantics.

---
 drivers/staging/most/dim2/hal.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/most/dim2/hal.h +2 -2
index 5d69a5e7d299..bc04bd9451af 100644
@@ -34,10 +34,10 @@ struct dim_ch_state {
 
 struct int_ch_state {
 	/* changed only in interrupt context */
-	volatile int request_counter;
+	int request_counter;
 
 	/* changed only in task context */
-	volatile int service_counter;
+	int service_counter;
 
 	u8 idx1;
 	u8 idx2;
Signature · 1 line
2.47.3

You usually can not just remove the 'volatile' marking like this, without actually fixing up the code at the same time. Otherwise we would have done so a long time ago :)

Please test to verify your change actually works properly for stuff like this.

thanks,

greg k-h