summaryrefslogtreecommitdiff
path: root/xpp/xbus-core.c
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/xbus-core.c')
-rw-r--r--xpp/xbus-core.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/xpp/xbus-core.c b/xpp/xbus-core.c
index ca14b38..dc5c812 100644
--- a/xpp/xbus-core.c
+++ b/xpp/xbus-core.c
@@ -58,7 +58,7 @@ static int proc_xbus_command_write(struct file *file, const char __user *buffer,
/* Command line parameters */
extern int print_dbg;
-DEF_PARM(uint, poll_timeout, POLL_TIMEOUT,"Timeout (in jiffies) waiting for units to reply (default " __stringify(POLL_TIMEOUT) ")");
+DEF_PARM(uint, poll_timeout, POLL_TIMEOUT, 0600, "Timeout (in jiffies) waiting for units to reply (default " __stringify(POLL_TIMEOUT) ")");
/* Forward declarations */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14)
@@ -237,8 +237,12 @@ static int debugfs_release(struct inode *inode, struct file *file)
#endif
/*------------------------- Frame Handling ------------------------*/
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+static kmem_cache_t *xframes_cache = NULL;
+#else
+static struct kmem_cache *xframes_cache = NULL;
+#endif
-static kmem_cache_t *xframes_cache = NULL;
xframe_t *xbus_xframe_new(xbus_t *xbus, gfp_t flags)
{
xframe_t *frm;
@@ -424,12 +428,24 @@ out:
}
/*
+ * Workqueue API change in kernel 2.6.20
+ * The work function always receives the work_struct as parameter
+ * and not an arbitrary pointer.
+ */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#define WORK_DATA void
+#define XBUS_WORK(xbus) INIT_WORK(&(xbus)->xpds_init_work, (void (*)(void *))xbus_poll, (void *)(xbus))
+#else
+#define WORK_DATA struct work_struct
+#define XBUS_WORK(xbus) INIT_WORK(&(xbus)->xpds_init_work, (work_func_t)xbus_poll)
+#endif
+
+/*
* This must be called from synchronous (non-interrupt) context
* it returns only when all XPD's on the bus are detected and
* initialized.
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
-static void xbus_poll(struct work_struct *work)
+static int xbus_poll(WORK_DATA *data)
{
xbus_t *xbus = container_of(work, xbus_t, xpds_init_work);
#else
@@ -447,7 +463,13 @@ static void xbus_poll(void *data)
struct list_head additions_list;
int count_removed;
int count_added;
+ xbus_t *xbus;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+ xbus = data;
+#else
+ xbus = container_of(data, xbus_t, xpds_init_work);
+#endif
if(!down_read_trylock(&xbus->in_use)) {
ERR("%s is being removed...\n", xbus->busname);
return;
@@ -565,11 +587,7 @@ void xbus_activate(xbus_t *xbus)
xbus->hardware_exists = 1;
DBG("Activating: %s\n", xbus->busname);
/* Poll it */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
- INIT_WORK(&xbus->xpds_init_work, xbus_poll);
-#else
- INIT_WORK(&xbus->xpds_init_work, xbus_poll, xbus);
-#endif
+ XBUS_WORK(xbus);
if(!queue_work(xpp_worker, &xbus->xpds_init_work)) {
ERR("Failed to queue xpd initialization work\n");
/* FIXME: need to return error */
@@ -1127,6 +1145,9 @@ int __init xbus_core_init(void)
#ifdef PROTOCOL_DEBUG
INFO("FEATURE: %s with PROTOCOL_DEBUG\n", THIS_MODULE->name);
#endif
+#ifdef XPP_DEBUGFS
+ INFO("FEATURE: %s with XPP_DEBUGFS support\n", THIS_MODULE->name);
+#endif
xframes_cache = kmem_cache_create("xpp_frames",
sizeof(xframe_t) + XFRAME_DATASIZE,
0, 0,