Re: [PATCH 1/2] staging: dgnc: take lock when accessing to dgnc_poll_tick

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

 



>On Sun, 6 Sep 2015 20:00:10 -0700, Greg KH wrote:
>>On Sat, Sep 05, 2015 at 01:12:01PM +0100, Salah Triki wrote:
>> poll_tick is declared global, so dgnc_driver_pollrate_* need to
>> take the lock dgnc_poll_lock before accessing to this variable.
>
>Really?  The scope of a variable doesn't matter if a lock is needed for
>it or not.
>
>And this patch doesn't really do anything at all, I don't understand why
>it is needed, please explain.

...
>>  static ssize_t dgnc_driver_pollrate_show(struct device_driver *ddp,
>>  char *buf)
>>  {
>> -	return snprintf(buf, PAGE_SIZE, "%dms\n", dgnc_poll_tick);
>> +	unsigned long flags;
>> +	int tick;
>> +
>> +	spin_lock_irqsave(&dgnc_poll_lock, flags);
>
>Why irqsave?  You are never grabbing this lock from within an irq.
>
>I don't think you understand how Linux kernel locks work, or how/where
>they are needed.  Please do a bit more research before creating patches
>like this.
>
>greg k-h

I messed up, please ignore this patch.

best regards
salah triki
_______________________________________________
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