#ifndef __COMMON_H__
 
#define __COMMON_H__
 
 
 
//****************************************************************************
 
// Copyright (C) 2000-2006  ARW Elektronik Germany
 
//
 
//
 
// This program is free software; you can redistribute it and/or modify
 
// it under the terms of the GNU General Public License as published by
 
// the Free Software Foundation; either version 2 of the License, or
 
// (at your option) any later version.
 
//
 
// This program is distributed in the hope that it will be useful,
 
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
// GNU General Public License for more details.
 
//
 
// You should have received a copy of the GNU General Public License
 
// along with this program; if not, write to the Free Software
 
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
//
 
// This product is not authorized for use as critical component in 
 
// life support systems without the express written approval of 
 
// ARW Elektronik Germany.
 
//  
 
// Please announce changes and hints to ARW Elektronik
 
//
 
// Maintainer(s): Klaus Hitschler (klaus.hitschler@gmx.de)
 
//
 
//****************************************************************************
 
 
 
//****************************************************************************
 
//
 
// common.h - common definitions to include in all *.c files
 
//
 
// $Log: common.h,v $
 
// Revision 1.6  2006/06/04 12:26:07  klaus
 
// release_20060604; Version 6.9; pci_{en|dis}able_device() added; remap_page_range reorganized
 
//
 
// Revision 1.5  2004/08/12 19:59:19  klaus
 
// conversion to kernel-version 2.6, released version 6.0
 
//
 
// Revision 1.4  2003/05/11 11:12:03  klaus
 
// matched to kernel 2.4 PCI handling, debug messages improved
 
//
 
// Revision 1.3  2001/11/20 21:29:24  klaus
 
// Small changes to correct versioning down to kernel 2.3
 
//
 
// Revision 1.2  2001/11/20 20:12:50  klaus
 
// included new header and CVS log
 
//
 
//
 
// created while adapting to kernel version 2.4                 AR   4.10.2001
 
//
 
//****************************************************************************
 
 
 
#include <linux/version.h>
 
#include <generated/autoconf.h>
 
#if defined(CONFIG_MODVERSIONS) && !defined(MODVERSIONS)
 
#define MODVERSIONS
 
#endif
 
 
 
#ifdef MODVERSIONS
 
  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 
    #include <config/modversions.h>
 
  #else
 
    #include <linux/modversions.h>
 
  #endif
 
#endif
 
 
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,3,0)  
 
#define kfree_s(ptr, size)  kfree(ptr)   /* a workaround cause kfree_s is disapeared in V 2.4 */
 
#endif
 
 
 
// some preparative defintions for kernel 2.6.x 
 
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,24)
 
  typedef void irqreturn_t;
 
  #define IRQ_NONE
 
  #define IRQ_HANDLED
 
  #define IRQ_RETVAL(x)
 
#endif
 
 
 
// circumvent deprecated MOD_..._USE_COUNT
 
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
 
#define __MOD_INC_USE_COUNT__
 
#define __MOD_DEC_USE_COUNT__
 
#else
 
#define __MOD_INC_USE_COUNT__ MOD_INC_USE_COUNT
 
#define __MOD_DEC_USE_COUNT__ MOD_DEC_USE_COUNT
 
#endif
 
 
 
// switch to disable all printks for not debugging
 
#ifdef __DEBUG__
 
#define DPRINTK printk
 
#else
 
#define DPRINTK(stuff...)
 
#endif
 
 
 
#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,4,22)
 
#define pcicc32_remap_page_range(a, b, c, d, e) remap_page_range(b, d, e)
 
#else
 
#if  LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13)
 
#define pcicc32_remap_page_range(a, b, c, d. e) remap_page_range(a, b, c, d, e)
 
#else
 
#define pcicc32_remap_page_range(a, b, c, d, e) remap_pfn_range(a, b, (c >> PAGE_SHIFT), d, e)
 
#endif
 
#endif
 
 
 
#endif /* __COMMON_H__ */