From e7588de3fe4a9b3650fcd787bfd653ff70d6b7fd Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Fri, 23 Nov 2007 15:11:59 -0500 Subject: [PATCH] Import 2.0.36pre10 --- arch/i386/math-emu/reg_u_sub.S | 2 +- drivers/char/isicom.c | 89 +++++++++++++++++++----- drivers/char/random.c | 2 +- drivers/net/de4x5.c | 2 +- drivers/scsi/sd.c | 4 +- drivers/scsi/seagate.c | 2 +- drivers/sound/Readme | 2 +- drivers/sound/ad1848_mixer.h | 2 +- fs/fat/misc.c | 2 +- include/linux/interrupt.h | 3 +- {drivers/char => include/linux}/isicom.h | 26 +++---- include/linux/types.h | 3 +- init/main.c | 2 +- mm/swapfile.c | 2 + net/socket.c | 2 +- 15 files changed, 101 insertions(+), 44 deletions(-) rename {drivers/char => include/linux}/isicom.h (95%) diff --git a/arch/i386/math-emu/reg_u_sub.S b/arch/i386/math-emu/reg_u_sub.S index 89167026002b..03c961cc41e6 100644 --- a/arch/i386/math-emu/reg_u_sub.S +++ b/arch/i386/math-emu/reg_u_sub.S @@ -66,7 +66,7 @@ xOp2_not_denorm: /* source 2 is always smaller than source 1 */ js L_bugged_1 - testl $0x80000000,SIGH(%edi) /* The args are assumed to be be normalized */ + testl $0x80000000,SIGH(%edi) /* The args are assumed to be normalized */ je L_bugged_2 testl $0x80000000,SIGH(%esi) diff --git a/drivers/char/isicom.c b/drivers/char/isicom.c index de2383c99b9a..fbbf48bfc1b4 100644 --- a/drivers/char/isicom.c +++ b/drivers/char/isicom.c @@ -14,6 +14,12 @@ * Printk clean up */ +/* + * Currently ISICOM_BH is hard coded to 16 in isicom.h, cannot + * ask the kernel for a free slot as of 2.0.x - sameer + */ + + #include #include #include @@ -31,7 +37,7 @@ #include #include #include -#include "isicom.h" +#include static int isicom_refcount = 0; static int prev_card = 3; /* start servicing isi_card[0] */ @@ -108,7 +114,7 @@ extern inline int WaitTillCardIsFree(unsigned short base) static int ISILoad_open(struct inode *inode, struct file *filp) { #ifdef ISICOM_DEBUG - printk(KERN_DEBUG "ISILoad:Card%d Opened!!!\n",MINOR(inode->i_rdev)+1); + printk(KERN_DEBUG "ISILoad:Firmware loader Opened!!!\n"); #endif return 0; } @@ -116,7 +122,7 @@ static int ISILoad_open(struct inode *inode, struct file *filp) static void ISILoad_release(struct inode *inode, struct file *filp) { #ifdef ISICOM_DEBUG - printk(KERN_DEBUG "ISILoad:Card%d Close(Release)d\n",MINOR(inode->i_rdev)+1); + printk(KERN_DEBUG "ISILoad:Firmware loader Close(Release)d\n",); #endif } @@ -128,15 +134,20 @@ static int ISILoad_ioctl(struct inode *inode, struct file *filp, bin_frame frame; /* exec_record exec_rec; */ - i=get_user((int *)arg); - if(i<0 || i >= BOARD_COUNT) + /* Added this check to avoid oopses on an ioctl with no + * args - sameer + */ + error=verify_area(VERIFY_READ, (void *) arg, sizeof(int)); + if (error) + return error; + card=get_user((int *)arg); + if(card < 0 || card >= BOARD_COUNT) return -ENXIO; - card=i; base=isi_card[card].base; if(base==0) - return -ENXIO; + return -ENXIO; /* disabled or not used */ switch(cmd) { case MIOCTL_RESET_CARD: @@ -347,7 +358,7 @@ extern inline void schedule_bh(struct isi_port * port) static void isicom_tx(unsigned long _data) { short count = (BOARD_COUNT-1), card, base; - short txcount, wait, wrd; + short txcount, wait, wrd, residue, word_count, cnt; struct isi_port * port; struct tty_struct * tty; unsigned long flags; @@ -357,11 +368,11 @@ static void isicom_tx(unsigned long _data) #endif /* find next active board */ - card = (prev_card + 1) % 4; + card = (prev_card + 1) & 0x0003; while(count-- > 0) { if (isi_card[card].status & BOARD_ACTIVE) break; - card = (card + 1) % 4; + card = (card + 1) & 0x0003; } if (!(isi_card[card].status & BOARD_ACTIVE)) goto sched_again; @@ -383,7 +394,7 @@ static void isicom_tx(unsigned long _data) restore_flags(flags); continue; } - wait = 300; + wait = 200; while(((inw(base+0x0e) & 0x01) == 0) && (wait-- > 0)); if (wait <= 0) { restore_flags(flags); @@ -407,6 +418,45 @@ static void isicom_tx(unsigned long _data) #endif outw((port->channel << isi_card[card].shift_count) | txcount , base); + residue = NO; + wrd = 0; + while (1) { + cnt = MIN(txcount, (SERIAL_XMIT_SIZE - port->xmit_tail)); + if (residue == YES) { + residue = NO; + if (cnt > 0) { + wrd |= (port->xmit_buf[port->xmit_tail] << 8); + port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); + port->xmit_cnt--; + txcount--; + cnt--; + outw(wrd, base); + } + else { + outw(wrd, base); + break; + } + } + if (cnt <= 0) break; + word_count = cnt >> 1; + outsw(base, port->xmit_buf+port->xmit_tail, word_count); + port->xmit_tail = (port->xmit_tail + (word_count << 1)) & + (SERIAL_XMIT_SIZE - 1); + txcount -= (word_count << 1); + port->xmit_cnt -= (word_count << 1); + if (cnt & 0x0001) { + residue = YES; + wrd = port->xmit_buf[port->xmit_tail]; + port->xmit_tail = (port->xmit_tail + 1) & (SERIAL_XMIT_SIZE - 1); + port->xmit_cnt--; + txcount--; + } + } +/* + * Replaced the code below with hopefully a faster loop - sameer + */ + +/* while (1) { wrd = port->xmit_buf[port->xmit_tail++]; port->xmit_tail = port->xmit_tail & (SERIAL_XMIT_SIZE - 1); @@ -423,6 +473,7 @@ static void isicom_tx(unsigned long _data) break; } } +*/ InterruptTheCard(base); if (port->xmit_cnt <= 0) port->status &= ~ISI_TXOK; @@ -436,7 +487,7 @@ sched_again: if (!re_schedule) return; init_timer(&tx); - tx.expires = jiffies + 1; + tx.expires = jiffies + HZ/100; tx.data = 0; tx.function = isicom_tx; add_timer(&tx); @@ -608,7 +659,7 @@ static void isicom_interrupt(int irq, void * dev_id, struct pt_regs * regs) insw(base, tty->flip.char_buf_ptr, word_count); tty->flip.char_buf_ptr += (word_count << 1); byte_count -= (word_count << 1); - if (count % 2) { + if (count & 0x0001) { *tty->flip.char_buf_ptr++ = (char)(inw(base) & 0xff); byte_count -= 2; } @@ -616,12 +667,13 @@ static void isicom_interrupt(int irq, void * dev_id, struct pt_regs * regs) tty->flip.flag_buf_ptr += count; tty->flip.count += count; - if (byte_count > 0) + if (byte_count > 0) { printk(KERN_DEBUG "ISICOM: Intr(0x%x:%d): Flip buffer overflow! dropping bytes...\n", base, channel+1); - while(byte_count > 0) { /* drain out unread xtra data */ - inw(base); - byte_count -= 2; + while(byte_count > 0) { /* drain out unread xtra data */ + inw(base); + byte_count -= 2; + } } queue_task_irq_off(&tty->flip.tqueue, &tq_timer); } @@ -1305,7 +1357,8 @@ static int isicom_get_modem_info(struct isi_port * port, unsigned int * value) ((status & ISI_DTR) ? TIOCM_DTR : 0) | ((status & ISI_DCD) ? TIOCM_CAR : 0) | ((status & ISI_DSR) ? TIOCM_DSR : 0) | - ((status & ISI_CTS) ? TIOCM_CTS : 0); + ((status & ISI_CTS) ? TIOCM_CTS : 0) | + ((status & ISI_RI ) ? TIOCM_RI : 0); put_user(info, (unsigned long *) value); return 0; } diff --git a/drivers/char/random.c b/drivers/char/random.c index ab0ed7f2fe0b..3e8d21d55036 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1500,7 +1500,7 @@ static inline unsigned long long get_clock_cnt(void) { unsigned long low, high; __asm__(".byte 0x0f,0x31" :"=a" (low), "=d" (high)); - return (((unsigned long long) high << 31) | low); + return (((unsigned long long) high << 32) | low); } static void initialize_benchmark(struct random_benchmark *bench, diff --git a/drivers/net/de4x5.c b/drivers/net/de4x5.c index 21b3497240d6..1b641b1e11df 100644 --- a/drivers/net/de4x5.c +++ b/drivers/net/de4x5.c @@ -1563,7 +1563,7 @@ de4x5_interrupt(int irq, void *dev_id, struct pt_regs *regs) lp = (struct de4x5_private *)dev->priv; iobase = dev->base_addr; - if (dev->interrupt) + if (test_and_set_bit(0, (void*) &dev->interrupt)) printk("%s: Re-entering the interrupt handler.\n", dev->name); DISABLE_IRQs; /* Ensure non re-entrancy */ diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 8e0da4b81670..c647ab44e5cd 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -424,8 +424,8 @@ static void rw_intr (Scsi_Cmnd *SCpnt) /* If we had an ILLEGAL REQUEST returned, then we may have * performed an unsupported command. The only thing this should be * would be a ten byte read where only a six byte read was supported. - * Also, on a system where READ CAPACITY failed, we have have read - * past the end of the disk. + * Also, on a system where READ CAPACITY failed, we have read past + * the end of the disk. */ if (SCpnt->sense_buffer[2] == ILLEGAL_REQUEST) { diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index c23fdb97ec7f..9e94274644e1 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c @@ -689,7 +689,7 @@ static int internal_command(unsigned char target, unsigned char lun, const void return DID_BAD_TARGET; /* - * We work it differently depending on if this is is "the first time," + * We work it differently depending on if this is "the first time," * or a reconnect. If this is a reselect phase, then SEL will * be asserted, and we must skip selection / arbitration phases. */ diff --git a/drivers/sound/Readme b/drivers/sound/Readme index faf1b40517ca..14154f3bcfde 100644 --- a/drivers/sound/Readme +++ b/drivers/sound/Readme @@ -157,7 +157,7 @@ The following errors are likely with /dev/dsp and /dev/audio. with impossible parameters. Check that the application is for sound driver version 2.X or later. -In general the printout of of /dev/sndstat should tell what is the problem. +In general the printout of /dev/sndstat should tell what is the problem. It's possible that there are bugs in the sound driver but 99% of the problems reported to me are caused by somehow incorrect setup during "make config". diff --git a/drivers/sound/ad1848_mixer.h b/drivers/sound/ad1848_mixer.h index 073c14d95bbc..46123483f4de 100644 --- a/drivers/sound/ad1848_mixer.h +++ b/drivers/sound/ad1848_mixer.h @@ -17,7 +17,7 @@ * The AD1848 codec has generic input lines called Line, Aux1 and Aux2. * Soundcard manufacturers have connected actual inputs (CD, synth, line, * etc) to these inputs in different order. Therefore it's difficult - * to assign mixer channels to to these inputs correctly. The following + * to assign mixer channels to these inputs correctly. The following * contains two alternative mappings. The first one is for GUS MAX and * the second is just a generic one (line1, line2 and line3). * (Actually this is not a mapping but rather some kind of interleaving diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 64790c59296a..f710b7ffc033 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c @@ -515,7 +515,7 @@ static int raw_scan_nonroot(struct super_block *sb,int start,const char *name, /* * raw_scan performs raw_scan_sector on any sector. * - * NOTE: raw_scan must not be used on a directory that is is the process of + * NOTE: raw_scan must not be used on a directory that is the process of * being created. */ diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h index ebcfa55dad30..8654a4f2ac8e 100644 --- a/include/linux/interrupt.h +++ b/include/linux/interrupt.h @@ -39,7 +39,8 @@ enum { IMMEDIATE_BH, KEYBOARD_BH, CYCLADES_BH, - CM206_BH + CM206_BH, + ISICOM_BH }; extern inline void init_bh(int nr, void (*routine)(void)) diff --git a/drivers/char/isicom.h b/include/linux/isicom.h similarity index 95% rename from drivers/char/isicom.h rename to include/linux/isicom.h index 040d2f05b097..cea7d6f5ec0b 100644 --- a/drivers/char/isicom.h +++ b/include/linux/isicom.h @@ -1,23 +1,19 @@ -#ifndef ISICOM_H -#define ISICOM_H +#ifndef _LINUX_ISICOM_H +#define _LINUX_ISICOM_H /*#define ISICOM_DEBUG*/ /*#define ISICOM_DEBUG_DTR_RTS*/ - /* * Firmware Loader definitions ... */ - -#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ -#define ISILOAD_NAME "ISILoad" -#define MultiTech ('M'<<8) -#define MIOCTL_LOAD_FIRMWARE (MultiTech | 0x01) -#define MIOCTL_READ_FIRMWARE (MultiTech | 0x02) -#define MIOCTL_XFER_CTRL (MultiTech | 0x03) -#define MIOCTL_RESET_CARD (MultiTech | 0x04) +#define __MultiTech ('M'<<8) +#define MIOCTL_LOAD_FIRMWARE (__MultiTech | 0x01) +#define MIOCTL_READ_FIRMWARE (__MultiTech | 0x02) +#define MIOCTL_XFER_CTRL (__MultiTech | 0x03) +#define MIOCTL_RESET_CARD (__MultiTech | 0x04) #define DATA_SIZE 16 @@ -42,6 +38,12 @@ typedef struct { #ifdef __KERNEL__ +#define YES 1 +#define NO 0 + +#define ISILOAD_MISC_MINOR 155 /* /dev/isctl */ +#define ISILOAD_NAME "ISILoad" + /* * ISICOM Driver definitions ... * @@ -57,8 +59,6 @@ typedef struct { #define ISICOM_CMAJOR 113 /* callout */ #define ISICOM_MAGIC (('M' << 8) | 'T') -#define ISICOM_BH 16 /* bottom half entry # */ - #define WAKEUP_CHARS 256 /* hard coded for now */ #define TX_SIZE 254 diff --git a/include/linux/types.h b/include/linux/types.h index 5eed5ab0cc41..504b8657b0c2 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -1,11 +1,12 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H -#ifdef __KERNEL__ +#if defined(__KERNEL__) && !defined(STDC_HEADERS) #if ((__GNUC_MINOR__ >= 8) || (__GNUC_MAJOR >=3)) #warning "This code is tested with gcc 2.7.2.x only. Using egcs/gcc 2.8.x needs" #warning "additional patches that have not been sufficiently tested to include by" #warning "default." +#warning "See http://www.suse.de/~florian/kernel+egcs.html for more information" #error "Remove this if you have applied the gcc 2.8/egcs patches and wish to use them" #endif #endif diff --git a/init/main.c b/init/main.c index f9eb10641d2c..44d5a78287c9 100644 --- a/init/main.c +++ b/init/main.c @@ -949,7 +949,7 @@ asmlinkage void start_kernel(void) sti(); check_bugs(); -#ifdef CONFIG_MTRR +#if defined(CONFIG_MTRR) && defined(__SMP__) init_mtrr_config(); #endif diff --git a/mm/swapfile.c b/mm/swapfile.c index 7c7e1c0ad43f..f7eda6c4d236 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -314,7 +314,9 @@ static int try_to_unuse(unsigned int type) nr++; } free_page(page); +#ifdef CONFIG_SYSVIPC shm_unuse(type); +#endif return 0; } diff --git a/net/socket.c b/net/socket.c index 609ea6041052..7d73eac5c35c 100644 --- a/net/socket.c +++ b/net/socket.c @@ -707,7 +707,7 @@ asmlinkage int sys_bind(int fd, struct sockaddr *umyaddr, int addrlen) err = 0; out: sockfd_put(sock); - return(0); + return err; } -- 2.39.5