diff options
author | Alan Cox <alan@linux.intel.com> | 2009-08-07 19:24:08 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-09-15 12:02:13 -0700 |
commit | 577092ac155005ecb3a1385d628ef27fc9b52b72 (patch) | |
tree | dee0b5cd6ec1c4d42a5180a0d44d2dd665f7b134 /drivers/staging/sep | |
parent | 7913c21a25a9d54b093bed3522d35b188aadf6a4 (diff) | |
download | talos-obmc-linux-577092ac155005ecb3a1385d628ef27fc9b52b72.tar.gz talos-obmc-linux-577092ac155005ecb3a1385d628ef27fc9b52b72.zip |
Staging: sep: use O_NDELAY instead of magic APIs
Open is still completely bogus in this driver but we'll tackle that later -
for now fix the bogus API
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_dev.h | 3 | ||||
-rw-r--r-- | drivers/staging/sep/sep_driver.c | 46 | ||||
-rw-r--r-- | drivers/staging/sep/sep_driver_api.h | 11 |
3 files changed, 5 insertions, 55 deletions
diff --git a/drivers/staging/sep/sep_dev.h b/drivers/staging/sep/sep_dev.h index b190373fa182..920e23a5142c 100644 --- a/drivers/staging/sep/sep_dev.h +++ b/drivers/staging/sep/sep_dev.h @@ -86,9 +86,6 @@ struct sep_device { /* global data for every flow */ struct sep_flow_context_t flows_data_array[SEP_DRIVER_NUM_FLOWS]; - /* flag for API mode - 1 -is blocking, 0 is non-blocking */ - unsigned long block_mode_flag; - /* pointer to the workqueue that handles the flow done interrupts */ struct workqueue_struct *flow_wq_ptr; diff --git a/drivers/staging/sep/sep_driver.c b/drivers/staging/sep/sep_driver.c index c2d9cab85d42..307c7749310b 100644 --- a/drivers/staging/sep/sep_driver.c +++ b/drivers/staging/sep/sep_driver.c @@ -49,7 +49,6 @@ #include "sep_driver_hw_defs.h" #include "sep_driver_config.h" #include "sep_driver_api.h" -#include "sep_driver_ext_api.h" #include "sep_dev.h" #if SEP_DRIVER_ARM_DEBUG_MODE @@ -345,25 +344,22 @@ static unsigned long sep_shared_area_phys_to_virt(unsigned long phys_address) open function of the character driver - must only lock the mutex must also release the memory data pool allocations ------------------------------------------------------------------------*/ -static int sep_open(struct inode *inode_ptr, struct file *file_ptr) +static int sep_open(struct inode *inode, struct file *filp) { - int error; + int error = 0; dbg("SEP Driver:--------> open start\n"); - error = 0; - /* check the blocking mode */ - if (sep_dev->block_mode_flag) + if (filp->f_flags & O_NDELAY) + error = mutex_trylock(&sep_mutex); + else /* lock mutex */ mutex_lock(&sep_mutex); - else - error = mutex_trylock(&sep_mutex); /* check the error */ if (error) { edbg("SEP Driver: down_interruptible failed\n"); - goto end_function; } @@ -388,17 +384,13 @@ static int sep_release(struct inode *inode_ptr, struct file *file_ptr) #if 0 /*!SEP_DRIVER_POLLING_MODE */ /* close IMR */ sep_write_reg(sep_dev, HW_HOST_IMR_REG_ADDR, 0x7FFF); - /* release IRQ line */ free_irq(SEP_DIRVER_IRQ_NUM, &sep_dev->reg_base_address); #endif - /* unlock the sep mutex */ mutex_unlock(&sep_mutex); - dbg("SEP Driver:<-------- sep_release end\n"); - return 0; } @@ -2151,27 +2143,6 @@ static int sep_get_time_handler(unsigned long arg) } /* - This api handles the setting of API mode to blocking or non-blocking -*/ -static int sep_set_api_mode_handler(unsigned long arg) -{ - int error; - unsigned long mode_flag; - - dbg("SEP Driver:--------> sep_set_api_mode_handler start\n"); - - error = get_user(mode_flag, &(((struct sep_driver_set_api_mode_t *) arg)->mode)); - if (error) - goto end_function; - - /* set the global flag */ - sep_dev->block_mode_flag = mode_flag; -end_function: - dbg("SEP Driver:<-------- sep_set_api_mode_handler end\n"); - return error; -} - -/* This API handles the end transaction request */ static int sep_end_transaction_handler(unsigned long arg) @@ -2294,10 +2265,6 @@ static int sep_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, u /* init command to sep */ error = sep_init_handler(arg); break; - case SEP_IOCSETAPIMODE: - /* set non- blocking mode */ - error = sep_set_api_mode_handler(arg); - break; case SEP_IOCGETSTATICPOOLADDR: /* get the physical and virtual addresses of the static pool */ error = sep_get_static_pool_addr_handler(arg); @@ -2639,9 +2606,6 @@ static int __init sep_init(void) for the current transaction */ sep_dev->data_pool_bytes_allocated = 0; - /* set the starting mode to blocking */ - sep_dev->block_mode_flag = 1; - /* FIXME: Probe can occur before we are ready to survive a probe */ ret_val = pci_register_driver(&sep_pci_driver); if (ret_val) { diff --git a/drivers/staging/sep/sep_driver_api.h b/drivers/staging/sep/sep_driver_api.h index c9f4e56057fb..08b4c2418506 100644 --- a/drivers/staging/sep/sep_driver_api.h +++ b/drivers/staging/sep/sep_driver_api.h @@ -83,9 +83,6 @@ /* init sep command */ #define SEP_IOCSEPINIT _IO(SEP_IOC_MAGIC_NUMBER , 13) -/* set non blocking mode */ -#define SEP_IOCSETAPIMODE _IO(SEP_IOC_MAGIC_NUMBER , 14) - /* end transaction command */ #define SEP_IOCENDTRANSACTION _IO(SEP_IOC_MAGIC_NUMBER , 15) @@ -147,14 +144,6 @@ struct sep_driver_realloc_cache_resident_t { unsigned long new_base_addr; }; -/* - set api mode command struct -*/ -struct sep_driver_set_api_mode_t { - /* mode to set - 1 - blocking, 0 - non-blocking */ - unsigned long mode; -}; - struct sep_driver_alloc_t { /* virtual address of allocated space */ unsigned long offset; |