From 773cde9a496f1f2db6612927863d649bda2dc8da Mon Sep 17 00:00:00 2001 From: Huang Weiyi Date: Fri, 12 Mar 2010 22:13:43 +0800 Subject: Staging: remove unused #include Remove unused #include ('s) in drivers/staging/dt3155/allocator.c drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c drivers/staging/vme/boards/vme_vmivme7805.c Signed-off-by: Huang Weiyi Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/allocator.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/allocator.c b/drivers/staging/dt3155/allocator.c index db382ef..6fbd050 100644 --- a/drivers/staging/dt3155/allocator.c +++ b/drivers/staging/dt3155/allocator.c @@ -45,7 +45,6 @@ # define MODULE #endif -#include #include #include -- cgit v1.1 From 59200df52cf7d4bfb93aeb30289a8e9d2af3058d Mon Sep 17 00:00:00 2001 From: H Hartley Sweeten Date: Tue, 13 Apr 2010 22:01:31 -0500 Subject: Staging: dt3155: fix wait_ibsyclr function The wait_ibsyclr function is supposed to return the status of the I2C cycle. Currently it will always return FALSE because the IIC_CSR2 register is not re-read in order to update the cached register value. This results in the NEW_CYCLE bit still being 1. The current code actually works correctly only because the return value of {Read|Write}I2C is not checked in the driver. Fix wait_ibsyclr by actually reading the IIC_CSR2 register to get the updated status. While here, change the return type to be an actual errno instead of the private TRUE/FALSE define and remove the now obvious comments about the return value. Also, remove the local variable 'writestat' in WriteI2C and just return the result of wait_ibsyclr. Signed-off-by: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155_io.c | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155_io.c b/drivers/staging/dt3155/dt3155_io.c index 6b9c685..7792e71 100644 --- a/drivers/staging/dt3155/dt3155_io.c +++ b/drivers/staging/dt3155/dt3155_io.c @@ -74,23 +74,22 @@ u8 i2c_pm_lut_data; * wait_ibsyclr() * * This function handles read/write timing and r/w timeout error - * - * Returns TRUE if NEW_CYCLE clears - * Returns FALSE if NEW_CYCLE doesn't clear in roughly 3 msecs, otherwise - * returns 0 */ static int wait_ibsyclr(u8 *lpReg) { /* wait 100 microseconds */ udelay(100L); /* __delay(loops_per_sec/10000); */ + + ReadMReg(lpReg + IIC_CSR2, iic_csr2_r.reg); if (iic_csr2_r.fld.NEW_CYCLE) { /* if NEW_CYCLE didn't clear */ /* TIMEOUT ERROR */ dt3155_errno = DT_ERR_I2C_TIMEOUT; - return FALSE; - } else - return TRUE; /* no error */ + return -ETIMEDOUT; + } + + return 0; /* no error */ } /* @@ -101,14 +100,9 @@ static int wait_ibsyclr(u8 *lpReg) * 1st parameter is pointer to 32-bit register base address * 2nd parameter is reg. index; * 3rd is value to be written - * - * Returns TRUE - Successful completion - * FALSE - Timeout error - cycle did not complete! */ int WriteI2C(u8 *lpReg, u_short wIregIndex, u8 byVal) { - int writestat; /* status for return */ - /* read 32 bit IIC_CSR2 register data into union */ ReadMReg((lpReg + IIC_CSR2), iic_csr2_r.reg); @@ -126,8 +120,7 @@ int WriteI2C(u8 *lpReg, u_short wIregIndex, u8 byVal) WriteMReg((lpReg + IIC_CSR2), iic_csr2_r.reg); /* wait for IIC cycle to finish */ - writestat = wait_ibsyclr(lpReg); - return writestat; + return wait_ibsyclr(lpReg); } /* @@ -138,9 +131,6 @@ int WriteI2C(u8 *lpReg, u_short wIregIndex, u8 byVal) * 1st parameter is pointer to 32-bit register base address * 2nd parameter is reg. index; * 3rd is adrs of value to be read - * - * Returns TRUE - Successful completion - * FALSE - Timeout error - cycle did not complete! */ int ReadI2C(u8 *lpReg, u_short wIregIndex, u8 *byVal) { -- cgit v1.1 From b1f2ac07636aadee5cb077fc7e830908b00fcaae Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Tue, 27 Apr 2010 20:15:07 +0200 Subject: Staging: push down BKL into ioctl functions Signed-off-by: Arnd Bergmann Cc: Frederic Weisbecker Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155_drv.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index e2c44ec..7e6095f 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -63,6 +63,7 @@ extern void printques(int); #include #include #include +#include #include #include @@ -835,6 +836,17 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait) return 0; } +static long +dt3155_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + int ret; + + lock_kernel(); + ret = dt3155_ioctl(file->f_path.dentry->d_inode, file, cmd, arg); + unlock_kernel(); + + return ret; +} /***************************************************** * file operations supported by DT3155 driver @@ -842,12 +854,12 @@ static unsigned int dt3155_poll (struct file * filp, poll_table *wait) * register_chrdev *****************************************************/ static struct file_operations dt3155_fops = { - read: dt3155_read, - ioctl: dt3155_ioctl, - mmap: dt3155_mmap, - poll: dt3155_poll, - open: dt3155_open, - release: dt3155_close + .read = dt3155_read, + .unlocked_ioctl = dt3155_unlocked_ioctl, + .mmap = dt3155_mmap, + .poll = dt3155_poll, + .open = dt3155_open, + .release = dt3155_close }; -- cgit v1.1 From 484d3be1bded596a404ac99401652c7728be2f24 Mon Sep 17 00:00:00 2001 From: Gorskin Ilya Date: Sun, 14 Mar 2010 00:35:17 +0500 Subject: Staging: dt3155: fix coding style issue in dt3155_isr.c This is a patch to the dt3155_isr.c file that fixes up a coding style warning and errors found by the checkpatch.pl tool Signed-off-by: Gorskin Ilya Acked-by: Simon Horman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155_isr.c | 295 ++++++++++++++++++------------------ 1 file changed, 144 insertions(+), 151 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155_isr.c b/drivers/staging/dt3155/dt3155_isr.c index 09d7d9b..1ebcec0 100644 --- a/drivers/staging/dt3155/dt3155_isr.c +++ b/drivers/staging/dt3155/dt3155_isr.c @@ -1,7 +1,7 @@ /* Copyright 1996,2002,2005 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan, - Jason Lapenta, Scott Smedley, Greg Sharp + Jason Lapenta, Scott Smedley, Greg Sharp This file is part of the DT3155 Device Driver. @@ -22,7 +22,7 @@ MA 02111-1307 USA File: dt3155_isr.c Purpose: Buffer management routines, and other routines for the ISR - (the actual isr is in dt3155_drv.c) + (the actual isr is in dt3155_drv.c) -- Changes -- @@ -30,16 +30,16 @@ Purpose: Buffer management routines, and other routines for the ISR ------------------------------------------------------------------- 03-Jul-2000 JML n/a 02-Apr-2002 SS Mods to make work with separate allocator - module; Merged John Roll's mods to make work with - multiple boards. + module; Merged John Roll's mods to make work with + multiple boards. 10-Jul-2002 GCS Complete rewrite of setup_buffers to disallow - buffers which span a 4MB boundary. + buffers which span a 4MB boundary. 24-Jul-2002 SS GPL licence. 30-Jul-2002 NJC Added support for buffer loop. 31-Jul-2002 NJC Complete rewrite of buffer management 02-Aug-2002 NJC Including slab.h instead of malloc.h (no warning). - Also, allocator_init() now returns allocator_max - so cleaned up allocate_buffers() accordingly. + Also, allocator_init() now returns allocator_max + so cleaned up allocate_buffers() accordingly. 08-Aug-2005 SS port to 2.6 kernel. */ @@ -77,9 +77,9 @@ struct dt3155_fbuffer_s *dt3155_fbuffer[MAXBOARDS] = {NULL * are_empty_buffers * m is minor # of device ***************************/ -inline bool are_empty_buffers( int m ) +inline bool are_empty_buffers(int m) { - return ( dt3155_fbuffer[ m ]->empty_len ); + return dt3155_fbuffer[m]->empty_len; } /************************** @@ -92,56 +92,56 @@ inline bool are_empty_buffers( int m ) * given by dt3155_fbuffer[m]->empty_buffers[0]. * empty_buffers should never fill up, though this is not checked. **************************/ -inline void push_empty( int index, int m ) +inline void push_empty(int index, int m) { - dt3155_fbuffer[m]->empty_buffers[ dt3155_fbuffer[m]->empty_len ] = index; + dt3155_fbuffer[m]->empty_buffers[dt3155_fbuffer[m]->empty_len] = index; dt3155_fbuffer[m]->empty_len++; } /************************** - * pop_empty( m ) + * pop_empty(m) * m is minor # of device **************************/ -inline int pop_empty( int m ) +inline int pop_empty(int m) { dt3155_fbuffer[m]->empty_len--; - return dt3155_fbuffer[m]->empty_buffers[ dt3155_fbuffer[m]->empty_len ]; + return dt3155_fbuffer[m]->empty_buffers[dt3155_fbuffer[m]->empty_len]; } /************************* - * is_ready_buf_empty( m ) + * is_ready_buf_empty(m) * m is minor # of device *************************/ -inline bool is_ready_buf_empty( int m ) +inline bool is_ready_buf_empty(int m) { - return ((dt3155_fbuffer[ m ]->ready_len) == 0); + return ((dt3155_fbuffer[m]->ready_len) == 0); } /************************* - * is_ready_buf_full( m ) + * is_ready_buf_full(m) * m is minor # of device * this should *never* be true if there are any active, locked or empty * buffers, since it corresponds to nbuffers ready buffers!! * 7/31/02: total rewrite. --NJC *************************/ -inline bool is_ready_buf_full( int m ) +inline bool is_ready_buf_full(int m) { - return ( dt3155_fbuffer[ m ]->ready_len == dt3155_fbuffer[ m ]->nbuffers ); + return dt3155_fbuffer[m]->ready_len == dt3155_fbuffer[m]->nbuffers; } /***************************************************** - * push_ready( m, buffer ) + * push_ready(m, buffer) * m is minor # of device * *****************************************************/ -inline void push_ready( int m, int index ) +inline void push_ready(int m, int index) { int head = dt3155_fbuffer[m]->ready_head; - dt3155_fbuffer[ m ]->ready_que[ head ] = index; - dt3155_fbuffer[ m ]->ready_head = ( (head + 1) % - (dt3155_fbuffer[ m ]->nbuffers) ); - dt3155_fbuffer[ m ]->ready_len++; + dt3155_fbuffer[m]->ready_que[head] = index; + dt3155_fbuffer[m]->ready_head = ((head + 1) % + (dt3155_fbuffer[m]->nbuffers)); + dt3155_fbuffer[m]->ready_len++; } @@ -151,12 +151,12 @@ inline void push_ready( int m, int index ) * * Simply comptutes the tail given the head and the length. *****************************************************/ -static inline int get_tail( int m ) +static inline int get_tail(int m) { - return ((dt3155_fbuffer[ m ]->ready_head - - dt3155_fbuffer[ m ]->ready_len + - dt3155_fbuffer[ m ]->nbuffers)% - (dt3155_fbuffer[ m ]->nbuffers)); + return (dt3155_fbuffer[m]->ready_head - + dt3155_fbuffer[m]->ready_len + + dt3155_fbuffer[m]->nbuffers)% + (dt3155_fbuffer[m]->nbuffers); } @@ -168,12 +168,12 @@ static inline int get_tail( int m ) * This assumes that there is a ready buffer ready... should * be checked (e.g. with is_ready_buf_empty() prior to call. *****************************************************/ -inline int pop_ready( int m ) +inline int pop_ready(int m) { int tail; tail = get_tail(m); - dt3155_fbuffer[ m ]->ready_len--; - return dt3155_fbuffer[ m ]->ready_que[ tail ]; + dt3155_fbuffer[m]->ready_len--; + return dt3155_fbuffer[m]->ready_que[tail]; } @@ -181,35 +181,33 @@ inline int pop_ready( int m ) * printques * m is minor # of device *****************************************************/ -inline void printques( int m ) +inline void printques(int m) { - int head = dt3155_fbuffer[ m ]->ready_head; + int head = dt3155_fbuffer[m]->ready_head; int tail; - int num = dt3155_fbuffer[ m ]->nbuffers; + int num = dt3155_fbuffer[m]->nbuffers; int frame_index; int index; tail = get_tail(m); printk("\n R:"); - for ( index = tail; index != head; index++, index = index % (num) ) - { - frame_index = dt3155_fbuffer[ m ]->ready_que[ index ]; - printk(" %d ", frame_index ); + for (index = tail; index != head; index++, index = index % (num)) { + frame_index = dt3155_fbuffer[m]->ready_que[index]; + printk(" %d ", frame_index); } printk("\n E:"); - for ( index = 0; index < dt3155_fbuffer[ m ]->empty_len; index++ ) - { - frame_index = dt3155_fbuffer[ m ]->empty_buffers[ index ]; - printk(" %d ", frame_index ); + for (index = 0; index < dt3155_fbuffer[m]->empty_len; index++) { + frame_index = dt3155_fbuffer[m]->empty_buffers[index]; + printk(" %d ", frame_index); } - frame_index = dt3155_fbuffer[ m ]->active_buf; + frame_index = dt3155_fbuffer[m]->active_buf; printk("\n A: %d", frame_index); - frame_index = dt3155_fbuffer[ m ]->locked_buf; - printk("\n L: %d \n", frame_index ); + frame_index = dt3155_fbuffer[m]->locked_buf; + printk("\n L: %d\n", frame_index); } @@ -220,11 +218,12 @@ inline void printques( int m ) * the start address up to the beginning of the * next 4MB chunk (assuming bufsize < 4MB). *****************************************************/ -u32 adjust_4MB (u32 buf_addr, u32 bufsize) { - if (((buf_addr+bufsize) & UPPER_10_BITS) != (buf_addr & UPPER_10_BITS)) - return (buf_addr+bufsize) & UPPER_10_BITS; - else - return buf_addr; +u32 adjust_4MB(u32 buf_addr, u32 bufsize) +{ + if (((buf_addr+bufsize) & UPPER_10_BITS) != (buf_addr & UPPER_10_BITS)) + return (buf_addr+bufsize) & UPPER_10_BITS; + else + return buf_addr; } @@ -235,7 +234,7 @@ u32 adjust_4MB (u32 buf_addr, u32 bufsize) { * buffers. If there is not enough free space * try for less memory. *****************************************************/ -void allocate_buffers (u32 *buf_addr, u32* total_size_kbs, +void allocate_buffers(u32 *buf_addr, u32* total_size_kbs, u32 bufsize) { /* Compute the minimum amount of memory guaranteed to hold all @@ -268,15 +267,15 @@ void allocate_buffers (u32 *buf_addr, u32* total_size_kbs, printk("DT3155: ...but need at least: %d KB\n", min_size_kbs); printk("DT3155: ...the allocator has: %d KB\n", allocator_max); size_kbs = (full_size_kbs <= allocator_max ? full_size_kbs : allocator_max); - if (size_kbs > min_size_kbs) { - if ((*buf_addr = allocator_allocate_dma (size_kbs, GFP_KERNEL)) != 0) { - printk("DT3155: Managed to allocate: %d KB\n", size_kbs); - *total_size_kbs = size_kbs; - return; + if (size_kbs > min_size_kbs) { + if ((*buf_addr = allocator_allocate_dma(size_kbs, GFP_KERNEL)) != 0) { + printk("DT3155: Managed to allocate: %d KB\n", size_kbs); + *total_size_kbs = size_kbs; + return; + } } - } /* If we got here, the allocation failed */ - printk ("DT3155: Allocator failed!\n"); + printk("DT3155: Allocator failed!\n"); *buf_addr = 0; *total_size_kbs = 0; return; @@ -312,28 +311,26 @@ u32 dt3155_setup_buffers(u32 *allocatorAddr) int m; /* minor # of device, looped for all devs */ /* zero the fbuffer status and address structure */ - for ( m = 0; m < ndevices; m++) - { - dt3155_fbuffer[ m ] = &(dt3155_status[ m ].fbuffer); + for (m = 0; m < ndevices; m++) { + dt3155_fbuffer[m] = &(dt3155_status[m].fbuffer); /* Make sure the buffering variables are consistent */ { - u8 *ptr = (u8 *) dt3155_fbuffer[ m ]; - for( index = 0; index < sizeof(struct dt3155_fbuffer_s); index++) - *(ptr++)=0; + u8 *ptr = (u8 *) dt3155_fbuffer[m]; + for (index = 0; index < sizeof(struct dt3155_fbuffer_s); index++) + *(ptr++) = 0; } } /* allocate a large contiguous chunk of RAM */ - allocate_buffers (&rambuff_addr, &rambuff_size, bufsize); + allocate_buffers(&rambuff_addr, &rambuff_size, bufsize); printk("DT3155: mem info\n"); - printk(" - rambuf_addr = 0x%x \n", rambuff_addr); - printk(" - length (kb) = %u \n", rambuff_size); - if( rambuff_addr == 0 ) - { - printk( KERN_INFO - "DT3155: Error setup_buffers() allocator dma failed \n" ); - return -ENOMEM; + printk(" - rambuf_addr = 0x%x\n", rambuff_addr); + printk(" - length (kb) = %u\n", rambuff_size); + if (rambuff_addr == 0) { + printk(KERN_INFO + "DT3155: Error setup_buffers() allocator dma failed\n"); + return -ENOMEM; } *allocatorAddr = rambuff_addr; rambuff_end = rambuff_addr + 1024 * rambuff_size; @@ -341,70 +338,68 @@ u32 dt3155_setup_buffers(u32 *allocatorAddr) /* after allocation, we need to count how many useful buffers there are so we can give an equal number to each device */ rambuff_acm = rambuff_addr; - for ( index = 0; index < MAXBUFFERS; index++) { - rambuff_acm = adjust_4MB (rambuff_acm, bufsize);/*avoid spanning 4MB bdry*/ - if (rambuff_acm + bufsize > rambuff_end) - break; - rambuff_acm += bufsize; - } + for (index = 0; index < MAXBUFFERS; index++) { + rambuff_acm = adjust_4MB(rambuff_acm, bufsize);/*avoid spanning 4MB bdry*/ + if (rambuff_acm + bufsize > rambuff_end) + break; + rambuff_acm += bufsize; + } /* Following line is OK, will waste buffers if index * not evenly divisible by ndevices -NJC*/ numbufs = index / ndevices; printk(" - numbufs = %u\n", numbufs); - if (numbufs < 2) { - printk( KERN_INFO - "DT3155: Error setup_buffers() couldn't allocate 2 bufs/board\n" ); - return -ENOMEM; - } + if (numbufs < 2) { + printk(KERN_INFO + "DT3155: Error setup_buffers() couldn't allocate 2 bufs/board\n"); + return -ENOMEM; + } /* now that we have board memory we spit it up */ /* between the boards and the buffers */ - rambuff_acm = rambuff_addr; - for ( m = 0; m < ndevices; m ++) - { - rambuff_acm = adjust_4MB (rambuff_acm, bufsize); - - /* Save the start of this boards buffer space (for mmap). */ - dt3155_status[ m ].mem_addr = rambuff_acm; - - for (index = 0; index < numbufs; index++) - { - rambuff_acm = adjust_4MB (rambuff_acm, bufsize); - if (rambuff_acm + bufsize > rambuff_end) { - /* Should never happen */ - printk ("DT3155 PROGRAM ERROR (GCS)\n" - "Error distributing allocated buffers\n"); - return -ENOMEM; - } - - dt3155_fbuffer[ m ]->frame_info[ index ].addr = rambuff_acm; - push_empty( index, m ); - /* printk(" - Buffer : %lx\n", - * dt3155_fbuffer[ m ]->frame_info[ index ].addr ); - */ - dt3155_fbuffer[ m ]->nbuffers += 1; - rambuff_acm += bufsize; + rambuff_acm = rambuff_addr; + for (m = 0; m < ndevices; m++) { + rambuff_acm = adjust_4MB(rambuff_acm, bufsize); + + /* Save the start of this boards buffer space (for mmap). */ + dt3155_status[m].mem_addr = rambuff_acm; + + for (index = 0; index < numbufs; index++) { + rambuff_acm = adjust_4MB(rambuff_acm, bufsize); + if (rambuff_acm + bufsize > rambuff_end) { + /* Should never happen */ + printk("DT3155 PROGRAM ERROR (GCS)\n" + "Error distributing allocated buffers\n"); + return -ENOMEM; + } + + dt3155_fbuffer[m]->frame_info[index].addr = rambuff_acm; + push_empty(index, m); + /* printk(" - Buffer : %lx\n", + * dt3155_fbuffer[m]->frame_info[index].addr); + */ + dt3155_fbuffer[m]->nbuffers += 1; + rambuff_acm += bufsize; } - /* Make sure there is an active buffer there. */ - dt3155_fbuffer[ m ]->active_buf = pop_empty( m ); - dt3155_fbuffer[ m ]->even_happened = 0; - dt3155_fbuffer[ m ]->even_stopped = 0; + /* Make sure there is an active buffer there. */ + dt3155_fbuffer[m]->active_buf = pop_empty(m); + dt3155_fbuffer[m]->even_happened = 0; + dt3155_fbuffer[m]->even_stopped = 0; - /* make sure there is no locked_buf JML 2/28/00 */ - dt3155_fbuffer[ m ]->locked_buf = -1; + /* make sure there is no locked_buf JML 2/28/00 */ + dt3155_fbuffer[m]->locked_buf = -1; - dt3155_status[ m ].mem_size = - rambuff_acm - dt3155_status[ m ].mem_addr; + dt3155_status[m].mem_size = + rambuff_acm - dt3155_status[m].mem_addr; - /* setup the ready queue */ - dt3155_fbuffer[ m ]->ready_head = 0; - dt3155_fbuffer[ m ]->ready_len = 0; - printk("Available buffers for device %d: %d\n", - m, dt3155_fbuffer[ m ]->nbuffers); + /* setup the ready queue */ + dt3155_fbuffer[m]->ready_head = 0; + dt3155_fbuffer[m]->ready_len = 0; + printk("Available buffers for device %d: %d\n", + m, dt3155_fbuffer[m]->nbuffers); } - return 1; + return 1; } /***************************************************** @@ -415,13 +410,12 @@ u32 dt3155_setup_buffers(u32 *allocatorAddr) * * m is minor number of device *****************************************************/ -static inline void internal_release_locked_buffer( int m ) +static inline void internal_release_locked_buffer(int m) { /* Pointer into global structure for handling buffers */ - if ( dt3155_fbuffer[ m ]->locked_buf >= 0 ) - { - push_empty( dt3155_fbuffer[ m ]->locked_buf, m ); - dt3155_fbuffer[ m ]->locked_buf = -1; + if (dt3155_fbuffer[m]->locked_buf >= 0) { + push_empty(dt3155_fbuffer[m]->locked_buf, m); + dt3155_fbuffer[m]->locked_buf = -1; } } @@ -433,7 +427,7 @@ static inline void internal_release_locked_buffer( int m ) * The user function of the above. * *****************************************************/ -inline void dt3155_release_locked_buffer( int m ) +inline void dt3155_release_locked_buffer(int m) { unsigned long int flags; local_save_flags(flags); @@ -448,28 +442,28 @@ inline void dt3155_release_locked_buffer( int m ) * m is minor # of device * *****************************************************/ -inline int dt3155_flush( int m ) +inline int dt3155_flush(int m) { int index; unsigned long int flags; local_save_flags(flags); local_irq_disable(); - internal_release_locked_buffer( m ); - dt3155_fbuffer[ m ]->empty_len = 0; + internal_release_locked_buffer(m); + dt3155_fbuffer[m]->empty_len = 0; - for ( index = 0; index < dt3155_fbuffer[ m ]->nbuffers; index++ ) - push_empty( index, m ); + for (index = 0; index < dt3155_fbuffer[m]->nbuffers; index++) + push_empty(index, m); /* Make sure there is an active buffer there. */ - dt3155_fbuffer[ m ]->active_buf = pop_empty( m ); + dt3155_fbuffer[m]->active_buf = pop_empty(m); - dt3155_fbuffer[ m ]->even_happened = 0; - dt3155_fbuffer[ m ]->even_stopped = 0; + dt3155_fbuffer[m]->even_happened = 0; + dt3155_fbuffer[m]->even_stopped = 0; /* setup the ready queue */ - dt3155_fbuffer[ m ]->ready_head = 0; - dt3155_fbuffer[ m ]->ready_len = 0; + dt3155_fbuffer[m]->ready_head = 0; + dt3155_fbuffer[m]->ready_len = 0; local_irq_restore(flags); @@ -485,7 +479,7 @@ inline int dt3155_flush( int m ) * If the user has a buffer locked it will unlock * that buffer before returning the new one. *****************************************************/ -inline int dt3155_get_ready_buffer( int m ) +inline int dt3155_get_ready_buffer(int m) { int frame_index; unsigned long int flags; @@ -493,21 +487,20 @@ inline int dt3155_get_ready_buffer( int m ) local_irq_disable(); #ifdef DEBUG_QUES_A - printques( m ); + printques(m); #endif - internal_release_locked_buffer( m ); + internal_release_locked_buffer(m); - if (is_ready_buf_empty( m )) - frame_index = -1; - else - { - frame_index = pop_ready( m ); - dt3155_fbuffer[ m ]->locked_buf = frame_index; + if (is_ready_buf_empty(m)) + frame_index = -1; + else { + frame_index = pop_ready(m); + dt3155_fbuffer[m]->locked_buf = frame_index; } #ifdef DEBUG_QUES_B - printques( m ); + printques(m); #endif local_irq_restore(flags); -- cgit v1.1 From d241fd58e407cd3943cabd61217a0ae32c795c1d Mon Sep 17 00:00:00 2001 From: Jason Baldus Date: Sun, 28 Mar 2010 09:59:37 -0400 Subject: Staging: dt3155: fix parentheses and bracket spacing style issues This is a patch to the dt3155_drv.c file that removes spaces after open parentheses and brackets and before close parentheses and brackets. Signed-off-by: Jason Baldus Reviewed-by: Simon Horman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155_drv.c | 338 ++++++++++++++++++------------------ 1 file changed, 169 insertions(+), 169 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index 7e6095f..91ebfad 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -95,7 +95,7 @@ int dt3155_errno = 0; #endif /* wait queue for interrupts */ -wait_queue_head_t dt3155_read_wait_queue[ MAXBOARDS ]; +wait_queue_head_t dt3155_read_wait_queue[MAXBOARDS]; #define DT_3155_SUCCESS 0 #define DT_3155_FAILURE -EIO @@ -112,10 +112,10 @@ int dt3155_major = 0; /* Global structures and variables */ /* Status of each device */ -struct dt3155_status_s dt3155_status[ MAXBOARDS ]; +struct dt3155_status_s dt3155_status[MAXBOARDS]; /* kernel logical address of the board */ -u8 *dt3155_lbase[ MAXBOARDS ] = { NULL +u8 *dt3155_lbase[MAXBOARDS] = { NULL #if MAXBOARDS == 2 , NULL #endif @@ -123,7 +123,7 @@ u8 *dt3155_lbase[ MAXBOARDS ] = { NULL /* DT3155 registers */ u8 *dt3155_bbase = NULL; /* kernel logical address of the * * buffer region */ -u32 dt3155_dev_open[ MAXBOARDS ] = {0 +u32 dt3155_dev_open[MAXBOARDS] = {0 #if MAXBOARDS == 2 , 0 #endif @@ -142,17 +142,17 @@ static void quick_stop (int minor) { // TODO: scott was here #if 1 - ReadMReg((dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg); + ReadMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); /* disable interrupts */ int_csr_r.fld.FLD_END_EVE_EN = 0; int_csr_r.fld.FLD_END_ODD_EN = 0; - WriteMReg((dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg ); + WriteMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); - dt3155_status[ minor ].state &= ~(DT3155_STATE_STOP|0xff); + dt3155_status[minor].state &= ~(DT3155_STATE_STOP|0xff); /* mark the system stopped: */ - dt3155_status[ minor ].state |= DT3155_STATE_IDLE; - dt3155_fbuffer[ minor ]->stop_acquire = 0; - dt3155_fbuffer[ minor ]->even_stopped = 0; + dt3155_status[minor].state |= DT3155_STATE_IDLE; + dt3155_fbuffer[minor]->stop_acquire = 0; + dt3155_fbuffer[minor]->even_stopped = 0; #else dt3155_status[minor].state |= DT3155_STATE_STOP; dt3155_status[minor].fbuffer.stop_acquire = 1; @@ -168,7 +168,7 @@ static void quick_stop (int minor) * - Assumes irq's are disabled, via SA_INTERRUPT flag * being set in request_irq() call from init_module() *****************************************************/ -static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) +static inline void dt3155_isr(int irq, void *dev_id, struct pt_regs *regs) { int minor = -1; int index; @@ -176,8 +176,8 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) u32 buffer_addr; /* find out who issued the interrupt */ - for ( index = 0; index < ndevices; index++ ) { - if( dev_id == (void*) &dt3155_status[ index ]) + for (index = 0; index < ndevices; index++) { + if(dev_id == (void*) &dt3155_status[index]) { minor = index; break; @@ -185,15 +185,15 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) } /* hopefully we should not get here */ - if ( minor < 0 || minor >= MAXBOARDS ) { + if (minor < 0 || minor >= MAXBOARDS) { printk(KERN_ERR "dt3155_isr called with invalid dev_id\n"); return; } /* Check for corruption and set a flag if so */ - ReadMReg( (dt3155_lbase[ minor ] + CSR1), csr1_r.reg ); + ReadMReg((dt3155_lbase[minor] + CSR1), csr1_r.reg); - if ( (csr1_r.fld.FLD_CRPT_EVE) || (csr1_r.fld.FLD_CRPT_ODD) ) + if ((csr1_r.fld.FLD_CRPT_EVE) || (csr1_r.fld.FLD_CRPT_ODD)) { /* TODO: this should probably stop acquisition */ /* and set some flags so that dt3155_read */ @@ -203,27 +203,27 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) return; } - ReadMReg((dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg); + ReadMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); /* Handle the even field ... */ if (int_csr_r.fld.FLD_END_EVE) { - if ( (dt3155_status[ minor ].state & DT3155_STATE_MODE) == - DT3155_STATE_FLD ) + if ((dt3155_status[minor].state & DT3155_STATE_MODE) == + DT3155_STATE_FLD) { - dt3155_fbuffer[ minor ]->frame_count++; + dt3155_fbuffer[minor]->frame_count++; } - ReadI2C(dt3155_lbase[ minor ], EVEN_CSR, &i2c_even_csr.reg); + ReadI2C(dt3155_lbase[minor], EVEN_CSR, &i2c_even_csr.reg); /* Clear the interrupt? */ int_csr_r.fld.FLD_END_EVE = 1; /* disable the interrupt if last field */ - if (dt3155_fbuffer[ minor ]->stop_acquire) + if (dt3155_fbuffer[minor]->stop_acquire) { printk("dt3155: even stopped.\n"); - dt3155_fbuffer[ minor ]->even_stopped = 1; + dt3155_fbuffer[minor]->even_stopped = 1; if (i2c_even_csr.fld.SNGL_EVE) { int_csr_r.fld.FLD_END_EVE_EN = 0; @@ -234,75 +234,75 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) } } - WriteMReg( (dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg ); + WriteMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); /* Set up next DMA if we are doing FIELDS */ - if ( (dt3155_status[ minor ].state & DT3155_STATE_MODE ) == + if ((dt3155_status[minor].state & DT3155_STATE_MODE) == DT3155_STATE_FLD) { /* GCS (Aug 2, 2002) -- In field mode, dma the odd field into the lower half of the buffer */ - const u32 stride = dt3155_status[ minor ].config.cols; - buffer_addr = dt3155_fbuffer[ minor ]-> - frame_info[ dt3155_fbuffer[ minor ]->active_buf ].addr + const u32 stride = dt3155_status[minor].config.cols; + buffer_addr = dt3155_fbuffer[minor]-> + frame_info[dt3155_fbuffer[minor]->active_buf].addr + (DT3155_MAX_ROWS / 2) * stride; local_save_flags(flags); local_irq_disable(); - wake_up_interruptible( &dt3155_read_wait_queue[ minor ] ); + wake_up_interruptible(&dt3155_read_wait_queue[minor]); /* Set up the DMA address for the next field */ local_irq_restore(flags); - WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_START), buffer_addr); + WriteMReg((dt3155_lbase[minor] + ODD_DMA_START), buffer_addr); } /* Check for errors. */ i2c_even_csr.fld.DONE_EVE = 1; - if ( i2c_even_csr.fld.ERROR_EVE ) + if (i2c_even_csr.fld.ERROR_EVE) dt3155_errno = DT_ERR_OVERRUN; - WriteI2C( dt3155_lbase[ minor ], EVEN_CSR, i2c_even_csr.reg ); + WriteI2C(dt3155_lbase[minor], EVEN_CSR, i2c_even_csr.reg); /* Note that we actually saw an even field meaning */ /* that subsequent odd field complete the frame */ - dt3155_fbuffer[ minor ]->even_happened = 1; + dt3155_fbuffer[minor]->even_happened = 1; /* recording the time that the even field finished, this should be */ /* about time in the middle of the frame */ - do_gettimeofday( &(dt3155_fbuffer[ minor ]-> - frame_info[ dt3155_fbuffer[ minor ]-> - active_buf ].time) ); + do_gettimeofday(&(dt3155_fbuffer[minor]-> + frame_info[dt3155_fbuffer[minor]-> + active_buf].time)); return; } /* ... now handle the odd field */ - if ( int_csr_r.fld.FLD_END_ODD ) + if (int_csr_r.fld.FLD_END_ODD) { - ReadI2C( dt3155_lbase[ minor ], ODD_CSR, &i2c_odd_csr.reg ); + ReadI2C(dt3155_lbase[minor], ODD_CSR, &i2c_odd_csr.reg); /* Clear the interrupt? */ int_csr_r.fld.FLD_END_ODD = 1; - if (dt3155_fbuffer[ minor ]->even_happened || - (dt3155_status[ minor ].state & DT3155_STATE_MODE) == + if (dt3155_fbuffer[minor]->even_happened || + (dt3155_status[minor].state & DT3155_STATE_MODE) == DT3155_STATE_FLD) { - dt3155_fbuffer[ minor ]->frame_count++; + dt3155_fbuffer[minor]->frame_count++; } - if ( dt3155_fbuffer[ minor ]->stop_acquire && - dt3155_fbuffer[ minor ]->even_stopped ) + if (dt3155_fbuffer[minor]->stop_acquire && + dt3155_fbuffer[minor]->even_stopped) { printk(KERN_DEBUG "dt3155: stopping odd..\n"); - if ( i2c_odd_csr.fld.SNGL_ODD ) + if (i2c_odd_csr.fld.SNGL_ODD) { /* disable interrupts */ int_csr_r.fld.FLD_END_ODD_EN = 0; - dt3155_status[ minor ].state &= ~(DT3155_STATE_STOP|0xff); + dt3155_status[minor].state &= ~(DT3155_STATE_STOP|0xff); /* mark the system stopped: */ - dt3155_status[ minor ].state |= DT3155_STATE_IDLE; - dt3155_fbuffer[ minor ]->stop_acquire = 0; - dt3155_fbuffer[ minor ]->even_stopped = 0; + dt3155_status[minor].state |= DT3155_STATE_IDLE; + dt3155_fbuffer[minor]->stop_acquire = 0; + dt3155_fbuffer[minor]->even_stopped = 0; printk(KERN_DEBUG "dt3155: state is now %x\n", dt3155_status[minor].state); @@ -313,104 +313,104 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) } } - WriteMReg( (dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg ); + WriteMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); /* if the odd field has been acquired, then */ /* change the next dma location for both fields */ /* and wake up the process if sleeping */ - if ( dt3155_fbuffer[ minor ]->even_happened || - (dt3155_status[ minor ].state & DT3155_STATE_MODE) == - DT3155_STATE_FLD ) + if (dt3155_fbuffer[minor]->even_happened || + (dt3155_status[minor].state & DT3155_STATE_MODE) == + DT3155_STATE_FLD) { local_save_flags(flags); local_irq_disable(); #ifdef DEBUG_QUES_B - printques( minor ); + printques(minor); #endif - if ( dt3155_fbuffer[ minor ]->nbuffers > 2 ) + if (dt3155_fbuffer[minor]->nbuffers > 2) { - if ( !are_empty_buffers( minor ) ) + if (!are_empty_buffers(minor)) { /* The number of active + locked buffers is * at most 2, and since there are none empty, there * must be at least nbuffers-2 ready buffers. * This is where we 'drop frames', oldest first. */ - push_empty( pop_ready( minor ), minor ); + push_empty(pop_ready(minor), minor); } /* The ready_que can't be full, since we know * there is one active buffer right now, so it's safe * to push the active buf on the ready_que. */ - push_ready( minor, dt3155_fbuffer[ minor ]->active_buf ); + push_ready(minor, dt3155_fbuffer[minor]->active_buf); /* There's at least 1 empty -- make it active */ - dt3155_fbuffer[ minor ]->active_buf = pop_empty( minor ); - dt3155_fbuffer[ minor ]-> - frame_info[ dt3155_fbuffer[ minor ]-> - active_buf ].tag = ++unique_tag; + dt3155_fbuffer[minor]->active_buf = pop_empty(minor); + dt3155_fbuffer[minor]-> + frame_info[dt3155_fbuffer[minor]-> + active_buf].tag = ++unique_tag; } else /* nbuffers == 2, special case */ { /* There is 1 active buffer. * If there is a locked buffer, keep the active buffer * the same -- that means we drop a frame. */ - if ( dt3155_fbuffer[ minor ]->locked_buf < 0 ) + if (dt3155_fbuffer[minor]->locked_buf < 0) { - push_ready( minor, - dt3155_fbuffer[ minor ]->active_buf ); - if (are_empty_buffers( minor ) ) + push_ready(minor, + dt3155_fbuffer[minor]->active_buf); + if (are_empty_buffers(minor)) { - dt3155_fbuffer[ minor ]->active_buf = - pop_empty( minor ); + dt3155_fbuffer[minor]->active_buf = + pop_empty(minor); } else { /* no empty or locked buffers, so use a readybuf */ - dt3155_fbuffer[ minor ]->active_buf = - pop_ready( minor ); + dt3155_fbuffer[minor]->active_buf = + pop_ready(minor); } } } #ifdef DEBUG_QUES_B - printques( minor ); + printques(minor); #endif - dt3155_fbuffer[ minor ]->even_happened = 0; + dt3155_fbuffer[minor]->even_happened = 0; - wake_up_interruptible( &dt3155_read_wait_queue[ minor ] ); + wake_up_interruptible(&dt3155_read_wait_queue[minor]); local_irq_restore(flags); } /* Set up the DMA address for the next frame/field */ - buffer_addr = dt3155_fbuffer[ minor ]-> - frame_info[ dt3155_fbuffer[ minor ]->active_buf ].addr; - if ( (dt3155_status[ minor ].state & DT3155_STATE_MODE) == - DT3155_STATE_FLD ) + buffer_addr = dt3155_fbuffer[minor]-> + frame_info[dt3155_fbuffer[minor]->active_buf].addr; + if ((dt3155_status[minor].state & DT3155_STATE_MODE) == + DT3155_STATE_FLD) { - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_START), buffer_addr); + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_START), buffer_addr); } else { - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_START), buffer_addr); + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_START), buffer_addr); - WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_START), buffer_addr - + dt3155_status[ minor ].config.cols); + WriteMReg((dt3155_lbase[minor] + ODD_DMA_START), buffer_addr + + dt3155_status[minor].config.cols); } /* Do error checking */ i2c_odd_csr.fld.DONE_ODD = 1; - if ( i2c_odd_csr.fld.ERROR_ODD ) + if (i2c_odd_csr.fld.ERROR_ODD) dt3155_errno = DT_ERR_OVERRUN; - WriteI2C(dt3155_lbase[ minor ], ODD_CSR, i2c_odd_csr.reg ); + WriteI2C(dt3155_lbase[minor], ODD_CSR, i2c_odd_csr.reg); return; } /* If we get here, the Odd Field wasn't it either... */ - printk( "neither even nor odd. shared perhaps?\n"); + printk("neither even nor odd. shared perhaps?\n"); } /***************************************************** @@ -421,22 +421,22 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs ) *****************************************************/ static void dt3155_init_isr(int minor) { - const u32 stride = dt3155_status[ minor ].config.cols; + const u32 stride = dt3155_status[minor].config.cols; - switch (dt3155_status[ minor ].state & DT3155_STATE_MODE) + switch (dt3155_status[minor].state & DT3155_STATE_MODE) { case DT3155_STATE_FLD: { - even_dma_start_r = dt3155_status[ minor ]. - fbuffer.frame_info[ dt3155_status[ minor ].fbuffer.active_buf ].addr; + even_dma_start_r = dt3155_status[minor]. + fbuffer.frame_info[dt3155_status[minor].fbuffer.active_buf].addr; even_dma_stride_r = 0; odd_dma_stride_r = 0; - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_START), + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_START), even_dma_start_r); - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_STRIDE), + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_STRIDE), even_dma_stride_r); - WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_STRIDE), + WriteMReg((dt3155_lbase[minor] + ODD_DMA_STRIDE), odd_dma_stride_r); break; } @@ -444,19 +444,19 @@ static void dt3155_init_isr(int minor) case DT3155_STATE_FRAME: default: { - even_dma_start_r = dt3155_status[ minor ]. - fbuffer.frame_info[ dt3155_status[ minor ].fbuffer.active_buf ].addr; + even_dma_start_r = dt3155_status[minor]. + fbuffer.frame_info[dt3155_status[minor].fbuffer.active_buf].addr; odd_dma_start_r = even_dma_start_r + stride; even_dma_stride_r = stride; odd_dma_stride_r = stride; - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_START), + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_START), even_dma_start_r); - WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_START), + WriteMReg((dt3155_lbase[minor] + ODD_DMA_START), odd_dma_start_r); - WriteMReg((dt3155_lbase[ minor ] + EVEN_DMA_STRIDE), + WriteMReg((dt3155_lbase[minor] + EVEN_DMA_STRIDE), even_dma_stride_r); - WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_STRIDE), + WriteMReg((dt3155_lbase[minor] + ODD_DMA_STRIDE), odd_dma_stride_r); break; } @@ -465,9 +465,9 @@ static void dt3155_init_isr(int minor) /* 50/60 Hz should be set before this point but let's make sure it is */ /* right anyway */ - ReadI2C(dt3155_lbase[ minor ], CONFIG, &i2c_csr2.reg); + ReadI2C(dt3155_lbase[minor], CONFIG, &i2c_csr2.reg); i2c_csr2.fld.HZ50 = FORMAT50HZ; - WriteI2C(dt3155_lbase[ minor ], CONFIG, i2c_config.reg); + WriteI2C(dt3155_lbase[minor], CONFIG, i2c_config.reg); /* enable busmaster chip, clear flags */ @@ -487,7 +487,7 @@ static void dt3155_init_isr(int minor) csr1_r.fld.FLD_CRPT_EVE = 1; /* writing a 1 clears flags */ csr1_r.fld.FLD_CRPT_ODD = 1; - WriteMReg((dt3155_lbase[ minor ] + CSR1),csr1_r.reg); + WriteMReg((dt3155_lbase[minor] + CSR1),csr1_r.reg); /* Enable interrupts at the end of each field */ @@ -496,14 +496,14 @@ static void dt3155_init_isr(int minor) int_csr_r.fld.FLD_END_ODD_EN = 1; int_csr_r.fld.FLD_START_EN = 0; - WriteMReg((dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg); + WriteMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); /* start internal BUSY bits */ - ReadI2C(dt3155_lbase[ minor ], CSR2, &i2c_csr2.reg); + ReadI2C(dt3155_lbase[minor], CSR2, &i2c_csr2.reg); i2c_csr2.fld.BUSY_ODD = 1; i2c_csr2.fld.BUSY_EVE = 1; - WriteI2C(dt3155_lbase[ minor ], CSR2, i2c_csr2.reg); + WriteI2C(dt3155_lbase[minor], CSR2, i2c_csr2.reg); /* Now its up to the interrupt routine!! */ @@ -522,7 +522,7 @@ static int dt3155_ioctl(struct inode *inode, { int minor = MINOR(inode->i_rdev); /* What device are we ioctl()'ing? */ - if ( minor >= MAXBOARDS || minor < 0 ) + if (minor >= MAXBOARDS || minor < 0) return -ENODEV; /* make sure it is valid command */ @@ -566,7 +566,7 @@ static int dt3155_ioctl(struct inode *inode, case DT3155_GET_CONFIG: { if (copy_to_user((void *) arg, (void *) &dt3155_status[minor], - sizeof(dt3155_status_t) )) + sizeof(dt3155_status_t))) return -EFAULT; return 0; } @@ -610,7 +610,7 @@ static int dt3155_ioctl(struct inode *inode, } dt3155_init_isr(minor); - if (copy_to_user( (void *) arg, (void *) &dt3155_status[minor], + if (copy_to_user((void *) arg, (void *) &dt3155_status[minor], sizeof(dt3155_status_t))) return -EFAULT; return 0; @@ -682,36 +682,36 @@ static int dt3155_mmap (struct file * file, struct vm_area_struct * vma) * MOD_INC_USE_COUNT make sure that the driver memory is not freed * while the device is in use. *****************************************************/ -static int dt3155_open( struct inode* inode, struct file* filep) +static int dt3155_open(struct inode* inode, struct file* filep) { int minor = MINOR(inode->i_rdev); /* what device are we opening? */ - if (dt3155_dev_open[ minor ]) { + if (dt3155_dev_open[minor]) { printk ("DT3155: Already opened by another process.\n"); return -EBUSY; } - if (dt3155_status[ minor ].device_installed==0) + if (dt3155_status[minor].device_installed==0) { printk("DT3155 Open Error: No such device dt3155 minor number %d\n", minor); return -EIO; } - if (dt3155_status[ minor ].state != DT3155_STATE_IDLE) { + if (dt3155_status[minor].state != DT3155_STATE_IDLE) { printk ("DT3155: Not in idle state (state = %x)\n", - dt3155_status[ minor ].state); + dt3155_status[minor].state); return -EBUSY; } printk("DT3155: Device opened.\n"); - dt3155_dev_open[ minor ] = 1 ; + dt3155_dev_open[minor] = 1 ; - dt3155_flush( minor ); + dt3155_flush(minor); /* Disable ALL interrupts */ int_csr_r.reg = 0; - WriteMReg( (dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg ); + WriteMReg((dt3155_lbase[minor] + INT_CSR), int_csr_r.reg); init_waitqueue_head(&(dt3155_read_wait_queue[minor])); @@ -725,20 +725,20 @@ static int dt3155_open( struct inode* inode, struct file* filep) * Now decrement the use count. * *****************************************************/ -static int dt3155_close( struct inode *inode, struct file *filep) +static int dt3155_close(struct inode *inode, struct file *filep) { int minor; minor = MINOR(inode->i_rdev); /* which device are we closing */ - if (!dt3155_dev_open[ minor ]) + if (!dt3155_dev_open[minor]) { printk("DT3155: attempt to CLOSE a not OPEN device\n"); } else { - dt3155_dev_open[ minor ] = 0; + dt3155_dev_open[minor] = 0; - if (dt3155_status[ minor ].state != DT3155_STATE_IDLE) + if (dt3155_status[minor].state != DT3155_STATE_IDLE) { quick_stop(minor); } @@ -782,7 +782,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, if (filep->f_flags & O_NDELAY) { if ((frame_index = dt3155_get_ready_buffer(minor)) < 0) { - /*printk( "dt3155: no buffers available (?)\n");*/ + /*printk("dt3155: no buffers available (?)\n");*/ /* printques(minor); */ return -EAGAIN; } @@ -814,7 +814,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, put_user(offset, (unsigned int *) buf); buf += sizeof(u32); - put_user( dt3155_status[minor].fbuffer.frame_count, (unsigned int *) buf); + put_user(dt3155_status[minor].fbuffer.frame_count, (unsigned int *) buf); buf += sizeof(u32); put_user(dt3155_status[minor].state, (unsigned int *) buf); buf += sizeof(u32); @@ -901,7 +901,7 @@ static int find_PCI (void) /* Now, just go out and make sure that this/these device(s) is/are actually mapped into the kernel address space */ - if ((error = pci_read_config_dword( pci_dev, PCI_BASE_ADDRESS_0, + if ((error = pci_read_config_dword(pci_dev, PCI_BASE_ADDRESS_0, (u32 *) &base))) { printk("DT3155: Was not able to find device \n"); @@ -913,26 +913,26 @@ static int find_PCI (void) /* Remap the base address to a logical address through which we * can access it. */ - dt3155_lbase[ pci_index - 1 ] = ioremap(base,PCI_PAGE_SIZE); - dt3155_status[ pci_index - 1 ].reg_addr = base; + dt3155_lbase[pci_index - 1] = ioremap(base,PCI_PAGE_SIZE); + dt3155_status[pci_index - 1].reg_addr = base; DT_3155_DEBUG_MSG("DT3155: New logical address is %p \n", dt3155_lbase[pci_index-1]); - if ( !dt3155_lbase[pci_index-1] ) + if (!dt3155_lbase[pci_index-1]) { printk("DT3155: Unable to remap control registers\n"); goto err; } - if ( (error = pci_read_config_byte( pci_dev, PCI_INTERRUPT_LINE, &irq)) ) + if ((error = pci_read_config_byte(pci_dev, PCI_INTERRUPT_LINE, &irq))) { printk("DT3155: Was not able to find device \n"); goto err; } DT_3155_DEBUG_MSG("DT3155: IRQ is %d \n",irq); - dt3155_status[ pci_index-1 ].irq = irq; + dt3155_status[pci_index-1].irq = irq; /* Set flag: kth device found! */ - dt3155_status[ pci_index-1 ].device_installed = 1; + dt3155_status[pci_index-1].device_installed = 1; printk("DT3155: Installing device %d w/irq %d and address %p\n", pci_index, dt3155_status[pci_index-1].irq, @@ -957,89 +957,89 @@ int init_module(void) { int index; int rcode = 0; - char *devname[ MAXBOARDS ]; + char *devname[MAXBOARDS]; - devname[ 0 ] = "dt3155a"; + devname[0] = "dt3155a"; #if MAXBOARDS == 2 - devname[ 1 ] = "dt3155b"; + devname[1] = "dt3155b"; #endif printk("DT3155: Loading module...\n"); /* Register the device driver */ - rcode = register_chrdev( dt3155_major, "dt3155", &dt3155_fops ); - if( rcode < 0 ) + rcode = register_chrdev(dt3155_major, "dt3155", &dt3155_fops); + if(rcode < 0) { - printk( KERN_INFO "DT3155: register_chrdev failed \n"); + printk(KERN_INFO "DT3155: register_chrdev failed \n"); return rcode; } - if( dt3155_major == 0 ) + if(dt3155_major == 0) dt3155_major = rcode; /* dynamic */ /* init the status variables. */ /* DMA memory is taken care of in setup_buffers() */ - for ( index = 0; index < MAXBOARDS; index++ ) + for (index = 0; index < MAXBOARDS; index++) { - dt3155_status[ index ].config.acq_mode = DT3155_MODE_FRAME; - dt3155_status[ index ].config.continuous = DT3155_ACQ; - dt3155_status[ index ].config.cols = DT3155_MAX_COLS; - dt3155_status[ index ].config.rows = DT3155_MAX_ROWS; - dt3155_status[ index ].state = DT3155_STATE_IDLE; + dt3155_status[index].config.acq_mode = DT3155_MODE_FRAME; + dt3155_status[index].config.continuous = DT3155_ACQ; + dt3155_status[index].config.cols = DT3155_MAX_COLS; + dt3155_status[index].config.rows = DT3155_MAX_ROWS; + dt3155_status[index].state = DT3155_STATE_IDLE; /* find_PCI() will check if devices are installed; */ /* first assume they're not: */ - dt3155_status[ index ].mem_addr = 0; - dt3155_status[ index ].mem_size = 0; - dt3155_status[ index ].state = DT3155_STATE_IDLE; - dt3155_status[ index ].device_installed = 0; + dt3155_status[index].mem_addr = 0; + dt3155_status[index].mem_size = 0; + dt3155_status[index].state = DT3155_STATE_IDLE; + dt3155_status[index].device_installed = 0; } /* Now let's find the hardware. find_PCI() will set ndevices to the * number of cards found in this machine. */ { - if ( (rcode = find_PCI()) != DT_3155_SUCCESS ) + if ((rcode = find_PCI()) != DT_3155_SUCCESS) { printk("DT3155 error: find_PCI() failed to find dt3155 board(s)\n"); - unregister_chrdev( dt3155_major, "dt3155" ); + unregister_chrdev(dt3155_major, "dt3155"); return rcode; } } /* Ok, time to setup the frame buffers */ - if( (rcode = dt3155_setup_buffers(&allocatorAddr)) < 0 ) + if((rcode = dt3155_setup_buffers(&allocatorAddr)) < 0) { printk("DT3155: Error: setting up buffer not large enough."); - unregister_chrdev( dt3155_major, "dt3155" ); + unregister_chrdev(dt3155_major, "dt3155"); return rcode; } /* If we are this far, then there is enough RAM */ /* for the buffers: Print the configuration. */ - for( index = 0; index < ndevices; index++ ) + for( index = 0; index < ndevices; index++) { printk("DT3155: Device = %d; acq_mode = %d; " "continuous = %d; cols = %d; rows = %d;\n", index , - dt3155_status[ index ].config.acq_mode, - dt3155_status[ index ].config.continuous, - dt3155_status[ index ].config.cols, - dt3155_status[ index ].config.rows); + dt3155_status[index].config.acq_mode, + dt3155_status[index].config.continuous, + dt3155_status[index].config.cols, + dt3155_status[index].config.rows); printk("DT3155: m_addr = 0x%x; m_size = %ld; " "state = %d; device_installed = %d\n", - dt3155_status[ index ].mem_addr, - (long int)dt3155_status[ index ].mem_size, - dt3155_status[ index ].state, - dt3155_status[ index ].device_installed); + dt3155_status[index].mem_addr, + (long int)dt3155_status[index].mem_size, + dt3155_status[index].state, + dt3155_status[index].device_installed); } /* Disable ALL interrupts */ int_csr_r.reg = 0; - for( index = 0; index < ndevices; index++ ) + for( index = 0; index < ndevices; index++) { - WriteMReg( (dt3155_lbase[ index ] + INT_CSR), int_csr_r.reg ); - if( dt3155_status[ index ].device_installed ) + WriteMReg((dt3155_lbase[index] + INT_CSR), int_csr_r.reg); + if(dt3155_status[index].device_installed) { /* * This driver *looks* like it can handle sharing interrupts, @@ -1048,14 +1048,14 @@ int init_module(void) * as a reminder in case any problems arise. (SS) */ /* in older kernels flags are: SA_SHIRQ | SA_INTERRUPT */ - rcode = request_irq( dt3155_status[ index ].irq, (void *)dt3155_isr, - IRQF_SHARED | IRQF_DISABLED, devname[ index ], + rcode = request_irq(dt3155_status[index].irq, (void *)dt3155_isr, + IRQF_SHARED | IRQF_DISABLED, devname[index], (void*) &dt3155_status[index]); - if( rcode < 0 ) + if(rcode < 0) { printk("DT3155: minor %d request_irq failed for IRQ %d\n", index, dt3155_status[index].irq); - unregister_chrdev( dt3155_major, "dt3155" ); + unregister_chrdev(dt3155_major, "dt3155"); return rcode; } } @@ -1084,15 +1084,15 @@ void cleanup_module(void) allocator_cleanup(); #endif - unregister_chrdev( dt3155_major, "dt3155" ); + unregister_chrdev(dt3155_major, "dt3155"); - for( index = 0; index < ndevices; index++ ) + for(index = 0; index < ndevices; index++) { - if( dt3155_status[ index ].device_installed == 1 ) + if(dt3155_status[index].device_installed == 1) { - printk( "DT3155: Freeing irq %d for device %d\n", - dt3155_status[ index ].irq, index ); - free_irq( dt3155_status[ index ].irq, (void*)&dt3155_status[index] ); + printk("DT3155: Freeing irq %d for device %d\n", + dt3155_status[index].irq, index); + free_irq(dt3155_status[index].irq, (void*)&dt3155_status[index]); } } } -- cgit v1.1 From 7d4984d8424182eba2774755ae2ae8145651e788 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Mon, 29 Mar 2010 00:34:29 -0700 Subject: Staging: dt3155: allocator.c: sparse cleanups Make prototypes match implementation Use gfp_t flags not int prio Still a couple of sparse warnings left Signed-off-by: Joe Perches Cc: Simon Horman Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/allocator.c | 15 ++++++++------- drivers/staging/dt3155/allocator.h | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/allocator.c b/drivers/staging/dt3155/allocator.c index 6fbd050..bd5adbc 100644 --- a/drivers/staging/dt3155/allocator.c +++ b/drivers/staging/dt3155/allocator.c @@ -58,6 +58,8 @@ #include +#include "allocator.h" + /*#define ALL_DEBUG*/ #define ALL_MSG "allocator: " @@ -83,9 +85,9 @@ /*#define PDEBUGG(fmt, args...) printk( KERN_DEBUG ALL_MSG fmt, ## args)*/ -int allocator_himem = 1; /* 0 = probe, pos. = megs, neg. = disable */ -int allocator_step = 1; /* This is the step size in MB */ -int allocator_probe = 1; /* This is a flag -- 1=probe, 0=don't probe */ +static int allocator_himem = 1; /* 0 = probe, pos. = megs, neg. = disable */ +static int allocator_step = 1; /* This is the step size in MB */ +static int allocator_probe = 1; /* This is a flag -- 1=probe, 0=don't probe */ static unsigned long allocator_buffer; /* physical address */ static unsigned long allocator_buffer_size; /* kilobytes */ @@ -101,8 +103,7 @@ struct allocator_struct { struct allocator_struct *next; }; -struct allocator_struct *allocator_list; - +static struct allocator_struct *allocator_list; #ifdef ALL_DEBUG static int dump_list(void) @@ -124,7 +125,7 @@ static int dump_list(void) * be used straight ahead for DMA, but needs remapping for program use). */ -unsigned long allocator_allocate_dma(unsigned long kilobytes, int prio) +unsigned long allocator_allocate_dma(unsigned long kilobytes, gfp_t flags) { struct allocator_struct *ptr = allocator_list, *newptr; unsigned long bytes = kilobytes << 10; @@ -147,7 +148,7 @@ unsigned long allocator_allocate_dma(unsigned long kilobytes, int prio) PDEBUG("alloc failed\n"); return 0; /* end of list */ } - newptr = kmalloc(sizeof(struct allocator_struct), prio); + newptr = kmalloc(sizeof(struct allocator_struct), flags); if (!newptr) return 0; diff --git a/drivers/staging/dt3155/allocator.h b/drivers/staging/dt3155/allocator.h index bdf3268..425b70f 100644 --- a/drivers/staging/dt3155/allocator.h +++ b/drivers/staging/dt3155/allocator.h @@ -22,7 +22,7 @@ * */ -void allocator_free_dma(unsigned long address); -unsigned long allocator_allocate_dma(unsigned long kilobytes, int priority); +int allocator_free_dma(unsigned long address); +unsigned long allocator_allocate_dma(unsigned long kilobytes, gfp_t flags); int allocator_init(u32 *); void allocator_cleanup(void); -- cgit v1.1 From e43a0edcb066935268b60c3444e30423bfee664c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:04:13 -0700 Subject: Staging: dt3155.h: remove #ifdef We are in the kernel now, don't check to see if we are not. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 7 ------- 1 file changed, 7 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 1bf7863..37d9fc6 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -34,15 +34,8 @@ MA 02111-1307 USA #ifndef _DT3155_INC #define _DT3155_INC -#ifdef __KERNEL__ #include #include /* struct timeval */ -#else -#include -#include -#include -#include -#endif #define TRUE 1 -- cgit v1.1 From ffefea471134987fc647f0a7502540bb6e5ae71f Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:06:14 -0700 Subject: Staging: dt3155: remove TRUE/FALSE These aren't needed in the kernel, so remove them. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 37d9fc6..453686e 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -38,9 +38,6 @@ MA 02111-1307 USA #include /* struct timeval */ -#define TRUE 1 -#define FALSE 0 - /* Uncomment this for 50Hz CCIR */ #define CCIR 1 @@ -55,11 +52,11 @@ MA 02111-1307 USA #ifdef CCIR #define DT3155_MAX_ROWS 576 #define DT3155_MAX_COLS 768 -#define FORMAT50HZ TRUE +#define FORMAT50HZ 1 #else #define DT3155_MAX_ROWS 480 #define DT3155_MAX_COLS 640 -#define FORMAT50HZ FALSE +#define FORMAT50HZ 0 #endif /* Configuration structure */ -- cgit v1.1 From 7f76c52fb0f4c7dfbe7dba1e80691fef957242b6 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:45:27 -0700 Subject: Staging: dt3155: remove frame_info_t The typedef is not needed. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 8 ++++---- drivers/staging/dt3155/dt3155_drv.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 453686e..93ee663 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -68,11 +68,11 @@ struct dt3155_config_s { /* hold data for each frame */ -typedef struct { +struct frame_info { u32 addr; /* address of the buffer with the frame */ u32 tag; /* unique number for the frame */ struct timeval time; /* time that capture took place */ -} frame_info_t; +}; /* * Structure for interrupt and buffer handling. @@ -81,7 +81,7 @@ typedef struct { struct dt3155_fbuffer_s { int nbuffers; - frame_info_t frame_info[BOARD_MAX_BUFFS]; + struct frame_info frame_info[BOARD_MAX_BUFFS]; int empty_buffers[BOARD_MAX_BUFFS]; /* indexes empty frames */ int empty_len; /* Number of empty buffers */ @@ -155,7 +155,7 @@ typedef struct dt3155_read_s { u32 frame_seq; u32 state; - frame_info_t frame_info; + struct frame_info frame_info; } dt3155_read_t; #endif /* _DT3155_inc */ diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index 91ebfad..cd674e1 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -757,7 +757,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, int minor = MINOR(filep->f_dentry->d_inode->i_rdev); u32 offset; int frame_index; - frame_info_t *frame_info_p; + struct frame_info *frame_info; /* TODO: this should check the error flag and */ /* return an error on hardware failures */ @@ -807,10 +807,10 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, } } - frame_info_p = &dt3155_status[minor].fbuffer.frame_info[frame_index]; + frame_info = &dt3155_status[minor].fbuffer.frame_info[frame_index]; /* make this an offset */ - offset = frame_info_p->addr - dt3155_status[minor].mem_addr; + offset = frame_info->addr - dt3155_status[minor].mem_addr; put_user(offset, (unsigned int *) buf); buf += sizeof(u32); @@ -818,7 +818,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, buf += sizeof(u32); put_user(dt3155_status[minor].state, (unsigned int *) buf); buf += sizeof(u32); - if (copy_to_user(buf, frame_info_p, sizeof(frame_info_t))) + if (copy_to_user(buf, frame_info, sizeof(*frame_info))) return -EFAULT; return sizeof(dt3155_read_t); -- cgit v1.1 From 923c1244fc27dc1623d95b6b3a29bc305a18bac5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:47:55 -0700 Subject: Staging: dt3155: remove dt3155_status_t The typedef is not needed. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 8 ++++---- drivers/staging/dt3155/dt3155_drv.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 93ee663..6546b60 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -110,7 +110,7 @@ struct dt3155_fbuffer_s { #define DT3155_ACQ 2 /* There is one status structure for each card. */ -typedef struct dt3155_status_s { +struct dt3155_status { int fixed_mode; /* if 1, we are in fixed frame mode */ u32 reg_addr; /* Register address for a single card */ u32 mem_addr; /* Buffer start addr for this card */ @@ -120,10 +120,10 @@ typedef struct dt3155_status_s { struct dt3155_fbuffer_s fbuffer; /* frame buffer state struct */ u32 state; /* this card's state */ u32 device_installed; /* Flag if installed. 1=installed */ -} dt3155_status_t; +}; /* Reference to global status structure */ -extern struct dt3155_status_s dt3155_status[MAXBOARDS]; +extern struct dt3155_status dt3155_status[MAXBOARDS]; #define DT3155_STATE_IDLE 0x00 #define DT3155_STATE_FRAME 0x01 @@ -135,7 +135,7 @@ extern struct dt3155_status_s dt3155_status[MAXBOARDS]; #define DT3155_IOC_MAGIC '!' #define DT3155_SET_CONFIG _IOW(DT3155_IOC_MAGIC, 1, struct dt3155_config_s) -#define DT3155_GET_CONFIG _IOR(DT3155_IOC_MAGIC, 2, struct dt3155_status_s) +#define DT3155_GET_CONFIG _IOR(DT3155_IOC_MAGIC, 2, struct dt3155_status) #define DT3155_STOP _IO(DT3155_IOC_MAGIC, 3) #define DT3155_START _IO(DT3155_IOC_MAGIC, 4) #define DT3155_FLUSH _IO(DT3155_IOC_MAGIC, 5) diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index cd674e1..5c567e4 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -112,7 +112,7 @@ int dt3155_major = 0; /* Global structures and variables */ /* Status of each device */ -struct dt3155_status_s dt3155_status[MAXBOARDS]; +struct dt3155_status dt3155_status[MAXBOARDS]; /* kernel logical address of the board */ u8 *dt3155_lbase[MAXBOARDS] = { NULL @@ -566,7 +566,7 @@ static int dt3155_ioctl(struct inode *inode, case DT3155_GET_CONFIG: { if (copy_to_user((void *) arg, (void *) &dt3155_status[minor], - sizeof(dt3155_status_t))) + sizeof(struct dt3155_status))) return -EFAULT; return 0; } @@ -587,7 +587,7 @@ static int dt3155_ioctl(struct inode *inode, quick_stop(minor); if (copy_to_user((void *) arg, (void *) &dt3155_status[minor], - sizeof(dt3155_status_t))) + sizeof(struct dt3155_status))) return -EFAULT; return 0; } @@ -611,7 +611,7 @@ static int dt3155_ioctl(struct inode *inode, dt3155_init_isr(minor); if (copy_to_user((void *) arg, (void *) &dt3155_status[minor], - sizeof(dt3155_status_t))) + sizeof(struct dt3155_status))) return -EFAULT; return 0; } -- cgit v1.1 From 5019d2848c6773ee5815291e6d3fcc33d0f5345c Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:49:23 -0700 Subject: Staging: dt3155: remove dt3155_read_t The typedef is not needed. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 4 ++-- drivers/staging/dt3155/dt3155_drv.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 6546b60..74a71f6 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -150,12 +150,12 @@ extern struct dt3155_status dt3155_status[MAXBOARDS]; #define DT_ERR_MASK 0xff0000/* not used but it might be one day */ /* User code will probably want to declare one of these for each card */ -typedef struct dt3155_read_s { +struct dt3155_read { u32 offset; u32 frame_seq; u32 state; struct frame_info frame_info; -} dt3155_read_t; +}; #endif /* _DT3155_inc */ diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index 5c567e4..3e8ceac 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -761,7 +761,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, /* TODO: this should check the error flag and */ /* return an error on hardware failures */ - if (count != sizeof(dt3155_read_t)) + if (count != sizeof(struct dt3155_read)) { printk("DT3155 ERROR (NJC): count is not right\n"); return -EINVAL; @@ -821,7 +821,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf, if (copy_to_user(buf, frame_info, sizeof(*frame_info))) return -EFAULT; - return sizeof(dt3155_read_t); + return sizeof(struct dt3155_read); } static unsigned int dt3155_poll (struct file * filp, poll_table *wait) -- cgit v1.1 From 8b692e69c76592fd91ebfbb0e59faea3b6fda256 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:51:50 -0700 Subject: Staging: dt3155: rename dt3155_config_s Drop the "_s", as it's not needed. Now, dt3155.h is checkpatch.pl clean. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 6 +++--- drivers/staging/dt3155/dt3155_drv.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index 74a71f6..b99b527 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -60,7 +60,7 @@ MA 02111-1307 USA #endif /* Configuration structure */ -struct dt3155_config_s { +struct dt3155_config { u32 acq_mode; u32 cols, rows; u32 continuous; @@ -116,7 +116,7 @@ struct dt3155_status { u32 mem_addr; /* Buffer start addr for this card */ u32 mem_size; /* This is the amount of mem available */ u32 irq; /* this card's irq */ - struct dt3155_config_s config; /* configuration struct */ + struct dt3155_config config; /* configuration struct */ struct dt3155_fbuffer_s fbuffer; /* frame buffer state struct */ u32 state; /* this card's state */ u32 device_installed; /* Flag if installed. 1=installed */ @@ -134,7 +134,7 @@ extern struct dt3155_status dt3155_status[MAXBOARDS]; #define DT3155_IOC_MAGIC '!' -#define DT3155_SET_CONFIG _IOW(DT3155_IOC_MAGIC, 1, struct dt3155_config_s) +#define DT3155_SET_CONFIG _IOW(DT3155_IOC_MAGIC, 1, struct dt3155_config) #define DT3155_GET_CONFIG _IOR(DT3155_IOC_MAGIC, 2, struct dt3155_status) #define DT3155_STOP _IO(DT3155_IOC_MAGIC, 3) #define DT3155_START _IO(DT3155_IOC_MAGIC, 4) diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index 3e8ceac..789d47a 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -546,7 +546,7 @@ static int dt3155_ioctl(struct inode *inode, return -EBUSY; { - struct dt3155_config_s tmp; + struct dt3155_config tmp; if (copy_from_user((void *)&tmp, (void *) arg, sizeof(tmp))) return -EFAULT; /* check for valid settings */ -- cgit v1.1 From e802b4b79d2b25c47736c135a709b6c31e95fc39 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 16:53:59 -0700 Subject: Staging: dt3155: rename dt3155_fbuffer_s drop the "_s" as it's not needed. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155.h | 4 ++-- drivers/staging/dt3155/dt3155_isr.c | 4 ++-- drivers/staging/dt3155/dt3155_isr.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155.h b/drivers/staging/dt3155/dt3155.h index b99b527..793e2fc 100644 --- a/drivers/staging/dt3155/dt3155.h +++ b/drivers/staging/dt3155/dt3155.h @@ -78,7 +78,7 @@ struct frame_info { * Structure for interrupt and buffer handling. * This is the setup for 1 card */ -struct dt3155_fbuffer_s { +struct dt3155_fbuffer { int nbuffers; struct frame_info frame_info[BOARD_MAX_BUFFS]; @@ -117,7 +117,7 @@ struct dt3155_status { u32 mem_size; /* This is the amount of mem available */ u32 irq; /* this card's irq */ struct dt3155_config config; /* configuration struct */ - struct dt3155_fbuffer_s fbuffer; /* frame buffer state struct */ + struct dt3155_fbuffer fbuffer; /* frame buffer state struct */ u32 state; /* this card's state */ u32 device_installed; /* Flag if installed. 1=installed */ }; diff --git a/drivers/staging/dt3155/dt3155_isr.c b/drivers/staging/dt3155/dt3155_isr.c index 1ebcec0..61f74b6 100644 --- a/drivers/staging/dt3155/dt3155_isr.c +++ b/drivers/staging/dt3155/dt3155_isr.c @@ -60,7 +60,7 @@ Purpose: Buffer management routines, and other routines for the ISR /* Pointer into global structure for handling buffers */ -struct dt3155_fbuffer_s *dt3155_fbuffer[MAXBOARDS] = {NULL +struct dt3155_fbuffer *dt3155_fbuffer[MAXBOARDS] = {NULL #if MAXBOARDS == 2 , NULL #endif @@ -317,7 +317,7 @@ u32 dt3155_setup_buffers(u32 *allocatorAddr) /* Make sure the buffering variables are consistent */ { u8 *ptr = (u8 *) dt3155_fbuffer[m]; - for (index = 0; index < sizeof(struct dt3155_fbuffer_s); index++) + for (index = 0; index < sizeof(struct dt3155_fbuffer); index++) *(ptr++) = 0; } } diff --git a/drivers/staging/dt3155/dt3155_isr.h b/drivers/staging/dt3155/dt3155_isr.h index 7595cb1..7d474cf 100644 --- a/drivers/staging/dt3155/dt3155_isr.h +++ b/drivers/staging/dt3155/dt3155_isr.h @@ -36,7 +36,7 @@ MA 02111-1307 USA #ifndef DT3155_ISR_H #define DT3155_ISR_H -extern struct dt3155_fbuffer_s *dt3155_fbuffer[MAXBOARDS]; +extern struct dt3155_fbuffer *dt3155_fbuffer[MAXBOARDS]; /* User functions for buffering */ /* Initialize the buffering system. This should */ -- cgit v1.1 From e8afd402cc37aa2e6134c2f6e866f4a330d2da80 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 27 Apr 2010 17:04:16 -0700 Subject: Staging: dt3155: remove "inline" usage It was wrong, and not doing what anyone would think it would do. Cc: H Hartley Sweeten Cc: Scott Smedley Signed-off-by: Greg Kroah-Hartman --- drivers/staging/dt3155/dt3155_drv.c | 2 +- drivers/staging/dt3155/dt3155_isr.c | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) (limited to 'drivers/staging/dt3155') diff --git a/drivers/staging/dt3155/dt3155_drv.c b/drivers/staging/dt3155/dt3155_drv.c index 789d47a..f31309b 100644 --- a/drivers/staging/dt3155/dt3155_drv.c +++ b/drivers/staging/dt3155/dt3155_drv.c @@ -168,7 +168,7 @@ static void quick_stop (int minor) * - Assumes irq's are disabled, via SA_INTERRUPT flag * being set in request_irq() call from init_module() *****************************************************/ -static inline void dt3155_isr(int irq, void *dev_id, struct pt_regs *regs) +static void dt3155_isr(int irq, void *dev_id, struct pt_regs *regs) { int minor = -1; int index; diff --git a/drivers/staging/dt3155/dt3155_isr.c b/drivers/staging/dt3155/dt3155_isr.c index 61f74b6..33ddc9c 100644 --- a/drivers/staging/dt3155/dt3155_isr.c +++ b/drivers/staging/dt3155/dt3155_isr.c @@ -77,7 +77,7 @@ struct dt3155_fbuffer *dt3155_fbuffer[MAXBOARDS] = {NULL * are_empty_buffers * m is minor # of device ***************************/ -inline bool are_empty_buffers(int m) +bool are_empty_buffers(int m) { return dt3155_fbuffer[m]->empty_len; } @@ -92,7 +92,7 @@ inline bool are_empty_buffers(int m) * given by dt3155_fbuffer[m]->empty_buffers[0]. * empty_buffers should never fill up, though this is not checked. **************************/ -inline void push_empty(int index, int m) +void push_empty(int index, int m) { dt3155_fbuffer[m]->empty_buffers[dt3155_fbuffer[m]->empty_len] = index; dt3155_fbuffer[m]->empty_len++; @@ -102,7 +102,7 @@ inline void push_empty(int index, int m) * pop_empty(m) * m is minor # of device **************************/ -inline int pop_empty(int m) +int pop_empty(int m) { dt3155_fbuffer[m]->empty_len--; return dt3155_fbuffer[m]->empty_buffers[dt3155_fbuffer[m]->empty_len]; @@ -112,7 +112,7 @@ inline int pop_empty(int m) * is_ready_buf_empty(m) * m is minor # of device *************************/ -inline bool is_ready_buf_empty(int m) +bool is_ready_buf_empty(int m) { return ((dt3155_fbuffer[m]->ready_len) == 0); } @@ -124,7 +124,7 @@ inline bool is_ready_buf_empty(int m) * buffers, since it corresponds to nbuffers ready buffers!! * 7/31/02: total rewrite. --NJC *************************/ -inline bool is_ready_buf_full(int m) +bool is_ready_buf_full(int m) { return dt3155_fbuffer[m]->ready_len == dt3155_fbuffer[m]->nbuffers; } @@ -134,7 +134,7 @@ inline bool is_ready_buf_full(int m) * m is minor # of device * *****************************************************/ -inline void push_ready(int m, int index) +void push_ready(int m, int index) { int head = dt3155_fbuffer[m]->ready_head; @@ -151,7 +151,7 @@ inline void push_ready(int m, int index) * * Simply comptutes the tail given the head and the length. *****************************************************/ -static inline int get_tail(int m) +static int get_tail(int m) { return (dt3155_fbuffer[m]->ready_head - dt3155_fbuffer[m]->ready_len + @@ -168,7 +168,7 @@ static inline int get_tail(int m) * This assumes that there is a ready buffer ready... should * be checked (e.g. with is_ready_buf_empty() prior to call. *****************************************************/ -inline int pop_ready(int m) +int pop_ready(int m) { int tail; tail = get_tail(m); @@ -181,7 +181,7 @@ inline int pop_ready(int m) * printques * m is minor # of device *****************************************************/ -inline void printques(int m) +void printques(int m) { int head = dt3155_fbuffer[m]->ready_head; int tail; @@ -410,7 +410,7 @@ u32 dt3155_setup_buffers(u32 *allocatorAddr) * * m is minor number of device *****************************************************/ -static inline void internal_release_locked_buffer(int m) +static void internal_release_locked_buffer(int m) { /* Pointer into global structure for handling buffers */ if (dt3155_fbuffer[m]->locked_buf >= 0) { @@ -427,7 +427,7 @@ static inline void internal_release_locked_buffer(int m) * The user function of the above. * *****************************************************/ -inline void dt3155_release_locked_buffer(int m) +void dt3155_release_locked_buffer(int m) { unsigned long int flags; local_save_flags(flags); @@ -442,7 +442,7 @@ inline void dt3155_release_locked_buffer(int m) * m is minor # of device * *****************************************************/ -inline int dt3155_flush(int m) +int dt3155_flush(int m) { int index; unsigned long int flags; @@ -479,7 +479,7 @@ inline int dt3155_flush(int m) * If the user has a buffer locked it will unlock * that buffer before returning the new one. *****************************************************/ -inline int dt3155_get_ready_buffer(int m) +int dt3155_get_ready_buffer(int m) { int frame_index; unsigned long int flags; -- cgit v1.1