lkml.org 
[lkml]   [2009]   [Jul]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] tsc2007: remove HR timer
On Tue, Jul 14, 2009 at 10:00:06AM +0200, Richard Röjfors wrote:
> On 7/14/09 9:08 AM, Thierry Reding wrote:
>> * Dmitry Torokhov wrote:
>>> Hi Richard,
>>>
>>> On Tue, Jun 23, 2009 at 01:54:48PM +0200, Richard Röjfors wrote:
>> [...]
>>> +static void tsc2007_free_irq(struct tsc2007 *ts)
>>> +{
>>> + free_irq(ts->irq, ts);
>>> + if (cancel_delayed_work_sync(&ts->work)) {
>>> + /*
>>> + * Work was pending, therefore we need to enable
>>> + * IRQ here to balance the disable_irq() done in the
>>> + * interrupt handler.
>>> + */
>>> + enable_irq(ts->irq);
>>> + }
>>> +}
>> [...]
>>> -static int tsc2007_remove(struct i2c_client *client)
>>> +static int __devexit tsc2007_remove(struct i2c_client *client)
>>> {
>>> struct tsc2007 *ts = i2c_get_clientdata(client);
>>> - struct tsc2007_platform_data *pdata;
>>> + struct tsc2007_platform_data *pdata = client->dev.platform_data;
>>>
>>> - cancel_delayed_work_sync(&ts->work);
>>> + free_irq(ts->irq, ts);
>>> + if (cancel_delayed_work_sync(&ts->work)) {
>>> + /*
>>> + * Work was pending, therefore we need to enable
>>> + * IRQ here to balance the disabel done in the
>>> + * interrupt handler.
>>> + */
>>> + enable_irq(ts->irq);
>>> + }
>>
>> Shouldn't this be tsc2007_free_irq(ts) as well?
>
> Is this really good enough? The work function might re-enable the IRQ.

I am pretty sure it is. cancel_delayed_work_sync() will terurn true if
there was work scheduled but not yet executed. In this case we know that
IRQ was disabled by interrupt handler and will re-enable it.

--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2009-07-14 10:23    [W:0.047 / U:0.920 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site