]> git.neil.brown.name Git - history.git/commitdiff
Import 1.1.26 1.1.26
authorLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:33 +0000 (15:09 -0500)
committerLinus Torvalds <torvalds@linuxfoundation.org>
Fri, 23 Nov 2007 20:09:33 +0000 (15:09 -0500)
20 files changed:
Makefile
config.in
drivers/block/Makefile
drivers/block/README.sbpcd
drivers/block/blk.h
drivers/block/mcd.c
drivers/block/sbpcd.c
drivers/char/n_tty.c
drivers/char/serial.c
drivers/char/tty_io.c
fs/devices.c
fs/isofs/inode.c
include/linux/major.h
include/linux/mm.h
include/linux/sbpcd.h
include/linux/timer.h
include/linux/tty_driver.h
ipc/shm.c
kernel/fork.c
mm/mmap.c

index 508e0a6832fb85725f1f554c2d9b228a16344eac..21b9affc5cb2c6a78fd19d314a3d533c9cb3fba0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 1
 PATCHLEVEL = 1
-SUBLEVEL = 25
+SUBLEVEL = 26
 
 all:   Version zImage
 
index a9a463fc449393234b7a14b343e2815d637d4288..34e1f620ee89a6f4636a61b0d545057a6a7861ba 100644 (file)
--- a/config.in
+++ b/config.in
@@ -101,7 +101,7 @@ if [ "$CONFIG_NET_VENDOR_3COM" = "y" ]; then
 fi
 bool 'Other ISA cards' CONFIG_NET_ISA n
 if [ "$CONFIG_NET_ISA" = "y" ]; then
-       bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE y
+       bool 'AT1500 and NE2100 (LANCE and PCnet-ISA) support' CONFIG_LANCE n
        bool 'Cabletron E21xx support (not recommended)' CONFIG_E2100 n
        bool 'DEPCA support' CONFIG_DEPCA n
        if [ "$CONFIG_NET_ALPHA" = "y" ]; then
@@ -109,7 +109,7 @@ if [ "$CONFIG_NET_ISA" = "y" ]; then
                bool 'AT1700 support' CONFIG_AT1700 n
        fi
        bool 'HP PCLAN support' CONFIG_HPLAN n
-       bool 'NE2000/NE1000 support' CONFIG_NE2000 n
+       bool 'NE2000/NE1000 support' CONFIG_NE2000 y
 fi
 bool 'EISA and on board controllers' CONFIG_NET_EISA n
        if [ "$CONFIG_NET_ALPHA" = "y" ]; then
@@ -133,6 +133,15 @@ comment 'CD-ROM drivers'
 bool 'Sony CDU31A/CDU33A CDROM driver support' CONFIG_CDU31A n
 bool 'Mitsumi CDROM driver support' CONFIG_MCD n
 bool 'Matsushita/Panasonic CDROM driver support' CONFIG_SBPCD n
+if [ "$CONFIG_SBPCD" = "y" ]; then
+  bool 'Matsushita/Panasonic second CDROM controller support' CONFIG_SBPCD2 n
+  if [ "$CONFIG_SBPCD2" = "y" ]; then
+    bool 'Matsushita/Panasonic third CDROM controller support' CONFIG_SBPCD3 n
+    if [ "$CONFIG_SBPCD3" = "y" ]; then
+      bool 'Matsushita/Panasonic fourth CDROM controller support' CONFIG_SBPCD4 n
+    fi
+  fi
+fi
 
 comment 'Filesystems'
 
index c1e022af16517d38b4808e765c40e4fb30862ad2..30e6d74a1eeaf43dccb95efff9650303fded5768 100644 (file)
@@ -39,6 +39,21 @@ OBJS := $(OBJS) sbpcd.o
 SRCS := $(SRCS) sbpcd.c
 endif #CONFIG_SBPCD
 
+ifdef CONFIG_SBPCD2
+OBJS := $(OBJS) sbpcd2.o
+SRCS := $(SRCS) sbpcd2.c
+endif #CONFIG_SBPCD2
+
+ifdef CONFIG_SBPCD3
+OBJS := $(OBJS) sbpcd3.o
+SRCS := $(SRCS) sbpcd3.c
+endif #CONFIG_SBPCD3
+
+ifdef CONFIG_SBPCD4
+OBJS := $(OBJS) sbpcd4.o
+SRCS := $(SRCS) sbpcd4.c
+endif #CONFIG_SBPCD4
+
 ifdef CONFIG_BLK_DEV_HD
 OBJS := $(OBJS) hd.o
 SRCS := $(SRCS) hd.c
