Re: [PATCH] staging:slicoss:slicoss.h remove volatile variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Vikul, welcome! See my comment below...

On Fri, Jun 26, 2015 at 12:57 PM, Vikul Gupta <guptav@xxxxxxxxxxxxxxxxxx> wrote:
> I am a high school student trying to become familiar with the opensource
> process and linux kernel. This is my first submission to the mailing list.
>
> I fixed the slicoss sub-system. The TODO file asks to remove volatile
> variables - also, checkpatch.pl warnings included volatile variables.
>
> I removed "volatile" from the variables /isr /and /linkstatus/ in the header
> file, because they are not needed. The two variables are used in the
> slicoss.c file, where /isr/ is used as function parameters, string outputs,
> pointers, logic, and one assignment, while /linkstatus /is used as pointers,
> logic, and one assignment. All but the assignments will not change these
> variables, and the assignment does not warrant a volatile qualifier.

It is not safe to simply drop volatile from these fields. For example,
slic_card_init polls on isr waiting for the device to write to it. If you
drop volatile, the compiler is within its rights to pull the read out of
the loop.

>
> To make sure the changes were correct, I ran the files with checkpatch.pl
> again, test built it, and rebooted it.
>
> Signed-off-by: Vikul Gupta <guptav@xxxxxxxxxxxxxxxxxx>
>
> diff --git a/drivers/staging/slicoss/slic.h b/drivers/staging/slicoss/slic.h
> index 3a5aa88..f19f86a 100644
> --- a/drivers/staging/slicoss/slic.h
> +++ b/drivers/staging/slicoss/slic.h
> @@ -357,8 +357,8 @@ struct base_driver {
>  };
>
>  struct slic_shmem {
> -    volatile u32          isr;
> -    volatile u32          linkstatus;
> +    u32          isr;
> +    u32          linkstatus;
>      volatile struct slic_stats     inicstats;
>  };
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux