mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
hwmon: (ams) Simplify IRQ handling routine
Simplify the IRQ handling routine of ams driver. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
This commit is contained in:
parent
ee4cd32ee8
commit
dbee356262
1 changed files with 20 additions and 28 deletions
|
@ -99,23 +99,19 @@ static struct pmf_irq_client ams_shock_client = {
|
|||
*/
|
||||
static void ams_worker(struct work_struct *work)
|
||||
{
|
||||
unsigned long flags;
|
||||
u8 irqs_to_clear;
|
||||
|
||||
mutex_lock(&ams_info.lock);
|
||||
|
||||
if (ams_info.has_device) {
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&ams_info.irq_lock, flags);
|
||||
irqs_to_clear = ams_info.worker_irqs;
|
||||
|
||||
if (ams_info.worker_irqs & AMS_IRQ_FREEFALL) {
|
||||
if (verbose)
|
||||
printk(KERN_INFO "ams: freefall detected!\n");
|
||||
|
||||
ams_info.worker_irqs &= ~AMS_IRQ_FREEFALL;
|
||||
|
||||
/* we must call this with interrupts enabled */
|
||||
spin_unlock_irqrestore(&ams_info.irq_lock, flags);
|
||||
ams_info.clear_irq(AMS_IRQ_FREEFALL);
|
||||
spin_lock_irqsave(&ams_info.irq_lock, flags);
|
||||
}
|
||||
|
||||
if (ams_info.worker_irqs & AMS_IRQ_SHOCK) {
|
||||
|
@ -123,15 +119,11 @@ static void ams_worker(struct work_struct *work)
|
|||
printk(KERN_INFO "ams: shock detected!\n");
|
||||
|
||||
ams_info.worker_irqs &= ~AMS_IRQ_SHOCK;
|
||||
|
||||
/* we must call this with interrupts enabled */
|
||||
spin_unlock_irqrestore(&ams_info.irq_lock, flags);
|
||||
ams_info.clear_irq(AMS_IRQ_SHOCK);
|
||||
spin_lock_irqsave(&ams_info.irq_lock, flags);
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&ams_info.irq_lock, flags);
|
||||
}
|
||||
|
||||
ams_info.clear_irq(irqs_to_clear);
|
||||
|
||||
mutex_unlock(&ams_info.lock);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue