Patchwork Staging: ccree: Don't use volatile for monitor_lock

login
register
mail settings
Submitter srishti
Date Sept. 11, 2017, 3:59 p.m.
Message ID <1505145571-11248-1-git-send-email-srishtishar@gmail.com>
Download mbox | patch
Permalink /patch/9947647/
State Not Applicable
Delegated to: Herbert Xu
Headers show

Comments

srishti - Sept. 11, 2017, 3:59 p.m.
The use of volatile for the variable monitor_lock is unnecessary.

Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
---
 drivers/staging/ccree/ssi_request_mgr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
2.7.4
Julia Lawall - Sept. 11, 2017, 4:03 p.m.
On Mon, 11 Sep 2017, Srishti Sharma wrote:

> The use of volatile for the variable monitor_lock is unnecessary.

You need to give more evidence of why this is the case.  How is the
variable used?  I guess this comes from checkpatch, but checkpatch has
only a local view of things, and doesn't know how the variable is used.

julia

>
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
> index e5c2f92..7d77941 100644
> --- a/drivers/staging/ccree/ssi_request_mgr.c
> +++ b/drivers/staging/ccree/ssi_request_mgr.c
> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>  	dma_addr_t dummy_comp_buff_dma;
>  	struct cc_hw_desc monitor_desc;
>
> -	volatile unsigned long monitor_lock;
> +	unsigned long monitor_lock;
>  #ifdef COMP_IN_WQ
>  	struct workqueue_struct *workq;
>  	struct delayed_work compwork;
> --
> 2.7.4
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505145571-11248-1-git-send-email-srishtishar%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
>
gregkh@linuxfoundation.org - Sept. 11, 2017, 4:04 p.m.
On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
> The use of volatile for the variable monitor_lock is unnecessary.
> 
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
> index e5c2f92..7d77941 100644
> --- a/drivers/staging/ccree/ssi_request_mgr.c
> +++ b/drivers/staging/ccree/ssi_request_mgr.c
> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>  	dma_addr_t dummy_comp_buff_dma;
>  	struct cc_hw_desc monitor_desc;
> 
> -	volatile unsigned long monitor_lock;
> +	unsigned long monitor_lock;

While volatile is not right, odds are, this is still totally wrong as
well.  How about using a "real" lock instead?

thanks,

greg k-h
srishti - Sept. 11, 2017, 4:08 p.m.
On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
>> The use of volatile for the variable monitor_lock is unnecessary.
>>
>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> ---
>>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
>> index e5c2f92..7d77941 100644
>> --- a/drivers/staging/ccree/ssi_request_mgr.c
>> +++ b/drivers/staging/ccree/ssi_request_mgr.c
>> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>>       dma_addr_t dummy_comp_buff_dma;
>>       struct cc_hw_desc monitor_desc;
>>
>> -     volatile unsigned long monitor_lock;
>> +     unsigned long monitor_lock;
>
> While volatile is not right, odds are, this is still totally wrong as
> well.  How about using a "real" lock instead?

I tried to find where is this variable being used in the code, but I
didn't find any usage of it . It might be an important attribute of
this structure definition but, I don't see it's value being set to
anything or being used somewhere .

Regards,
Srishti
>
> thanks,
>
> greg k-h
Sean Paul - Sept. 11, 2017, 4:10 p.m.
On Mon, Sep 11, 2017 at 12:08 PM, Srishti Sharma <srishtishar@gmail.com> wrote:
> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
>>> The use of volatile for the variable monitor_lock is unnecessary.
>>>
>>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>>> ---
>>>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
>>> index e5c2f92..7d77941 100644
>>> --- a/drivers/staging/ccree/ssi_request_mgr.c
>>> +++ b/drivers/staging/ccree/ssi_request_mgr.c
>>> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>>>       dma_addr_t dummy_comp_buff_dma;
>>>       struct cc_hw_desc monitor_desc;
>>>
>>> -     volatile unsigned long monitor_lock;
>>> +     unsigned long monitor_lock;
>>
>> While volatile is not right, odds are, this is still totally wrong as
>> well.  How about using a "real" lock instead?
>
> I tried to find where is this variable being used in the code, but I
> didn't find any usage of it . It might be an important attribute of
> this structure definition but, I don't see it's value being set to
> anything or being used somewhere .
>

AFAICT, it's not used. Your patch should just remove it instead :)

Sean

> Regards,
> Srishti
>>
>> thanks,
>>
>> greg k-h
>
> --
> You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/CAB3L5oxcyhgyy8EuGuPo9QtJQd-W7JTgQQE1PfopZFmSx58P9g%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.
Julia Lawall - Sept. 11, 2017, 4:11 p.m.
On Mon, 11 Sep 2017, Srishti Sharma wrote:

> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
> >> The use of volatile for the variable monitor_lock is unnecessary.
> >>
> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> >> ---
> >>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
> >> index e5c2f92..7d77941 100644
> >> --- a/drivers/staging/ccree/ssi_request_mgr.c
> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c
> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
> >>       dma_addr_t dummy_comp_buff_dma;
> >>       struct cc_hw_desc monitor_desc;
> >>
> >> -     volatile unsigned long monitor_lock;
> >> +     unsigned long monitor_lock;
> >
> > While volatile is not right, odds are, this is still totally wrong as
> > well.  How about using a "real" lock instead?
>
> I tried to find where is this variable being used in the code, but I
> didn't find any usage of it . It might be an important attribute of
> this structure definition but, I don't see it's value being set to
> anything or being used somewhere .

