diff options
| author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-22 15:20:27 -0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-12-22 15:20:27 -0800 |
| commit | 3915bd1f61e9bca5d567fcf65c3a077e405236b2 (patch) | |
| tree | 563928facd8333bc4829a7c1ac0e1b5e56d183d0 | |
| parent | 66b961e9446097d3edeba4da06fa2f770a721cdf (diff) | |
| download | patches-3915bd1f61e9bca5d567fcf65c3a077e405236b2.tar.gz | |
staging patches
| -rw-r--r-- | series | 3 | ||||
| -rw-r--r-- | staging/staging-dt3155-coding-style-cleanups-for-allocator-code.patch | 399 | ||||
| -rw-r--r-- | staging/staging-dt3155-coding-style-cleanups-for-the-.h-files.patch | 434 |
3 files changed, 835 insertions, 1 deletions
@@ -258,5 +258,6 @@ staging/staging-rtl8192su-use-z-format-qualifier-for-output-of-sizeof.patch staging/staging-prism2-usb-build-should-select-wireless_ext.patch staging/staging-wlan-ng-initialise-mibitem.patch - +staging/staging-dt3155-coding-style-cleanups-for-allocator-code.patch +staging/staging-dt3155-coding-style-cleanups-for-the-.h-files.patch diff --git a/staging/staging-dt3155-coding-style-cleanups-for-allocator-code.patch b/staging/staging-dt3155-coding-style-cleanups-for-allocator-code.patch new file mode 100644 index 00000000000000..298f0b70843bb5 --- /dev/null +++ b/staging/staging-dt3155-coding-style-cleanups-for-allocator-code.patch @@ -0,0 +1,399 @@ +From foo@baz Tue Dec 22 15:18:28 PST 2009 +Date: Tue, 22 Dec 2009 15:18:28 -0800 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Staging: dt3155: coding style cleanups for allocator code + +This fixes up the worst of the coding style errors for the +allocator code. + +Cc: Scott Smedley <ss@aao.gov.au> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/staging/dt3155/allocator.c | 304 ++++++++++++++++++------------------- + drivers/staging/dt3155/allocator.h | 2 + 2 files changed, 153 insertions(+), 153 deletions(-) + +--- a/drivers/staging/dt3155/allocator.c ++++ b/drivers/staging/dt3155/allocator.c +@@ -26,7 +26,7 @@ + Date Programmer Description of changes made + ------------------------------------------------------------------- + 02-Aug-2002 NJC allocator now steps in 1MB increments, rather +- than doubling its size each time. ++ than doubling its size each time. + Also, allocator_init(u_int *) now returns + (in the first arg) the size of the free + space. This is no longer consistent with +@@ -68,7 +68,7 @@ + # define DUMP_LIST() dump_list() + # ifdef __KERNEL__ + /* This one if debugging is on, and kernel space */ +-# define PDEBUG(fmt, args...) printk( KERN_DEBUG ALL_MSG fmt, ## args) ++# define PDEBUG(fmt, args...) printk(KERN_DEBUG ALL_MSG fmt, ## args) + # else + /* This one for user space */ + # define PDEBUG(fmt, args...) fprintf(stderr, fmt, ## args) +@@ -88,8 +88,8 @@ int allocator_himem = 1; /* 0 = probe, p + 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 unsigned long allocator_buffer = 0; /* physical address */ +-static unsigned long allocator_buffer_size = 0; /* kilobytes */ ++static unsigned long allocator_buffer; /* physical address */ ++static unsigned long allocator_buffer_size; /* kilobytes */ + + /* + * The allocator keeps a list of DMA areas, so multiple devices +@@ -97,24 +97,23 @@ static unsigned long allocator_buffer_si + */ + + struct allocator_struct { +- unsigned long address; +- unsigned long size; +- struct allocator_struct *next; ++ unsigned long address; ++ unsigned long size; ++ struct allocator_struct *next; + }; + +-struct allocator_struct *allocator_list = NULL; ++struct allocator_struct *allocator_list; + + + #ifdef ALL_DEBUG + static int dump_list(void) + { +- struct allocator_struct *ptr; ++ struct allocator_struct *ptr; + +- PDEBUG("Current list:\n"); +- for (ptr = allocator_list; ptr; ptr = ptr->next) { +- PDEBUG("0x%08lx (size %likB)\n",ptr->address,ptr->size>>10); +- } +- return 0; ++ PDEBUG("Current list:\n"); ++ for (ptr = allocator_list; ptr; ptr = ptr->next) ++ PDEBUG("0x%08lx (size %likB)\n", ptr->address, ptr->size>>10); ++ return 0; + } + #endif + +@@ -126,68 +125,69 @@ 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, int prio) + { +- struct allocator_struct *ptr = allocator_list, *newptr; +- unsigned long bytes = kilobytes << 10; ++ struct allocator_struct *ptr = allocator_list, *newptr; ++ unsigned long bytes = kilobytes << 10; + +- /* check if high memory is available */ +- if (!allocator_buffer) +- return 0; +- +- /* Round it to a multiple of the pagesize */ +- bytes = PAGE_ALIGN(bytes); +- PDEBUG("request for %li bytes\n", bytes); +- +- while (ptr && ptr->next) { +- if (ptr->next->address - (ptr->address + ptr->size) >= bytes) +- break; /* enough space */ +- ptr = ptr->next; +- } +- if (!ptr->next) { +- DUMP_LIST(); +- PDEBUG("alloc failed\n"); +- return 0; /* end of list */ +- } +- newptr = kmalloc(sizeof(struct allocator_struct),prio); +- if (!newptr) +- return 0; +- +- /* ok, now stick it after ptr */ +- newptr->address = ptr->address + ptr->size; +- newptr->size = bytes; +- newptr->next = ptr->next; +- ptr->next = newptr; +- +- DUMP_LIST(); +- PDEBUG("returning 0x%08lx\n",newptr->address); +- return newptr->address; ++ /* check if high memory is available */ ++ if (!allocator_buffer) ++ return 0; ++ ++ /* Round it to a multiple of the pagesize */ ++ bytes = PAGE_ALIGN(bytes); ++ PDEBUG("request for %li bytes\n", bytes); ++ ++ while (ptr && ptr->next) { ++ if (ptr->next->address - (ptr->address + ptr->size) >= bytes) ++ break; /* enough space */ ++ ptr = ptr->next; ++ } ++ if (!ptr->next) { ++ DUMP_LIST(); ++ PDEBUG("alloc failed\n"); ++ return 0; /* end of list */ ++ } ++ newptr = kmalloc(sizeof(struct allocator_struct), prio); ++ if (!newptr) ++ return 0; ++ ++ /* ok, now stick it after ptr */ ++ newptr->address = ptr->address + ptr->size; ++ newptr->size = bytes; ++ newptr->next = ptr->next; ++ ptr->next = newptr; ++ ++ DUMP_LIST(); ++ PDEBUG("returning 0x%08lx\n", newptr->address); ++ return newptr->address; + } + +-int allocator_free_dma (unsigned long address) ++int allocator_free_dma(unsigned long address) + { +- struct allocator_struct *ptr = allocator_list, *prev; ++ struct allocator_struct *ptr = allocator_list, *prev; + +- while (ptr && ptr->next) { +- if (ptr->next->address == address) +- break; +- ptr = ptr->next; ++ while (ptr && ptr->next) { ++ if (ptr->next->address == address) ++ break; ++ ptr = ptr->next; + } +- /* the one being freed is ptr->next */ +- prev = ptr; ptr = ptr->next; ++ /* the one being freed is ptr->next */ ++ prev = ptr; ptr = ptr->next; + +- if (!ptr) { +- printk(KERN_ERR ALL_MSG "free_dma(0x%08lx) but add. not allocated\n", +- ptr->address); +- return -EINVAL; +- } +- PDEBUGG("freeing: %08lx (%li) next %08lx\n",ptr->address,ptr->size, +- ptr->next->address); +- prev->next = ptr->next; +- kfree(ptr); ++ if (!ptr) { ++ printk(KERN_ERR ALL_MSG ++ "free_dma(0x%08lx) but add. not allocated\n", ++ ptr->address); ++ return -EINVAL; ++ } ++ PDEBUGG("freeing: %08lx (%li) next %08lx\n", ptr->address, ptr->size, ++ ptr->next->address); ++ prev->next = ptr->next; ++ kfree(ptr); + +- /* dump_list(); */ +- return 0; ++ /* dump_list(); */ ++ return 0; + } + + /* ======================================================================== +@@ -198,99 +198,99 @@ int allocator_free_dma (unsigned long ad + */ + int allocator_init(u_long *allocator_max) + { +- /* check how much free memory is there */ ++ /* check how much free memory is there */ ++ void *remapped; ++ unsigned long max; ++ unsigned long trial_size = allocator_himem<<20; ++ unsigned long last_trial = 0; ++ unsigned long step = allocator_step<<20; ++ unsigned long i = 0; ++ struct allocator_struct *head, *tail; ++ char test_string[] = "0123456789abcde"; /* 16 bytes */ ++ ++ PDEBUGG("himem = %i\n", allocator_himem); ++ if (allocator_himem < 0) /* don't even try */ ++ return -EINVAL; ++ ++ if (!trial_size) ++ trial_size = 1<<20; /* not specified: try one meg */ ++ ++ while (1) { ++ remapped = ioremap(__pa(high_memory), trial_size); ++ if (!remapped) { ++ PDEBUGG("%li megs failed!\n", trial_size>>20); ++ break; ++ } ++ PDEBUGG("Trying %li megs (at %p, %p)\n", trial_size>>20, ++ (void *)__pa(high_memory), remapped); ++ for (i = last_trial; i < trial_size; i += 16) { ++ strcpy((char *)(remapped)+i, test_string); ++ if (strcmp((char *)(remapped)+i, test_string)) ++ break; ++ } ++ iounmap((void *)remapped); ++ schedule(); ++ last_trial = trial_size; ++ if (i == trial_size) ++ trial_size += step; /* increment, if all went well */ ++ else { ++ PDEBUGG("%li megs copy test failed!\n", trial_size>>20); ++ break; ++ } ++ if (!allocator_probe) ++ break; ++ } ++ PDEBUG("%li megs (%li k, %li b)\n", i>>20, i>>10, i); ++ allocator_buffer_size = i>>10; /* kilobytes */ ++ allocator_buffer = __pa(high_memory); ++ if (!allocator_buffer_size) { ++ printk(KERN_WARNING ALL_MSG "no free high memory to use\n"); ++ return -ENOMEM; ++ } + +- volatile void *remapped; +- unsigned long max; +- unsigned long trial_size = allocator_himem<<20; +- unsigned long last_trial = 0; +- unsigned long step = allocator_step<<20; +- unsigned long i=0; +- struct allocator_struct *head, *tail; +- char test_string[]="0123456789abcde"; /* 16 bytes */ +- +- PDEBUGG("himem = %i\n",allocator_himem); +- if (allocator_himem < 0) /* don't even try */ +- return -EINVAL; +- +- if (!trial_size) trial_size = 1<<20; /* not specified: try one meg */ +- +- while (1) { +- remapped = ioremap(__pa(high_memory), trial_size); +- if (!remapped) +- { +- PDEBUGG("%li megs failed!\n",trial_size>>20); +- break; +- } +- PDEBUGG("Trying %li megs (at %p, %p)\n",trial_size>>20, +- (void *)__pa(high_memory), remapped); +- for (i=last_trial; i<trial_size; i+=16) { +- strcpy((char *)(remapped)+i, test_string); +- if (strcmp((char *)(remapped)+i, test_string)) +- break; +- } +- iounmap((void *)remapped); +- schedule(); +- last_trial = trial_size; +- if (i==trial_size) +- trial_size += step; /* increment, if all went well */ +- else +- { +- PDEBUGG("%li megs copy test failed!\n",trial_size>>20); +- break; +- } +- if (!allocator_probe) break; +- } +- PDEBUG("%li megs (%li k, %li b)\n",i>>20,i>>10,i); +- allocator_buffer_size = i>>10; /* kilobytes */ +- allocator_buffer = __pa(high_memory); +- if (!allocator_buffer_size) { +- printk(KERN_WARNING ALL_MSG "no free high memory to use\n"); +- return -ENOMEM; +- } +- +- /* +- * to simplify things, always have two cells in the list: +- * the first and the last. This avoids some conditionals and +- * extra code when allocating and deallocating: we only play +- * in the middle of the list +- */ +- head = kmalloc(sizeof(struct allocator_struct),GFP_KERNEL); +- if (!head) +- return -ENOMEM; +- tail = kmalloc(sizeof(struct allocator_struct),GFP_KERNEL); +- if (!tail) { +- kfree(head); +- return -ENOMEM; +- } +- +- max = allocator_buffer_size<<10; +- +- head->size = tail->size = 0; +- head->address = allocator_buffer; +- tail->address = allocator_buffer + max; +- head->next = tail; +- tail->next = NULL; +- allocator_list = head; ++ /* ++ * to simplify things, always have two cells in the list: ++ * the first and the last. This avoids some conditionals and ++ * extra code when allocating and deallocating: we only play ++ * in the middle of the list ++ */ ++ head = kmalloc(sizeof(struct allocator_struct), GFP_KERNEL); ++ if (!head) ++ return -ENOMEM; ++ tail = kmalloc(sizeof(struct allocator_struct), GFP_KERNEL); ++ if (!tail) { ++ kfree(head); ++ return -ENOMEM; ++ } ++ ++ max = allocator_buffer_size<<10; ++ ++ head->size = tail->size = 0; ++ head->address = allocator_buffer; ++ tail->address = allocator_buffer + max; ++ head->next = tail; ++ tail->next = NULL; ++ allocator_list = head; + +- *allocator_max = allocator_buffer_size; /* Back to the user code, in KB */ ++ /* Back to the user code, in KB */ ++ *allocator_max = allocator_buffer_size; + +- return 0; /* ok, ready */ ++ return 0; /* ok, ready */ + } + + void allocator_cleanup(void) + { +- struct allocator_struct *ptr, *next; ++ struct allocator_struct *ptr, *next; ++ ++ for (ptr = allocator_list; ptr; ptr = next) { ++ next = ptr->next; ++ PDEBUG("freeing list: 0x%08lx\n", ptr->address); ++ kfree(ptr); ++ } + +- for (ptr = allocator_list; ptr; ptr = next) { +- next = ptr->next; +- PDEBUG("freeing list: 0x%08lx\n",ptr->address); +- kfree(ptr); +- } +- +- allocator_buffer = 0; +- allocator_buffer_size = 0; +- allocator_list = NULL; ++ allocator_buffer = 0; ++ allocator_buffer_size = 0; ++ allocator_list = NULL; + } + + +--- a/drivers/staging/dt3155/allocator.h ++++ b/drivers/staging/dt3155/allocator.h +@@ -23,6 +23,6 @@ + */ + + void allocator_free_dma(unsigned long address); +-unsigned long allocator_allocate_dma (unsigned long kilobytes, int priority); ++unsigned long allocator_allocate_dma(unsigned long kilobytes, int priority); + int allocator_init(u_long *); + void allocator_cleanup(void); diff --git a/staging/staging-dt3155-coding-style-cleanups-for-the-.h-files.patch b/staging/staging-dt3155-coding-style-cleanups-for-the-.h-files.patch new file mode 100644 index 00000000000000..6154e886c636f6 --- /dev/null +++ b/staging/staging-dt3155-coding-style-cleanups-for-the-.h-files.patch @@ -0,0 +1,434 @@ +From foo@baz Tue Dec 22 15:19:21 PST 2009 +Date: Tue, 22 Dec 2009 15:19:21 -0800 +To: Greg KH <greg@kroah.com> +From: Greg Kroah-Hartman <gregkh@suse.de> +Subject: Staging: dt3155: coding style cleanups for the .h files + +This cleans up some of the coding style issues in the .h files. + +More remains to be done. + +Cc: Scott Smedley <ss@aao.gov.au> +Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de> +--- + drivers/staging/dt3155/dt3155.h | 152 +++++++++++++++++------------------- + drivers/staging/dt3155/dt3155_drv.h | 6 - + drivers/staging/dt3155/dt3155_io.h | 73 ++++++++--------- + drivers/staging/dt3155/dt3155_isr.h | 20 ++-- + 4 files changed, 122 insertions(+), 129 deletions(-) + +--- a/drivers/staging/dt3155/dt3155_drv.h ++++ b/drivers/staging/dt3155/dt3155_drv.h +@@ -1,7 +1,7 @@ + /* + + Copyright 1996,2002 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan, +- Scott Smedley ++ Scott Smedley + + This file is part of the DT3155 Device Driver. + +@@ -25,7 +25,7 @@ MA 02111-1307 USA + #define DT3155_DRV_INC + + /* kernel logical address of the frame grabbers */ +-extern u_char *dt3155_lbase[ MAXBOARDS ]; ++extern u_char *dt3155_lbase[MAXBOARDS]; + + /* kernel logical address of ram buffer */ + extern u_char *dt3155_bbase; +@@ -35,7 +35,7 @@ extern u_char *dt3155_bbase; + + #include <linux/version.h> /* need access to LINUX_VERSION_CODE */ + /* wait queue for reads */ +-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1) ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 1) + extern wait_queue_head_t dt3155_read_wait_queue[MAXBOARDS]; + #else + extern struct wait_queue *dt3155_read_wait_queue[MAXBOARDS]; +--- a/drivers/staging/dt3155/dt3155.h ++++ b/drivers/staging/dt3155/dt3155.h +@@ -1,7 +1,7 @@ + /* + + Copyright 1996,2002,2005 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan, +- Jason Lapenta, Scott Smedley ++ Jason Lapenta, Scott Smedley + + This file is part of the DT3155 Device Driver. + +@@ -20,8 +20,6 @@ along with the DT3155 Device Driver; if + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + MA 02111-1307 USA + +- $Id: dt3155.h,v 1.11 2005/08/09 06:08:51 ssmedley Exp $ +- + -- Changes -- + + Date Programmer Description of changes made +@@ -56,120 +54,118 @@ MA 02111-1307 USA + /* Can be 1 or 2 */ + #define MAXBOARDS 1 + +-#define BOARD_MAX_BUFFS 3 +-#define MAXBUFFERS BOARD_MAX_BUFFS*MAXBOARDS ++#define BOARD_MAX_BUFFS 3 ++#define MAXBUFFERS (BOARD_MAX_BUFFS*MAXBOARDS) + +-#define PCI_PAGE_SIZE (1 << 12) ++#define PCI_PAGE_SIZE (1 << 12) + + #ifdef CCIR +-#define DT3155_MAX_ROWS 576 +-#define DT3155_MAX_COLS 768 +-#define FORMAT50HZ TRUE ++#define DT3155_MAX_ROWS 576 ++#define DT3155_MAX_COLS 768 ++#define FORMAT50HZ TRUE + #else +-#define DT3155_MAX_ROWS 480 +-#define DT3155_MAX_COLS 640 +-#define FORMAT50HZ FALSE ++#define DT3155_MAX_ROWS 480 ++#define DT3155_MAX_COLS 640 ++#define FORMAT50HZ FALSE + #endif + + /* Configuration structure */ + struct dt3155_config_s { +- u_int acq_mode; +- u_int cols, rows; +- u_int continuous; ++ u_int acq_mode; ++ u_int cols, rows; ++ u_int continuous; + }; + + + /* hold data for each frame */ +-typedef struct +-{ +- u_long addr; /* address of the buffer with the frame */ +- u_long tag; /* unique number for the frame */ +- struct timeval time; /* time that capture took place */ ++typedef struct { ++ u_long addr; /* address of the buffer with the frame */ ++ u_long tag; /* unique number for the frame */ ++ struct timeval time; /* time that capture took place */ + } frame_info_t; + +-/* Structure for interrupt and buffer handling. */ +-/* This is the setup for 1 card */ ++/* ++ * Structure for interrupt and buffer handling. ++ * This is the setup for 1 card ++ */ + struct dt3155_fbuffer_s { +- int nbuffers; +- +- frame_info_t frame_info[ BOARD_MAX_BUFFS ]; ++ int nbuffers; + +- int empty_buffers[ BOARD_MAX_BUFFS ]; /* indexes empty frames */ +- int empty_len; /* Number of empty buffers */ +- /* Zero means empty */ ++ frame_info_t frame_info[BOARD_MAX_BUFFS]; + +- int active_buf; /* Where data is currently dma'ing */ +- int locked_buf; /* Buffers used by user */ ++ int empty_buffers[BOARD_MAX_BUFFS]; /* indexes empty frames */ ++ int empty_len; /* Number of empty buffers */ ++ /* Zero means empty */ + +- int ready_que[ BOARD_MAX_BUFFS ]; +- u_long ready_head; /* The most recent buffer located here */ +- u_long ready_len; /* The number of ready buffers */ ++ int active_buf; /* Where data is currently dma'ing */ ++ int locked_buf; /* Buffers used by user */ + +- int even_happened; +- int even_stopped; ++ int ready_que[BOARD_MAX_BUFFS]; ++ u_long ready_head; /* The most recent buffer located here */ ++ u_long ready_len; /* The number of ready buffers */ + +- int stop_acquire; /* Flag to stop interrupts */ +- u_long frame_count; /* Counter for frames acquired by this card */ ++ int even_happened; ++ int even_stopped; + ++ int stop_acquire; /* Flag to stop interrupts */ ++ u_long frame_count; /* Counter for frames acquired by this card */ + }; + + + +-#define DT3155_MODE_FRAME 1 +-#define DT3155_MODE_FIELD 2 ++#define DT3155_MODE_FRAME 1 ++#define DT3155_MODE_FIELD 2 + +-#define DT3155_SNAP 1 +-#define DT3155_ACQ 2 ++#define DT3155_SNAP 1 ++#define DT3155_ACQ 2 + + /* There is one status structure for each card. */ +-typedef struct dt3155_status_s +-{ +- int fixed_mode; /* if 1, we are in fixed frame mode */ +- u_long reg_addr; /* Register address for a single card */ +- u_long mem_addr; /* Buffer start addr for this card */ +- u_long mem_size; /* This is the amount of mem available */ +- u_int irq; /* this card's irq */ +- struct dt3155_config_s config; /* configuration struct */ +- struct dt3155_fbuffer_s fbuffer;/* frame buffer state struct */ +- u_long state; /* this card's state */ +- u_int device_installed; /* Flag if installed. 1=installed */ ++typedef struct dt3155_status_s { ++ int fixed_mode; /* if 1, we are in fixed frame mode */ ++ u_long reg_addr; /* Register address for a single card */ ++ u_long mem_addr; /* Buffer start addr for this card */ ++ u_long mem_size; /* This is the amount of mem available */ ++ u_int irq; /* this card's irq */ ++ struct dt3155_config_s config; /* configuration struct */ ++ struct dt3155_fbuffer_s fbuffer; /* frame buffer state struct */ ++ u_long state; /* this card's state */ ++ u_int device_installed; /* Flag if installed. 1=installed */ + } dt3155_status_t; + + /* Reference to global status structure */ + extern struct dt3155_status_s dt3155_status[MAXBOARDS]; + +-#define DT3155_STATE_IDLE 0x00 +-#define DT3155_STATE_FRAME 0x01 +-#define DT3155_STATE_FLD 0x02 +-#define DT3155_STATE_STOP 0x100 +-#define DT3155_STATE_ERROR 0x200 +-#define DT3155_STATE_MODE 0x0ff +- +-#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_STOP _IO( DT3155_IOC_MAGIC, 3 ) +-#define DT3155_START _IO( DT3155_IOC_MAGIC, 4 ) +-#define DT3155_FLUSH _IO( DT3155_IOC_MAGIC, 5 ) +-#define DT3155_IOC_MAXNR 5 ++#define DT3155_STATE_IDLE 0x00 ++#define DT3155_STATE_FRAME 0x01 ++#define DT3155_STATE_FLD 0x02 ++#define DT3155_STATE_STOP 0x100 ++#define DT3155_STATE_ERROR 0x200 ++#define DT3155_STATE_MODE 0x0ff ++ ++#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_STOP _IO(DT3155_IOC_MAGIC, 3) ++#define DT3155_START _IO(DT3155_IOC_MAGIC, 4) ++#define DT3155_FLUSH _IO(DT3155_IOC_MAGIC, 5) ++#define DT3155_IOC_MAXNR 5 + + /* Error codes */ + +-#define DT_ERR_NO_BUFFERS 0x10000 /* not used but it might be one day - SS */ +-#define DT_ERR_CORRUPT 0x20000 +-#define DT_ERR_OVERRUN 0x30000 +-#define DT_ERR_I2C_TIMEOUT 0x40000 +-#define DT_ERR_MASK 0xff0000/* not used but it might be one day - SS */ ++#define DT_ERR_NO_BUFFERS 0x10000 /* not used but it might be one day */ ++#define DT_ERR_CORRUPT 0x20000 ++#define DT_ERR_OVERRUN 0x30000 ++#define DT_ERR_I2C_TIMEOUT 0x40000 ++#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 +-{ +- u_long offset; +- u_long frame_seq; +- u_long state; ++typedef struct dt3155_read_s { ++ u_long offset; ++ u_long frame_seq; ++ u_long state; + +- frame_info_t frame_info; ++ frame_info_t frame_info; + } dt3155_read_t; + + #endif /* _DT3155_inc */ +--- a/drivers/staging/dt3155/dt3155_io.h ++++ b/drivers/staging/dt3155/dt3155_io.h +@@ -1,7 +1,7 @@ + /* + + Copyright 1996,2002 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan, +- Jason Lapenta, Scott Smedley ++ Jason Lapenta, Scott Smedley + + This file is part of the DT3155 Device Driver. + +@@ -36,8 +36,8 @@ MA 02111-1307 USA + + /* macros to access registers */ + +-#define WriteMReg(Address, Data) * ((u_long *) (Address)) = Data +-#define ReadMReg(Address, Data) Data = * ((u_long *) (Address)) ++#define WriteMReg(Address, Data) (*((u_long *)(Address)) = Data) ++#define ReadMReg(Address, Data) (Data = *((u_long *)(Address))) + + /***************** 32 bit register globals **************/ + +@@ -240,12 +240,11 @@ typedef union iic_csr2_tag { + * dma_upper_lmt_tag + */ + typedef union dma_upper_lmt_tag { +- u_long reg; +- struct +- { +- u_long DMA_UPPER_LMT_VAL : 24; +- u_long : 8; +- } fld; ++ u_long reg; ++ struct { ++ u_long DMA_UPPER_LMT_VAL:24; ++ u_long :8; ++ } fld; + } DMA_UPPER_LMT_R; + + +@@ -253,12 +252,12 @@ typedef union dma_upper_lmt_tag { + * Global declarations of local copies + * of boards' 32 bit registers + ***************************************/ +-extern u_long even_dma_start_r; /* bit 0 should always be 0 */ +-extern u_long odd_dma_start_r; /* .. */ +-extern u_long even_dma_stride_r; /* bits 0&1 should always be 0 */ +-extern u_long odd_dma_stride_r; /* .. */ +-extern u_long even_pixel_fmt_r; +-extern u_long odd_pixel_fmt_r; ++extern u_long even_dma_start_r; /* bit 0 should always be 0 */ ++extern u_long odd_dma_start_r; /* .. */ ++extern u_long even_dma_stride_r; /* bits 0&1 should always be 0 */ ++extern u_long odd_dma_stride_r; /* .. */ ++extern u_long even_pixel_fmt_r; ++extern u_long odd_pixel_fmt_r; + + extern FIFO_TRIGGER_R fifo_trigger_r; + extern XFER_MODE_R xfer_mode_r; +@@ -266,8 +265,8 @@ extern CSR1_R csr1_r; + extern RETRY_WAIT_CNT_R retry_wait_cnt_r; + extern INT_CSR_R int_csr_r; + +-extern u_long even_fld_mask_r; +-extern u_long odd_fld_mask_r; ++extern u_long even_fld_mask_r; ++extern u_long odd_fld_mask_r; + + extern MASK_LENGTH_R mask_length_r; + extern FIFO_FLAG_CNT_R fifo_flag_cnt_r; +@@ -301,28 +300,26 @@ extern DMA_UPPER_LMT_R odd_dma_upper + /******** Assignments and Typedefs for 8 bit I2C Registers********************/ + + typedef union i2c_csr2_tag { +- u_char reg; +- struct +- { +- u_char CHROM_FIL : 1; +- u_char SYNC_SNTL : 1; +- u_char HZ50 : 1; +- u_char SYNC_PRESENT : 1; +- u_char BUSY_EVE : 1; +- u_char BUSY_ODD : 1; +- u_char DISP_PASS : 1; +- } fld; ++ u_char reg; ++ struct { ++ u_char CHROM_FIL:1; ++ u_char SYNC_SNTL:1; ++ u_char HZ50:1; ++ u_char SYNC_PRESENT:1; ++ u_char BUSY_EVE:1; ++ u_char BUSY_ODD:1; ++ u_char DISP_PASS:1; ++ } fld; + } I2C_CSR2; + + typedef union i2c_even_csr_tag { +- u_char reg; +- struct +- { +- u_char DONE_EVE : 1; +- u_char SNGL_EVE : 1; +- u_char ERROR_EVE : 1; +- u_char : 5; +- } fld; ++ u_char reg; ++ struct { ++ u_char DONE_EVE:1; ++ u_char SNGL_EVE:1; ++ u_char ERROR_EVE:1; ++ u_char :5; ++ } fld; + } I2C_EVEN_CSR; + + typedef union i2c_odd_csr_tag { +@@ -394,7 +391,7 @@ extern u_char i2c_pm_lut + + /* access 8-bit IIC registers */ + +-extern int ReadI2C (u_char * lpReg, u_short wIregIndex, u_char * byVal); +-extern int WriteI2C (u_char * lpReg, u_short wIregIndex, u_char byVal); ++extern int ReadI2C(u_char *lpReg, u_short wIregIndex, u_char *byVal); ++extern int WriteI2C(u_char *lpReg, u_short wIregIndex, u_char byVal); + + #endif +--- a/drivers/staging/dt3155/dt3155_isr.h ++++ b/drivers/staging/dt3155/dt3155_isr.h +@@ -1,7 +1,7 @@ + /* + + Copyright 1996,2002 Gregory D. Hager, Alfred A. Rizzi, Noah J. Cowan, +- Jason Lapenta, Scott Smedley ++ Jason Lapenta, Scott Smedley + + This file is part of the DT3155 Device Driver. + +@@ -33,8 +33,8 @@ MA 02111-1307 USA + + */ + +-#ifndef DT3155_ISR_H +-#define DT3155_ISR_H ++#ifndef DT3155_ISR_H ++#define DT3155_ISR_H + + extern struct dt3155_fbuffer_s *dt3155_fbuffer[MAXBOARDS]; + +@@ -62,16 +62,16 @@ int dt3155_flush(int minor); + * Simple array based que struct + **********************************/ + +-bool are_empty_buffers( int minor ); +-void push_empty( int index, int minor ); ++bool are_empty_buffers(int minor); ++void push_empty(int index, int minor); + +-int pop_empty( int minor ); ++int pop_empty(int minor); + +-bool is_ready_buf_empty( int minor ); +-bool is_ready_buf_full( int minor ); ++bool is_ready_buf_empty(int minor); ++bool is_ready_buf_full(int minor); + +-void push_ready( int minor, int index ); +-int pop_ready( int minor ); ++void push_ready(int minor, int index); ++int pop_ready(int minor); + + + #endif |
