Skip to content

Commit a8f5693

Browse files
committed
Input: sx8654 - use guard notation when acquiring spinlock
Guard notation simplifies code. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
1 parent dc05a01 commit a8f5693

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/input/touchscreen/sx8654.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,20 +117,18 @@ static inline void sx865x_penrelease(struct sx8654 *ts)
117117
static void sx865x_penrelease_timer_handler(struct timer_list *t)
118118
{
119119
struct sx8654 *ts = timer_container_of(ts, t, timer);
120-
unsigned long flags;
121120

122-
spin_lock_irqsave(&ts->lock, flags);
123-
sx865x_penrelease(ts);
124-
spin_unlock_irqrestore(&ts->lock, flags);
125121
dev_dbg(&ts->client->dev, "penrelease by timer\n");
122+
123+
guard(spinlock_irqsave)(&ts->lock);
124+
sx865x_penrelease(ts);
126125
}
127126

128127
static irqreturn_t sx8650_irq(int irq, void *handle)
129128
{
130129
struct sx8654 *ts = handle;
131130
struct device *dev = &ts->client->dev;
132131
int len, i;
133-
unsigned long flags;
134132
u8 stat;
135133
u16 x, y;
136134
u16 ch;
@@ -153,7 +151,7 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
153151
return IRQ_HANDLED;
154152
}
155153

156-
spin_lock_irqsave(&ts->lock, flags);
154+
guard(spinlock_irqsave)(&ts->lock);
157155

158156
x = 0;
159157
y = 0;
@@ -184,7 +182,6 @@ static irqreturn_t sx8650_irq(int irq, void *handle)
184182
dev_dbg(dev, "point(%4d,%4d)\n", x, y);
185183

186184
mod_timer(&ts->timer, jiffies + SX8650_PENIRQ_TIMEOUT);
187-
spin_unlock_irqrestore(&ts->lock, flags);
188185

189186
return IRQ_HANDLED;
190187
}

0 commit comments

Comments
 (0)