index f05d78132d9b7222130cc005b3deb240f45cfaad..79003ec26a9ba6cf98fe74d4a601eefdf281d44a 100644 (file)
@@ -1,4 +1,4 @@
-This README belongs to release 2.1 of the SoundBlaster Pro (Matsushita,
+This README belongs to release 2.2 of the SoundBlaster Pro (Matsushita,
 Kotobuki, Panasonic, CreativeLabs) CD-ROM driver for Linux.
 
 The driver is able to drive the whole family of IDE-style
index f21eb238eca0fe27b4066cc706a7c52ec3fad0ee..def01b7224a895e68bade115bcf6a3a8cf96e814 100644 (file)
@@ -194,12 +194,36 @@ static void floppy_off(unsigned int nr);
 
 #elif (MAJOR_NR == MATSUSHITA_CDROM_MAJOR)
 
-#define DEVICE_NAME "Matsushita CD-ROM"
+#define DEVICE_NAME "Matsushita CD-ROM controller #1"
 #define DEVICE_REQUEST do_sbpcd_request
 #define DEVICE_NR(device) (MINOR(device))
 #define DEVICE_ON(device)
 #define DEVICE_OFF(device)
 
+#elif (MAJOR_NR == MATSUSHITA_CDROM2_MAJOR)
+
+#define DEVICE_NAME "Matsushita CD-ROM controller #2"
+#define DEVICE_REQUEST do_sbpcd2_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
+#elif (MAJOR_NR == MATSUSHITA_CDROM3_MAJOR)
+
+#define DEVICE_NAME "Matsushita CD-ROM controller #3"
+#define DEVICE_REQUEST do_sbpcd3_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
+#elif (MAJOR_NR == MATSUSHITA_CDROM4_MAJOR)
+
+#define DEVICE_NAME "Matsushita CD-ROM controller #4"
+#define DEVICE_REQUEST do_sbpcd4_request
+#define DEVICE_NR(device) (MINOR(device))
+#define DEVICE_ON(device)
+#define DEVICE_OFF(device)
+
 #else
 
 #error "unknown blk device"
index 6b62bbd347e73b4e5f4ee169e7b94aafd06c88fc..c63e54ac78fd39c09db17e5f39afedb819af8b41 100644 (file)
@@ -158,8 +158,8 @@ void mcd_setup(char *str, int *ints)
 }
 
  
-int
-check_mcd_media_change(int full_dev, int flag)
+static int
+check_mcd_change(dev_t full_dev)
 {
    int retval, target;
 
@@ -175,10 +175,7 @@ check_mcd_media_change(int full_dev, int flag)
    }
 
    retval = mcdDiskChanged;
-   if (!flag)
-   {
-      mcdDiskChanged = 0;
-   }
+   mcdDiskChanged = 0;
 
    return retval;
 }
@@ -1082,7 +1079,10 @@ static struct file_operations mcd_fops = {
        NULL,                   /* mmap */
        mcd_open,               /* open */
        mcd_release,            /* release */
-       NULL                    /* fsync */
+       NULL,                   /* fsync */
+       NULL,                   /* fasync */
+       check_mcd_change,       /* media change */
+       NULL                    /* revalidate */
 };
 
 
index c1f0280ccff1ed6493db2813a7cd73678ef66635..94bca451be0b944a66ff60c71cc0a28b23750b83 100644 (file)
@@ -5,7 +5,7 @@
  *            and for "no-sound" interfaces like Lasermate and the
  *            Panasonic CI-101P.
  *
- *  NOTE:     This is release 2.1.
+ *  NOTE:     This is release 2.2.
  *            It works with my SbPro & drive CR-521 V2.11 from 2/92
  *            and with the new CR-562-B V0.75 on a "naked" Panasonic
  *            CI-101P interface. And vice versa. 
  *       Bigger audio frame buffer: allows reading max. 4 frames at time; but
  *       reading more than one frame at once gives poor quality.
  *
+ *  2.2  
  *
  *  TODO
  *
 
 #include "blk.h"
 
-#define VERSION "2.1 Eberhard Moenkeberg <emoenke@gwdg.de>"
+#define VERSION "2.2 Eberhard Moenkeberg <emoenke@gwdg.de>"
 
 #define SBPCD_DEBUG
 
  * currently up to 4 drivers, expandable
  */
 #if !(SBPCD_ISSUE-1)
-#define SBPCD_IOCTL_F sbpcd_ioctl
-#define SBPCD_IOCTL(a,b,c,d) sbpcd_ioctl(a,b,c,d)
 #define DO_SBPCD_REQUEST(a) do_sbpcd_request(a)
-#define SBPCD_OPEN_F sbpcd_open
-#define SBPCD_OPEN(a,b) sbpcd_open(a,b)
-#define SBPCD_RELEASE_F sbpcd_release
-#define SBPCD_RELEASE(a,b) sbpcd_release(a,b)
 #define SBPCD_SETUP(a,b) sbpcd_setup(a,b)
 #define SBPCD_INIT(a,b) sbpcd_init(a,b)
-#define SBPCD_MEDIA_CHANGE(a,b) check_sbpcd_media_change(a,b)
 #endif
 #if !(SBPCD_ISSUE-2)
-#define SBPCD_IOCTL_F sbpcd2_ioctl
-#define SBPCD_IOCTL(a,b,c,d) sbpcd2_ioctl(a,b,c,d)
 #define DO_SBPCD_REQUEST(a) do_sbpcd2_request(a)
-#define SBPCD_OPEN_F sbpcd2_open
-#define SBPCD_OPEN(a,b) sbpcd2_open(a,b)
-#define SBPCD_RELEASE_F sbpcd2_release
-#define SBPCD_RELEASE(a,b) sbpcd2_release(a,b)
 #define SBPCD_SETUP(a,b) sbpcd2_setup(a,b)
 #define SBPCD_INIT(a,b) sbpcd2_init(a,b)
-#define SBPCD_MEDIA_CHANGE(a,b) check_sbpcd2_media_change(a,b)
 #endif
 #if !(SBPCD_ISSUE-3)
-#define SBPCD_IOCTL_F sbpcd3_ioctl
-#define SBPCD_IOCTL(a,b,c,d) sbpcd3_ioctl(a,b,c,d)
 #define DO_SBPCD_REQUEST(a) do_sbpcd3_request(a)
