lkml.org 
[lkml]   [2011]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] NFC: Driver for Inside Secure MicroRead NFC chip
> >Would it not be lighter to use atomic bit ops ?
>
> Do you mean in order to remove rx_mutex?
>
> mutex_lock(&info->rx_mutex);
> atomic_set(info->irq_state ,1);
> mutex_unlock(&info->rx_mutex);
>
> looks a bit strange. I still need the rx_mutex to protect irq_state while reading i2c.
>
> mutex_lock(&info->rx_mutex);
> ret = i2c_master_recv(client, info->buf, info->buflen);
> info->irq_state = 0;
> mutex_unlock(&info->rx_mutex);
>

I was thinking clear_bit/test_and_set_bit rather than atomic_t operations.

ie in the IRQ

clear_bit(0, &info->irq_state);


in the main path

if (test_and_set_bit(0, &info->state))
i2c_master_recv(...)

but if the mutex is needed anyway it doesn't help make the code saner.


\
 
 \ /
  Last update: 2011-03-18 16:15    [W:0.053 / U:35.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site