X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=include%2Flinux%2Fserio.h;h=fc387e4d8e66c9a71fc83962b8b039b28424b83e;hb=6a77f38946aaee1cd85eeec6cf4229b204c15071;hp=f84b362a561f330142e3af2473ec8e8c786569c9;hpb=87fc8d1bb10cd459024a742c6a10961fefcef18f;p=linux-2.6.git diff --git a/include/linux/serio.h b/include/linux/serio.h index f84b362a5..fc387e4d8 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h @@ -45,7 +45,8 @@ struct serio { struct serio *parent, *child; - struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock */ + struct serio_driver *drv; /* accessed from interrupt, must be protected by serio->lock and serio->sem */ + struct semaphore drv_sem; /* protects serio->drv so attributes can pin driver */ struct device dev; @@ -122,6 +123,19 @@ static __inline__ void serio_continue_rx(struct serio *serio) spin_unlock_irq(&serio->lock); } +/* + * Use the following fucntions to pin serio's driver in process context + */ +static __inline__ int serio_pin_driver(struct serio *serio) +{ + return down_interruptible(&serio->drv_sem); +} + +static __inline__ void serio_unpin_driver(struct serio *serio) +{ + up(&serio->drv_sem); +} + #endif