Re: [PATCH] staging: most: dim2: remove volatile qualifier from struct int_ch_state
From: Greg Kroah-Hartman
Date: Sat Jul 25 2026 - 01:34:24 EST
On Fri, Jul 24, 2026 at 09:41:46PM +0100, Paulo Tomé wrote:
> 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.
>
> Signed-off-by: Paulo Tomé <paulo.jorge.tome@xxxxxxxxx>
> ---
> drivers/staging/most/dim2/hal.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/most/dim2/hal.h b/drivers/staging/most/dim2/hal.h
> index 5d69a5e7d299..bc04bd9451af 100644
> --- a/drivers/staging/most/dim2/hal.h
> +++ b/drivers/staging/most/dim2/hal.h
> @@ -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;
> --
> 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