Skip to content

Commit 8bf020e

Browse files
dilingerdtor
authored andcommitted
Input: psmouse - add psmouse_queue_work() for ps/2 extension to make use of
psmouse_queue_work is passed a delayed_work struct, and queues up the work with kpsmouse_wq. Since we're dealing with delayed_work stuff, this also switches resync_work to a delayed_work struct as well, and makes use of psmouse_queue_work when doing a resync within psmouse-base. Signed-off-by: Andres Salomon <dilinger@debian.org> Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
1 parent a48cf5f commit 8bf020e

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

‎drivers/input/mouse/psmouse-base.c‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,12 @@ static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
201201
return PSMOUSE_FULL_PACKET;
202202
}
203203

204+
void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
205+
unsigned long delay)
206+
{
207+
queue_delayed_work(kpsmoused_wq, work, delay);
208+
}
209+
204210
/*
205211
* __psmouse_set_state() sets new psmouse state and resets all flags.
206212
*/
@@ -305,7 +311,7 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
305311
psmouse->name, psmouse->phys, psmouse->pktcnt);
306312
psmouse->badbyte = psmouse->packet[0];
307313
__psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
308-
queue_work(kpsmoused_wq, &psmouse->resync_work);
314+
psmouse_queue_work(psmouse, &psmouse->resync_work, 0);
309315
goto out;
310316
}
311317

@@ -342,7 +348,7 @@ static irqreturn_t psmouse_interrupt(struct serio *serio,
342348
time_after(jiffies, psmouse->last + psmouse->resync_time * HZ)) {
343349
psmouse->badbyte = psmouse->packet[0];
344350
__psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
345-
queue_work(kpsmoused_wq, &psmouse->resync_work);
351+
psmouse_queue_work(psmouse, &psmouse->resync_work, 0);
346352
goto out;
347353
}
348354

@@ -935,7 +941,7 @@ static int psmouse_poll(struct psmouse *psmouse)
935941
static void psmouse_resync(struct work_struct *work)
936942
{
937943
struct psmouse *parent = NULL, *psmouse =
938-
container_of(work, struct psmouse, resync_work);
944+
container_of(work, struct psmouse, resync_work.work);
939945
struct serio *serio = psmouse->ps2dev.serio;
940946
psmouse_ret_t rc = PSMOUSE_GOOD_DATA;
941947
int failed = 0, enabled = 0;
@@ -1194,7 +1200,7 @@ static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
11941200
goto err_free;
11951201

11961202
ps2_init(&psmouse->ps2dev, serio);
1197-
INIT_WORK(&psmouse->resync_work, psmouse_resync);
1203+
INIT_DELAYED_WORK(&psmouse->resync_work, psmouse_resync);
11981204
psmouse->dev = input_dev;
11991205
snprintf(psmouse->phys, sizeof(psmouse->phys), "%s/input0", serio->phys);
12001206

‎drivers/input/mouse/psmouse.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ struct psmouse {
3939
void *private;
4040
struct input_dev *dev;
4141
struct ps2dev ps2dev;
42-
struct work_struct resync_work;
42+
struct delayed_work resync_work;
4343
char *vendor;
4444
char *name;
4545
unsigned char packet[8];
@@ -92,6 +92,8 @@ enum psmouse_type {
9292
PSMOUSE_AUTO /* This one should always be last */
9393
};
9494

95+
void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
96+
unsigned long delay);
9597
int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
9698
int psmouse_reset(struct psmouse *psmouse);
9799
void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state);

0 commit comments

Comments
 (0)