Staging: remove me4000 driver.
[linux-2.6/mini2440.git] / drivers / staging / meilhaus / medlist.h
blob091c11e48ed27daf45076534a11976000d8cbdc6
1 /**
2 * @file me_dlist.h
4 * @brief Provides the device list class.
5 * @note Copyright (C) 2007 Meilhaus Electronic GmbH (support@meilhaus.de)
6 * @author Guenter Gebhardt
7 */
9 #ifndef _ME_DLIST_H_
10 #define _ME_DLIST_H_
12 #include <linux/list.h>
14 #include "medevice.h"
16 #ifdef __KERNEL__
18 /**
19 * @brief The device list container.
21 typedef struct me_dlist {
22 struct list_head head; /**< The head of the internal list. */
23 unsigned int n; /**< The number of devices in the list. */
24 } me_dlist_t;
26 /**
27 * @brief Queries the number of devices currently inside the list.
29 * @param dlist The device list to query.
30 * @param[out] number The number of devices.
32 * @return ME-iDS error code.
34 int me_dlist_query_number_devices(struct me_dlist *dlist, int *number);
36 /**
37 * @brief Returns the number of devices currently inside the list.
39 * @param dlist The device list to query.
41 * @return The number of devices in the list.
43 unsigned int me_dlist_get_number_devices(struct me_dlist *dlist);
45 /**
46 * @brief Get a device by index.
48 * @param dlist The device list to query.
49 * @param index The index of the device to get in the list.
51 * @return The device at index if available.\n
52 * NULL if the index is out of range.
54 me_device_t *me_dlist_get_device(struct me_dlist *dlist, unsigned int index);
56 /**
57 * @brief Adds a device to the tail of the list.
59 * @param dlist The device list to add a device to.
60 * @param device The device to add to the list.
62 void me_dlist_add_device_tail(struct me_dlist *dlist, me_device_t * device);
64 /**
65 * @brief Removes a device from the tail of the list.
67 * @param dlist The device list.
69 * @return Pointer to the removed subdeivce.\n
70 * NULL in cases where the list was empty.
72 me_device_t *me_dlist_del_device_tail(struct me_dlist *dlist);
74 /**
75 * @brief Initializes a device list structure.
77 * @param lock The device list structure to initialize.
78 * @return 0 on success.
80 int me_dlist_init(me_dlist_t * dlist);
82 /**
83 * @brief Deinitializes a device list structure and destructs every device in it.
85 * @param dlist The device list structure to deinitialize.
86 * @return 0 on success.
88 void me_dlist_deinit(me_dlist_t * dlist);
90 #endif
91 #endif