@@ -37,7+37,7 @@ void mcheck_fault(void) high&=~(1<<31);
if(high&(1<<27))
{
- rdmsr(0x402+i*4, alow, ahigh);
+ rdmsr(0x403+i*4, alow, ahigh);
printk("[%08x%08x]", alow, ahigh);
}
if(high&(1<<26))
@@ -47,6+47,8 @@ void mcheck_fault(void) high, low);
}
wrmsr(0x401+i*4, low, high);
+ /* Serialize */
+ mb();
}
}
@@ -187,7+187,7 @@ static int cpia_usb_open(void *privdata) if (ret < 0) {
printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret);
retval = -EBUSY;
- goto error_all;
+ goto error_1;
}
ucpia->buffers[0]->status = FRAME_EMPTY;
@@ -204,7+204,7 @@ static int cpia_usb_open(void *privdata) if (!urb) {
printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 0\n");
retval = -ENOMEM;
- goto error_all;
+ goto error_1;
}
ucpia->sbuf[0].urb = urb;
@@ -223,9+223,9 @@ static int cpia_usb_open(void *privdata)
urb = usb_alloc_urb(FRAMES_PER_DESC);
if (!urb) {
- printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 0\n");
+ printk(KERN_ERR "cpia_init_isoc: usb_alloc_urb 1\n");
retval = -ENOMEM;
- goto error_all;
+ goto error_urb0;
}
ucpia->sbuf[1].urb = urb;
@@ -246,20+246,30 @@ static int cpia_usb_open(void *privdata) ucpia->sbuf[0].urb->next = ucpia->sbuf[1].urb;
err = usb_submit_urb(ucpia->sbuf[0].urb);
- if (err)
+ if (err) {
printk(KERN_ERR "cpia_init_isoc: usb_submit_urb 0 ret %d\n",
err);
+ goto error_urb1;
+ }
err = usb_submit_urb(ucpia->sbuf[1].urb);
- if (err)
+ if (err) {
printk(KERN_ERR "cpia_init_isoc: usb_submit_urb 1 ret %d\n",
err);
+ goto error_urb1;
+ }
ucpia->streaming = 1;
ucpia->open = 1;
return 0;
-error_all:
+error_urb1: /* free urb 1 */
+ usb_free_urb(ucpia->sbuf[1].urb);
+
+error_urb0: /* free urb 0 */
+ usb_free_urb(ucpia->sbuf[0].urb);
+
+error_1:
kfree (ucpia->sbuf[1].data);
error_0:
kfree (ucpia->sbuf[0].data);
@@ -46,8+46,8 @@ proc_bus_pci_read(struct file *file, char *buf, size_t nbytes, loff_t *ppos) const struct inode *ino = file->f_dentry->d_inode;
const struct proc_dir_entry *dp = ino->u.generic_ip;
struct pci_dev *dev = dp->data;
- int pos = *ppos;
- int cnt, size;
+ unsigned int pos = *ppos;
+ unsigned int cnt, size;
/*
* Normal users can read only the standardized portion of the
@@ -137,7+137,7 @@ obj-m := $(filter-out $(obj-y), $(obj-m)) int-m := $(filter-out $(int-y), $(int-m))
# Take multi-part drivers out of obj-y and put components in.
-# obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y)
+obj-y := $(filter-out $(list-multi), $(obj-y)) $(int-y)
O_OBJS := $(filter-out $(export-objs), $(obj-y))
OX_OBJS := $(filter $(export-objs), $(obj-y))
@@ -147,12+147,12 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){ hname = (tpnt->proc_name) ? tpnt->proc_name : "";
hname_len = strlen(hname);
for (shn = scsi_host_no_list;shn;shn = shn->next) {
- if (!(shn->host_registered) && shn->loaded_as_module &&
+ if (!(shn->host_registered) &&
(hname_len > 0) && (0 == strncmp(hname, shn->name, hname_len))) {
flag_new = 0;
retval->host_no = shn->host_no;
shn->host_registered = 1;
- shn->loaded_as_module = scsi_loadable_module_flag;
+ shn->loaded_as_module = 1;
break;
}
}
@@ -161,7+161,7 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){ retval->host_failed = 0;
if(j > 0xffff) panic("Too many extra bytes requested\n");
retval->extra_bytes = j;
- retval->loaded_as_module = scsi_loadable_module_flag;
+ retval->loaded_as_module = 1;
if (flag_new) {
shn = (Scsi_Host_Name *) kmalloc(sizeof(Scsi_Host_Name), GFP_ATOMIC);
shn->name = kmalloc(hname_len + 1, GFP_ATOMIC);
@@ -170,7+170,7 @@ struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){ shn->name[hname_len] = 0;
shn->host_no = max_scsi_hosts++;
shn->host_registered = 1;
- shn->loaded_as_module = scsi_loadable_module_flag;
+ shn->loaded_as_module = 1;
shn->next = NULL;
if (scsi_host_no_list) {
for (shn2 = scsi_host_no_list;shn2->next;shn2 = shn2->next)
@@ -459,7+459,6 @@ extern void build_proc_dir_entries(Scsi_Host_Template *);
extern int next_scsi_host;
-extern int scsi_loadable_module_flag;
unsigned int scsi_init(void);
extern struct Scsi_Host * scsi_register(Scsi_Host_Template *, int j);
extern void scsi_unregister(struct Scsi_Host * i);
@@ -1375,8+1375,6 @@ void scsi_finish_command(Scsi_Cmnd * SCpnt) static int scsi_register_host(Scsi_Host_Template *);
static void scsi_unregister_host(Scsi_Host_Template *);
-int scsi_loadable_module_flag; /* Set after we scan builtin drivers */
-
/*
* Function: scsi_release_commandblocks()
*
@@ -1440,10+1438,9 @@ void scsi_build_commandblocks(Scsi_Device * SDpnt) kmalloc(sizeof(Scsi_Cmnd),
GFP_ATOMIC |
(host->unchecked_isa_dma ? GFP_DMA : 0));
- memset(SCpnt, 0, sizeof(Scsi_Cmnd));
if (NULL == SCpnt)
break; /* If not, the next line will oops ... */
- memset(&SCpnt->eh_timeout, 0, sizeof(SCpnt->eh_timeout));
+ memset(SCpnt, 0, sizeof(Scsi_Cmnd));
SCpnt->host = host;
SCpnt->device = SDpnt;
SCpnt->target = SDpnt->id;
@@ -1978,8+1975,6 @@ static void scsi_unregister_host(Scsi_Host_Template * tpnt) struct Scsi_Device_Template *sdtpnt;
struct Scsi_Host *sh1;
struct Scsi_Host *shpnt;
- Scsi_Host_Template *SHT;
- Scsi_Host_Template *SHTp;
char name[10]; /* host_no>=10^9? I don't think so. */
/*
@@ -2115,7+2110,7 @@ static void scsi_unregister_host(Scsi_Host_Template * tpnt)
for (shpnt = scsi_hostlist; shpnt; shpnt = sh1) {
sh1 = shpnt->next;
- if (shpnt->hostt != tpnt || !shpnt->loaded_as_module)
+ if (shpnt->hostt != tpnt)
continue;
pcount = next_scsi_host;
/* Remove the /proc/scsi directory entry */
@@ -2129,7+2124,7 @@ static void scsi_unregister_host(Scsi_Host_Template * tpnt) * written host adapters.
*/
if (shpnt->irq)
- free_irq(shpnt->irq, NULL);
+ free_irq(shpnt->irq, NULL);
if (shpnt->dma_channel != 0xff)
free_dma(shpnt->dma_channel);
if (shpnt->io_port && shpnt->n_io_port)
@@ -2158,24+2153,21 @@ static void scsi_unregister_host(Scsi_Host_Template * tpnt) (scsi_memory_upper_value - scsi_init_memory_start) / 1024);
#endif
- /* There were some hosts that were loaded at boot time, so we cannot
- do any more than this */
- if (tpnt->present)
- return;
+ /* Remove it from the linked list and /proc */
+ if (tpnt->present) {
+ Scsi_Host_Template **SHTp = &scsi_hosts;
+ Scsi_Host_Template *SHT;
- /* OK, this is the very last step. Remove this host adapter from the
- linked list. */
- for (SHTp = NULL, SHT = scsi_hosts; SHT; SHTp = SHT, SHT = SHT->next)
- if (SHT == tpnt) {
- if (SHTp)
- SHTp->next = SHT->next;
- else
- scsi_hosts = SHT->next;
- SHT->next = NULL;
- break;
+ while ((SHT = *SHTp) != NULL) {
+ if (SHT == tpnt) {
+ *SHTp = SHT->next;
+ break;
+ }
+ SHTp = &SHT->next;
}
- /* Rebuild the /proc/scsi directory entries */
- remove_proc_entry(tpnt->proc_name, proc_scsi);
+ /* Rebuild the /proc/scsi directory entries */
+ remove_proc_entry(tpnt->proc_name, proc_scsi);
+ }
MOD_DEC_USE_COUNT;
}
@@ -2514,8+2506,6 @@ static int __init init_scsi(void) generic->write_proc = proc_scsi_gen_write;
#endif
- scsi_loadable_module_flag = 1;
-
scsi_devfs_handle = devfs_mk_dir (NULL, "scsi", NULL);
scsi_host_no_init (scsihosts);
/*
/*
- * $Id: hid.c,v 1.14 2000/08/14 21:05:26 vojtech Exp $
+ * $Id: hid.c,v 1.16 2000/09/18 21:38:55 vojtech Exp $
*
* Copyright (c) 1999 Andreas Gal
* Copyright (c) 2000 Vojtech Pavlik
@@ -924,6+924,8 @@ static void hid_configure_usage(struct hid_device *device, struct hid_field *fie usage->code = find_next_zero_bit(bit, max + 1, usage->code);
}
+ if (usage->code > max) return;
+
if (usage->type == EV_ABS) {
int a = field->logical_minimum;
int b = field->logical_maximum;
@@ -936,7+938,7 @@ static void hid_configure_usage(struct hid_device *device, struct hid_field *fie
if (usage->hat) {
int i;
- for (i = usage->code; i < usage->code + 2; i++) {
+ for (i = usage->code; i < usage->code + 2 && i <= max; i++) {
input->absmax[i] = 1;
input->absmin[i] = -1;
input->absfuzz[i] = 0;
* 20000603 Version 0.2.1
* 20000620 minor cosmetic changes
* 20000620 Version 0.2.2
- * 20000822 Hopefully fixed deadlock in mts_remove_nolock()
- * 20000822 Fixed minor race in mts_transfer_cleanup()
- * 20000822 Fixed deadlock on submission error in queuecommand
- * 20000822 Version 0.2.3
+ * 20000822 Hopefully fixed deadlock in mts_remove_nolock()
+ * 20000822 Fixed minor race in mts_transfer_cleanup()
+ * 20000822 Fixed deadlock on submission error in queuecommand
+ * 20000822 Version 0.2.3
+ * 20000913 Reduced module size if debugging is off
+ * 20000913 Version 0.2.4
*/
#include <linux/module.h>
@@ -151,7+153,7 @@ static struct usb_driver mts_usb_driver = {
/* Internal driver stuff */
-#define MTS_VERSION "0.2.3"
+#define MTS_VERSION "0.2.4"
#define MTS_NAME "microtek usb (rev " MTS_VERSION "): "
#define MTS_WARNING(x...) \
@@ -198,6+200,8 @@ static struct usb_driver mts_usb_driver = { MTS_DEBUG_INT();\
} while (0)
+#ifdef MTS_DO_DEBUG
+
static inline void mts_debug_dump(struct mts_desc* desc) {
MTS_DEBUG("desc at 0x%x: halted = %x%x, toggle = %x%x\n",
(int)desc,(int)desc->usb_dev->halted[1],(int)desc->usb_dev->halted[0],
@@ -293,6+297,23 @@ static inline void mts_show_command(Scsi_Cmnd *srb) srb->cmnd[6], srb->cmnd[7], srb->cmnd[8], srb->cmnd[9]);
}
+#else
+
+static inline void mts_show_command(Scsi_Cmnd *srb)
+{
+ while (0) {}
+}
+
+static inline void mts_debug_dump(struct mts_desc* desc)
+{
+ while (0) {}
+}
+
+#endif
+
+
+
+
static inline int mts_is_aborting(struct mts_desc* desc) {
return (atomic_read(&desc->context.do_abort));
}