[Prism54-devel] Re: Suggested compat patch to CVS

Luis R. Rodriguez ;"Luis R. Rodriguez" <mcgrof@ruslug.rutgers.edu>
Sat, 20 Mar 2004 12:03:11 -0500


Committed. 

	Luis

On Fri, Mar 19, 2004 at 05:52:18PM +0100, Margit Schubert-While wrote:
> Margit scribeth:
> > Attached is suggested patch to CVS.
> Sent to Luis as attachment.
> 
> Here it is in plain text:
> 
> diff -Naur prism54-ng/ksrc/isl_38xx.c prism54mw/ksrc/isl_38xx.c
> --- prism54-ng/ksrc/isl_38xx.c  2004-03-18 06:25:24.000000000 +0100
> +++ prism54mw/ksrc/isl_38xx.c   2004-03-19 17:26:21.248624288 +0100
> @@ -25,17 +25,11 @@
>  #include <linux/types.h>
>  #include <linux/delay.h>
> 
> -#include "isl_38xx.h"
> -#include <linux/firmware.h>
> -
>  #include <asm/uaccess.h>
>  #include <asm/io.h>
> 
> -#include <linux/config.h>
> -#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
> -#error No Firmware Loading configured in the kernel !
> -#endif
> -
> +#include "prismcompat.h"
> +#include "isl_38xx.h"
>  #include "islpci_dev.h"
>  #include "islpci_mgt.h"
> 
> diff -Naur prism54-ng/ksrc/isl_38xx.h prism54mw/ksrc/isl_38xx.h
> --- prism54-ng/ksrc/isl_38xx.h  2004-03-18 06:25:24.000000000 +0100
> +++ prism54mw/ksrc/isl_38xx.h   2004-03-19 17:25:38.848070152 +0100
> @@ -22,14 +22,6 @@
> 
>  #include <linux/version.h>
>  #include <asm/io.h>
> -
> -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,75))
> -#include <linux/device.h>
> -# define _REQ_FW_DEV_T struct device *
> -#else
> -# define _REQ_FW_DEV_T char *
> -#endif
> -
>  #include <asm/byteorder.h>
> 
>  #define ISL38XX_CB_RX_QSIZE                     8
> diff -Naur prism54-ng/ksrc/isl_ioctl.c prism54mw/ksrc/isl_ioctl.c
> --- prism54-ng/ksrc/isl_ioctl.c 2004-03-18 16:27:44.000000000 +0100
> +++ prism54mw/ksrc/isl_ioctl.c  2004-03-19 16:57:58.567471168 +0100
> @@ -25,10 +25,10 @@
>  #include <linux/kernel.h>
>  #include <linux/if_arp.h>
>  #include <linux/pci.h>
> -#include <linux/moduleparam.h>
> 
>  #include <asm/uaccess.h>
> 
> +#include "prismcompat.h"
>  #include "isl_ioctl.h"
>  #include "islpci_mgt.h"
>  #include "isl_oid.h"           /* additional types and defs for isl38xx fw 
>  */
> diff -Naur prism54-ng/ksrc/islpci_dev.c prism54mw/ksrc/islpci_dev.c
> --- prism54-ng/ksrc/islpci_dev.c        2004-03-18 12:44:17.000000000 +0100
> +++ prism54mw/ksrc/islpci_dev.c 2004-03-19 17:30:14.337189440 +0100
> @@ -30,6 +30,7 @@
> 
>  #include <asm/io.h>
> 
> +#include "prismcompat.h"
>  #include "isl_38xx.h"
>  #include "isl_ioctl.h"
>  #include "islpci_dev.h"
> @@ -37,12 +38,6 @@
>  #include "islpci_eth.h"
>  #include "oid_mgt.h"
> 
> -#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,0)
> -#define prism54_synchronize_irq(irq) synchronize_irq()
> -#else
> -#define prism54_synchronize_irq(irq) synchronize_irq(irq)
> -#endif
> -
>  #define ISL3877_IMAGE_FILE     "isl3877"
>  #define ISL3890_IMAGE_FILE     "isl3890"
> 
> @@ -325,11 +320,7 @@
>         printk(KERN_DEBUG "%s: uploading firmware...\n", priv->ndev->name);
> 
>         rc = isl38xx_upload_firmware(priv->firmware,
> -#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,75))
> -               &priv->pdev->dev,
> -#else
> -               pci_name(priv->pdev),
> -#endif
> +               PRISM_FW_PDEV,
>                 priv->device_base,
>                 priv->device_host_address);
>         if (rc) {
> @@ -357,15 +348,7 @@
>         int result = -ETIME;
>         int count;
> 
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> -       /* This is 2.6 specific, nicer, shorter, but not in 2.4 yet */
> -       DEFINE_WAIT(wait);
> -       prepare_to_wait(&priv->reset_done, &wait, TASK_UNINTERRUPTIBLE);
> -#else
> -       DECLARE_WAITQUEUE(wait, current);
> -       set_current_state(TASK_UNINTERRUPTIBLE);
> -       add_wait_queue(&priv->reset_done, &wait);
> -#endif
> +       PRISM_DEFWAITQ(priv->reset_done, wait);
> 
>         /* now the last step is to reset the interface */
>         isl38xx_interface_reset(priv->device_base, 
>         priv->device_host_address);
> @@ -390,13 +373,7 @@
> 
>         }
> 
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> -       /* 2.6 specific too */
> -       finish_wait(&priv->reset_done, &wait);
> -#else
> -       remove_wait_queue(&priv->reset_done, &wait);
> -       set_current_state(TASK_RUNNING);
> -#endif
> +       PRISM_ENDWAITQ(priv->reset_done, wait);
> 
>         if(result)
>                 return result;
> diff -Naur prism54-ng/ksrc/islpci_eth.c prism54mw/ksrc/islpci_eth.c
> --- prism54-ng/ksrc/islpci_eth.c        2004-03-18 16:27:44.000000000 +0100
> +++ prism54mw/ksrc/islpci_eth.c 2004-03-19 16:57:58.567471168 +0100
> @@ -25,6 +25,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/etherdevice.h>
> 
> +#include "prismcompat.h"
>  #include "isl_38xx.h"
>  #include "islpci_eth.h"
>  #include "islpci_mgt.h"
> diff -Naur prism54-ng/ksrc/islpci_hotplug.c prism54mw/ksrc/islpci_hotplug.c
> --- prism54-ng/ksrc/islpci_hotplug.c    2004-03-18 06:25:24.000000000 +0100
> +++ prism54mw/ksrc/islpci_hotplug.c     2004-03-19 16:57:58.567471168 +0100
> @@ -24,6 +24,7 @@
>  #include <linux/delay.h>
>  #include <linux/init.h> /* For __init, __exit */
> 
> +#include "prismcompat.h"
>  #include "islpci_dev.h"
>  #include "islpci_mgt.h"                /* for pc_debug */
>  #include "isl_oid.h"
> diff -Naur prism54-ng/ksrc/islpci_mgt.c prism54mw/ksrc/islpci_mgt.c
> --- prism54-ng/ksrc/islpci_mgt.c        2004-03-18 06:25:24.000000000 +0100
> +++ prism54mw/ksrc/islpci_mgt.c 2004-03-19 16:57:58.567471168 +0100
> @@ -28,6 +28,7 @@
>  #include <asm/system.h>
>  #include <linux/if_arp.h>
> 
> +#include "prismcompat.h"
>  #include "isl_38xx.h"
>  #include "islpci_mgt.h"
>  #include "isl_oid.h"           /* additional types and defs for isl38xx fw 
>  */
> @@ -456,21 +457,11 @@
>         const long wait_cycle_jiffies = (ISL38XX_WAIT_CYCLE * 10 * HZ) / 
>         1000;
>         long timeout_left = ISL38XX_MAX_WAIT_CYCLES * wait_cycle_jiffies;
>         int err;
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> -       DEFINE_WAIT(wait);
> -#else
> -       DECLARE_WAITQUEUE(wait, current);
> -#endif
> 
>         if (down_interruptible(&priv->mgmt_sem))
>                 return -ERESTARTSYS;
> 
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> -       prepare_to_wait(&priv->mgmt_wqueue, &wait, TASK_UNINTERRUPTIBLE);
> -#else
> -       set_current_state(TASK_UNINTERRUPTIBLE);
> -       add_wait_queue(&priv->mgmt_wqueue, &wait);
> -#endif
> +       PRISM_DEFWAITQ(priv->mgmt_wqueue, wait);
>         err = islpci_mgt_transmit(ndev, operation, oid, senddata, sendlen);
>         if(err)
>                 goto out;
> @@ -499,12 +490,7 @@
> 
>         /* TODO: we should reset the device here */
>   out:
> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
> -       finish_wait(&priv->mgmt_wqueue, &wait);
> -#else
> -       remove_wait_queue(&priv->mgmt_wqueue, &wait);
> -       set_current_state(TASK_RUNNING);
> -#endif
> +       PRISM_ENDWAITQ(priv->mgmt_wqueue, wait);
>         up(&priv->mgmt_sem);
>         return err;
>  }
> diff -Naur prism54-ng/ksrc/oid_mgt.c prism54mw/ksrc/oid_mgt.c
> --- prism54-ng/ksrc/oid_mgt.c   2004-03-18 16:27:44.000000000 +0100
> +++ prism54mw/ksrc/oid_mgt.c    2004-03-19 16:57:58.567471168 +0100
> @@ -16,6 +16,7 @@
>   *
>   */
> 
> +#include "prismcompat.h"
>  #include "islpci_dev.h"
>  #include "islpci_mgt.h"
>  #include "isl_oid.h"
> diff -Naur prism54-ng/ksrc/prismcompat.h prism54mw/ksrc/prismcompat.h
> --- prism54-ng/ksrc/prismcompat.h       1970-01-01 01:00:00.000000000 +0100
> +++ prism54mw/ksrc/prismcompat.h        2004-03-19 17:28:00.549528256 +0100
> @@ -0,0 +1,46 @@
> +/*
> + *  (C) 2004 Margit Schubert-While <margitsw@t-online.de>
> + *
> + *  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
> + *
> + *  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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  
> USA
> + *
> + */
> +
> +/*
> + *     Compatibility header file to aid support of different kernel 
> versions
> + */
> +
> +#ifndef _PRISM_COMPAT_H
> +#define _PRISM_COMPAT_H
> +
> +#include <linux/device.h>
> +#include <linux/firmware.h>
> +#include <linux/config.h>
> +#include <linux/moduleparam.h>
> +
> +#if !defined(CONFIG_FW_LOADER) && !defined(CONFIG_FW_LOADER_MODULE)
> +#error Firmware Loading is not configured in the kernel !
> +#endif
> +
> +#define prism54_synchronize_irq(irq) synchronize_irq(irq)
> +
> +#define PRISM_DEFWAITQ(x, y)   DEFINE_WAIT(y); \
> +       prepare_to_wait(&(x), &(y), TASK_UNINTERRUPTIBLE)
> +
> +#define PRISM_ENDWAITQ(x, y)   finish_wait(&(x), &(y))
> +
> +#define _REQ_FW_DEV_T          struct device *
> +
> +#define PRISM_FW_PDEV          &priv->pdev->dev
> +
> +#endif                         /* _PRISM_COMPAT_H */
> 
> Margit
> 
> 
> _______________________________________________
> Prism54-devel mailing list
> Prism54-devel@prism54.org
> http://prism54.org/mailman/listinfo/prism54-devel

-- 
GnuPG Key fingerprint = 113F B290 C6D2 0251 4D84  A34A 6ADD 4937 E20A 525E