-#define SBPCD_OPEN_F sbpcd3_open
-#define SBPCD_OPEN(a,b) sbpcd3_open(a,b)
-#define SBPCD_RELEASE_F sbpcd3_release
-#define SBPCD_RELEASE(a,b) sbpcd3_release(a,b)
 #define SBPCD_SETUP(a,b) sbpcd3_setup(a,b)
 #define SBPCD_INIT(a,b) sbpcd3_init(a,b)
-#define SBPCD_MEDIA_CHANGE(a,b) check_sbpcd3_media_change(a,b)
 #endif
 #if !(SBPCD_ISSUE-4)
-#define SBPCD_IOCTL_F sbpcd4_ioctl
-#define SBPCD_IOCTL(a,b,c,d) sbpcd4_ioctl(a,b,c,d)
 #define DO_SBPCD_REQUEST(a) do_sbpcd4_request(a)
-#define SBPCD_OPEN_F sbpcd4_open
-#define SBPCD_OPEN(a,b) sbpcd4_open(a,b)
-#define SBPCD_RELEASE_F sbpcd4_release
-#define SBPCD_RELEASE(a,b) sbpcd4_release(a,b)
 #define SBPCD_SETUP(a,b) sbpcd4_setup(a,b)
 #define SBPCD_INIT(a,b) sbpcd4_init(a,b)
-#define SBPCD_MEDIA_CHANGE(a,b) check_sbpcd4_media_change(a,b)
 #endif
 /*==========================================================================*/
 #if MANY_SESSION
@@ -333,6 +306,23 @@ static int autoprobe[] =
 #define NUM_AUTOPROBE  (sizeof(autoprobe) / sizeof(int))
 
 
+/*==========================================================================*/
+/*
+ * the external references:
+ */
+#if !(SBPCD_ISSUE-1)
+#ifdef CONFIG_SBPCD2
+extern unsigned long sbpcd2_init(unsigned long, unsigned long);
+#endif
+#ifdef CONFIG_SBPCD3
+extern unsigned long sbpcd3_init(unsigned long, unsigned long);
+#endif
+#ifdef CONFIG_SBPCD4
+extern unsigned long sbpcd4_init(unsigned long, unsigned long);
+#endif
+#endif
+
+/*==========================================================================*/
 /*==========================================================================*/
 /*
  * the forward references:
@@ -341,6 +331,7 @@ static void sbp_read_cmd(void);
 static int sbp_data(void);
 static int cmd_out(void);
 static int DiskInfo(void);
+static int check_media_change(dev_t);
 
 /*==========================================================================*/
 
@@ -719,12 +710,18 @@ static void clr_cmdbuf(void)
   cmd_type=0;
 }
 /*==========================================================================*/
-static void mark_timeout(void)
+static void mark_timeout(unsigned long i)
 {
   timed_out=1;
-  DPRINTF((DBG_TIM,"SBPCD: timer stopped.\n"));
+  DPRINTF((DBG_TIM,"SBPCD: timer expired.\n"));
 }
 /*==========================================================================*/
+static struct timer_list delay_timer = { NULL, NULL, 0, 0, mark_timeout};
+#if 0
+static struct timer_list data_timer = { NULL, NULL, 0, 0, mark_timeout};
+static struct timer_list audio_timer = { NULL, NULL, 0, 0, mark_timeout};
+#endif
+/*==========================================================================*/
 static void flush_status(void)
 {
 #ifdef CDMKE
@@ -739,10 +736,16 @@ static void flush_status(void)
     }
 #else
   timed_out=0;
-  SET_TIMER(mark_timeout,150);
+#if 0
+  del_timer(&delay_timer);
+#endif
+  delay_timer.expires = 150;
+  add_timer(&delay_timer);
   do { }
   while (!timed_out);
-  CLEAR_TIMER;
+#if 0
+  del_timer(&delay_timer);
+#endif 0
   inb(CDi_status);
 #endif CDMKE
 }
@@ -1782,29 +1785,30 @@ static void check_datarate(void)
   int i=0;
 
   DPRINTF((DBG_IOX,"SBPCD: check_datarate entered.\n"));
-  timed_out=0;
   datarate=0;
-
 #if TEST_STI
   for (i=0;i<=1000;i++) printk(".");
 #endif
-
   /* set a timer to make (timed_out!=0) after 1.1 seconds */
-
+#if 0
+  del_timer(&delay_timer);
+#endif
+  delay_timer.expires = 110;
+  timed_out=0;
+  add_timer(&delay_timer);
   DPRINTF((DBG_TIM,"SBPCD: timer started (110).\n"));
-  SET_TIMER(mark_timeout,110);
   do
     {
       i=inb(CDi_status);
       datarate++;
-
 #if 00000
       if (datarate>0x0FFFFFFF) break;
 #endif 00000
-
     }
   while (!timed_out); /* originally looping for 1.1 seconds */
-  CLEAR_TIMER;
+#if 0
+  del_timer(&delay_timer);
+#endif 0
   DPRINTF((DBG_TIM,"SBPCD: datarate: %d\n", datarate));
   if (datarate<65536) datarate=65536;
 
