Skip to contentSkip to conversation

staging: dt3155: revert u_long to u64 usage

PATCH New H Hartley Sweeten 1 participant 1 message Feb 27, 2010 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: dt3155: revert u_long to u64 usage

Commit 9c1390a923ddb6fba1cf9d7440743369140c6d8a replaced all u_int's with u32 and u_long's with u64. Unfortunately, a u_long is still only 32-bits so they should have been replaced with u32 also.

This can be verified by the register definitions in dt3155_io.h. It specifically states that the memory mapped registers are 32-bit.

Fix this by changing all the u64 to u32.

Cc Greg Kroah-Hartman <[email protected]>
Cc Scott Smedley <[email protected]>

---

drivers/staging/dt3155/allocator.c +1 -1
index 114e2a8..c74234c 100644
@@ -195,7 +195,7 @@ int allocator_free_dma(unsigned long address)
  * On cleanup everything is released. If the list is not empty, that a
  * problem of our clients
  */
-int allocator_init(u64 *allocator_max)
+int allocator_init(u32 *allocator_max)
 {
 	/* check how much free memory is there */
 	void *remapped;
drivers/staging/dt3155/allocator.h +1 -1
index 4cd81bd..bdf3268 100644
@@ -24,5 +24,5 @@
 
 void allocator_free_dma(unsigned long address);
 unsigned long allocator_allocate_dma(unsigned long kilobytes, int priority);
-int allocator_init(u64 *);
+int allocator_init(u32 *);
 void allocator_cleanup(void);
drivers/staging/dt3155/dt3155.h +12 -12
index 22292b1..1bf7863 100644
@@ -79,8 +79,8 @@ struct dt3155_config_s {
 
 /* hold data for each frame */
 typedef struct {
-	u64 addr;		/* address of the buffer with the frame */
-	u64 tag;		/* unique number for the frame */
+	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;
 
@@ -101,14 +101,14 @@ struct dt3155_fbuffer_s {
 	int locked_buf;			/* Buffers used by user */
 
 	int ready_que[BOARD_MAX_BUFFS];
-	u64 ready_head;	/* The most recent buffer located here */
-	u64 ready_len;	/* The number of ready buffers */
+	u32 ready_head;	/* The most recent buffer located here */
+	u32 ready_len;	/* The number of ready buffers */
 
 	int even_happened;
 	int even_stopped;
 
 	int stop_acquire;	/* Flag to stop interrupts */
-	u64 frame_count;	/* Counter for frames acquired by this card */
+	u32 frame_count;	/* Counter for frames acquired by this card */
 };
 
 
@@ -122,13 +122,13 @@ struct dt3155_fbuffer_s {
 /* There is one status structure for each card. */
 typedef struct dt3155_status_s {
 	int fixed_mode;		/* if 1, we are in fixed frame mode */
-	u64 reg_addr;	/* Register address for a single card */
-	u64 mem_addr;	/* Buffer start addr for this card */
-	u64 mem_size;	/* This is the amount of mem available  */
+	u32 reg_addr;	/* Register address for a single card */
+	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_fbuffer_s fbuffer;	/* frame buffer state struct */
-	u64 state;		/* this card's state */
+	u32 state;		/* this card's state */
 	u32 device_installed;	/* Flag if installed. 1=installed */
 } dt3155_status_t;
 
@@ -161,9 +161,9 @@ extern struct dt3155_status_s dt3155_status[MAXBOARDS];
 
 /* User code will probably want to declare one of these for each card */
 typedef struct dt3155_read_s {
-	u64 offset;
-	u64 frame_seq;
-	u64 state;
+	u32 offset;
+	u32 frame_seq;
+	u32 state;
 
 	frame_info_t frame_info;
 } dt3155_read_t;
drivers/staging/dt3155/dt3155_drv.c +14 -14
index 930a3e6..a67c622 100644
@@ -137,7 +137,7 @@ u32  dt3155_dev_open[ MAXBOARDS ] = {0
 };
 
 u32  ndevices = 0;
-u64 unique_tag = 0;;
+u32 unique_tag = 0;;
 
 
 /*
@@ -180,7 +180,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
   int    minor = -1;
   int    index;
   unsigned long flags;
-  u64 buffer_addr;
+  u32 buffer_addr;
 
   /* find out who issued the interrupt */
   for ( index = 0; index < ndevices; index++ ) {
@@ -249,7 +249,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
 	{
 	  /* GCS (Aug 2, 2002) -- In field mode, dma the odd field
 	     into the lower half of the buffer */
-	  const u64 stride =  dt3155_status[ minor ].config.cols;
+	  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;
@@ -312,7 +312,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
 	      dt3155_fbuffer[ minor ]->even_stopped = 0;
 
 	      printk(KERN_DEBUG "dt3155:  state is now %x\n",
-		     (u32)dt3155_status[minor].state);
+		     dt3155_status[minor].state);
 	    }
 	  else
 	    {
@@ -428,7 +428,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
  *****************************************************/
 static void dt3155_init_isr(int minor)
 {
-  const u64 stride =  dt3155_status[ minor ].config.cols;
+  const u32 stride =  dt3155_status[ minor ].config.cols;
 
   switch (dt3155_status[ minor ].state & DT3155_STATE_MODE)
     {
@@ -706,7 +706,7 @@ static int dt3155_open( struct inode* inode, struct file* filep)
 
   if (dt3155_status[ minor ].state != DT3155_STATE_IDLE) {
     printk ("DT3155:  Not in idle state (state = %x)\n",
-	    (u32)dt3155_status[ minor ].state);
+	    dt3155_status[ minor ].state);
     return -EBUSY;
   }
 
@@ -762,7 +762,7 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf,
 {
   /* which device are we reading from? */
   int		minor = MINOR(filep->f_dentry->d_inode->i_rdev);
-  u64		offset;
+  u32		offset;
   int		frame_index;
   frame_info_t	*frame_info_p;
 
@@ -820,11 +820,11 @@ static ssize_t dt3155_read(struct file *filep, char __user *buf,
   offset = frame_info_p->addr - dt3155_status[minor].mem_addr;
 
   put_user(offset, (unsigned int *) buf);
-  buf += sizeof(u64);
+  buf += sizeof(u32);
   put_user( dt3155_status[minor].fbuffer.frame_count, (unsigned int *) buf);
-  buf += sizeof(u64);
+  buf += sizeof(u32);
   put_user(dt3155_status[minor].state, (unsigned int *) buf);
-  buf += sizeof(u64);
+  buf += sizeof(u32);
   if (copy_to_user(buf, frame_info_p, sizeof(frame_info_t)))
       return -EFAULT;
 
@@ -931,7 +931,7 @@ static int find_PCI (void)
       dt3155_status[ pci_index-1 ].device_installed = 1;
       printk("DT3155: Installing device %d w/irq %d and address %p\n",
 	     pci_index,
-	     (u32)dt3155_status[pci_index-1].irq,
+	     dt3155_status[pci_index-1].irq,
 	     dt3155_lbase[pci_index-1]);
 
     }
@@ -944,7 +944,7 @@ err:
   return DT_3155_FAILURE;
 }
 
-u64 allocatorAddr = 0;
+u32 allocatorAddr = 0;
 
 /*****************************************************
  * init_module()
@@ -1024,9 +1024,9 @@ int init_module(void)
 	     dt3155_status[ index ].config.rows);
       printk("DT3155: m_addr = 0x%x; m_size = %ld; "
 	     "state = %d; device_installed = %d\n",
-	     (u32)dt3155_status[ index ].mem_addr,
+	     dt3155_status[ index ].mem_addr,
 	     (long int)dt3155_status[ index ].mem_size,
-	     (u32)dt3155_status[ index ].state,
+	     dt3155_status[ index ].state,
 	     dt3155_status[ index ].device_installed);
     }
 
drivers/staging/dt3155/dt3155_io.c +8 -8
index 1c15604..6b9c685 100644
@@ -27,12 +27,12 @@
 
 
 /****** local copies of board's 32 bit registers ******/
-u64 even_dma_start_r;	/*  bit 0 should always be 0 */
-u64 odd_dma_start_r;	/*               .. */
-u64 even_dma_stride_r;	/*  bits 0&1 should always be 0 */
-u64 odd_dma_stride_r;	/*               .. */
-u64 even_pixel_fmt_r;
-u64 odd_pixel_fmt_r;
+u32 even_dma_start_r;	/*  bit 0 should always be 0 */
+u32 odd_dma_start_r;	/*               .. */
+u32 even_dma_stride_r;	/*  bits 0&1 should always be 0 */
+u32 odd_dma_stride_r;	/*               .. */
+u32 even_pixel_fmt_r;
+u32 odd_pixel_fmt_r;
 
 FIFO_TRIGGER_R		fifo_trigger_r;
 XFER_MODE_R		xfer_mode_r;
@@ -40,8 +40,8 @@ CSR1_R			csr1_r;
 RETRY_WAIT_CNT_R	retry_wait_cnt_r;
 INT_CSR_R		int_csr_r;
 
-u64 even_fld_mask_r;
-u64 odd_fld_mask_r;
+u32 even_fld_mask_r;
+u32 odd_fld_mask_r;
 
 MASK_LENGTH_R		mask_length_r;
 FIFO_FLAG_CNT_R		fifo_flag_cnt_r;
drivers/staging/dt3155/dt3155_io.h +87 -87

253 lines not on this page · raw message

drivers/staging/dt3155/dt3155_isr.c +27 -27

106 lines not on this page · raw message

drivers/staging/dt3155/dt3155_isr.h +1 -1
index 7f27910..7595cb1 100644
@@ -42,7 +42,7 @@ extern struct dt3155_fbuffer_s *dt3155_fbuffer[MAXBOARDS];
 /* Initialize the buffering system.  This should */
 /* be called prior to enabling interrupts */
 
-u64 dt3155_setup_buffers(u64 *allocatorAddr);
+u32 dt3155_setup_buffers(u32 *allocatorAddr);
 
 /* Get the next frame of data if it is ready.  Returns */
 /* zero if no data is ready.  If there is data but */