Try removing it and see if the code still compiles.  There is always a
danger that a use of something could be constructed using ## in a macro,
although given the uses of ## for this driver, it doesn't seem likely
here.

julia
srishti - Sept. 11, 2017, 4:15 p.m.
On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Mon, 11 Sep 2017, Srishti Sharma wrote:
>
>> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
>> >> The use of volatile for the variable monitor_lock is unnecessary.
>> >>
>> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> >> ---
>> >>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>> >>
>> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
>> >> index e5c2f92..7d77941 100644
>> >> --- a/drivers/staging/ccree/ssi_request_mgr.c
>> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c
>> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>> >>       dma_addr_t dummy_comp_buff_dma;
>> >>       struct cc_hw_desc monitor_desc;
>> >>
>> >> -     volatile unsigned long monitor_lock;
>> >> +     unsigned long monitor_lock;
>> >
>> > While volatile is not right, odds are, this is still totally wrong as
>> > well.  How about using a "real" lock instead?
>>
>> I tried to find where is this variable being used in the code, but I
>> didn't find any usage of it . It might be an important attribute of
>> this structure definition but, I don't see it's value being set to
>> anything or being used somewhere .
>
> Try removing it and see if the code still compiles.  There is always a
> danger that a use of something could be constructed using ## in a macro,
> although given the uses of ## for this driver, it doesn't seem likely
> here.

Yes, I'll do that.

Regards,
Srishti
>
> julia
srishti - Sept. 11, 2017, 4:34 p.m.
On Mon, Sep 11, 2017 at 9:45 PM, Srishti Sharma <srishtishar@gmail.com> wrote:
> On Mon, Sep 11, 2017 at 9:41 PM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>>
>>
>> On Mon, 11 Sep 2017, Srishti Sharma wrote:
>>
>>> On Mon, Sep 11, 2017 at 9:34 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
>>> > On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
>>> >> The use of volatile for the variable monitor_lock is unnecessary.
>>> >>
>>> >> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>>> >> ---
>>> >>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>>> >>  1 file changed, 1 insertion(+), 1 deletion(-)
>>> >>
>>> >> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
>>> >> index e5c2f92..7d77941 100644
>>> >> --- a/drivers/staging/ccree/ssi_request_mgr.c
>>> >> +++ b/drivers/staging/ccree/ssi_request_mgr.c
>>> >> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>>> >>       dma_addr_t dummy_comp_buff_dma;
>>> >>       struct cc_hw_desc monitor_desc;
>>> >>
>>> >> -     volatile unsigned long monitor_lock;
>>> >> +     unsigned long monitor_lock;
>>> >
>>> > While volatile is not right, odds are, this is still totally wrong as
>>> > well.  How about using a "real" lock instead?
>>>
>>> I tried to find where is this variable being used in the code, but I
>>> didn't find any usage of it . It might be an important attribute of
>>> this structure definition but, I don't see it's value being set to
>>> anything or being used somewhere .
>>
>> Try removing it and see if the code still compiles.  There is always a
>> danger that a use of something could be constructed using ## in a macro,
>> although given the uses of ## for this driver, it doesn't seem likely
>> here.

It compiles, so I have removed the variable and sent another patch

Thanks,
Srishti

>
> Yes, I'll do that.
>
> Regards,
> Srishti
>>
>> julia
Dan Carpenter - Sept. 12, 2017, 9:19 a.m.
On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
> The use of volatile for the variable monitor_lock is unnecessary.
> 
> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
> ---
>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
> index e5c2f92..7d77941 100644
> --- a/drivers/staging/ccree/ssi_request_mgr.c
> +++ b/drivers/staging/ccree/ssi_request_mgr.c
> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>  	dma_addr_t dummy_comp_buff_dma;
>  	struct cc_hw_desc monitor_desc;
> 
> -	volatile unsigned long monitor_lock;
> +	unsigned long monitor_lock;

The variable seems unused.  Try deleting it instead.

regards,
dan carpenter
srishti - Sept. 12, 2017, 12:05 p.m.
On Tue, Sep 12, 2017 at 2:49 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> On Mon, Sep 11, 2017 at 09:29:31PM +0530, Srishti Sharma wrote:
>> The use of volatile for the variable monitor_lock is unnecessary.
>>
>> Signed-off-by: Srishti Sharma <srishtishar@gmail.com>
>> ---
>>  drivers/staging/ccree/ssi_request_mgr.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
>> index e5c2f92..7d77941 100644
>> --- a/drivers/staging/ccree/ssi_request_mgr.c
>> +++ b/drivers/staging/ccree/ssi_request_mgr.c
>> @@ -49,7 +49,7 @@ struct ssi_request_mgr_handle {
>>       dma_addr_t dummy_comp_buff_dma;
>>       struct cc_hw_desc monitor_desc;
>>
>> -     volatile unsigned long monitor_lock;
>> +     unsigned long monitor_lock;
>
> The variable seems unused.  Try deleting it instead.

Had already sent a patch for that as v2.

Thanks
Srishti

> regards,
> dan carpenter
>

Patch

diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c
index e5c2f92..7d77941 100644
--- a/drivers/staging/ccree/ssi_request_mgr.c
+++ b/drivers/staging/ccree/ssi_request_mgr.c
@@ -49,7 +49,7 @@  struct ssi_request_mgr_handle {
 	dma_addr_t dummy_comp_buff_dma;
 	struct cc_hw_desc monitor_desc;

-	volatile unsigned long monitor_lock;
+	unsigned long monitor_lock;
 #ifdef COMP_IN_WQ
 	struct workqueue_struct *workq;
 	struct delayed_work compwork;