@@ -2292,7 +2296,7 @@ static int xx_PlayAudioMSF(int pos_audio_start,int pos_audio_end)
 /*==========================================================================*/
 /*==========================================================================*/
 /*
- * Called from the timer to check the results of the get-status cmd.
+ * Check the results of the "get status" command.
  */
 static int sbp_status(void)
 {
@@ -2341,7 +2345,7 @@ static int sbp_status(void)
 /*
  * ioctl support, adopted from scsi/sr_ioctl.c and mcd.c
  */
-static int SBPCD_IOCTL(struct inode *inode, struct file *file, u_int cmd,
+static int sbpcd_ioctl(struct inode *inode, struct file *file, u_int cmd,
                       u_long arg)
 {
   int i, st;
@@ -2612,10 +2616,7 @@ static int SBPCD_IOCTL(struct inode *inode, struct file *file, u_int cmd,
        int status_tries;
        int error_flag;
 
-       error_flag=0;
-
        DPRINTF((DBG_IOC,"SBPCD: ioctl: CDROMREADAUDIO requested.\n"));
-
 #if 0
        if (!new_drive) return (-EINVAL);
 #endif
@@ -2636,10 +2637,9 @@ static int SBPCD_IOCTL(struct inode *inode, struct file *file, u_int cmd,
        DPRINTF((DBG_AUD,"SBPCD: read_audio: lba: %d, msf: %06X\n",
                 block, blk2msf(block)));
        DPRINTF((DBG_AUD,"SBPCD: read_audio: before xx_ReadStatus.\n"));
-
        while (busy_data) sbp_sleep(10); /* wait a bit */
        busy_audio=1;
-
+       error_flag=0;
        for (data_tries=5; data_tries>0; data_tries--)
          {
            DPRINTF((DBG_AUD,"SBPCD: data_tries=%d ...\n", data_tries));
@@ -2717,7 +2717,6 @@ static int SBPCD_IOCTL(struct inode *inode, struct file *file, u_int cmd,
                    break;
                  }
                DPRINTF((DBG_AUD,"SBPCD: read_audio: before reading data.\n"));
-               CLEAR_TIMER;
                error_flag=0;
                p = DriveStruct[d].aud_buf;
                if (sbpro_type==1) OUT(CDo_sel_d_i,0x01);
@@ -3091,7 +3090,6 @@ static int sbp_data(void)
        }
 
       SBPCD_STI;
-      CLEAR_TIMER;
       error_flag=0;
       p = DriveStruct[d].sbp_buf + frame *  CD_FRAMESIZE;
 
@@ -3181,7 +3179,7 @@ static int sbp_data(void)
 /*
  *  Open the device special file.  Check that a disk is in. Read TOC.
  */
-int SBPCD_OPEN(struct inode *ip, struct file *fp)
+static int sbpcd_open(struct inode *ip, struct file *fp)
 {
   int i;
 
@@ -3234,7 +3232,7 @@ int SBPCD_OPEN(struct inode *ip, struct file *fp)
 /*
  *  On close, we flush all sbp blocks from the buffer cache.
  */
-static void SBPCD_RELEASE(struct inode * ip, struct file * file)
+static void sbpcd_release(struct inode * ip, struct file * file)
 {
   int i;
 
@@ -3247,7 +3245,7 @@ static void SBPCD_RELEASE(struct inode * ip, struct file * file)
   switch_drive(i);
 
   DriveStruct[d].sbp_first_frame=DriveStruct[d].sbp_last_frame=-1;
-  sync_dev(ip->i_rdev);                    /* nonsense if read only device? */
+  fsync_dev(ip->i_rdev);                   /* nonsense if read only device? */
   invalidate_buffers(ip->i_rdev);
   DriveStruct[d].diskstate_flags &= ~cd_size_bit;
 
@@ -3274,18 +3272,23 @@ static struct file_operations sbpcd_fops =
   block_write,            /* write - general block-dev write */
   NULL,                   /* readdir - bad */
   NULL,                   /* select */
-  SBPCD_IOCTL_F,          /* ioctl */
+  sbpcd_ioctl,            /* ioctl */
   NULL,                   /* mmap */
-  SBPCD_OPEN_F,           /* open */
-  SBPCD_RELEASE_F,        /* release */
+  sbpcd_open,             /* open */
+  sbpcd_release,          /* release */
   NULL,                   /* fsync */
-  NULL                    /* fasync */
+  NULL,                   /* fasync */
+  check_media_change,     /* media_change */
+  NULL                    /* revalidate */
 };
 /*==========================================================================*/
 /*
  * accept "kernel command line" parameters 
  * (suggested by Peter MacDonald with SLS 1.03)
  *
+ * This is only implemented for the first controller. Should be enough to
+ * allow installing with a "strange" distribution kernel.
+ *
  * use: tell LILO:
  *                 sbpcd=0x230,SoundBlaster
  *             or
@@ -3299,6 +3302,9 @@ static struct file_operations sbpcd_fops =
  * not the soundcard base address.
  *
  */
+#if (SBPCD_ISSUE-1)
+static
+#endif
 void SBPCD_SETUP(char *s, int *p)
 {
   DPRINTF((DBG_INI,"SBPCD: sbpcd_setup called with %04X,%s\n",p[1], s));
@@ -3442,7 +3448,7 @@ unsigned long SBPCD_INIT(u_long mem_start, u_long mem_end)
 #if PRINTK_BUG
       sti(); /* to avoid possible "printk" bug */
 #endif
-      return (mem_start);
+      goto init_done;
     }
 
   if (port_index>0)
@@ -3515,7 +3521,7 @@ unsigned long SBPCD_INIT(u_long mem_start, u_long mem_end)
 #if PRINTK_BUG
       sti(); /* to avoid possible "printk" bug */
 #endif
-      return (mem_start);
+      goto init_done;
     }
   blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
   read_ahead[MAJOR_NR] = SBP_BUFFER_FRAMES * (CD_FRAMESIZE / 512);
@@ -3543,7 +3549,21 @@ unsigned long SBPCD_INIT(u_long mem_start, u_long mem_end)
     }
   blksize_size[MAJOR_NR]=sbpcd_blocksizes;
 
+init_done:
+#if !(SBPCD_ISSUE-1)
+#ifdef CONFIG_SBPCD2
+  mem_start=sbpcd2_init(mem_start, mem_end);
+#endif
+#ifdef CONFIG_SBPCD3
+  mem_start=sbpcd3_init(mem_start, mem_end);
+#endif
+#ifdef CONFIG_SBPCD4
+  mem_start=sbpcd4_init(mem_start, mem_end);
+#endif
+#endif
+#if !(SBPCD_ISSUE-1)
   DPRINTF((DBG_INF,"SBPCD: init done.\n"));
+#endif
   return (mem_start);
 }
 /*==========================================================================*/
@@ -3552,7 +3572,7 @@ unsigned long SBPCD_INIT(u_long mem_start, u_long mem_end)
  * used externally (isofs/inode.c, fs/buffer.c)
  * Currently disabled (has to get "synchronized").
  */
-int SBPCD_MEDIA_CHANGE(int full_dev, int unused_minor)
+static int check_media_change(dev_t full_dev)
 {
   int st;
 
index 1a8d34098678f20f2489e78aea1e262eef7924f7..5e5c2dddfed70cc9a7654051ca7a5901beceeec2 100644 (file)
@@ -594,6 +594,9 @@ int is_ignored(int sig)
 
 static void n_tty_set_termios(struct tty_struct *tty, struct termios * old)
 {
+       if (!tty)
+               return;
+       
        tty->icanon = (L_ICANON(tty) != 0);
        if (I_ISTRIP(tty) || I_IUCLC(tty) || I_IGNCR(tty) ||
            I_ICRNL(tty) || I_INLCR(tty) || L_ICANON(tty) ||
@@ -661,6 +664,9 @@ static void n_tty_close(struct tty_struct *tty)
 
 static int n_tty_open(struct tty_struct *tty)
 {
+       if (!tty)
+               return -EINVAL;
+
        if (!tty->read_buf) {
                tty->read_buf = (unsigned char *)
                        get_free_page(intr_count ? GFP_ATOMIC : GFP_KERNEL);
index d21c4d687e912fcf4a698efb063aa48727589b30..e2b19f2f7cd6b8783251673999de4be54cf1c8c4 100644 (file)
@@ -845,7 +845,7 @@ static int startup(struct async_struct * info)
        if (!info->xmit_buf) {
                info->xmit_buf = (unsigned char *) get_free_page(GFP_KERNEL);
                if (!info->xmit_buf)
-                       return ENOMEM;
+                       return -ENOMEM;
        }
 
        save_flags(flags); cli();
@@ -871,7 +871,7 @@ static int startup(struct async_struct * info)
         * here.
         */
        if (serial_inp(info, UART_LSR) == 0xff) {
-                       restore_flags(flags);
+               restore_flags(flags);
                if (suser()) {
                        if (info->tty)
                                set_bit(TTY_IO_ERROR, &info->tty->flags);
@@ -1802,11 +1802,9 @@ static void rs_close(struct tty_struct *tty, struct file * filp)
        }
        if (info->blocked_open) {
                if (info->close_delay) {
-                       tty->count++; /* avoid race condition */
                        current->state = TASK_INTERRUPTIBLE;
                        current->timeout = jiffies + info->close_delay;
                        schedule();
-                       tty->count--;
                }
                wake_up_interruptible(&info->open_wait);
        }
@@ -2156,9 +2154,15 @@ static void autoconfig(struct async_struct * info)
        /*
         * Do a simple existence test first; if we fail this, there's
         * no point trying anything else.
+        *
+        * 0x80 is used as a nonsense port to prevent against false
+        * positives due to ISA bus float.  The assumption is that
+        * 0x80 is a non-existent port; which should be safe since
+        * include/asm/io.h also makes this assumption.
         */
        scratch = serial_inp(info, UART_IER);
        serial_outp(info, UART_IER, 0);
+       outb(0xff, 0x080);
        scratch2 = serial_inp(info, UART_IER);
        serial_outp(info, UART_IER, scratch);
        if (scratch2) {
@@ -2358,3 +2362,75 @@ long rs_init(long kmem_start)
        return kmem_start;
 }
 
+/*
+ * register_serial and unregister_serial allows for serial ports to be
+ * configured at run-time, to support PCMCIA modems.
+ */
+int register_serial(struct serial_struct *req)
+{
+       int i;
+       unsigned long flags;
+       struct async_struct *info;
+
+       save_flags(flags);
+       cli();
+       for (i = 0; i < NR_PORTS; i++) {
+               if (rs_table[i].port == req->port)
+                       break;
+       }
+       if (i == NR_PORTS) {
+               for (i = 0; i < NR_PORTS; i++)
+                       if ((rs_table[i].type == PORT_UNKNOWN) &&
+                           (rs_table[i].count == 0))
+                               break;
+       }
+       if (i == NR_PORTS) {
+               restore_flags(flags);
+               return -1;
+       }
+       info = &rs_table[i];
+       if (rs_table[i].count) {
+               restore_flags(flags);
+               printk("Couldn't configure serial #%d (port=%d,irq=%d): "
+                      "device already open\n", i, req->port, req->irq);
+               return -1;
+       }
+       info->irq = req->irq;
+       info->port = req->port;
+       autoconfig(info);
+       if (info->type == PORT_UNKNOWN) {
+               restore_flags(flags);
+               printk("register_serial(): autoconfig failed\n");
+               return -1;
+       }
+       printk("tty%02d at 0x%04x (irq = %d)", info->line, 
+              info->port, info->irq);
+       switch (info->type) {
+       case PORT_8250:
+               printk(" is a 8250\n"); break;
+       case PORT_16450:
+               printk(" is a 16450\n"); break;
+       case PORT_16550:
+               printk(" is a 16550\n"); break;
+       case PORT_16550A:
+               printk(" is a 16550A\n"); break;
+       default:
+               printk("\n"); break;
+       }
+       restore_flags(flags);
+       return info->line;
+}
+
+void unregister_serial(int line)
+{
+       unsigned long flags;
+       struct async_struct *info = &rs_table[line];
+
+       save_flags(flags);
+       cli();
+       if (info->tty)
+               tty_hangup(info->tty);
+       info->type = PORT_UNKNOWN;
+       printk("tty%02d unloaded\n", info->line);
+       restore_flags(flags);
+}
index 3d5b4309bc10866538ffbde89ca8ded0fe4e3239..9787aebe3efd0648994be1e28675505df40abfe6 100644 (file)
@@ -160,7 +160,7 @@ int tty_register_ldisc(int disc, struct tty_ldisc *new_ldisc)
 /* Set the discipline of a tty line. */
 static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
 {
-       int     retval;
+       int     retval = 0;
        struct  tty_ldisc o_ldisc;
 
        if ((ldisc < N_TTY) || (ldisc >= NR_LDISCS) ||
@@ -178,11 +178,9 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
        /* Now set up the new line discipline. */
        tty->ldisc = ldiscs[ldisc];
        tty->termios->c_line = ldisc;
-       if (tty->ldisc.open) {
+       if (tty->ldisc.open)
                retval = (tty->ldisc.open)(tty);
-               if (retval >= 0)
-                       return retval;
-               
+       if (retval < 0) {
                tty->ldisc = o_ldisc;
                tty->termios->c_line = tty->ldisc.num;
                if (tty->ldisc.open && (tty->ldisc.open(tty) < 0)) {
@@ -197,9 +195,10 @@ static int tty_set_ldisc(struct tty_struct *tty, int ldisc)
                                              tty_name(tty), r);
                        }
                }
-               return retval;
        }
-       return 0;
+       if (tty->ldisc.num != o_ldisc.num && tty->driver.set_ldisc)
+               tty->driver.set_ldisc(tty);
+       return retval;
 }
 
 /*
@@ -731,12 +730,12 @@ static int init_dev(dev_t device, struct tty_struct **ret_tty)
        tp_loc = &driver->termios[idx];
        ltp_loc = &driver->termios_locked[idx];
 
+repeat:
        retval = -EAGAIN;
        if (driver->type == TTY_DRIVER_TYPE_PTY &&
            driver->subtype == PTY_TYPE_MASTER &&
            *tty_loc && (*tty_loc)->count)
                goto end_init;
-repeat:
        retval = -ENOMEM;
        if (!*tty_loc && !tty) {
                if (!(tty = (struct tty_struct*) get_free_page(GFP_KERNEL)))
@@ -813,13 +812,18 @@ repeat:
                tty->termios_locked = *ltp_loc;
                *tty_loc = tty;
                (*driver->refcount)++;
+               (*tty_loc)->count++;
                if (tty->ldisc.open) {
                        retval = (tty->ldisc.open)(tty);
-                       if (retval < 0)
+                       if (retval < 0) {
+                               (*tty_loc)->count--;
+                               tty = NULL;
                                goto end_init;
+                       }
                }
                tty = NULL;
-       }
+       } else
+               (*tty_loc)->count++;
        if (driver->type == TTY_DRIVER_TYPE_PTY) {
                if (!*o_tp_loc) {
                        *o_tp_loc = o_tp;
@@ -836,19 +840,19 @@ repeat:
                        (*driver->other->refcount)++;
                        if (o_tty->ldisc.open) {
                                retval = (o_tty->ldisc.open)(o_tty);
-                               if (retval < 0)
+                               if (retval < 0) {
+                                       (*tty_loc)->count--;
+                                       o_tty = NULL;
                                        goto end_init;
+                               }
                        }
                        o_tty = NULL;
                }
                (*tty_loc)->link = *o_tty_loc;
                (*o_tty_loc)->link = *tty_loc;
+               if (driver->subtype == PTY_TYPE_MASTER)
+                       (*o_tty_loc)->count++;
        }
-       (*tty_loc)->count++;
-       (*tty_loc)->driver = *driver;
-       if (driver->type == TTY_DRIVER_TYPE_PTY &&
-           driver->subtype == PTY_TYPE_MASTER)
-               (*o_tty_loc)->count++;
        *ret_tty = *tty_loc;
        retval = 0;
 end_init:
index 16c098c9e747006915abd1abbeec272af70ac35f..aa309ce50caff8c74f2ee9f253cdbcc9dd6f7ecf 100644 (file)
 #include <linux/fcntl.h>
 #include <linux/errno.h>
 
-#include <linux/config.h>
-
-/*
- * Ugly. We'll fix this once all the drivers use the f_ops->check_media_change()
- * stuff instead..
- */
-#ifdef CONFIG_MCD
-extern int check_mcd_media_change(int, int);
-#endif
-#ifdef CONFIG_SBPCD
-extern int check_sbpcd_media_change(int, int);
-#endif
-
 struct device_struct {
        const char * name;
        struct file_operations * fops;
@@ -144,27 +131,6 @@ int check_disk_change(dev_t dev)
                if (!fops->check_media_change(dev))
                        return 0;
        } 
-#if 1 /* this will go soon.. */
-       else switch(MAJOR(dev)){
-
-#if defined(CONFIG_MCD)
-         case MITSUMI_CDROM_MAJOR:
-               if (!check_mcd_media_change(dev, 0))
-                       return 0;
-               break;
-#endif
-
-#if defined(CONFIG_SBPCD)
-         case MATSUSHITA_CDROM_MAJOR:
-               if (!check_sbpcd_media_change(dev, 0))
-                       return 0;
-               break;
-#endif
-
-         default:
-               return 0;
-       }
-#endif /* will go away */
 
        printk("VFS: Disk change detected on device %d/%d\n",
                                        MAJOR(dev), MINOR(dev));
index 5387e34666d3441fe1571cf5e953c5c4fed75887..9e836d19bef82b77fcd6072f95826b9bd4811fab 100644 (file)
@@ -30,9 +30,6 @@ extern int check_cdu31a_media_change(int, int);
 #if defined(CONFIG_MCD)
 extern int check_mcd_media_change(int, int);
 #endif
-#if defined (CONFIG_SBPCD)
-extern int check_sbpcd_media_change(int, int);
-#endif CONFIG_SBPCD
 
 #ifdef LEAK_CHECK
 static int check_malloc = 0;
index 8b3a8ab2f3d00740a7c14a7dd6c62832c8b8523b..da3eaf9412b710112aac0e8e433236a5b5f12fa8 100644 (file)
@@ -43,8 +43,9 @@
  * 23 -                        mitsumi cdrom
  * 24 -                               sony535 cdrom
  * 25 -                        matsushita cdrom       minors 0..3
- * 26 -
- * 27 - qic117 tape
+ * 26 -                        matsushita cdrom 2     minors 0..3
+ * 27 - qic117 tape            matsushita cdrom 3     minors 0..3
+ * 28 -                        matsushita cdrom 4     minors 0..3
  */
 
 #define UNNAMED_MAJOR  0
@@ -72,6 +73,9 @@
 #define MITSUMI_CDROM_MAJOR 23
 #define CDU535_CDROM_MAJOR 24
 #define MATSUSHITA_CDROM_MAJOR 25
+#define MATSUSHITA_CDROM2_MAJOR 26
+#define MATSUSHITA_CDROM3_MAJOR 27
+#define MATSUSHITA_CDROM4_MAJOR 28
 #define QIC117_TAPE_MAJOR 27
 
 /*
index b3bfdc4c39e274e9ba2c247590f71b9492978252..d29152b1ad18463a9615a19d3d91d16f26d38152 100644 (file)
@@ -44,6 +44,7 @@ struct vm_area_struct {
  */
 #define VM_GROWSDOWN   0x01
 #define VM_GROWSUP     0x02
+#define VM_SHM         0x04
 
 /*
  * These are the virtual MM functions - opening of an area, closing it (needed to
index b00ef9d4eaad74cff85da77b9c8c50f5e96e934f..0b7da5152fe63b2c00e4c764ad225b4d83745bc8 100644 (file)
@@ -3,18 +3,15 @@
  */
 
 /*
- * these definitions can get overridden by the kernel command line
- * ("lilo boot option"). Examples:
+ * the definitions for the first controller can get overridden by
+ * the kernel command line ("lilo boot option").
+ * Examples:
  *                                 sbpcd=0x230,SoundBlaster
  *                             or
  *                                 sbpcd=0x300,LaserMate
  *                             or
  *                                 sbpcd=0x330,SPEA
  *
- *  and, if you have a second CDROM controller board,
- *                                 sbpcd2=0x310,LaserMate
- *  and so on.
- *
  * These strings are case sensitive !!!
  */
 
 
 #define _LINUX_SBPCD_H
 
-/*==========================================================================*/
-/*==========================================================================*/
-/*
- * to fork and execute a function after some elapsed time:
- * one "jifs" unit is 10 msec.
- */
-#undef MY_TIMER
-#undef SET_TIMER
-#undef CLEAR_TIMER
-
-#if !(SBPCD_ISSUE-1)
-#define MY_TIMER SBPCD_TIMER
-#endif
-#if !(SBPCD_ISSUE-2)
-#define MY_TIMER SBPCD2_TIMER
-#endif
-#if !(SBPCD_ISSUE-3)
-#define MY_TIMER SBPCD3_TIMER
-#endif
-#if !(SBPCD_ISSUE-4)
-#define MY_TIMER SBPCD4_TIMER
-#endif
-
-#define SET_TIMER(func, jifs) \
-        ((timer_table[MY_TIMER].expires = jiffies + jifs), \
-        (timer_table[MY_TIMER].fn = func), \
-        (timer_active |= 1<<MY_TIMER))
-
-#define CLEAR_TIMER    timer_active &= ~(1<<MY_TIMER)
-
 /*==========================================================================*/
 /*==========================================================================*/
 /*
index 448bc2a1fdcbef68ae4f9e2f5a5c5f13342d2495..aecd966e69c8ae8131c19414b3b3b65609024e76 100644 (file)
@@ -30,8 +30,6 @@
  * TAPE_QIC02_TIMER    timer for QIC-02 tape driver (it's not hardcoded)
  *
  * MCD_TIMER           Mitsumi CD-ROM Timer
- *
- * SBPCD_TIMER         SoundBlaster/Matsushita/Panasonic CD-ROM timer
  */
 
 #define BLANK_TIMER    0
@@ -50,8 +48,6 @@
 
 #define HD_TIMER2      24
 
-#define SBPCD_TIMER    25
-
 struct timer_struct {
        unsigned long expires;
        void (*fn)(void);
index cb95160432a041698df0202403c47440c074007b..efecd6ab7d3a0ad0bf0819c68840b1b13ffe3183 100644 (file)
  * void (*set_termios)(struct tty_struct *tty, struct termios * old);
  *
  *     This routine allows the tty driver to be notified when
- *     device's termios settings have changed.  
+ *     device's termios settings have changed.  Note that a
+ *     well-designed tty driver should be prepared to accept the case
+ *     where old == NULL, and try to do something rational.
+ *
+ * void (*set_ldisc)(struct tty_struct *tty);
+ *
+ *     This routine allows the tty driver to be notified when the
+ *     device's termios settings have changed.
  * 
  * void (*throttle)(struct tty_struct * tty);
  *
@@ -131,6 +138,7 @@ struct tty_driver {
        void (*start)(struct tty_struct *tty);
        void (*hangup)(struct tty_struct *tty);
        void (*flush_buffer)(struct tty_struct *tty);
+       void (*set_ldisc)(struct tty_struct *tty);
 
        /*
         * linked list pointers
index 6735df9840f24aa897c55cf640ad782e9af508a7..2c686d330e93ca605f2fa982c96dbe29e63b4ae9 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -375,6 +375,34 @@ static int shm_map (struct shm_desc *shmd, int remap)
        return 0;
 }
 
+/*
+ * This is really minimal support to make the shared mem stuff
+ * ve known by the general VM manager. It should add the vm_ops
+ * field so that 'munmap()' and friends work correctly on shared
+ * memory areas..
+ */
+static int add_vm_area(unsigned long addr, unsigned long len)
+{
+       struct vm_area_struct * vma;
+
+       vma = (struct vm_area_struct * ) kmalloc(sizeof(struct vm_area_struct), GFP_KERNEL);
+       if (!vma)
+               return -ENOMEM;
+       do_munmap(addr, len);
+       vma->vm_task = current;
+       vma->vm_start = addr;
+       vma->vm_end = addr + len;
+       vma->vm_page_prot = PAGE_SHARED;
+       vma->vm_flags = VM_SHM;
+       vma->vm_share = NULL;
+       vma->vm_inode = NULL;
+       vma->vm_offset = 0;
+       vma->vm_ops = NULL;
+       insert_vm_struct(current, vma);
+       merge_segments(current->mm->mmap, NULL, NULL);
+       return 0;
+}
+
 /* 
  * Fix shmaddr, allocate descriptor, map shm, add attach descriptor to lists.
  * raddr is needed to return addresses above 2Gig.
@@ -448,6 +476,11 @@ int sys_shmat (int shmid, char *shmaddr, int shmflg, ulong *raddr)
        shmd->end = addr + shp->shm_npages * PAGE_SIZE;
        shmd->task = current;
 
+       if ((err = add_vm_area(shmd->start, shmd->end - shmd->start))) {
+               kfree(shmd);
+               return err;
+       }
+
        shp->shm_nattch++;            /* prevent destruction */
        if (addr < current->mm->end_data) {
                iput (current->executable);
@@ -496,7 +529,7 @@ static void detach (struct shm_desc **shmdp)
        printk("detach: shm segment (id=%d) attach list inconsistent\n",id);
        
  found:
-       unmap_page_range (shmd->start, shp->shm_segsz); /* sleeps */
+       do_munmap(shmd->start, shp->shm_segsz);
        kfree(shmd);
        shp->shm_lpid = current->pid;
        shp->shm_dtime = CURRENT_TIME;
@@ -543,6 +576,8 @@ int shm_fork (struct task_struct *p1, struct task_struct *p2)
        struct shmid_ds *shp;
        int id;
 
+       p2->semun = NULL;
+       p2->shm = NULL;
         if (!p1->shm)
                return 0;
        for (shmd = p1->shm; shmd; shmd = shmd->task_next) {
index cd0e6593cda64e62a8dae1b976e556ca822d6f16..a4859a7033e5b2e231d9563faf4d9bc98a02ce30 100644 (file)
@@ -147,7 +147,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * p)
                        return 1;
                dup_mmap(p);            /* wrong.. */
        }
-       return 0;
+       return shm_fork(current, p);
 }
 
 static void copy_fs(unsigned long clone_flags, struct task_struct * p)
@@ -243,8 +243,7 @@ asmlinkage int sys_fork(struct pt_regs regs)
                p->tss.io_bitmap[i] = ~0;
        if (last_task_used_math == current)
                __asm__("clts ; fnsave %0 ; frstor %0":"=m" (p->tss.i387));
-       p->semun = NULL; p->shm = NULL;
-       if (copy_mm(clone_flags, p) || shm_fork(current, p))
+       if (copy_mm(clone_flags, p))
                goto bad_fork_cleanup;
        copy_files(clone_flags, p);
        copy_fs(clone_flags, p);
index bd152468e529fa831b4b0e2cff330972f16dc27e..6ba5f39cf8536993c40c7d93bee270909c48851f 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -423,6 +423,7 @@ void merge_segments(struct vm_area_struct *mpnt,
                    prev->vm_inode != mpnt->vm_inode ||
                    prev->vm_end != mpnt->vm_start ||
                    !mp ||
+                   prev->vm_flags != mpnt->vm_flags ||
                    prev->vm_share != mpnt->vm_share ||         /* ?? */
                    prev->vm_next != mpnt)                      /* !!! */
                        continue;