On Tue, 26 Feb 2008 13:40:17 +0000 Mark Brown <broonie@xxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote: > +#ifdef CONFIG_PXA27x > +static void wm97xx_acc_pen_up(struct wm97xx *wm) > +{ > + set_current_state(TASK_INTERRUPTIBLE); > + schedule_timeout(1); > + > + while (MISR & (1 << 2)) > + MODR; > +} > +#else > +static void wm97xx_acc_pen_up(struct wm97xx *wm) > +{ > + int count = 16; > + set_current_state(TASK_INTERRUPTIBLE); > + schedule_timeout(1); > + > + while (count < 16) { > + MODR; > + count--; > + } > +} > +#endif Can use schedule_timeout_interruptible() here. If the calling process happens to have a signal pending then the schedule_timeout() becomes a no-op. Will the driver still function correctly? > +static int wm97xx_acc_pen_down(struct wm97xx *wm) > +{ > + u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES; > + int reads = 0; > + > + /* data is never immediately available after pen down irq */ > + set_current_state(TASK_INTERRUPTIBLE); > + schedule_timeout(1); dittoes. > + if (tries > 5) { > + tries = 0; > + return RC_PENUP; > + } > + > + x = MODR; > + if (x == last) { > + tries++; > + return RC_AGAIN; > + } > + last = x; > + do { > + if (reads) > + x = MODR; > + y = MODR; > + if (pressure) > + p = MODR; > + > + /* are samples valid */ > + if ((x & 0x7000) != WM97XX_ADCSEL_X || > + (y & 0x7000) != WM97XX_ADCSEL_Y || > + (p & 0x7000) != WM97XX_ADCSEL_PRES) > + goto up; > + > + /* coordinate is good */ > + tries = 0; > + input_report_abs(wm->input_dev, ABS_X, x & 0xfff); > + input_report_abs(wm->input_dev, ABS_Y, y & 0xfff); > + input_report_abs(wm->input_dev, ABS_PRESSURE, p & 0xfff); > + input_sync(wm->input_dev); > + reads++; > + } while (reads < cinfo[sp_idx].reads); > +up: > + return RC_PENDOWN | RC_AGAIN; > +} > + - To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html