summaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-11-28 03:58:46 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-11-28 03:58:46 +0000
commitb63ad0882a16a5d28003e57f2b0b81dee3fb322b (patch)
tree0a343ce219e2b8b38a5d702d66032c57b83d9720 /drivers/char
parenta9d7bff9a84dba79609a0002e5321b74c4d64c64 (diff)
Merge with 2.4.0-test11.
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/Config.in6
-rw-r--r--drivers/char/agp/agp.h2
-rw-r--r--drivers/char/agp/agpgart_be.c26
-rw-r--r--drivers/char/console.c1
-rw-r--r--drivers/char/cyclades.c2
-rw-r--r--drivers/char/drm/agpsupport.c120
-rw-r--r--drivers/char/drm/dma.c1
-rw-r--r--drivers/char/drm/drmP.h18
-rw-r--r--drivers/char/drm/ffb_drv.c10
-rw-r--r--drivers/char/drm/gamma_drv.c4
-rw-r--r--drivers/char/drm/i810_drv.c7
-rw-r--r--drivers/char/drm/memory.c64
-rw-r--r--drivers/char/drm/mga_drv.c7
-rw-r--r--drivers/char/drm/mga_state.c2
-rw-r--r--drivers/char/drm/r128_drm.h6
-rw-r--r--drivers/char/drm/r128_drv.c7
-rw-r--r--drivers/char/drm/tdfx_drv.c6
-rw-r--r--drivers/char/ftape/lowlevel/ftape-ctl.c21
-rw-r--r--drivers/char/generic_serial.c58
-rw-r--r--drivers/char/joystick/adi.c4
-rw-r--r--drivers/char/joystick/analog.c5
-rw-r--r--drivers/char/joystick/iforce.c23
-rw-r--r--drivers/char/joystick/ns558.c18
-rw-r--r--drivers/char/joystick/sidewinder.c2
-rw-r--r--drivers/char/mem.c7
-rw-r--r--drivers/char/mxser.c2
-rw-r--r--drivers/char/n_hdlc.c196
-rw-r--r--drivers/char/random.c2
-rw-r--r--drivers/char/rio/rio_linux.c3
-rw-r--r--drivers/char/rtc.c8
-rw-r--r--drivers/char/sx.c8
-rw-r--r--drivers/char/synclink.c603
32 files changed, 418 insertions, 831 deletions
diff --git a/drivers/char/Config.in b/drivers/char/Config.in
index 1ec7792a6..e2e57cc90 100644
--- a/drivers/char/Config.in
+++ b/drivers/char/Config.in
@@ -16,7 +16,7 @@ if [ "$CONFIG_SERIAL" = "y" ]; then
tristate ' Dual serial port support' CONFIG_DUALSP_SERIAL
fi
fi
-dep_bool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL
+dep_mbool 'Extended dumb serial driver options' CONFIG_SERIAL_EXTENDED $CONFIG_SERIAL
if [ "$CONFIG_SERIAL_EXTENDED" = "y" ]; then
bool ' Support more than 4 serial ports' CONFIG_SERIAL_MANY_PORTS
bool ' Support for sharing serial interrupts' CONFIG_SERIAL_SHARE_IRQ
@@ -178,8 +178,8 @@ endmenu
tristate '/dev/agpgart (AGP Support)' CONFIG_AGP $CONFIG_DRM_AGP
if [ "$CONFIG_AGP" != "n" ]; then
- bool ' Intel 440LX/BX/GX 840 support' CONFIG_AGP_INTEL
- bool ' Intel I810/I815 support' CONFIG_AGP_I810
+ bool ' Intel 440LX/BX/GX and I815/I840 support' CONFIG_AGP_INTEL
+ bool ' Intel I810/I815 (on-board) support' CONFIG_AGP_I810
bool ' VIA chipset support' CONFIG_AGP_VIA
bool ' AMD Irongate support' CONFIG_AGP_AMD
bool ' Generic SiS support' CONFIG_AGP_SIS
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h
index acad5947a..a054af745 100644
--- a/drivers/char/agp/agp.h
+++ b/drivers/char/agp/agp.h
@@ -144,8 +144,6 @@ struct agp_bridge_data {
#define min(a,b) (((a)<(b))?(a):(b))
#endif
-#define arraysize(x) (sizeof(x)/sizeof(*(x)))
-
#define AGPGART_MODULE_NAME "agpgart"
#define PFX AGPGART_MODULE_NAME ": "
diff --git a/drivers/char/agp/agpgart_be.c b/drivers/char/agp/agpgart_be.c
index 44bd3bfb4..5d2b3de61 100644
--- a/drivers/char/agp/agpgart_be.c
+++ b/drivers/char/agp/agpgart_be.c
@@ -2057,6 +2057,13 @@ static struct {
"Intel",
"440GX",
intel_generic_setup },
+ /* could we add support for PCI_DEVICE_ID_INTEL_815_1 too ? */
+ { PCI_DEVICE_ID_INTEL_815_0,
+ PCI_VENDOR_ID_INTEL,
+ INTEL_I815,
+ "Intel",
+ "i815",
+ intel_generic_setup },
{ PCI_DEVICE_ID_INTEL_840_0,
PCI_VENDOR_ID_INTEL,
INTEL_I840,
@@ -2182,16 +2189,16 @@ static int __init agp_lookup_host_bridge (struct pci_dev *pdev)
{
int i;
- for (i = 0; i < arraysize (agp_bridge_info); i++)
+ for (i = 0; i < ARRAY_SIZE (agp_bridge_info); i++)
if (pdev->vendor == agp_bridge_info[i].vendor_id)
break;
- if (i >= arraysize (agp_bridge_info)) {
+ if (i >= ARRAY_SIZE (agp_bridge_info)) {
printk (KERN_DEBUG PFX "unsupported bridge\n");
return -ENODEV;
}
- while ((i < arraysize (agp_bridge_info)) &&
+ while ((i < ARRAY_SIZE (agp_bridge_info)) &&
(agp_bridge_info[i].vendor_id == pdev->vendor)) {
if (pdev->device == agp_bridge_info[i].device_id) {
printk (KERN_INFO PFX "Detected %s %s chipset\n",
@@ -2490,6 +2497,17 @@ static void agp_backend_cleanup(void)
extern int agp_frontend_initialize(void);
extern void agp_frontend_cleanup(void);
+static const drm_agp_t drm_agp = {
+ &agp_free_memory,
+ &agp_allocate_memory,
+ &agp_bind_memory,
+ &agp_unbind_memory,
+ &agp_enable,
+ &agp_backend_acquire,
+ &agp_backend_release,
+ &agp_copy_info
+};
+
static int __init agp_init(void)
{
int ret_val;
@@ -2509,6 +2527,7 @@ static int __init agp_init(void)
return ret_val;
}
+ inter_module_register("drm_agp", THIS_MODULE, &drm_agp);
return 0;
}
@@ -2516,6 +2535,7 @@ static void __exit agp_cleanup(void)
{
agp_frontend_cleanup();
agp_backend_cleanup();
+ inter_module_unregister("drm_agp");
}
module_init(agp_init);
diff --git a/drivers/char/console.c b/drivers/char/console.c
index ea44cace4..0285eab79 100644
--- a/drivers/char/console.c
+++ b/drivers/char/console.c
@@ -2135,7 +2135,6 @@ void vt_console_print(struct console *co, const char * b, unsigned count)
}
}
set_cursor(currcons);
- poke_blanked_console();
quit:
clear_bit(0, &printing);
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c
index e5bdb6ccf..35b23d944 100644
--- a/drivers/char/cyclades.c
+++ b/drivers/char/cyclades.c
@@ -2517,6 +2517,8 @@ block_til_ready(struct tty_struct *tty, struct file * filp,
firm_id = (struct FIRM_ID *)
(base_addr + ID_ADDRESS);
if (!ISZLOADED(*cinfo)){
+ current->state = TASK_RUNNING;
+ remove_wait_queue(&info->open_wait, &wait);
return -EINVAL;
}
diff --git a/drivers/char/drm/agpsupport.c b/drivers/char/drm/agpsupport.c
index 24fd59cdf..c996df8f4 100644
--- a/drivers/char/drm/agpsupport.c
+++ b/drivers/char/drm/agpsupport.c
@@ -31,48 +31,14 @@
#define __NO_VERSION__
#include "drmP.h"
#include <linux/module.h>
+#if LINUX_VERSION_CODE < 0x020400
+#include "agpsupport-pre24.h"
+#else
+#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp")
+#define DRM_AGP_PUT inter_module_put("drm_agp")
+#endif
-drm_agp_func_t drm_agp = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
-
-/* The C standard says that 'void *' is not guaranteed to hold a function
- pointer, so we use this union to define a generic pointer that is
- guaranteed to hold any of the function pointers we care about. */
-typedef union {
- void (*free_memory)(agp_memory *);
- agp_memory *(*allocate_memory)(size_t, u32);
- int (*bind_memory)(agp_memory *, off_t);
- int (*unbind_memory)(agp_memory *);
- void (*enable)(u32);
- int (*acquire)(void);
- void (*release)(void);
- void (*copy_info)(agp_kern_info *);
- unsigned long address;
-} drm_agp_func_u;
-
-typedef struct drm_agp_fill {
- const char *name;
- drm_agp_func_u *f;
-} drm_agp_fill_t;
-
-static drm_agp_fill_t drm_agp_fill[] = {
- { __MODULE_STRING(agp_free_memory),
- (drm_agp_func_u *)&drm_agp.free_memory },
- { __MODULE_STRING(agp_allocate_memory),
- (drm_agp_func_u *)&drm_agp.allocate_memory },
- { __MODULE_STRING(agp_bind_memory),
- (drm_agp_func_u *)&drm_agp.bind_memory },
- { __MODULE_STRING(agp_unbind_memory),
- (drm_agp_func_u *)&drm_agp.unbind_memory },
- { __MODULE_STRING(agp_enable),
- (drm_agp_func_u *)&drm_agp.enable },
- { __MODULE_STRING(agp_backend_acquire),
- (drm_agp_func_u *)&drm_agp.acquire },
- { __MODULE_STRING(agp_backend_release),
- (drm_agp_func_u *)&drm_agp.release },
- { __MODULE_STRING(agp_copy_info),
- (drm_agp_func_u *)&drm_agp.copy_info },
- { NULL, NULL }
-};
+static const drm_agp_t *drm_agp = NULL;
int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
@@ -82,7 +48,7 @@ int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd,
agp_kern_info *kern;
drm_agp_info_t info;
- if (!dev->agp->acquired || !drm_agp.copy_info) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL;
kern = &dev->agp->agp_info;
info.agp_version_major = kern->version.major;
@@ -107,8 +73,8 @@ int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd,
drm_device_t *dev = priv->dev;
int retcode;
- if (dev->agp->acquired || !drm_agp.acquire) return -EINVAL;
- if ((retcode = (*drm_agp.acquire)())) return retcode;
+ if (dev->agp->acquired || !drm_agp->acquire) return -EINVAL;
+ if ((retcode = drm_agp->acquire())) return retcode;
dev->agp->acquired = 1;
return 0;
}
@@ -119,13 +85,18 @@ int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd,
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev;
- if (!dev->agp->acquired || !drm_agp.release) return -EINVAL;
- (*drm_agp.release)();
+ if (!dev->agp->acquired || !drm_agp->release) return -EINVAL;
+ drm_agp->release();
dev->agp->acquired = 0;
return 0;
}
+void _drm_agp_release(void)
+{
+ if (drm_agp->release) drm_agp->release();
+}
+
int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
@@ -133,13 +104,13 @@ int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd,
drm_device_t *dev = priv->dev;
drm_agp_mode_t mode;
- if (!dev->agp->acquired || !drm_agp.enable) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL;
if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode)))
return -EFAULT;
dev->agp->mode = mode.mode;
- (*drm_agp.enable)(mode.mode);
+ drm_agp->enable(mode.mode);
dev->agp->base = dev->agp->agp_info.aper_base;
dev->agp->enabled = 1;
return 0;
@@ -231,7 +202,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd,
int retcode;
int page;
- if (!dev->agp->acquired || !drm_agp.bind_memory) return -EINVAL;
+ if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL;
if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request)))
return -EFAULT;
if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
@@ -270,24 +241,14 @@ int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd,
drm_agp_head_t *drm_agp_init(void)
{
- drm_agp_fill_t *fill;
drm_agp_head_t *head = NULL;
- int agp_available = 1;
-
- for (fill = &drm_agp_fill[0]; fill->name; fill++) {
- char *n = (char *)fill->name;
- *fill->f = (drm_agp_func_u)get_module_symbol(NULL, n);
- DRM_DEBUG("%s resolves to 0x%08lx\n", n, (*fill->f).address);
- if (!(*fill->f).address) agp_available = 0;
- }
-
- DRM_DEBUG("agp_available = %d\n", agp_available);
- if (agp_available) {
+ drm_agp = DRM_AGP_GET;
+ if (drm_agp) {
if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
return NULL;
memset((void *)head, 0, sizeof(*head));
- (*drm_agp.copy_info)(&head->agp_info);
+ drm_agp->copy_info(&head->agp_info);
if (head->agp_info.chipset == NOT_SUPPORTED) {
drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS);
return NULL;
@@ -337,12 +298,31 @@ drm_agp_head_t *drm_agp_init(void)
void drm_agp_uninit(void)
{
- drm_agp_fill_t *fill;
-
- for (fill = &drm_agp_fill[0]; fill->name; fill++) {
-#if LINUX_VERSION_CODE >= 0x020400
- if ((*fill->f).address) put_module_symbol((*fill->f).address);
-#endif
- (*fill->f).address = 0;
- }
+ DRM_AGP_PUT;
+ drm_agp = NULL;
+}
+
+agp_memory *drm_agp_allocate_memory(size_t pages, u32 type)
+{
+ if (!drm_agp->allocate_memory) return NULL;
+ return drm_agp->allocate_memory(pages, type);
+}
+
+int drm_agp_free_memory(agp_memory *handle)
+{
+ if (!handle || !drm_agp->free_memory) return 0;
+ drm_agp->free_memory(handle);
+ return 1;
+}
+
+int drm_agp_bind_memory(agp_memory *handle, off_t start)
+{
+ if (!handle || !drm_agp->bind_memory) return -EINVAL;
+ return drm_agp->bind_memory(handle, start);
+}
+
+int drm_agp_unbind_memory(agp_memory *handle)
+{
+ if (!handle || !drm_agp->unbind_memory) return -EINVAL;
+ return drm_agp->unbind_memory(handle);
}
diff --git a/drivers/char/drm/dma.c b/drivers/char/drm/dma.c
index 5cc3ec369..56dd2441e 100644
--- a/drivers/char/drm/dma.c
+++ b/drivers/char/drm/dma.c
@@ -405,6 +405,7 @@ int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *d)
schedule();
if (signal_pending(current)) {
atomic_dec(&q->use_count);
+ remove_wait_queue(&q->write_queue, &entry);
return -EINTR;
}
}
diff --git a/drivers/char/drm/drmP.h b/drivers/char/drm/drmP.h
index 6be90c516..affeae705 100644
--- a/drivers/char/drm/drmP.h
+++ b/drivers/char/drm/drmP.h
@@ -510,19 +510,6 @@ typedef struct drm_agp_head {
unsigned long base;
int agp_mtrr;
} drm_agp_head_t;
-
-typedef struct {
- void (*free_memory)(agp_memory *);
- agp_memory *(*allocate_memory)(size_t, u32);
- int (*bind_memory)(agp_memory *, off_t);
- int (*unbind_memory)(agp_memory *);
- void (*enable)(u32);
- int (*acquire)(void);
- void (*release)(void);
- void (*copy_info)(agp_kern_info *);
-} drm_agp_func_t;
-
-extern drm_agp_func_t drm_agp;
#endif
typedef struct drm_sigdata {
@@ -824,6 +811,7 @@ extern drm_agp_head_t *drm_agp_init(void);
extern void drm_agp_uninit(void);
extern int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern void _drm_agp_release(void);
extern int drm_agp_release(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_enable(struct inode *inode, struct file *filp,
@@ -838,6 +826,10 @@ extern int drm_agp_unbind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_bind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
+extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type);
+extern int drm_agp_free_memory(agp_memory *handle);
+extern int drm_agp_bind_memory(agp_memory *handle, off_t start);
+extern int drm_agp_unbind_memory(agp_memory *handle);
#endif
#endif
#endif
diff --git a/drivers/char/drm/ffb_drv.c b/drivers/char/drm/ffb_drv.c
index 84c7f0644..cf9a9f5d9 100644
--- a/drivers/char/drm/ffb_drv.c
+++ b/drivers/char/drm/ffb_drv.c
@@ -1,4 +1,4 @@
-/* $Id: ffb_drv.c,v 1.6 2000/08/10 05:26:23 davem Exp $
+/* $Id: ffb_drv.c,v 1.7 2000/11/12 10:01:41 davem Exp $
* ffb_drv.c: Creator/Creator3D direct rendering driver.
*
* Copyright (C) 2000 David S. Miller (davem@redhat.com)
@@ -244,7 +244,7 @@ static void get_ffb_type(ffb_dev_priv_t *ffb_priv, int instance)
};
}
-static int ffb_init_one(int prom_node, int instance)
+static int __init ffb_init_one(int prom_node, int instance)
{
struct linux_prom64_registers regs[2*PROMREG_MAX];
drm_device_t *dev;
@@ -305,7 +305,7 @@ static int ffb_init_one(int prom_node, int instance)
return 0;
}
-static int ffb_init_dev_table(void)
+static int __init ffb_init_dev_table(void)
{
int root, node;
int total = 0;
@@ -324,7 +324,7 @@ static int ffb_init_dev_table(void)
return 0;
}
-int ffb_init(void)
+int __init ffb_init(void)
{
int root, node, instance, ret;
@@ -345,7 +345,7 @@ int ffb_init(void)
return 0;
}
-void ffb_cleanup(void)
+void __exit ffb_cleanup(void)
{
int instance;
diff --git a/drivers/char/drm/gamma_drv.c b/drivers/char/drm/gamma_drv.c
index dba974c2b..a17bc1a9f 100644
--- a/drivers/char/drm/gamma_drv.c
+++ b/drivers/char/drm/gamma_drv.c
@@ -339,7 +339,7 @@ int gamma_find_devices(void)
/* gamma_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int gamma_init(void)
+static int __init gamma_init(void)
{
int retcode;
drm_device_t *dev = &gamma_device;
@@ -380,7 +380,7 @@ static int gamma_init(void)
/* gamma_cleanup is called via cleanup_module at module unload time. */
-static void gamma_cleanup(void)
+static void __exit gamma_cleanup(void)
{
drm_device_t *dev = &gamma_device;
diff --git a/drivers/char/drm/i810_drv.c b/drivers/char/drm/i810_drv.c
index ed880c41a..7152eac3a 100644
--- a/drivers/char/drm/i810_drv.c
+++ b/drivers/char/drm/i810_drv.c
@@ -255,8 +255,7 @@ static int i810_takedown(drm_device_t *dev)
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
@@ -338,7 +337,7 @@ static int i810_takedown(drm_device_t *dev)
/* i810_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int i810_init(void)
+static int __init i810_init(void)
{
int retcode;
drm_device_t *dev = &i810_device;
@@ -397,7 +396,7 @@ static int i810_init(void)
/* i810_cleanup is called via cleanup_module at module unload time. */
-static void i810_cleanup(void)
+static void __exit i810_cleanup(void)
{
drm_device_t *dev = &i810_device;
diff --git a/drivers/char/drm/memory.c b/drivers/char/drm/memory.c
index 34d19b203..261fb34a3 100644
--- a/drivers/char/drm/memory.c
+++ b/drivers/char/drm/memory.c
@@ -352,16 +352,13 @@ agp_memory *drm_alloc_agp(int pages, u32 type)
return NULL;
}
- if (drm_agp.allocate_memory) {
- if ((handle = (*drm_agp.allocate_memory)(pages,
- type))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
- drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
- += pages << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- return handle;
- }
+ if ((handle = drm_agp_allocate_memory(pages, type))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated
+ += pages << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return handle;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count;
@@ -381,8 +378,7 @@ int drm_free_agp(agp_memory *handle, int pages)
return retval;;
}
- if (drm_agp.free_memory) {
- (*drm_agp.free_memory)(handle);
+ if (drm_agp_free_memory(handle)) {
spin_lock(&drm_mem_lock);
free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count;
alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count;
@@ -403,24 +399,19 @@ int drm_bind_agp(agp_memory *handle, unsigned int start)
{
int retcode = -EINVAL;
- DRM_DEBUG("drm_bind_agp called\n");
if (!handle) {
DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
"Attempt to bind NULL AGP handle\n");
return retcode;
}
- DRM_DEBUG("drm_agp.bind_memory : %p\n", drm_agp.bind_memory);
- if (drm_agp.bind_memory) {
- if (!(retcode = (*drm_agp.bind_memory)(handle, start))) {
- spin_lock(&drm_mem_lock);
- ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
- += handle->page_count << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- DRM_DEBUG("drm_agp.bind_memory: retcode %d\n", retcode);
- return retcode;
- }
+ if (!(retcode = drm_agp_bind_memory(handle, start))) {
+ spin_lock(&drm_mem_lock);
+ ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ return retcode;
}
spin_lock(&drm_mem_lock);
++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count;
@@ -440,20 +431,17 @@ int drm_unbind_agp(agp_memory *handle)
return retcode;
}
- if (drm_agp.unbind_memory) {
- int c = handle->page_count;
- if ((retcode = (*drm_agp.unbind_memory)(handle)))
- return retcode;
- spin_lock(&drm_mem_lock);
- free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
- alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
- drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed += c << PAGE_SHIFT;
- spin_unlock(&drm_mem_lock);
- if (free_count > alloc_count) {
- DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
- "Excess frees: %d frees, %d allocs\n",
- free_count, alloc_count);
- }
+ if ((retcode = drm_agp_unbind_memory(handle))) return retcode;
+ spin_lock(&drm_mem_lock);
+ free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count;
+ alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count;
+ drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed
+ += handle->page_count << PAGE_SHIFT;
+ spin_unlock(&drm_mem_lock);
+ if (free_count > alloc_count) {
+ DRM_MEM_ERROR(DRM_MEM_BOUNDAGP,
+ "Excess frees: %d frees, %d allocs\n",
+ free_count, alloc_count);
}
return retcode;
}
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 4aaac6254..883eb75ca 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -255,8 +255,7 @@ static int mga_takedown(drm_device_t *dev)
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
@@ -338,7 +337,7 @@ static int mga_takedown(drm_device_t *dev)
/* mga_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int mga_init(void)
+static int __init mga_init(void)
{
int retcode;
drm_device_t *dev = &mga_device;
@@ -398,7 +397,7 @@ static int mga_init(void)
/* mga_cleanup is called via cleanup_module at module unload time. */
-static void mga_cleanup(void)
+static void __exit mga_cleanup(void)
{
drm_device_t *dev = &mga_device;
diff --git a/drivers/char/drm/mga_state.c b/drivers/char/drm/mga_state.c
index 9bbd254c1..6ac3d6059 100644
--- a/drivers/char/drm/mga_state.c
+++ b/drivers/char/drm/mga_state.c
@@ -287,7 +287,7 @@ static void mgaG400EmitPipe(drm_mga_private_t * dev_priv)
PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000);
PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0);
- PRIMOUTREG(MGAREG_DMAPAD, 0);
+ PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000);
PRIMOUTREG(MGAREG_DMAPAD, 0);
}
diff --git a/drivers/char/drm/r128_drm.h b/drivers/char/drm/r128_drm.h
index ac6f73bcd..8a4842cf3 100644
--- a/drivers/char/drm/r128_drm.h
+++ b/drivers/char/drm/r128_drm.h
@@ -57,9 +57,9 @@ typedef struct drm_r128_init {
} drm_r128_init_t;
typedef struct drm_r128_packet {
- unsigned long *buffer;
- int count;
- int flags;
+ unsigned int *buffer;
+ int count;
+ int flags;
} drm_r128_packet_t;
typedef enum drm_r128_prim {
diff --git a/drivers/char/drm/r128_drv.c b/drivers/char/drm/r128_drv.c
index 7ae498014..969ada93f 100644
--- a/drivers/char/drm/r128_drv.c
+++ b/drivers/char/drm/r128_drv.c
@@ -252,8 +252,7 @@ static int r128_takedown(drm_device_t *dev)
}
dev->agp->memory = NULL;
- if (dev->agp->acquired && drm_agp.release)
- (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
dev->agp->acquired = 0;
dev->agp->enabled = 0;
@@ -323,7 +322,7 @@ static int r128_takedown(drm_device_t *dev)
/* r128_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int r128_init(void)
+static int __init r128_init(void)
{
int retcode;
drm_device_t *dev = &r128_device;
@@ -387,7 +386,7 @@ static int r128_init(void)
/* r128_cleanup is called via cleanup_module at module unload time. */
-static void r128_cleanup(void)
+static void __exit r128_cleanup(void)
{
drm_device_t *dev = &r128_device;
diff --git a/drivers/char/drm/tdfx_drv.c b/drivers/char/drm/tdfx_drv.c
index 5f2c804af..7d79a013b 100644
--- a/drivers/char/drm/tdfx_drv.c
+++ b/drivers/char/drm/tdfx_drv.c
@@ -235,7 +235,7 @@ static int tdfx_takedown(drm_device_t *dev)
drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS);
temp = temp_next;
}
- if (dev->agp->acquired) (*drm_agp.release)();
+ if (dev->agp->acquired) _drm_agp_release();
}
#endif
/* Clear vma list (only built for debugging) */
@@ -298,7 +298,7 @@ static int tdfx_takedown(drm_device_t *dev)
/* tdfx_init is called via init_module at module load time, or via
* linux/init/main.c (this is not currently supported). */
-static int tdfx_init(void)
+static int __init tdfx_init(void)
{
int retcode;
drm_device_t *dev = &tdfx_device;
@@ -346,7 +346,7 @@ static int tdfx_init(void)
/* tdfx_cleanup is called via cleanup_module at module unload time. */
-static void tdfx_cleanup(void)
+static void __exit tdfx_cleanup(void)
{
drm_device_t *dev = &tdfx_device;
diff --git a/drivers/char/ftape/lowlevel/ftape-ctl.c b/drivers/char/ftape/lowlevel/ftape-ctl.c
index 4196458d0..6c1ef5235 100644
--- a/drivers/char/ftape/lowlevel/ftape-ctl.c
+++ b/drivers/char/ftape/lowlevel/ftape-ctl.c
@@ -40,6 +40,9 @@
#endif
#include <asm/io.h>
+/* ease porting between pre-2.4.x and later kernels */
+#define vma_get_pgoff(v) ((v)->vm_pgoff)
+
#include "../lowlevel/ftape-tracing.h"
#include "../lowlevel/ftape-io.h"
#include "../lowlevel/ftape-ctl.h"
@@ -701,23 +704,23 @@ int ftape_mmap(struct vm_area_struct *vma)
if (ft_failure) {
TRACE_EXIT -ENODEV;
}
- if ((vma_get_flags(vma) & (VM_READ|VM_WRITE)) == 0) {
+ if (!(vma->vm_flags & (VM_READ|VM_WRITE))) {
TRACE_ABORT(-EINVAL, ft_t_err, "Undefined mmap() access");
}
if (vma_get_pgoff(vma) != 0) {
TRACE_ABORT(-EINVAL, ft_t_err, "page offset must be 0");
}
- if ((vma_get_end (vma) - vma_get_start (vma)) % FT_BUFF_SIZE != 0) {
+ if ((vma->vm_end - vma->vm_start) % FT_BUFF_SIZE != 0) {
TRACE_ABORT(-EINVAL, ft_t_err,
"size = %ld, should be a multiple of %d",
- vma_get_end (vma) - vma_get_start (vma),
+ vma->vm_end - vma->vm_start,
FT_BUFF_SIZE);
}
- num_buffers = (vma_get_end (vma) - vma_get_start (vma)) / FT_BUFF_SIZE;
+ num_buffers = (vma->vm_end - vma->vm_start) / FT_BUFF_SIZE;
if (num_buffers > ft_nr_buffers) {
TRACE_ABORT(-EINVAL,
ft_t_err, "size = %ld, should be less than %d",
- vma_get_end (vma) - vma_get_start (vma),
+ vma->vm_end - vma->vm_start,
ft_nr_buffers * FT_BUFF_SIZE);
}
if (ft_driver_state != idle) {
@@ -728,15 +731,15 @@ int ftape_mmap(struct vm_area_struct *vma)
ftape_reset_buffer();
}
for (i = 0; i < num_buffers; i++) {
- TRACE_CATCH(remap_page_range(vma_get_start (vma) +
+ TRACE_CATCH(remap_page_range(vma->vm_start +
i * FT_BUFF_SIZE,
- virt_to_phys(ft_buffer[i]->address),
+ virt_to_phys(ft_buffer[i]->address),
FT_BUFF_SIZE,
- vma_get_page_prot (vma)),
+ vma->vm_page_prot),
_res = -EAGAIN);
TRACE(ft_t_noise, "remapped dma buffer @ %p to location @ %p",
ft_buffer[i]->address,
- (void *)(vma_get_start(vma) + i * FT_BUFF_SIZE));
+ (void *)(vma->vm_start + i * FT_BUFF_SIZE));
}
for (i = 0; i < num_buffers; i++) {
memset(ft_buffer[i]->address, 0xAA, FT_BUFF_SIZE);
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c
index 78617055e..3e8c404df 100644
--- a/drivers/char/generic_serial.c
+++ b/drivers/char/generic_serial.c
@@ -19,21 +19,21 @@
* best to be responsive. -- REW
* */
+#include <linux/module.h>
+#include <linux/kernel.h>
#include <linux/tty.h>
#include <linux/serial.h>
#include <linux/mm.h>
+#include <linux/generic_serial.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
-#include <linux/version.h>
-#include <linux/module.h>
-#include <linux/generic_serial.h>
#define DEBUG
static char * tmp_buf;
static DECLARE_MUTEX(tmp_buf_sem);
-int gs_debug;
+static int gs_debug;
#ifdef DEBUG
@@ -57,30 +57,7 @@ int gs_debug;
#define RS_EVENT_WRITE_WAKEUP 1
-#ifdef MODULE
MODULE_PARM(gs_debug, "i");
-#endif
-
-#ifdef DEBUG
-static void my_hd (unsigned char *addr, int len)
-{
- int i, j, ch;
-
- for (i=0;i<len;i+=16) {
- printk ("%08x ", (int) addr+i);
- for (j=0;j<16;j++) {
- printk ("%02x %s", addr[j+i], (j==7)?" ":"");
- }
- for (j=0;j<16;j++) {
- ch = addr[j+i];
- printk ("%c", (ch < 0x20)?'.':((ch > 0x7f)?'.':ch));
- }
- printk ("\n");
- }
-}
-#else
-#define my_hd(addr,len)
-#endif
void gs_put_char(struct tty_struct * tty, unsigned char ch)
@@ -1083,15 +1060,20 @@ void gs_getserial(struct gs_port *port, struct serial_struct *sp)
copy_to_user(sp, &sio, sizeof(struct serial_struct));
}
+EXPORT_SYMBOL(gs_put_char);
+EXPORT_SYMBOL(gs_write);
+EXPORT_SYMBOL(gs_write_room);
+EXPORT_SYMBOL(gs_chars_in_buffer);
+EXPORT_SYMBOL(gs_flush_buffer);
+EXPORT_SYMBOL(gs_flush_chars);
+EXPORT_SYMBOL(gs_stop);
+EXPORT_SYMBOL(gs_start);
+EXPORT_SYMBOL(gs_hangup);
+EXPORT_SYMBOL(gs_do_softint);
+EXPORT_SYMBOL(block_til_ready);
+EXPORT_SYMBOL(gs_close);
+EXPORT_SYMBOL(gs_set_termios);
+EXPORT_SYMBOL(gs_init_port);
+EXPORT_SYMBOL(gs_setserial);
+EXPORT_SYMBOL(gs_getserial);
-#ifdef MODULE
-int init_module (void)
-{
- return 0;
-}
-
-int cleanup_module (void)
-{
- return 0;
-}
-#endif
diff --git a/drivers/char/joystick/adi.c b/drivers/char/joystick/adi.c
index 3195fce03..a2f68d74e 100644
--- a/drivers/char/joystick/adi.c
+++ b/drivers/char/joystick/adi.c
@@ -418,7 +418,7 @@ static void adi_init_input(struct adi *adi, struct adi_port *port)
adi->dev.private = port;
adi->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
- for (i = 0; i < adi->axes10 + adi->axes8 + adi->hats * 2; i++)
+ for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad > 0)) * 2; i++)
set_bit(adi->abs[i], &adi->dev.absbit);
for (i = 0; i < adi->buttons; i++)
@@ -431,7 +431,7 @@ static void adi_init_center(struct adi *adi)
if (!adi->length) return;
- for (i = 0; i < adi->axes10 + adi->axes8 + adi->hats * 2; i++) {
+ for (i = 0; i < adi->axes10 + adi->axes8 + (adi->hats + (adi->pad > 0)) * 2; i++) {
t = adi->abs[i];
x = adi->dev.abs[t];
diff --git a/drivers/char/joystick/analog.c b/drivers/char/joystick/analog.c
index 6514bef9b..dbd46fb7e 100644
--- a/drivers/char/joystick/analog.c
+++ b/drivers/char/joystick/analog.c
@@ -41,17 +41,18 @@
#include <linux/gameport.h>
MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
+MODULE_DESCRIPTION("Analog joystick and gamepad driver for Linux");
/*
* Option parsing.
*/
-MODULE_PARM(js,"1-16s");
-
#define ANALOG_PORTS 16
static char *js[ANALOG_PORTS];
static int analog_options[ANALOG_PORTS];
+MODULE_PARM(js, "1-" __MODULE_STRING(ANALOG_PORTS) "s");
+MODULE_PARM_DESC(js, "Analog joystick options");
/*
* Times, feature definitions.
diff --git a/drivers/char/joystick/iforce.c b/drivers/char/joystick/iforce.c
index acb0bfe5b..444d4e91c 100644
--- a/drivers/char/joystick/iforce.c
+++ b/drivers/char/joystick/iforce.c
@@ -54,6 +54,7 @@ MODULE_DESCRIPTION("USB/RS232 I-Force joysticks and wheels driver");
struct iforce {
signed char data[IFORCE_MAX_LENGTH];
+ struct usb_device *usbdev;
struct input_dev dev;
struct urb irq;
int open;
@@ -113,9 +114,11 @@ static int iforce_open(struct input_dev *dev)
{
struct iforce *iforce = dev->private;
- if (dev->idbus == BUS_USB && !iforce->open++)
+ if (dev->idbus == BUS_USB && !iforce->open++) {
+ iforce->irq.dev = iforce->usbdev;
if (usb_submit_urb(&iforce->irq))
return -EIO;
+ }
return 0;
}
@@ -177,15 +180,12 @@ static void iforce_usb_irq(struct urb *urb)
iforce_process_packet(&iforce->dev, iforce->data[0], 8, iforce->data + 1);
}
-static void *iforce_usb_probe(struct usb_device *dev, unsigned int ifnum)
+static void *iforce_usb_probe(struct usb_device *dev, unsigned int ifnum,
+ const struct usb_device_id *id)
{
struct usb_endpoint_descriptor *endpoint;
struct iforce *iforce;
- if (dev->descriptor.idVendor != USB_VENDOR_ID_LOGITECH ||
- dev->descriptor.idProduct != USB_DEVICE_ID_LOGITECH_WMFORCE)
- return NULL;
-
endpoint = dev->config[0].interface[ifnum].altsetting[0].endpoint + 0;
if (!(iforce = kmalloc(sizeof(struct iforce), GFP_KERNEL))) return NULL;
@@ -216,10 +216,21 @@ static void iforce_usb_disconnect(struct usb_device *dev, void *ptr)
kfree(iforce);
}
+static struct usb_device_id iforce_usb_ids [] = {
+ {
+ idVendor: USB_VENDOR_ID_LOGITECH,
+ idProduct: USB_DEVICE_ID_LOGITECH_WMFORCE
+ },
+ { } /* Terminating entry */
+};
+
+MODULE_DEVICE_TABLE (usb, iforce_usb_ids);
+
static struct usb_driver iforce_usb_driver = {
name: "iforce",
probe: iforce_usb_probe,
disconnect: iforce_usb_disconnect,
+ id_table: iforce_usb_ids,
};
#endif
diff --git a/drivers/char/joystick/ns558.c b/drivers/char/joystick/ns558.c
index 573eac51b..36c5d9f9e 100644
--- a/drivers/char/joystick/ns558.c
+++ b/drivers/char/joystick/ns558.c
@@ -58,7 +58,7 @@ struct ns558 {
};
static struct ns558 *ns558;
-static int have_pci_devices;
+static int ns558_pci;
/*
* ns558_isa_probe() tries to find an isa gameport at the
@@ -188,12 +188,10 @@ static int __devinit ns558_pci_probe(struct pci_dev *pdev, const struct pci_devi
}
memset(port, 0, sizeof(struct ns558));
- port->next = ns558;
port->type = NS558_PCI;
port->gameport.io = ioport;
port->gameport.size = iolen;
port->dev = pdev;
- ns558 = port;
pdev->driver_data = port;
@@ -316,9 +314,7 @@ int __init ns558_init(void)
* it is the least-invasive probe.
*/
- i = pci_module_init(&ns558_pci_driver);
- if (i == 0)
- have_pci_devices = 1;
+ ns558_pci = !pci_module_init(&ns558_pci_driver);
/*
* Probe for ISA ports.
@@ -339,12 +335,12 @@ int __init ns558_init(void)
}
#endif
- return ns558 ? 0 : -ENODEV;
+ return (ns558 || ns558_pci) ? 0 : -ENODEV;
}
void __exit ns558_exit(void)
{
- struct ns558 *port = ns558;
+ struct ns558 *next, *port = ns558;
while (port) {
gameport_unregister_port(&port->gameport);
@@ -365,10 +361,12 @@ void __exit ns558_exit(void)
break;
}
- port = port->next;
+ next = port->next;
+ kfree(port);
+ port = next;
}
- if (have_pci_devices)
+ if (ns558_pci)
pci_unregister_driver(&ns558_pci_driver);
}
diff --git a/drivers/char/joystick/sidewinder.c b/drivers/char/joystick/sidewinder.c
index 85be9f8b1..ae31265cb 100644
--- a/drivers/char/joystick/sidewinder.c
+++ b/drivers/char/joystick/sidewinder.c
@@ -102,7 +102,7 @@ static short sw_btn[][12] = {
{ BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_SELECT },
{ BTN_TRIGGER, BTN_THUMB, BTN_TOP, BTN_TOP2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4, BTN_SELECT },
{ BTN_A, BTN_B, BTN_C, BTN_X, BTN_Y, BTN_Z, BTN_TL, BTN_TR, BTN_START, BTN_MODE, BTN_SELECT },
- { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_THUMB2, BTN_BASE, BTN_BASE2, BTN_BASE3 }};
+ { BTN_TRIGGER, BTN_TOP, BTN_THUMB, BTN_THUMB2, BTN_BASE, BTN_BASE2, BTN_BASE3, BTN_BASE4 }};
static struct {
int x;
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 1b49e6e1b..828675d47 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -179,8 +179,11 @@ static inline int noncached_address(unsigned long addr)
* caching for the high addresses through the KEN pin, but
* we maintain the tradition of paranoia in this code.
*/
- return !(boot_cpu_data.x86_capability & X86_FEATURE_MTRR)
- && addr >= __pa(high_memory);
+ return !( test_bit(X86_FEATURE_MTRR, &boot_cpu_data.x86_capability) ||
+ test_bit(X86_FEATURE_K6_MTRR, &boot_cpu_data.x86_capability) ||
+ test_bit(X86_FEATURE_CYRIX_ARR, &boot_cpu_data.x86_capability) ||
+ test_bit(X86_FEATURE_CENTAUR_MCR, &boot_cpu_data.x86_capability) )
+ && addr >= __pa(high_memory);
#else
return addr >= __pa(high_memory);
#endif
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c
index 1681ac603..2ab0563c2 100644
--- a/drivers/char/mxser.c
+++ b/drivers/char/mxser.c
@@ -120,7 +120,7 @@
#define CI104J_ASIC_ID 5
enum {
- MXSER_BOARD_C168_ISA = 1,
+ MXSER_BOARD_C168_ISA = 0,
MXSER_BOARD_C104_ISA,
MXSER_BOARD_CI104J,
MXSER_BOARD_C168_PCI,
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c
index e9585bcaa..3427c1421 100644
--- a/drivers/char/n_hdlc.c
+++ b/drivers/char/n_hdlc.c
@@ -9,7 +9,7 @@
* Al Longyear <longyear@netcom.com>, Paul Mackerras <Paul.Mackerras@cs.anu.edu.au>
*
* Original release 01/11/99
- * ==FILEDATE 20000706==
+ * $Id: n_hdlc.c,v 3.2 2000/11/06 22:34:38 paul Exp $
*
* This code is released under the GNU General Public License (GPL)
*
@@ -78,11 +78,12 @@
*/
#define HDLC_MAGIC 0x239e
-#define HDLC_VERSION "1.16"
+#define HDLC_VERSION "3.2"
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.h>
+#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/types.h>
@@ -93,14 +94,7 @@
#undef VERSION
#define VERSION(major,minor,patch) (((((major)<<8)+(minor))<<8)+(patch))
-#if LINUX_VERSION_CODE < VERSION(2,1,14)
-#include <linux/ioport.h>
-#endif
-
-#if LINUX_VERSION_CODE >= VERSION(2,1,23)
#include <linux/poll.h>
-#endif
-
#include <linux/in.h>
#include <linux/malloc.h>
#include <linux/tty.h>
@@ -118,86 +112,16 @@
#include <linux/kerneld.h>
#endif
-#if LINUX_VERSION_CODE < VERSION(2,3,0)
-typedef struct wait_queue *wait_queue_head_t;
-#define DECLARE_WAITQUEUE(name,task) struct wait_queue (name) = {(task),NULL}
-#define init_waitqueue_head(head) *(head) = NULL
-#define set_current_state(a) current->state = (a)
-#endif
-
-#if LINUX_VERSION_CODE >= VERSION(2,1,4)
#include <asm/segment.h>
#define GET_USER(error,value,addr) error = get_user(value,addr)
#define COPY_FROM_USER(error,dest,src,size) error = copy_from_user(dest,src,size) ? -EFAULT : 0
#define PUT_USER(error,value,addr) error = put_user(value,addr)
#define COPY_TO_USER(error,dest,src,size) error = copy_to_user(dest,src,size) ? -EFAULT : 0
-#if LINUX_VERSION_CODE >= VERSION(2,1,5)
#include <asm/uaccess.h>
-#endif
-
-#else /* 2.0.x and 2.1.x before 2.1.4 */
-
-#define GET_USER(error,value,addr) \
-do { \
- error = verify_area (VERIFY_READ, (void *) addr, sizeof (value)); \
- if (error == 0) \
- value = get_user(addr); \
-} while (0)
-
-#define COPY_FROM_USER(error,dest,src,size) \
-do { \
- error = verify_area (VERIFY_READ, (void *) src, size); \
- if (error == 0) \
- memcpy_fromfs (dest, src, size); \
-} while (0)
-
-#define PUT_USER(error,value,addr) \
-do { \
- error = verify_area (VERIFY_WRITE, (void *) addr, sizeof (value)); \
- if (error == 0) \
- put_user (value, addr); \
-} while (0)
-
-#define COPY_TO_USER(error,dest,src,size) \
-do { \
- error = verify_area (VERIFY_WRITE, (void *) dest, size); \
- if (error == 0) \
- memcpy_tofs (dest, src, size); \
-} while (0)
-
-#endif
-#if LINUX_VERSION_CODE < VERSION(2,1,0)
-#define __init
-typedef int spinlock_t;
-#define spin_lock_init(a)
-#define spin_lock_irqsave(a,b) {save_flags((b));cli();}
-#define spin_unlock_irqrestore(a,b) {restore_flags((b));}
-#define spin_lock(a)
-#define spin_unlock(a)
-#define schedule_timeout(a){current->timeout = jiffies + (a); schedule();}
-#endif
-
-#if LINUX_VERSION_CODE < VERSION(2,1,37)
-#define test_and_set_bit(nr, addr) set_bit(nr, addr)
-#endif
-
-#if LINUX_VERSION_CODE < VERSION(2,1,57)
-#define signal_pending(p) ((p)->signal & ~(p)->blocked)
-#endif
-
-#if LINUX_VERSION_CODE < VERSION(2,1,25)
-#define net_device_stats enet_statistics
-#endif
-
-#if LINUX_VERSION_CODE < VERSION(2,1,60)
-typedef int rw_ret_t;
-typedef unsigned int rw_count_t;
-#else
typedef ssize_t rw_ret_t;
typedef size_t rw_count_t;
-#endif
/*
* Buffers for individual HDLC frames
@@ -261,10 +185,9 @@ N_HDLC_BUF* n_hdlc_buf_get(N_HDLC_BUF_LIST *list);
static struct n_hdlc *n_hdlc_alloc (void);
-#if LINUX_VERSION_CODE >= VERSION(2,1,19)
MODULE_PARM(debuglevel, "i");
MODULE_PARM(maxframe, "i");
-#endif
+
/* debug level can be set by insmod for debugging purposes */
#define DEBUG_LEVEL_INFO 1
@@ -281,13 +204,8 @@ static rw_ret_t n_hdlc_tty_write(struct tty_struct *,
struct file *, const __u8 *, rw_count_t);
static int n_hdlc_tty_ioctl(struct tty_struct *,
struct file *, unsigned int, unsigned long);
-#if LINUX_VERSION_CODE < VERSION(2,1,23)
-static int n_hdlc_tty_select (struct tty_struct *tty, struct inode *inode,
- struct file *filp, int sel_type, select_table * wait);
-#else
static unsigned int n_hdlc_tty_poll (struct tty_struct *tty, struct file *filp,
poll_table * wait);
-#endif
static int n_hdlc_tty_open (struct tty_struct *);
static void n_hdlc_tty_close (struct tty_struct *);
static int n_hdlc_tty_room (struct tty_struct *tty);
@@ -660,11 +578,8 @@ static void n_hdlc_tty_receive(struct tty_struct *tty,
wake_up_interruptible (&n_hdlc->read_wait);
wake_up_interruptible (&n_hdlc->poll_wait);
if (n_hdlc->tty->fasync != NULL)
-#if LINUX_VERSION_CODE < VERSION(2,3,0)
- kill_fasync (n_hdlc->tty->fasync, SIGIO);
-#else
kill_fasync (&n_hdlc->tty->fasync, SIGIO, POLL_IN);
-#endif
+
} /* end of n_hdlc_tty_receive() */
/* n_hdlc_tty_read()
@@ -893,73 +808,6 @@ static int n_hdlc_tty_ioctl (struct tty_struct *tty, struct file * file,
} /* end of n_hdlc_tty_ioctl() */
-#if LINUX_VERSION_CODE < VERSION(2,1,23)
-/* n_hdlc_tty_select()
- *
- * Device select method. Determine if operation requires
- * blocking and if so put appropriate wait queue in select
- * table and return 0, otherwise return 1.
- *
- * Arguments:
- *
- * tty pointer to tty device instance data
- * inode pointer to inode for device
- * filp pointer to file object
- * sel_type identified the select type (read/write/exception)
- * wait select table for adding wait queue if appropriate
- *
- * Return Value:
- *
- * 1 if no need to block on operation
- * 0 if must block and wait queue added to select table
- */
-static int n_hdlc_tty_select (struct tty_struct *tty, struct inode *inode,
- struct file *filp, int sel_type, select_table * wait)
-{
- struct n_hdlc *n_hdlc = tty2n_hdlc(tty);
- int result = 1;
-
- if (debuglevel >= DEBUG_LEVEL_INFO)
- printk("%s(%d)n_hdlc_tty_select() called\n",__FILE__,__LINE__);
-
- /* Verify the status of the device */
- if (!n_hdlc)
- return -EBADF;
-
- if (n_hdlc->magic != HDLC_MAGIC || tty != n_hdlc->tty)
- return -EBADF;
-
- switch (sel_type) {
- case SEL_IN:
- if (n_hdlc->rx_buf_list.head)
- break;
-
- case SEL_EX: /* Exceptions or read errors */
- /* Is this a pty link and the remote disconnected? */
- if (tty->flags & (1 << TTY_OTHER_CLOSED))
- break;
-
- /* Is this a local link and the modem disconnected? */
- if (tty_hung_up_p (filp))
- break;
-
- select_wait (&n_hdlc->read_wait, wait);
- result = 0;
- break;
-
- /* Write mode. A write is allowed if there is no current transmission */
- case SEL_OUT:
- if (!n_hdlc->tx_free_buf_list.head) {
- select_wait (&n_hdlc->write_wait, wait);
- result = 0;
- }
- break;
- }
- return result;
-} /* end of n_hdlc_tty_select() */
-
-#else /* 2.1.23 or later */
-
/* n_hdlc_tty_poll()
*
* TTY callback for poll system call. Determine which
@@ -988,11 +836,8 @@ static unsigned int n_hdlc_tty_poll (struct tty_struct *tty,
if (n_hdlc && n_hdlc->magic == HDLC_MAGIC && tty == n_hdlc->tty) {
/* queue current process into any wait queue that */
/* may awaken in the future (read and write) */
-#if LINUX_VERSION_CODE < VERSION(2,1,89)
- poll_wait(&n_hdlc->poll_wait, wait);
-#else
poll_wait(filp, &n_hdlc->poll_wait, wait);
-#endif
+
/* set bits for operations that wont block */
if(n_hdlc->rx_buf_list.head)
mask |= POLLIN | POLLRDNORM; /* readable */
@@ -1006,8 +851,6 @@ static unsigned int n_hdlc_tty_poll (struct tty_struct *tty,
return mask;
} /* end of n_hdlc_tty_poll() */
-#endif
-
/* n_hdlc_alloc()
*
* Allocate an n_hdlc instance data structure
@@ -1135,14 +978,7 @@ N_HDLC_BUF* n_hdlc_buf_get(N_HDLC_BUF_LIST *list)
} /* end of n_hdlc_buf_get() */
-/* init_module()
- *
- * called when module is loading to register line discipline
- *
- * Arguments: None
- * Return Value: 0 if success, otherwise error code
- */
-int init_module(void)
+static int __init n_hdlc_init(void)
{
static struct tty_ldisc n_hdlc_ldisc;
int status;
@@ -1160,19 +996,13 @@ int init_module(void)
memset(&n_hdlc_ldisc, 0, sizeof (n_hdlc_ldisc));
n_hdlc_ldisc.magic = TTY_LDISC_MAGIC;
-#if LINUX_VERSION_CODE >= VERSION(2,1,28)
n_hdlc_ldisc.name = "hdlc";
-#endif
n_hdlc_ldisc.open = n_hdlc_tty_open;
n_hdlc_ldisc.close = n_hdlc_tty_close;
n_hdlc_ldisc.read = n_hdlc_tty_read;
n_hdlc_ldisc.write = n_hdlc_tty_write;
n_hdlc_ldisc.ioctl = n_hdlc_tty_ioctl;
-#if LINUX_VERSION_CODE < VERSION(2,1,23)
- n_hdlc_ldisc.select = n_hdlc_tty_select;
-#else
n_hdlc_ldisc.poll = n_hdlc_tty_poll;
-#endif
n_hdlc_ldisc.receive_room = n_hdlc_tty_room;
n_hdlc_ldisc.receive_buf = n_hdlc_tty_receive;
n_hdlc_ldisc.write_wakeup = n_hdlc_tty_wakeup;
@@ -1189,14 +1019,7 @@ int init_module(void)
} /* end of init_module() */
-/* cleanup_module()
- *
- * called when module is unloading to unregister line discipline
- *
- * Arguments: None
- * Return Value: None
- */
-void cleanup_module(void)
+static void __exit n_hdlc_exit(void)
{
int status;
/* Release tty registration of line discipline */
@@ -1205,3 +1028,6 @@ void cleanup_module(void)
else
printk("N_HDLC: line discipline unregistered\n");
}
+
+module_init(n_hdlc_init);
+module_exit(n_hdlc_exit);
diff --git a/drivers/char/random.c b/drivers/char/random.c
index bf1242e35..bbd5aff21 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -710,7 +710,7 @@ static void add_timer_randomness(struct timer_rand_state *state, unsigned num)
int entropy = 0;
#if defined (__i386__)
- if (boot_cpu_data.x86_capability & X86_FEATURE_TSC) {
+ if ( test_bit(X86_FEATURE_TSC, &boot_cpu_data.x86_capability) ) {
__u32 high;
__asm__(".byte 0x0f,0x31"
:"=a" (time), "=d" (high));
diff --git a/drivers/char/rio/rio_linux.c b/drivers/char/rio/rio_linux.c
index 7ff56f84f..6b0e3d298 100644
--- a/drivers/char/rio/rio_linux.c
+++ b/drivers/char/rio/rio_linux.c
@@ -1103,8 +1103,6 @@ void fix_rio_pci (PDEV)
#define rio_init init_module
#endif
-extern int gs_debug;
-
int rio_init(void)
{
int found = 0;
@@ -1129,7 +1127,6 @@ int rio_init(void)
func_enter();
rio_dprintk (RIO_DEBUG_INIT, "Initing rio module... (rio_debug=%d)\n",
rio_debug);
- gs_debug = rio_debug >> 24;
if (abs ((long) (&rio_debug) - rio_debug) < 0x10000) {
printk (KERN_WARNING "rio: rio_debug is an address, instead of a value. "
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index d916a6aba..c249cb559 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -654,7 +654,7 @@ static int __init rtc_init(void)
}
}
}
- printk("rtc_init: no PC rtc found\n");
+ printk(KERN_ERR "rtc_init: no PC rtc found\n");
return -EIO;
found:
@@ -670,7 +670,7 @@ found:
* Standard way for sparc to print irq's is to use
* __irq_itoa(). I think for EBus it's ok to use %d.
*/
- printk("rtc: cannot register IRQ %d\n", rtc_irq);
+ printk(KERN_ERR "rtc: cannot register IRQ %d\n", rtc_irq);
return -EIO;
}
#else
@@ -725,7 +725,7 @@ found:
guess = "Digital DECstation";
}
if (guess)
- printk("rtc: %s epoch (%lu) detected\n", guess, epoch);
+ printk(KERN_INFO "rtc: %s epoch (%lu) detected\n", guess, epoch);
#endif
#if RTC_IRQ
init_timer(&rtc_irq_timer);
@@ -792,7 +792,7 @@ static void rtc_dropped_irq(unsigned long data)
spin_unlock_irq(&rtc_lock);
- printk(KERN_INFO "rtc: lost some interrupts at %ldHz.\n", freq);
+ printk(KERN_WARNING "rtc: lost some interrupts at %ldHz.\n", freq);
/* Now we have new data */
wake_up_interruptible(&rtc_wait);
diff --git a/drivers/char/sx.c b/drivers/char/sx.c
index 3dd5811d9..902642151 100644
--- a/drivers/char/sx.c
+++ b/drivers/char/sx.c
@@ -1756,16 +1756,12 @@ static int sx_fw_ioctl (struct inode *inode, struct file *filp,
sx_initialized++;
break;
case SXIO_SETDEBUG:
+ case SXIO_SETGSDEBUG:
sx_debug = arg;
break;
case SXIO_GETDEBUG:
- rc = sx_debug;
- break;
- case SXIO_SETGSDEBUG:
- gs_debug = arg;
- break;
case SXIO_GETGSDEBUG:
- rc = gs_debug;
+ rc = sx_debug;
break;
case SXIO_GETNPORTS:
rc = sx_nports;
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c
index 6da32381e..156c683e4 100644
--- a/drivers/char/synclink.c
+++ b/drivers/char/synclink.c
@@ -1,7 +1,7 @@
/*
* linux/drivers/char/synclink.c
*
- * ==FILEDATE 20000707==
+ * $Id: synclink.c,v 3.2 2000/11/06 22:34:38 paul Exp $
*
* Device driver for Microgate SyncLink ISA and PCI
* high speed multiprotocol serial adapters.
@@ -82,13 +82,9 @@
#include <linux/netdevice.h>
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <asm/serial.h>
-#else
-#include <linux/bios32.h>
-#endif
#include <linux/delay.h>
#include <linux/ioctl.h>
@@ -102,98 +98,21 @@
#include <linux/termios.h>
#include <linux/tqueue.h>
-#if LINUX_VERSION_CODE < VERSION(2,3,0)
-typedef struct wait_queue *wait_queue_head_t;
-#define DECLARE_WAITQUEUE(name,task) struct wait_queue (name) = {(task),NULL}
-#define init_waitqueue_head(head) *(head) = NULL
-#define DECLARE_MUTEX(name) struct semaphore (name) = MUTEX
-#define set_current_state(a) current->state = (a)
-#endif
-
#ifdef CONFIG_SYNCLINK_SYNCPPP_MODULE
#define CONFIG_SYNCLINK_SYNCPPP 1
#endif
#ifdef CONFIG_SYNCLINK_SYNCPPP
-#if LINUX_VERSION_CODE < VERSION(2,3,43)
-#include "../net/syncppp.h"
-#define net_device device
-#define netif_stop_queue(a) (a)->tbusy = 1
-#define netif_start_queue(a) (a)->tbusy = 0
-#define netif_wake_queue(a) (a)->tbusy = 0; mark_bh(NET_BH)
-#define netif_queue_stopped(a) ((a)->tbusy)
-#else
#include "../net/wan/syncppp.h"
#endif
-#endif
-#if LINUX_VERSION_CODE >= VERSION(2,1,4)
#include <asm/segment.h>
#define GET_USER(error,value,addr) error = get_user(value,addr)
#define COPY_FROM_USER(error,dest,src,size) error = copy_from_user(dest,src,size) ? -EFAULT : 0
#define PUT_USER(error,value,addr) error = put_user(value,addr)
#define COPY_TO_USER(error,dest,src,size) error = copy_to_user(dest,src,size) ? -EFAULT : 0
-#if LINUX_VERSION_CODE >= VERSION(2,1,5)
#include <asm/uaccess.h>
-#endif
-
-#else /* 2.0.x and 2.1.x before 2.1.4 */
-
-#define GET_USER(error,value,addr) \
-do { \
- error = verify_area (VERIFY_READ, (void *) addr, sizeof (value)); \
- if (error == 0) \
- value = get_user(addr); \
-} while (0)
-
-#define COPY_FROM_USER(error,dest,src,size) \
-do { \
- error = verify_area (VERIFY_READ, (void *) src, size); \
- if (error == 0) \
- memcpy_fromfs (dest, src, size); \
-} while (0)
-
-#define PUT_USER(error,value,addr) \
-do { \
- error = verify_area (VERIFY_WRITE, (void *) addr, sizeof (value)); \
- if (error == 0) \
- put_user (value, addr); \
-} while (0)
-
-#define COPY_TO_USER(error,dest,src,size) \
-do { \
- error = verify_area (VERIFY_WRITE, (void *) dest, size); \
- if (error == 0) \
- memcpy_tofs (dest, src, size); \
-} while (0)
-
-#endif
-
-#if LINUX_VERSION_CODE < VERSION(2,1,0)
-/*
- * This is used to figure out the divisor speeds and the timeouts
- */
-static int baud_table[] = {
- 0, 50, 75, 110, 134, 150, 200, 300, 600, 1200, 1800, 2400, 4800,
- 9600, 19200, 38400, 57600, 115200, 230400, 460800, 0 };
-
-#define __init
-#define ioremap(a,b) vremap((a),(b))
-#define iounmap(a) vfree((a))
-#define SERIAL_TYPE_NORMAL 1
-#define SERIAL_TYPE_CALLOUT 2
-typedef int spinlock_t;
-#define spin_lock_init(a)
-#define spin_lock_irqsave(a,b) {save_flags((b));cli();}
-#define spin_unlock_irqrestore(a,b) {restore_flags((b));}
-#define spin_lock(a)
-#define spin_unlock(a)
-#define schedule_timeout(a){current->timeout = jiffies + (a); schedule();}
-#define signal_pending(a) ((a)->signal & ~(a)->blocked)
-#endif
-
-
#include "linux/synclink.h"
@@ -365,10 +284,12 @@ struct mgsl_struct {
u32 last_mem_alloc;
unsigned char* memory_base; /* shared memory address (PCI only) */
u32 phys_memory_base;
+ int shared_mem_requested;
unsigned char* lcr_base; /* local config registers (PCI only) */
u32 phys_lcr_base;
u32 lcr_offset;
+ int lcr_mem_requested;
u32 misc_ctrl_value;
char flag_buf[MAX_ASYNC_BUFFER_SIZE];
@@ -389,10 +310,8 @@ struct mgsl_struct {
char netname[10];
struct net_device *netdev;
struct net_device_stats netstats;
-#if LINUX_VERSION_CODE >= VERSION(2,2,16)
struct net_device netdevice;
#endif
-#endif
};
#define MGSL_MAGIC 0x5401
@@ -845,7 +764,7 @@ int mgsl_claim_resources(struct mgsl_struct *info);
void mgsl_release_resources(struct mgsl_struct *info);
void mgsl_add_device(struct mgsl_struct *info);
struct mgsl_struct* mgsl_allocate_device(void);
-int mgsl_enumerate_devices(void);
+int mgsl_enum_isa_devices(void);
/*
* DMA buffer manupulation functions.
@@ -952,7 +871,6 @@ static int debug_level = 0;
static int maxframe[MAX_TOTAL_DEVICES] = {0,};
static int dosyncppp[MAX_TOTAL_DEVICES] = {0,};
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
MODULE_PARM(break_on_load,"i");
MODULE_PARM(ttymajor,"i");
MODULE_PARM(cuamajor,"i");
@@ -962,10 +880,26 @@ MODULE_PARM(dma,"1-" __MODULE_STRING(MAX_ISA_DEVICES) "i");
MODULE_PARM(debug_level,"i");
MODULE_PARM(maxframe,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
MODULE_PARM(dosyncppp,"1-" __MODULE_STRING(MAX_TOTAL_DEVICES) "i");
-#endif
static char *driver_name = "SyncLink serial driver";
-static char *driver_version = "1.21";
+static char *driver_version = "3.2";
+
+static int __init synclink_init_one (struct pci_dev *dev,
+ const struct pci_device_id *ent);
+static void __exit synclink_remove_one (struct pci_dev *dev);
+
+static struct pci_device_id synclink_pci_tbl[] __devinitdata = {
+ { PCI_VENDOR_ID_MICROGATE, PCI_DEVICE_ID_MICROGATE_USC, PCI_ANY_ID, PCI_ANY_ID, },
+ { 0, }, /* terminate list */
+};
+MODULE_DEVICE_TABLE(pci, synclink_pci_tbl);
+
+static struct pci_driver synclink_pci_driver = {
+ name: "synclink",
+ id_table: synclink_pci_tbl,
+ probe: synclink_init_one,
+ remove: synclink_remove_one,
+};
static struct tty_driver serial_driver, callout_driver;
static int serial_refcount;
@@ -977,9 +911,9 @@ static int serial_refcount;
static void mgsl_change_params(struct mgsl_struct *info);
static void mgsl_wait_until_sent(struct tty_struct *tty, int timeout);
-static struct tty_struct **serial_table = NULL;
-static struct termios **serial_termios = NULL;
-static struct termios **serial_termios_locked = NULL;
+static struct tty_struct *serial_table[MAX_TOTAL_DEVICES];
+static struct termios *serial_termios[MAX_TOTAL_DEVICES];
+static struct termios *serial_termios_locked[MAX_TOTAL_DEVICES];
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
@@ -1591,16 +1525,9 @@ void mgsl_isr_receive_data( struct mgsl_struct *info )
icount->parity,icount->frame,icount->overrun);
}
- if ( tty->flip.count ) {
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
+ if ( tty->flip.count )
tty_flip_buffer_push(tty);
-#else
- queue_task(&tty->flip.tqueue, &tq_timer);
-#endif
- }
-
-
-} /* end of mgsl_isr_receive_data() */
+}
/* mgsl_isr_misc()
*
@@ -1795,11 +1722,7 @@ static int startup(struct mgsl_struct * info)
retval = mgsl_adapter_test(info);
if ( retval ) {
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
if (capable(CAP_SYS_ADMIN) && info->tty)
-#else
- if (suser() && info->tty)
-#endif
set_bit(TTY_IO_ERROR, &info->tty->flags);
mgsl_release_resources(info);
return retval;
@@ -1974,21 +1897,8 @@ static void mgsl_change_params(struct mgsl_struct *info)
* allow tty settings to override, otherwise keep the
* current data rate.
*/
- if (info->params.data_rate <= 460800) {
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
+ if (info->params.data_rate <= 460800)
info->params.data_rate = tty_get_baud_rate(info->tty);
-#else
- int i = cflag & CBAUD;
- if (i & CBAUDEX) {
- i &= ~CBAUDEX;
- if (i < 1 || i > 4)
- info->tty->termios->c_cflag &= ~CBAUDEX;
- else
- i += 15;
- }
- info->params.data_rate = baud_table[i];
-#endif
- }
if ( info->params.data_rate ) {
info->timeout = (32*HZ*bits_per_char) /
@@ -2950,7 +2860,6 @@ static int set_modem_info(struct mgsl_struct * info, unsigned int cmd,
} /* end of set_modem_info() */
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
/* mgsl_break() Set or clear transmit break condition
*
* Arguments: tty pointer to tty instance data
@@ -2977,7 +2886,6 @@ static void mgsl_break(struct tty_struct *tty, int break_state)
spin_unlock_irqrestore(&info->irq_spinlock,flags);
} /* end of mgsl_break() */
-#endif
/* mgsl_ioctl() Service an IOCTL request
*
@@ -3100,7 +3008,6 @@ int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long
if (error) return error;
PUT_USER(error,cnow.dcd, &p_cuser->dcd);
if (error) return error;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
PUT_USER(error,cnow.rx, &p_cuser->rx);
if (error) return error;
PUT_USER(error,cnow.tx, &p_cuser->tx);
@@ -3115,7 +3022,6 @@ int mgsl_ioctl_common(struct mgsl_struct *info, unsigned int cmd, unsigned long
if (error) return error;
PUT_USER(error,cnow.buf_overrun, &p_cuser->buf_overrun);
if (error) return error;
-#endif
return 0;
default:
return -ENOIOCTLCMD;
@@ -3596,9 +3502,7 @@ static int mgsl_open(struct tty_struct *tty, struct file * filp)
tmp_buf = (unsigned char *) page;
}
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
info->tty->low_latency = (info->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
-#endif
spin_lock_irqsave(&info->netlock, flags);
if (info->netcount) {
@@ -3985,22 +3889,14 @@ int mgsl_alloc_buffer_list_memory( struct mgsl_struct *info )
} /* end of mgsl_alloc_buffer_list_memory() */
-/*
- * mgsl_free_buffer_list_memory()
- *
- * Free the common DMA buffer allocated for use as the
- * receive and transmit buffer lists. The associated Memory
- * Descriptor List (MDL) is also freed.
- *
+/* Free DMA buffers allocated for use as the
+ * receive and transmit buffer lists.
* Warning:
*
* The data transfer buffers associated with the buffer list
* MUST be freed before freeing the buffer list itself because
* the buffer list contains the information necessary to free
* the individual buffers!
- *
- * Arguments: info pointer to device extension
- * Return Value: None
*/
void mgsl_free_buffer_list_memory( struct mgsl_struct *info )
{
@@ -4138,67 +4034,61 @@ int mgsl_alloc_intermediate_rxbuffer_memory(struct mgsl_struct *info)
void mgsl_free_intermediate_rxbuffer_memory(struct mgsl_struct *info)
{
if ( info->intermediate_rxbuffer )
- kfree( info->intermediate_rxbuffer );
+ kfree(info->intermediate_rxbuffer);
info->intermediate_rxbuffer = NULL;
} /* end of mgsl_free_intermediate_rxbuffer_memory() */
-/* mgsl_claim_resources()
- *
- * Claim all resources used by a device
- *
- * Arguments: info pointer to device instance data
- * Return Value: 0 if success, otherwise -ENODEV
- */
int mgsl_claim_resources(struct mgsl_struct *info)
{
- /* claim 16C32 I/O base address */
-
- if ( check_region(info->io_base,info->io_addr_size) < 0 ) {
+ if (request_region(info->io_base,info->io_addr_size,"synclink") == NULL) {
printk( "%s(%d):I/O address conflict on device %s Addr=%08X\n",
- __FILE__,__LINE__,info->device_name, info->io_base );
+ __FILE__,__LINE__,info->device_name, info->io_base);
return -ENODEV;
}
- request_region(info->io_base,info->io_addr_size,"synclink.o");
info->io_addr_requested = 1;
- /* claim interrupt level */
-
if ( request_irq(info->irq_level,mgsl_interrupt,info->irq_flags,
info->device_name, info ) < 0 ) {
printk( "%s(%d):Cant request interrupt on device %s IRQ=%d\n",
__FILE__,__LINE__,info->device_name, info->irq_level );
- mgsl_release_resources( info );
- return -ENODEV;
+ goto errout;
}
info->irq_requested = 1;
if ( info->bus_type == MGSL_BUS_TYPE_PCI ) {
- /* claim shared memory range */
+ if (request_mem_region(info->phys_memory_base,0x40000,"synclink") == NULL) {
+ printk( "%s(%d):mem addr conflict device %s Addr=%08X\n",
+ __FILE__,__LINE__,info->device_name, info->phys_memory_base);
+ goto errout;
+ }
+ info->shared_mem_requested = 1;
+ if (request_mem_region(info->phys_lcr_base,128,"synclink") == NULL) {
+ printk( "%s(%d):lcr mem addr conflict device %s Addr=%08X\n",
+ __FILE__,__LINE__,info->device_name, info->phys_lcr_base);
+ goto errout;
+ }
+ info->lcr_mem_requested = 1;
+
info->memory_base = ioremap(info->phys_memory_base,0x40000);
if (!info->memory_base) {
printk( "%s(%d):Cant map shared memory on device %s MemAddr=%08X\n",
__FILE__,__LINE__,info->device_name, info->phys_memory_base );
- mgsl_release_resources( info );
- return -ENODEV;
+ goto errout;
}
- /* test the shared memory range */
if ( !mgsl_memory_test(info) ) {
printk( "%s(%d):Failed shared memory test %s MemAddr=%08X\n",
__FILE__,__LINE__,info->device_name, info->phys_memory_base );
- mgsl_release_resources( info );
- return -ENODEV;
+ goto errout;
}
- /* claim LCR memory range */
info->lcr_base = ioremap(info->phys_lcr_base,PAGE_SIZE) + info->lcr_offset;
if (!info->lcr_base) {
printk( "%s(%d):Cant map LCR memory on device %s MemAddr=%08X\n",
__FILE__,__LINE__,info->device_name, info->phys_lcr_base );
- mgsl_release_resources( info );
- return -ENODEV;
+ goto errout;
}
} else {
@@ -4220,21 +4110,16 @@ int mgsl_claim_resources(struct mgsl_struct *info)
if ( mgsl_allocate_dma_buffers(info) < 0 ) {
printk( "%s(%d):Cant allocate DMA buffers on device %s DMA=%d\n",
__FILE__,__LINE__,info->device_name, info->dma_level );
- mgsl_release_resources( info );
- return -ENODEV;
+ goto errout;
}
return 0;
-
+errout:
+ mgsl_release_resources(info);
+ return ENODEV;
+
} /* end of mgsl_claim_resources() */
-/* mgsl_release_resources()
- *
- * Release all resources used by a device
- *
- * Arguments: info pointer to device instance data
- * Return Value: None
- */
void mgsl_release_resources(struct mgsl_struct *info)
{
if ( debug_level >= DEBUG_LEVEL_INFO )
@@ -4245,7 +4130,6 @@ void mgsl_release_resources(struct mgsl_struct *info)
free_irq(info->irq_level, info);
info->irq_requested = 0;
}
-
if ( info->dma_requested ) {
disable_dma(info->dma_level);
free_dma(info->dma_level);
@@ -4258,12 +4142,18 @@ void mgsl_release_resources(struct mgsl_struct *info)
release_region(info->io_base,info->io_addr_size);
info->io_addr_requested = 0;
}
-
+ if ( info->shared_mem_requested ) {
+ release_mem_region(info->phys_memory_base,0x40000);
+ info->shared_mem_requested = 0;
+ }
+ if ( info->lcr_mem_requested ) {
+ release_mem_region(info->phys_lcr_base,128);
+ info->lcr_mem_requested = 0;
+ }
if (info->memory_base){
iounmap(info->memory_base);
info->memory_base = 0;
}
-
if (info->lcr_base){
iounmap(info->lcr_base - info->lcr_offset);
info->lcr_base = 0;
@@ -4367,210 +4257,23 @@ struct mgsl_struct* mgsl_allocate_device()
} /* end of mgsl_allocate_device()*/
-/* mgsl_enumerate_devices()
- *
- * Enumerate SyncLink serial devices based on user specified
- * options for ISA adapters and autodetected PCI adapters.
- *
- * Arguments: None
- * Return Value: 0 if success, otherwise error code
- */
-int mgsl_enumerate_devices()
-{
- struct mgsl_struct *info;
- int i;
-
- /* Check for user specified ISA devices */
-
- for (i=0 ;(i < MAX_ISA_DEVICES) && io[i] && irq[i]; i++){
- if ( debug_level >= DEBUG_LEVEL_INFO )
- printk("ISA device specified io=%04X,irq=%d,dma=%d\n",
- io[i], irq[i], dma[i] );
-
- info = mgsl_allocate_device();
- if ( !info ) {
- /* error allocating device instance data */
- if ( debug_level >= DEBUG_LEVEL_ERROR )
- printk( "can't allocate device instance data.\n");
- continue;
- }
-
- /* Copy user configuration info to device instance data */
- info->io_base = (unsigned int)io[i];
- info->irq_level = (unsigned int)irq[i];
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
- info->irq_level = irq_cannonicalize(info->irq_level);
-#else
- if (info->irq_level == 2)
- info->irq_level = 9;
-#endif
- info->dma_level = (unsigned int)dma[i];
- info->bus_type = MGSL_BUS_TYPE_ISA;
- info->io_addr_size = 16;
- info->irq_flags = 0;
-
- mgsl_add_device( info );
- }
-
-
-#ifdef CONFIG_PCI
- /* Auto detect PCI adapters */
-
- if ( pcibios_present() ) {
- unsigned char bus;
- unsigned char func;
- unsigned int shared_mem_base;
- unsigned int lcr_mem_base;
- unsigned int io_base;
- unsigned char irq_line;
-
- for(i=0;;i++){
- if ( PCIBIOS_SUCCESSFUL == pcibios_find_device(
- MICROGATE_VENDOR_ID, SYNCLINK_DEVICE_ID, i, &bus, &func) ) {
-
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
- struct pci_dev *pdev = pci_find_slot(bus,func);
- irq_line = pdev->irq;
-#else
- if (pcibios_read_config_byte(bus,func,
- PCI_INTERRUPT_LINE,&irq_line) ) {
- printk( "%s(%d):USC I/O addr not set.\n",
- __FILE__,__LINE__);
- continue;
- }
-#endif
-
- if (pcibios_read_config_dword(bus,func,
- PCI_BASE_ADDRESS_3,&shared_mem_base) ) {
- printk( "%s(%d):Shared mem addr not set.\n",
- __FILE__,__LINE__);
- continue;
- }
-
- if (pcibios_read_config_dword(bus,func,
- PCI_BASE_ADDRESS_0,&lcr_mem_base) ) {
- printk( "%s(%d):LCR mem addr not set.\n",
- __FILE__,__LINE__);
- continue;
- }
-
- if (pcibios_read_config_dword(bus,func,
- PCI_BASE_ADDRESS_2,&io_base) ) {
- printk( "%s(%d):USC I/O addr not set.\n",
- __FILE__,__LINE__);
- continue;
- }
-
- info = mgsl_allocate_device();
- if ( !info ) {
- /* error allocating device instance data */
- if ( debug_level >= DEBUG_LEVEL_ERROR )
- printk( "can't allocate device instance data.\n");
- continue;
- }
-
- /* Copy user configuration info to device instance data */
-
- info->io_base = io_base & PCI_BASE_ADDRESS_IO_MASK;
- info->irq_level = (unsigned int)irq_line;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
- info->irq_level = irq_cannonicalize(info->irq_level);
-#else
- if (info->irq_level == 2)
- info->irq_level = 9;
-#endif
- info->phys_memory_base = shared_mem_base & PCI_BASE_ADDRESS_MEM_MASK;
-
- /* Because veremap only works on page boundaries we must map
- * a larger area than is actually implemented for the LCR
- * memory range. We map a full page starting at the page boundary.
- */
- info->phys_lcr_base = lcr_mem_base & PCI_BASE_ADDRESS_MEM_MASK;
- info->lcr_offset = info->phys_lcr_base & (PAGE_SIZE-1);
- info->phys_lcr_base &= ~(PAGE_SIZE-1);
-
- info->bus_type = MGSL_BUS_TYPE_PCI;
- info->io_addr_size = 8;
- info->irq_flags = SA_SHIRQ;
- info->bus = bus;
- info->function = func;
-
- /* Store the PCI9050 misc control register value because a flaw
- * in the PCI9050 prevents LCR registers from being read if
- * BIOS assigns an LCR base address with bit 7 set.
- *
- * Only the misc control register is accessed for which only
- * write access is needed, so set an initial value and change
- * bits to the device instance data as we write the value
- * to the actual misc control register.
- */
- info->misc_ctrl_value = 0x087e4546;
-
- /* add new device to device list */
- mgsl_add_device( info );
- } else {
- break;
- }
- }
- }
-#endif
-
- /*
- * Allocate memory to hold the following tty/termios arrays
- * with an element for each enumerated device.
- */
-
- serial_table = (struct tty_struct**)kmalloc(sizeof(struct tty_struct*)*mgsl_device_count, GFP_KERNEL);
- serial_termios = (struct termios**)kmalloc(sizeof(struct termios*)*mgsl_device_count, GFP_KERNEL);
- serial_termios_locked = (struct termios**)kmalloc(sizeof(struct termios*)*mgsl_device_count, GFP_KERNEL);
-
- if (!serial_table || !serial_termios || !serial_termios_locked){
- printk("%s(%d):Can't allocate tty/termios arrays.\n",
- __FILE__,__LINE__);
- return -ENOMEM;
- }
-
- memset(serial_table,0,sizeof(struct tty_struct*)*mgsl_device_count);
- memset(serial_termios,0,sizeof(struct termios*)*mgsl_device_count);
- memset(serial_termios_locked,0,sizeof(struct termios*)*mgsl_device_count);
-
- return 0;
-
-} /* end of mgsl_enumerate_devices() */
-
-/* mgsl_init()
- *
- * Driver initialization entry point.
- *
- * Arguments: None
- * Return Value: 0 if success, otherwise error code
+/*
+ * perform tty device initialization
*/
-int __init mgsl_init(void)
+int mgsl_init_tty(void);
+int mgsl_init_tty()
{
struct mgsl_struct *info;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
- EXPORT_NO_SYMBOLS;
-#else
- register_symtab(NULL);
-#endif
-
- printk("%s version %s\n", driver_name, driver_version);
-
- /* determine how many SyncLink devices are installed */
- mgsl_enumerate_devices();
- if ( !mgsl_device_list ) {
- printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__);
- return -ENODEV;
- }
+ memset(serial_table,0,sizeof(struct tty_struct*)*MAX_TOTAL_DEVICES);
+ memset(serial_termios,0,sizeof(struct termios*)*MAX_TOTAL_DEVICES);
+ memset(serial_termios_locked,0,sizeof(struct termios*)*MAX_TOTAL_DEVICES);
/* Initialize the tty_driver structure */
memset(&serial_driver, 0, sizeof(struct tty_driver));
serial_driver.magic = TTY_DRIVER_MAGIC;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
serial_driver.driver_name = "synclink";
-#endif
serial_driver.name = "ttySL";
serial_driver.major = ttymajor;
serial_driver.minor_start = 64;
@@ -4597,12 +4300,10 @@ int __init mgsl_init(void)
serial_driver.ioctl = mgsl_ioctl;
serial_driver.throttle = mgsl_throttle;
serial_driver.unthrottle = mgsl_unthrottle;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
serial_driver.send_xchar = mgsl_send_xchar;
serial_driver.break_ctl = mgsl_break;
serial_driver.wait_until_sent = mgsl_wait_until_sent;
serial_driver.read_proc = mgsl_read_proc;
-#endif
serial_driver.set_termios = mgsl_set_termios;
serial_driver.stop = mgsl_stop;
serial_driver.start = mgsl_start;
@@ -4616,10 +4317,8 @@ int __init mgsl_init(void)
callout_driver.name = "cuaSL";
callout_driver.major = cuamajor;
callout_driver.subtype = SERIAL_TYPE_CALLOUT;
-#if LINUX_VERSION_CODE >= VERSION(2,1,0)
callout_driver.read_proc = 0;
callout_driver.proc_entry = 0;
-#endif
if (tty_register_driver(&serial_driver) < 0)
printk("%s(%d):Couldn't register serial driver\n",
@@ -4641,13 +4340,76 @@ int __init mgsl_init(void)
info->normal_termios = serial_driver.init_termios;
info = info->next_device;
}
+
+ return 0;
+}
+
+/* enumerate user specified ISA adapters
+ */
+int mgsl_enum_isa_devices()
+{
+ struct mgsl_struct *info;
+ int i;
+
+ /* Check for user specified ISA devices */
+
+ for (i=0 ;(i < MAX_ISA_DEVICES) && io[i] && irq[i]; i++){
+ if ( debug_level >= DEBUG_LEVEL_INFO )
+ printk("ISA device specified io=%04X,irq=%d,dma=%d\n",
+ io[i], irq[i], dma[i] );
+
+ info = mgsl_allocate_device();
+ if ( !info ) {
+ /* error allocating device instance data */
+ if ( debug_level >= DEBUG_LEVEL_ERROR )
+ printk( "can't allocate device instance data.\n");
+ continue;
+ }
+
+ /* Copy user configuration info to device instance data */
+ info->io_base = (unsigned int)io[i];
+ info->irq_level = (unsigned int)irq[i];
+ info->irq_level = irq_cannonicalize(info->irq_level);
+ info->dma_level = (unsigned int)dma[i];
+ info->bus_type = MGSL_BUS_TYPE_ISA;
+ info->io_addr_size = 16;
+ info->irq_flags = 0;
+
+ mgsl_add_device( info );
+ }
return 0;
+}
+
+/* mgsl_init()
+ *
+ * Driver initialization entry point.
+ *
+ * Arguments: None
+ * Return Value: 0 if success, otherwise error code
+ */
+int __init mgsl_init(void)
+{
+ int rc;
+
+ EXPORT_NO_SYMBOLS;
+
+ printk("%s version %s\n", driver_name, driver_version);
-} /* end of mgsl_init() */
+ mgsl_enum_isa_devices();
+ pci_register_driver(&synclink_pci_driver);
-#ifdef MODULE
-int init_module(void)
+ if ( !mgsl_device_list ) {
+ printk("%s(%d):No SyncLink devices found.\n",__FILE__,__LINE__);
+ return -ENODEV;
+ }
+ if ((rc = mgsl_init_tty()))
+ return rc;
+
+ return 0;
+}
+
+static int __init synclink_init(void)
{
/* Uncomment this to kernel debug module.
* mgsl_get_text_ptr() leaves the .text address in eax
@@ -4661,7 +4423,7 @@ int init_module(void)
return mgsl_init();
}
-void cleanup_module(void)
+static void __exit synclink_exit(void)
{
unsigned long flags;
int rc;
@@ -4693,19 +4455,11 @@ void cleanup_module(void)
tmp_buf = NULL;
}
- if (serial_table)
- kfree(serial_table);
-
- if (serial_termios)
- kfree(serial_termios);
-
- if (serial_termios_locked)
- kfree(serial_termios_locked);
-
-} /* end of cleanup_module() */
-
-#endif /* MODULE */
+ pci_unregister_driver(&synclink_pci_driver);
+}
+module_init(synclink_init);
+module_exit(synclink_exit);
/*
* usc_RTCmd()
@@ -6953,7 +6707,6 @@ BOOLEAN mgsl_irq_test( struct mgsl_struct *info )
while( EndTime-- && !info->irq_occurred ) {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(jiffies_from_ms(10));
- set_current_state(TASK_RUNNING);
}
spin_lock_irqsave(&info->irq_spinlock,flags);
@@ -7567,16 +7320,13 @@ void mgsl_sppp_init(struct mgsl_struct *info)
sprintf(info->netname,"mgsl%d",info->line);
-#if LINUX_VERSION_CODE < VERSION(2,2,16)
- info->netdev = &info->pppdev.dev;
-#else
info->if_ptr = &info->pppdev;
info->netdev = info->pppdev.dev = &info->netdevice;
-#endif
+
sppp_attach(&info->pppdev);
d = info->netdev;
- strcpy(d->name, info->netname);
+ strcpy(d->name,info->netname);
d->base_addr = info->io_base;
d->irq = info->irq_level;
d->dma = info->dma_level;
@@ -7587,10 +7337,9 @@ void mgsl_sppp_init(struct mgsl_struct *info)
d->hard_start_xmit = mgsl_sppp_tx;
d->do_ioctl = mgsl_sppp_ioctl;
d->get_stats = mgsl_net_stats;
-#if LINUX_VERSION_CODE >= VERSION(2,3,43)
d->tx_timeout = mgsl_sppp_tx_timeout;
d->watchdog_timeo = 10*HZ;
-#endif
+
dev_init_buffers(d);
if (register_netdev(d) == -1) {
@@ -7680,17 +7429,7 @@ int mgsl_sppp_tx(struct sk_buff *skb, struct net_device *dev)
if (debug_level >= DEBUG_LEVEL_INFO)
printk("mgsl_sppp_tx(%s)\n",info->netname);
-#if LINUX_VERSION_CODE < VERSION(2,3,43)
- if (dev->tbusy) {
- if (time_before(jiffies, dev->trans_start+10*HZ))
- return -EBUSY; /* 10 seconds timeout */
- mgsl_sppp_tx_timeout(dev);
- }
- if (test_and_set_bit(0, (void*)&dev->tbusy) != 0)
- return -EBUSY;
-#else
netif_stop_queue(dev);
-#endif
info->xmit_cnt = skb->len;
mgsl_load_tx_dma_buffer(info, skb->data, skb->len);
@@ -7777,3 +7516,57 @@ int mgsl_sppp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
}
#endif /* ifdef CONFIG_SYNCLINK_SYNCPPP */
+
+static int __init synclink_init_one (struct pci_dev *dev,
+ const struct pci_device_id *ent)
+{
+ struct mgsl_struct *info;
+
+ if (pci_enable_device(dev)) {
+ printk("error enabling pci device %p\n", dev);
+ return -EIO;
+ }
+
+ if (!(info = mgsl_allocate_device())) {
+ printk("can't allocate device instance data.\n");
+ return -EIO;
+ }
+
+ /* Copy user configuration info to device instance data */
+
+ info->io_base = pci_resource_start(dev, 2);
+ info->irq_level = dev->irq;
+ info->phys_memory_base = pci_resource_start(dev, 3);
+
+ /* Because veremap only works on page boundaries we must map
+ * a larger area than is actually implemented for the LCR
+ * memory range. We map a full page starting at the page boundary.
+ */
+ info->phys_lcr_base = pci_resource_start(dev, 0);
+ info->lcr_offset = info->phys_lcr_base & (PAGE_SIZE-1);
+ info->phys_lcr_base &= ~(PAGE_SIZE-1);
+
+ info->bus_type = MGSL_BUS_TYPE_PCI;
+ info->io_addr_size = 8;
+ info->irq_flags = SA_SHIRQ;
+
+ /* Store the PCI9050 misc control register value because a flaw
+ * in the PCI9050 prevents LCR registers from being read if
+ * BIOS assigns an LCR base address with bit 7 set.
+ *
+ * Only the misc control register is accessed for which only
+ * write access is needed, so set an initial value and change
+ * bits to the device instance data as we write the value
+ * to the actual misc control register.
+ */
+ info->misc_ctrl_value = 0x087e4546;
+
+ mgsl_add_device(info);
+
+ return 0;
+}
+
+static void __exit synclink_remove_one (struct pci_dev *dev)
+{
+}
+