Staging: remove me4000 driver.
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / drivers / staging / meilhaus / meslock.h
blobf42b25c3f622e1a5cb4755a2386c25a2fef8626d
1 /**
2 * @file meslock.h
4 * @brief Provides the subdevice lock class.
5 * @note Copyright (C) 2006 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
7 */
9 #ifndef _MESLOCK_H_
10 #define _MESLOCK_H_
12 #include <linux/spinlock.h>
14 #ifdef __KERNEL__
16 /**
17 * @brief The subdevice lock class.
19 typedef struct me_slock {
20 struct file *filep; /**< Pointer to file structure holding the subdevice. */
21 int count; /**< Number of tasks which are inside the subdevice. */
22 spinlock_t spin_lock; /**< Spin lock protecting the attributes from concurrent access. */
23 } me_slock_t;
25 /**
26 * @brief Tries to enter a subdevice.
28 * @param slock The subdevice lock instance.
29 * @param filep The file structure identifying the calling process.
31 * @return 0 on success.
33 int me_slock_enter(struct me_slock *slock, struct file *filep);
35 /**
36 * @brief Exits a subdevice.
38 * @param slock The subdevice lock instance.
39 * @param filep The file structure identifying the calling process.
41 * @return 0 on success.
43 int me_slock_exit(struct me_slock *slock, struct file *filep);
45 /**
46 * @brief Tries to perform a locking action on a subdevice.
48 * @param slock The subdevice lock instance.
49 * @param filep The file structure identifying the calling process.
50 * @param The action to be done.
52 * @return 0 on success.
54 int me_slock_lock(struct me_slock *slock, struct file *filep, int lock);
56 /**
57 * @brief Initializes a lock structure.
59 * @param slock The lock structure to initialize.
60 * @return 0 on success.
62 int me_slock_init(me_slock_t * slock);
64 /**
65 * @brief Deinitializes a lock structure.
67 * @param slock The lock structure to deinitialize.
68 * @return 0 on success.
70 void me_slock_deinit(me_slock_t * slock);
72 #endif
73 #endif