Commit c3d9871e authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] rio.c: remove TWO_ZERO

From: Adrian Bunk <bunk@fs.tum.de>

Three drivers under drivers/char/ in 2.5.72 use TWO_ZERO for compatibility
code with ancient 2.0 kernels.  The patch below removes this #ifdef'd code.
parent 7b0db1f8
...@@ -234,14 +234,12 @@ int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000}; ...@@ -234,14 +234,12 @@ int rio_probe_addrs[]= {0xc0000, 0xd0000, 0xe0000};
support up to 64 bits on 64bit architectures. -- REW 20/06/99 */ support up to 64 bits on 64bit architectures. -- REW 20/06/99 */
long rio_irqmask = -1; long rio_irqmask = -1;
#ifndef TWO_ZERO
MODULE_AUTHOR("Rogier Wolff <R.E.Wolff@bitwizard.nl>, Patrick van de Lageweg <patrick@bitwizard.nl>"); MODULE_AUTHOR("Rogier Wolff <R.E.Wolff@bitwizard.nl>, Patrick van de Lageweg <patrick@bitwizard.nl>");
MODULE_DESCRIPTION("RIO driver"); MODULE_DESCRIPTION("RIO driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_PARM(rio_poll, "i"); MODULE_PARM(rio_poll, "i");
MODULE_PARM(rio_debug, "i"); MODULE_PARM(rio_debug, "i");
MODULE_PARM(rio_irqmask, "i"); MODULE_PARM(rio_irqmask, "i");
#endif
static struct real_driver rio_real_driver = { static struct real_driver rio_real_driver = {
rio_disable_tx_interrupts, rio_disable_tx_interrupts,
...@@ -1034,13 +1032,6 @@ static void __exit rio_release_drivers(void) ...@@ -1034,13 +1032,6 @@ static void __exit rio_release_drivers(void)
func_exit(); func_exit();
} }
#ifdef TWO_ZERO
#define PDEV unsigned char pci_bus, unsigned pci_fun
#define pdev pci_bus, pci_fun
#else
#define PDEV struct pci_dev *pdev
#endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* This was written for SX, but applies to RIO too... /* This was written for SX, but applies to RIO too...
...@@ -1062,7 +1053,7 @@ static void __exit rio_release_drivers(void) ...@@ -1062,7 +1053,7 @@ static void __exit rio_release_drivers(void)
EEprom. As the bit is read/write for the CPU, we can fix it here, EEprom. As the bit is read/write for the CPU, we can fix it here,
if we detect that it isn't set correctly. -- REW */ if we detect that it isn't set correctly. -- REW */
void fix_rio_pci (PDEV) void fix_rio_pci (struct pci_dev *pdev)
{ {
unsigned int hwbase; unsigned int hwbase;
unsigned long rebase; unsigned long rebase;
...@@ -1095,12 +1086,7 @@ static int __init rio_init(void) ...@@ -1095,12 +1086,7 @@ static int __init rio_init(void)
int okboard; int okboard;
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#ifndef TWO_ZERO
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
#else
unsigned char pci_bus, pci_fun;
/* in 2.2.x pdev is a pointer defining a PCI device. In 2.0 its the bus/fn */
#endif
unsigned int tint; unsigned int tint;
unsigned short tshort; unsigned short tshort;
#endif #endif
...@@ -1128,17 +1114,11 @@ static int __init rio_init(void) ...@@ -1128,17 +1114,11 @@ static int __init rio_init(void)
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/* First look for the JET devices: */ /* First look for the JET devices: */
#ifndef TWO_ZERO
while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8,
pdev))) { pdev))) {
if (pci_enable_device(pdev)) continue; if (pci_enable_device(pdev)) continue;
#else
for (i=0;i< RIO_NBOARDS;i++) {
if (pcibios_find_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, i,
&pci_bus, &pci_fun)) break;
#endif
/* Specialix has a whole bunch of cards with /* Specialix has a whole bunch of cards with
0x2000 as the device ID. They say its because 0x2000 as the device ID. They say its because
the standard requires it. Stupid standard. */ the standard requires it. Stupid standard. */
...@@ -1196,16 +1176,9 @@ static int __init rio_init(void) ...@@ -1196,16 +1176,9 @@ static int __init rio_init(void)
} else { } else {
iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr)); iounmap((char*) (p->RIOHosts[p->RIONumHosts].Caddr));
} }
}
#ifdef TWO_ZERO
} /* We have two variants with the opening brace, so to prevent */
#else
} /* Emacs from getting confused we have two closing braces too. */
#endif
/* Then look for the older PCI card.... : */ /* Then look for the older PCI card.... : */
#ifndef TWO_ZERO
/* These older PCI cards have problems (only byte-mode access is /* These older PCI cards have problems (only byte-mode access is
supported), which makes them a bit awkward to support. supported), which makes them a bit awkward to support.
...@@ -1219,12 +1192,6 @@ static int __init rio_init(void) ...@@ -1219,12 +1192,6 @@ static int __init rio_init(void)
PCI_DEVICE_ID_SPECIALIX_RIO, PCI_DEVICE_ID_SPECIALIX_RIO,
pdev))) { pdev))) {
if (pci_enable_device(pdev)) continue; if (pci_enable_device(pdev)) continue;
#else
for (i=0;i< RIO_NBOARDS;i++) {
if (pcibios_find_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_RIO, i,
&pci_bus, &pci_fun)) break;
#endif
#ifdef CONFIG_RIO_OLDPCI #ifdef CONFIG_RIO_OLDPCI
pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint); pci_read_config_dword(pdev, PCI_BASE_ADDRESS_0, &tint);
...@@ -1272,11 +1239,7 @@ static int __init rio_init(void) ...@@ -1272,11 +1239,7 @@ static int __init rio_init(void)
printk (KERN_ERR "Found an older RIO PCI card, but the driver is not " printk (KERN_ERR "Found an older RIO PCI card, but the driver is not "
"compiled to support it.\n"); "compiled to support it.\n");
#endif #endif
#ifdef TWO_ZERO }
} /* We have two variants with the opening brace, so to prevent */
#else
} /* Emacs from getting confused we have two closing braces too. */
#endif
#endif /* PCI */ #endif /* PCI */
/* Now probe for ISA cards... */ /* Now probe for ISA cards... */
......
...@@ -92,40 +92,7 @@ ...@@ -92,40 +92,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/pci.h> #include <linux/pci.h>
/* ************************************************************** */
/* * This section can be removed when 2.0 becomes outdated.... * */
/* ************************************************************** */
#if LINUX_VERSION_CODE < 131328 /* Less than 2.1.0 */
#define TWO_ZERO
#else
#if LINUX_VERSION_CODE < 131371 /* less than 2.1.43 */
/* This has not been extensively tested yet. Sorry. */
#warning "You're on your own between 2.1.0 and 2.1.43.... "
#warning "Please use a recent kernel."
#endif
#endif
#ifdef TWO_ZERO
#define Get_user(a,b) a = get_user(b)
#define copy_from_user(a,b,c) memcpy_fromfs(a,b,c)
#define copy_to_user(a,b,c) memcpy_tofs(a,b,c)
#define queue_task queue_task_irq_off
#else
#define Get_user(a,b) get_user(a,b)
#endif
/* ************************************************************** */
/* * End of compatibility section.. * */
/* ************************************************************** */
#ifndef TWO_ZERO
#include <asm/uaccess.h> #include <asm/uaccess.h>
#endif
#include "specialix_io8.h" #include "specialix_io8.h"
#include "cd1865.h" #include "cd1865.h"
...@@ -1733,7 +1700,7 @@ static int sx_set_modem_info(struct specialix_port * port, unsigned int cmd, ...@@ -1733,7 +1700,7 @@ static int sx_set_modem_info(struct specialix_port * port, unsigned int cmd,
if (error) if (error)
return error; return error;
Get_user(arg, (unsigned long *) value); get_user(arg, (unsigned long *) value);
switch (cmd) { switch (cmd) {
case TIOCMBIS: case TIOCMBIS:
/* if (arg & TIOCM_RTS) /* if (arg & TIOCM_RTS)
...@@ -1925,7 +1892,7 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp, ...@@ -1925,7 +1892,7 @@ static int sx_ioctl(struct tty_struct * tty, struct file * filp,
(unsigned long *) arg); (unsigned long *) arg);
return 0; return 0;
case TIOCSSOFTCAR: case TIOCSSOFTCAR:
Get_user(arg, (unsigned long *) arg); get_user(arg, (unsigned long *) arg);
tty->termios->c_cflag = tty->termios->c_cflag =
((tty->termios->c_cflag & ~CLOCAL) | ((tty->termios->c_cflag & ~CLOCAL) |
(arg ? CLOCAL : 0)); (arg ? CLOCAL : 0));
......
...@@ -2356,14 +2356,6 @@ static void __exit sx_release_drivers(void) ...@@ -2356,14 +2356,6 @@ static void __exit sx_release_drivers(void)
func_exit(); func_exit();
} }
#ifdef TWO_ZERO
#define PDEV unsigned char pci_bus, unsigned pci_fun
#define pdev pci_bus, pci_fun
#else
#define PDEV struct pci_dev *pdev
#endif
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
/******************************************************** /********************************************************
* Setting bit 17 in the CNTRL register of the PLX 9050 * * Setting bit 17 in the CNTRL register of the PLX 9050 *
...@@ -2376,7 +2368,7 @@ static void __exit sx_release_drivers(void) ...@@ -2376,7 +2368,7 @@ static void __exit sx_release_drivers(void)
EEprom. As the bit is read/write for the CPU, we can fix it here, EEprom. As the bit is read/write for the CPU, we can fix it here,
if we detect that it isn't set correctly. -- REW */ if we detect that it isn't set correctly. -- REW */
static void fix_sx_pci (PDEV, struct sx_board *board) static void fix_sx_pci (struct pci_dev *pdev, struct sx_board *board)
{ {
unsigned int hwbase; unsigned int hwbase;
unsigned long rebase; unsigned long rebase;
...@@ -2406,12 +2398,7 @@ static int __init sx_init(void) ...@@ -2406,12 +2398,7 @@ static int __init sx_init(void)
struct sx_board *board; struct sx_board *board;
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#ifndef TWO_ZERO
struct pci_dev *pdev = NULL; struct pci_dev *pdev = NULL;
#else
unsigned char pci_bus, pci_fun;
/* in 2.2.x pdev is a pointer defining a PCI device. In 2.0 its the bus/fn */
#endif
unsigned int tint; unsigned int tint;
unsigned short tshort; unsigned short tshort;
#endif #endif
...@@ -2431,19 +2418,12 @@ static int __init sx_init(void) ...@@ -2431,19 +2418,12 @@ static int __init sx_init(void)
} }
#ifdef CONFIG_PCI #ifdef CONFIG_PCI
#ifndef TWO_ZERO
while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX, while ((pdev = pci_find_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8,
pdev))) { pdev))) {
if (pci_enable_device(pdev)) if (pci_enable_device(pdev))
continue; continue;
#else
for (i=0;i< SX_NBOARDS;i++) {
if (pcibios_find_device (PCI_VENDOR_ID_SPECIALIX,
PCI_DEVICE_ID_SPECIALIX_SX_XIO_IO8, i,
&pci_bus, &pci_fun))
break;
#endif
/* Specialix has a whole bunch of cards with /* Specialix has a whole bunch of cards with
0x2000 as the device ID. They say its because 0x2000 as the device ID. They say its because
the standard requires it. Stupid standard. */ the standard requires it. Stupid standard. */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment