aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/sep
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2009-08-14 15:42:41 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-15 12:02:15 -0700
commit6f9e0f60c46d597ee924dd073628ca2424f4178c (patch)
tree59c0ec57d06bd21264f92dcfdb851b702a4d0f29 /drivers/staging/sep
parentStaging: sep: kick out various fields we can prove are not needed (diff)
downloadlinux-dev-6f9e0f60c46d597ee924dd073628ca2424f4178c.tar.xz
linux-dev-6f9e0f60c46d597ee924dd073628ca2424f4178c.zip
Staging: sep: flow ioctl cleanup
Simple ioctl taking a single numeric argument so ditch the structs and weirdness. While we are it lock it properly and fix the error returns. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/sep')
-rw-r--r--drivers/staging/sep/sep_driver.c43
1 files changed, 18 insertions, 25 deletions
diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c
index 73f20c4bee94..23514f9d3230 100644
--- a/drivers/staging/sep/sep_driver.c
+++ b/drivers/staging/sep/sep_driver.c
@@ -2167,39 +2167,32 @@ static int sep_end_transaction_handler(struct sep_device *sep, unsigned long arg
}
-/*
- This function handler the set flow id command
-*/
-static int sep_set_flow_id_handler(struct sep_device *sep, unsigned long arg)
+/**
+ * sep_set_flow_id_handler - handle flow setting
+ * @sep: the SEP we are configuring
+ * @flow_id: the flow we are setting
+ *
+ * This function handler the set flow id command
+ */
+static int sep_set_flow_id_handler(struct sep_device *sep,
+ unsigned long flow_id)
{
- int error;
- unsigned long flow_id;
+ int error = 0;
struct sep_flow_context_t *flow_data_ptr;
- dbg("------------>SEP Driver: sep_set_flow_id_handler start\n");
-
- error = get_user(flow_id, &(((struct sep_driver_set_flow_id_t *) arg)->flow_id));
- if (error)
- goto end_function;
-
/* find the flow data structure that was just used for creating new flow
- its id should be default */
- flow_data_ptr = sep_find_flow_context(sep, SEP_TEMP_FLOW_ID);
- if (flow_data_ptr == NULL)
- goto end_function;
-
- /* set flow id */
- flow_data_ptr->flow_id = flow_id;
-end_function:
- dbg("SEP Driver:<-------- sep_set_flow_id_handler end\n");
+ mutex_lock(&sep_mutex);
+ flow_data_ptr = sep_find_flow_context(sep, SEP_TEMP_FLOW_ID);
+ if (flow_data_ptr)
+ flow_data_ptr->flow_id = flow_id; /* set flow id */
+ else
+ error = -EINVAL;
+ mutex_unlock(&sep_mutex);
return error;
}
-
-
-
-
static int sep_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
{
int error = 0;
@@ -2245,7 +2238,7 @@ static int sep_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, u
break;
case SEP_IOCSETFLOWID:
/* set flow id */
- error = sep_set_flow_id_handler(sep, arg);
+ error = sep_set_flow_id_handler(sep, (unsigned long)arg);
break;
case SEP_IOCADDFLOWTABLE:
/* add tables to the dynamic flow */