Skip to content

Commit

Permalink
Staging: dt3155: remove compat code
Browse files Browse the repository at this point in the history
Remove compatibility code as this is not an older version of the kernel.

Signed-off-by: Simon Horman <horms@verge.net.au>
Cc: Scott Smedley <ss@aao.gov.au>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Simon Horman authored and Greg Kroah-Hartman committed Mar 4, 2010
1 parent cf137d5 commit 2141ec6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1,073 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/dt3155/allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/mm.h> /* PAGE_ALIGN() */
#include <linux/io.h>

#include <asm/page.h>

#include "sysdep.h"

/*#define ALL_DEBUG*/
#define ALL_MSG "allocator: "

Expand Down
115 changes: 1 addition & 114 deletions drivers/staging/dt3155/dt3155_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,10 @@ extern void printques(int);

#ifdef MODULE
#include <linux/module.h>
#include <linux/version.h>
#include <linux/interrupt.h>


#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,10)
MODULE_LICENSE("GPL");
#endif

#endif

Expand Down Expand Up @@ -105,11 +102,7 @@ int dt3155_errno = 0;
#endif

/* wait queue for interrupts */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
wait_queue_head_t dt3155_read_wait_queue[ MAXBOARDS ];
#else
struct wait_queue *dt3155_read_wait_queue[ MAXBOARDS ];
#endif

#define DT_3155_SUCCESS 0
#define DT_3155_FAILURE -EIO
Expand Down Expand Up @@ -186,11 +179,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
{
int minor = -1;
int index;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
unsigned long flags;
#else
int flags;
#endif
u_long buffer_addr;

/* find out who issued the interrupt */
Expand Down Expand Up @@ -264,21 +253,12 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
buffer_addr = dt3155_fbuffer[ minor ]->
frame_info[ dt3155_fbuffer[ minor ]->active_buf ].addr
+ (DT3155_MAX_ROWS / 2) * stride;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_save_flags(flags);
local_irq_disable();
#else
save_flags( flags );
cli();
#endif
wake_up_interruptible( &dt3155_read_wait_queue[ minor ] );

/* Set up the DMA address for the next field */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_irq_restore(flags);
#else
restore_flags( flags );
#endif
WriteMReg((dt3155_lbase[ minor ] + ODD_DMA_START), buffer_addr);
}

Expand Down Expand Up @@ -350,13 +330,8 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )
DT3155_STATE_FLD )
{

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_save_flags(flags);
local_irq_disable();
#else
save_flags( flags );
cli();
#endif

#ifdef DEBUG_QUES_B
printques( minor );
Expand Down Expand Up @@ -412,11 +387,7 @@ static inline void dt3155_isr( int irq, void *dev_id, struct pt_regs *regs )

wake_up_interruptible( &dt3155_read_wait_queue[ minor ] );

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_irq_restore(flags);
#else
restore_flags( flags );
#endif
}


Expand Down Expand Up @@ -675,11 +646,6 @@ static int dt3155_mmap (struct file * file, struct vm_area_struct * vma)
/* which device are we mmapping? */
int minor = MINOR(file->f_dentry->d_inode->i_rdev);
unsigned long offset;

/* not actually sure when vm_area_struct changed,
but it was in 2.3 sometime */
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,20)

offset = vma->vm_pgoff << PAGE_SHIFT;

if (offset >= __pa(high_memory) || (file->f_flags & O_SYNC))
Expand All @@ -688,34 +654,17 @@ static int dt3155_mmap (struct file * file, struct vm_area_struct * vma)
/* Don't try to swap out physical pages.. */
vma->vm_flags |= VM_RESERVED;

#else

if (vma->vm_offset & ~PAGE_MASK)
return -ENXIO;

offset = vma->vm_offset;

#endif

/* they are mapping the registers or the buffer */
if ((offset == dt3155_status[minor].reg_addr &&
vma->vm_end - vma->vm_start == PCI_PAGE_SIZE) ||
(offset == dt3155_status[minor].mem_addr &&
vma->vm_end - vma->vm_start == dt3155_status[minor].mem_size))
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
if (remap_pfn_range(vma,
vma->vm_start,
offset >> PAGE_SHIFT,
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
#else
if (remap_page_range(vma->vm_start,
offset,
vma->vm_end - vma->vm_start,
vma->vm_page_prot))
#endif
{
vma->vm_page_prot)) {
printk("DT3155: remap_page_range() failed.\n");
return -EAGAIN;
}
Expand Down Expand Up @@ -761,21 +710,14 @@ static int dt3155_open( struct inode* inode, struct file* filep)
printk("DT3155: Device opened.\n");

dt3155_dev_open[ minor ] = 1 ;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
MOD_INC_USE_COUNT;
#endif

dt3155_flush( minor );

/* Disable ALL interrupts */
int_csr_r.reg = 0;
WriteMReg( (dt3155_lbase[ minor ] + INT_CSR), int_csr_r.reg );

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)
init_waitqueue_head(&(dt3155_read_wait_queue[minor]));
#else
dt3155_read_wait_queue[minor] = NULL;
#endif

return 0;
}
Expand All @@ -798,9 +740,6 @@ static int dt3155_close( struct inode *inode, struct file *filep)
}
else
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
MOD_DEC_USE_COUNT;
#endif
dt3155_dev_open[ minor ] = 0;

if (dt3155_status[ minor ].state != DT3155_STATE_IDLE)
Expand Down Expand Up @@ -846,8 +785,6 @@ static int dt3155_read (
/* if (dt3155_status[minor].state == DT3155_STATE_IDLE)*/
/* return -EBUSY;*/

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,1)

/* non-blocking reads should return if no data */
if (filep->f_flags & O_NDELAY)
{
Expand Down Expand Up @@ -877,34 +814,6 @@ static int dt3155_read (
}
}

#else
while ((frame_index = dt3155_get_ready_buffer(minor)) < 0 )
{
int index;
if (filep->f_flags & O_NDELAY)
return 0;

/* sleep till data arrives , or we get interrupted */
interruptible_sleep_on(&dt3155_read_wait_queue[minor]);
for (index = 0; index < _NSIG_WORDS; index++)
{
/*
* Changing the next line of code below to this:
* if (current->pending.signal.sig[index] &
* ~current->blocked.sig[index])
* would also work on a 2.4 kernel, however, the above
* method is preferred & more portable.
*/
if (current->signal.sig[index] & ~current->blocked.sig[index])
{
printk ("DT3155: read: interrupted\n");
return -EINTR;
}
}
}

#endif

frame_info_p = &dt3155_status[minor].fbuffer.frame_info[frame_index];

/* make this an offset */
Expand Down Expand Up @@ -1046,12 +955,6 @@ int init_module(void)
int rcode = 0;
char *devname[ MAXBOARDS ];

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,1)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
SET_MODULE_OWNER(&dt3155_fops);
#endif
#endif

devname[ 0 ] = "dt3155a";
#if MAXBOARDS == 2
devname[ 1 ] = "dt3155b";
Expand Down Expand Up @@ -1091,17 +994,6 @@ int init_module(void)

/* Now let's find the hardware. find_PCI() will set ndevices to the
* number of cards found in this machine. */
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
if ( !(pcibios_present()) )
{
printk("DT3155: Error: No PCI bios on this machine \n");
if( unregister_chrdev( dt3155_major, "dt3155" ) != 0 )
printk("DT3155: cleanup_module failed\n");

return DT_3155_FAILURE;
}
else
#endif
{
if ( (rcode = find_PCI()) != DT_3155_SUCCESS )
{
Expand Down Expand Up @@ -1199,10 +1091,5 @@ void cleanup_module(void)
free_irq( dt3155_status[ index ].irq, (void*)&dt3155_status[index] );
}
}

#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
if (MOD_IN_USE)
printk("DT3155: device busy, remove delayed\n");
#endif
}

5 changes: 0 additions & 5 deletions drivers/staging/dt3155/dt3155_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ extern u_char *dt3155_bbase;
#ifdef __KERNEL__
#include <linux/wait.h>

#include <linux/version.h> /* need access to LINUX_VERSION_CODE */
/* wait queue for reads */
#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];
#endif
#endif

/* number of devices */
Expand Down
41 changes: 6 additions & 35 deletions drivers/staging/dt3155/dt3155_isr.c
Original file line number Diff line number Diff line change
Expand Up @@ -435,20 +435,11 @@ static inline void internal_release_locked_buffer( int m )
*****************************************************/
inline void dt3155_release_locked_buffer( int m )
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
unsigned long int flags;
local_save_flags(flags);
local_irq_disable();
internal_release_locked_buffer(m);
local_irq_restore(flags);
#else
int flags;

save_flags( flags );
cli();
internal_release_locked_buffer( m );
restore_flags( flags );
#endif
}


Expand All @@ -460,15 +451,9 @@ inline void dt3155_release_locked_buffer( int m )
inline int dt3155_flush( int m )
{
int index;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
unsigned long int flags;
local_save_flags(flags);
local_irq_disable();
#else
int flags;
save_flags( flags );
cli();
#endif
unsigned long int flags;
local_save_flags(flags);
local_irq_disable();

internal_release_locked_buffer( m );
dt3155_fbuffer[ m ]->empty_len = 0;
Expand All @@ -486,11 +471,7 @@ inline int dt3155_flush( int m )
dt3155_fbuffer[ m ]->ready_head = 0;
dt3155_fbuffer[ m ]->ready_len = 0;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_irq_restore(flags);
#else
restore_flags( flags );
#endif

return 0;
}
Expand All @@ -507,15 +488,9 @@ inline int dt3155_flush( int m )
inline int dt3155_get_ready_buffer( int m )
{
int frame_index;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
unsigned long int flags;
local_save_flags(flags);
local_irq_disable();
#else
int flags;
save_flags( flags );
cli();
#endif
unsigned long int flags;
local_save_flags(flags);
local_irq_disable();

#ifdef DEBUG_QUES_A
printques( m );
Expand All @@ -535,11 +510,7 @@ inline int dt3155_get_ready_buffer( int m )
printques( m );
#endif

#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
local_irq_restore(flags);
#else
restore_flags( flags );
#endif

return frame_index;
}
Loading

0 comments on commit 2141ec6

Please sign in to comment.