## Automatically generated incremental diff ## From: linux-2.5.65-bk5 ## To: linux-2.5.66 ## Robot: $Id: make-incremental-diff,v 1.11 2002/02/20 02:59:33 hpa Exp $ diff -urN linux-2.5.65-bk5/Documentation/cciss.txt linux-2.5.66/Documentation/cciss.txt --- linux-2.5.65-bk5/Documentation/cciss.txt Mon Mar 17 13:43:42 2003 +++ linux-2.5.66/Documentation/cciss.txt Mon Mar 31 12:45:31 2003 @@ -9,6 +9,10 @@ * SA 5i * SA 532 * SA 5312 + * SA 641 + * SA 642 + * SA 6400 + * SA 6400 U320 Expansion Module If nodes are not already created in the /dev/cciss directory diff -urN linux-2.5.65-bk5/Makefile linux-2.5.66/Makefile --- linux-2.5.65-bk5/Makefile Mon Mar 31 12:45:27 2003 +++ linux-2.5.66/Makefile Mon Mar 31 12:45:31 2003 @@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 -SUBLEVEL = 65 -EXTRAVERSION = -bk5 +SUBLEVEL = 66 +EXTRAVERSION = # *DOCUMENTATION* # To see a list of typical targets execute "make help" diff -urN linux-2.5.65-bk5/arch/i386/kernel/cpu/amd.c linux-2.5.66/arch/i386/kernel/cpu/amd.c --- linux-2.5.65-bk5/arch/i386/kernel/cpu/amd.c Mon Mar 17 13:44:46 2003 +++ linux-2.5.66/arch/i386/kernel/cpu/amd.c Mon Mar 31 12:45:31 2003 @@ -90,14 +90,13 @@ d = d2-d; /* Knock these two lines out if it debugs out ok */ - printk(KERN_INFO "K6 BUG %ld %d (Report these if test report is incorrect)\n", d, 20*K6_BUG_LOOP); printk(KERN_INFO "AMD K6 stepping B detected - "); /* -- cut here -- */ if (d > 20*K6_BUG_LOOP) printk("system stability may be impaired when more than 32 MB are used.\n"); else printk("probably OK (after B9730xxxx).\n"); - printk(KERN_INFO "Please see http://www.mygale.com/~poulot/k6bug.html\n"); + printk(KERN_INFO "Please see http://membres.lycos.fr/poulot/k6bug.html\n"); } /* K6 with old style WHCR */ diff -urN linux-2.5.65-bk5/arch/i386/kernel/cpu/intel.c linux-2.5.66/arch/i386/kernel/cpu/intel.c --- linux-2.5.65-bk5/arch/i386/kernel/cpu/intel.c Mon Mar 17 13:43:50 2003 +++ linux-2.5.66/arch/i386/kernel/cpu/intel.c Mon Mar 31 12:45:31 2003 @@ -100,6 +100,7 @@ { 0x25, LVL_3, 2048 }, { 0x29, LVL_3, 4096 }, { 0x39, LVL_2, 128 }, + { 0x3b, LVL_2, 128 }, { 0x3C, LVL_2, 256 }, { 0x41, LVL_2, 128 }, { 0x42, LVL_2, 256 }, diff -urN linux-2.5.65-bk5/arch/i386/kernel/cpuid.c linux-2.5.66/arch/i386/kernel/cpuid.c --- linux-2.5.65-bk5/arch/i386/kernel/cpuid.c Mon Mar 17 13:43:37 2003 +++ linux-2.5.66/arch/i386/kernel/cpuid.c Mon Mar 31 12:45:31 2003 @@ -64,6 +64,7 @@ { struct cpuid_command cmd; + preempt_disable(); if ( cpu == smp_processor_id() ) { cpuid(reg, &data[0], &data[1], &data[2], &data[3]); } else { @@ -73,6 +74,7 @@ smp_call_function(cpuid_smp_cpuid, &cmd, 1, 1); } + preempt_enable(); } #else /* ! CONFIG_SMP */ diff -urN linux-2.5.65-bk5/arch/i386/kernel/msr.c linux-2.5.66/arch/i386/kernel/msr.c --- linux-2.5.65-bk5/arch/i386/kernel/msr.c Mon Mar 17 13:44:04 2003 +++ linux-2.5.66/arch/i386/kernel/msr.c Mon Mar 31 12:45:31 2003 @@ -115,9 +115,13 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) { struct msr_command cmd; + int ret; + preempt_disable(); if ( cpu == smp_processor_id() ) { - return wrmsr_eio(reg, eax, edx); + ret = wrmsr_eio(reg, eax, edx); + preempt_enable(); + return ret; } else { cmd.cpu = cpu; cmd.reg = reg; @@ -125,6 +129,7 @@ cmd.data[1] = edx; smp_call_function(msr_smp_wrmsr, &cmd, 1, 1); + preempt_enable(); return cmd.err; } } diff -urN linux-2.5.65-bk5/arch/x86_64/kernel/pci-gart.c linux-2.5.66/arch/x86_64/kernel/pci-gart.c --- linux-2.5.65-bk5/arch/x86_64/kernel/pci-gart.c Mon Mar 17 13:44:04 2003 +++ linux-2.5.66/arch/x86_64/kernel/pci-gart.c Mon Mar 31 12:45:31 2003 @@ -419,6 +419,7 @@ panic("Cannot allocate GATT table"); memset(gatt, 0, gatt_size); change_page_attr(virt_to_page(gatt), gatt_size/PAGE_SIZE, PAGE_KERNEL_NOCACHE); + global_flush_tlb(); agp_gatt_table = gatt; for_all_nb(dev) { diff -urN linux-2.5.65-bk5/drivers/block/cciss.c linux-2.5.66/drivers/block/cciss.c --- linux-2.5.65-bk5/drivers/block/cciss.c Mon Mar 31 12:45:27 2003 +++ linux-2.5.66/drivers/block/cciss.c Mon Mar 31 12:45:31 2003 @@ -1,6 +1,6 @@ /* - * Disk Array driver for Compaq SMART2 Controllers - * Copyright 2000 Compaq Computer Corporation + * Disk Array driver for HP SA 5xxx and 6xxx Controllers + * Copyright 2000, 2002 Hewlett-Packard Development Company, L.P. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * - * Questions/Comments/Bugfixes to arrays@compaq.com + * Questions/Comments/Bugfixes to Cciss-discuss@lists.sourceforge.net * */ @@ -69,6 +69,14 @@ 0x0E11, 0x4082, 0, 0, 0}, { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSB, 0x0E11, 0x4083, 0, 0, 0}, + { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, + 0x0E11, 0x409A, 0, 0, 0}, + { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, + 0x0E11, 0x409B, 0, 0, 0}, + { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, + 0x0E11, 0x409C, 0, 0, 0}, + { PCI_VENDOR_ID_COMPAQ, PCI_DEVICE_ID_COMPAQ_CISSC, + 0x0E11, 0x409D, 0, 0, 0}, {0,} }; MODULE_DEVICE_TABLE(pci, cciss_pci_device_id); @@ -80,10 +88,14 @@ * access = Address of the struct of function pointers */ static struct board_type products[] = { - { 0x40700E11, "Smart Array 5300", &SA5_access }, + { 0x40700E11, "Smart Array 5300", &SA5_access }, { 0x40800E11, "Smart Array 5i", &SA5B_access}, { 0x40820E11, "Smart Array 532", &SA5B_access}, { 0x40830E11, "Smart Array 5312", &SA5B_access}, + { 0x409A0E11, "Smart Array 641", &SA5_access}, + { 0x409B0E11, "Smart Array 642", &SA5_access}, + { 0x409C0E11, "Smart Array 6400", &SA5_access}, + { 0x409D0E11, "Smart Array 6400 EM", &SA5_access}, }; /* How long to wait (in millesconds) for board to go into simple mode */ diff -urN linux-2.5.65-bk5/drivers/char/cyclades.c linux-2.5.66/drivers/char/cyclades.c --- linux-2.5.65-bk5/drivers/char/cyclades.c Mon Mar 17 13:43:47 2003 +++ linux-2.5.66/drivers/char/cyclades.c Mon Mar 31 12:45:31 2003 @@ -4944,17 +4944,16 @@ struct pci_dev *pdev = NULL; unsigned char cyy_rev_id; - unsigned char cy_pci_irq = 0; - uclong cy_pci_phys0, cy_pci_phys1, cy_pci_phys2; + unsigned char cy_pci_irq = 0; + uclong cy_pci_phys0, cy_pci_phys2; uclong cy_pci_addr0, cy_pci_addr2; - unsigned short i,j,cy_pci_nchan, plx_ver; - unsigned short device_id,dev_index = 0; + unsigned short i,j,cy_pci_nchan, plx_ver; + unsigned short device_id,dev_index = 0; uclong mailbox; uclong Ze_addr0[NR_CARDS], Ze_addr2[NR_CARDS], ZeIndex = 0; uclong Ze_phys0[NR_CARDS], Ze_phys2[NR_CARDS]; - unsigned char Ze_irq[NR_CARDS]; - struct resource *resource; - unsigned long res_start, res_len; + unsigned char Ze_irq[NR_CARDS]; + struct pci_dev *Ze_pdev[NR_CARDS]; for (i = 0; i < NR_CARDS; i++) { /* look for a Cyclades card by vendor and device id */ @@ -4976,7 +4975,6 @@ /* read PCI configuration area */ cy_pci_irq = pdev->irq; cy_pci_phys0 = pci_resource_start(pdev, 0); - cy_pci_phys1 = pci_resource_start(pdev, 1); cy_pci_phys2 = pci_resource_start(pdev, 2); pci_read_config_byte(pdev, PCI_REVISION_ID, &cyy_rev_id); @@ -5002,15 +5000,10 @@ /* Although we don't use this I/O region, we should request it from the kernel anyway, to avoid problems with other drivers accessing it. */ - resource = request_region(cy_pci_phys1, - CyPCI_Yctl, "Cyclom-Y"); - if (resource == NULL) { - printk(KERN_ERR "cyclades: failed to allocate IO " - "resource at 0x%lx\n", cy_pci_phys1); + if (pci_request_regions(pdev, "Cyclom-Y") != 0) { + printk(KERN_ERR "cyclades: failed to reserve PCI resources\n"); continue; } - res_start = cy_pci_phys1; - res_len = CyPCI_Yctl; #if defined(__alpha__) if (device_id == PCI_DEVICE_ID_CYCLOM_Y_Lo) { /* below 1M? */ @@ -5081,10 +5074,7 @@ cy_card[j].bus_index = 1; cy_card[j].first_line = cy_next_channel; cy_card[j].num_chips = cy_pci_nchan/4; - cy_card[j].resource = resource; - cy_card[j].res_start = res_start; - cy_card[j].res_len = res_len; - resource = NULL; /* For next card */ + cy_card[j].pdev = pdev; /* enable interrupts in the PCI interface */ plx_ver = cy_readb(cy_pci_addr2 + CyPLX_VER) & 0x0f; @@ -5164,15 +5154,10 @@ /* Although we don't use this I/O region, we should request it from the kernel anyway, to avoid problems with other drivers accessing it. */ - resource = request_region(cy_pci_phys1, - CyPCI_Zctl, "Cyclades-Z"); - if (resource == NULL) { - printk(KERN_ERR "cyclades: failed ot allocate IO resource " - "at 0x%lx\n", cy_pci_phys1); + if (pci_request_regions(pdev, "Cyclades-Z") != 0) { + printk(KERN_ERR "cyclades: failed to reserve PCI resources\n"); continue; } - res_start = cy_pci_phys1; - res_len = CyPCI_Zctl; if (mailbox == ZE_V1) { cy_pci_addr2 = (ulong)ioremap(cy_pci_phys2, CyPCI_Ze_win); @@ -5187,6 +5172,7 @@ Ze_addr0[ZeIndex] = cy_pci_addr0; Ze_addr2[ZeIndex] = cy_pci_addr2; Ze_irq[ZeIndex] = cy_pci_irq; + Ze_pdev[ZeIndex] = pdev; ZeIndex++; } i--; @@ -5271,10 +5257,7 @@ cy_card[j].bus_index = 1; cy_card[j].first_line = cy_next_channel; cy_card[j].num_chips = -1; - cy_card[j].resource = resource; - cy_card[j].res_start = res_start; - cy_card[j].res_len = res_len; - resource = NULL; /* For next card */ + cy_card[j].pdev = pdev; /* print message */ #ifdef CONFIG_CYZ_INTR @@ -5302,12 +5285,14 @@ cy_pci_addr0 = Ze_addr0[0]; cy_pci_addr2 = Ze_addr2[0]; cy_pci_irq = Ze_irq[0]; + pdev = Ze_pdev[0]; for (j = 0 ; j < ZeIndex-1 ; j++) { Ze_phys0[j] = Ze_phys0[j+1]; Ze_phys2[j] = Ze_phys2[j+1]; Ze_addr0[j] = Ze_addr0[j+1]; Ze_addr2[j] = Ze_addr2[j+1]; Ze_irq[j] = Ze_irq[j+1]; + Ze_pdev[j] = Ze_pdev[j+1]; } ZeIndex--; mailbox = (uclong)cy_readl(&((struct RUNTIME_9060 *) @@ -5365,6 +5350,7 @@ cy_card[j].bus_index = 1; cy_card[j].first_line = cy_next_channel; cy_card[j].num_chips = -1; + cy_card[j].pdev = pdev; /* print message */ #ifdef CONFIG_CYZ_INTR @@ -5797,8 +5783,8 @@ #endif /* CONFIG_CYZ_INTR */ ) free_irq(cy_card[i].irq, &cy_card[i]); - if (cy_card[i].resource) - release_region(cy_card[i].res_start, cy_card[i].res_len); + if (cy_card[i].pdev) + pci_release_regions(cy_card[i].pdev); } } if (tmp_buf) { diff -urN linux-2.5.65-bk5/drivers/char/drm/drm_drv.h linux-2.5.66/drivers/char/drm/drm_drv.h --- linux-2.5.65-bk5/drivers/char/drm/drm_drv.h Mon Mar 17 13:44:41 2003 +++ linux-2.5.66/drivers/char/drm/drm_drv.h Mon Mar 31 12:45:32 2003 @@ -581,8 +581,10 @@ init_timer( &dev->timer ); init_waitqueue_head( &dev->context_wait ); - if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) - return -EPERM; + if ((DRM(minor)[i] = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) { + retcode = -EPERM; + goto fail_reg; + } dev->device = MKDEV(DRM_MAJOR, DRM(minor)[i] ); dev->name = DRIVER_NAME; @@ -591,9 +593,8 @@ #if __MUST_HAVE_AGP if ( dev->agp == NULL ) { DRM_ERROR( "Cannot initialize the agpgart module.\n" ); - DRM(stub_unregister)(DRM(minor)[i]); - DRM(takedown)( dev ); - return -ENOMEM; + retcode = -ENOMEM; + goto fail; } #endif #if __REALLY_HAVE_MTRR @@ -609,9 +610,7 @@ retcode = DRM(ctxbitmap_init)( dev ); if( retcode ) { DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); - DRM(stub_unregister)(DRM(minor)[i]); - DRM(takedown)( dev ); - return retcode; + goto fail; } #endif DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", @@ -626,6 +625,15 @@ DRIVER_POSTINIT(); return 0; + +fail: + DRM(stub_unregister)(DRM(minor)[i]); + DRM(takedown)( dev ); + +fail_reg: + kfree (DRM(device)); + kfree (DRM(minor)); + return retcode; } /* drm_cleanup is called via cleanup_module at module unload time. diff -urN linux-2.5.65-bk5/drivers/ide/ide-cd.c linux-2.5.66/drivers/ide/ide-cd.c --- linux-2.5.65-bk5/drivers/ide/ide-cd.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/drivers/ide/ide-cd.c Mon Mar 31 12:45:33 2003 @@ -1749,8 +1749,8 @@ /* * pad, if necessary */ - if (len) { - while (len) { + if (len > 0) { + while (len > 0) { int pad = 0; xferfunc(drive, &pad, sizeof(pad)); diff -urN linux-2.5.65-bk5/drivers/parisc/eisa_eeprom.c linux-2.5.66/drivers/parisc/eisa_eeprom.c --- linux-2.5.65-bk5/drivers/parisc/eisa_eeprom.c Mon Mar 17 13:44:42 2003 +++ linux-2.5.66/drivers/parisc/eisa_eeprom.c Mon Mar 31 12:45:35 2003 @@ -12,7 +12,7 @@ static unsigned long eeprom_addr; -static long long eisa_eeprom_llseek(struct file *file, loff_t offset, int origin ) +static loff_t eisa_eeprom_llseek(struct file *file, loff_t offset, int origin ) { switch (origin) { case 0: diff -urN linux-2.5.65-bk5/drivers/pci/pci.ids linux-2.5.66/drivers/pci/pci.ids --- linux-2.5.65-bk5/drivers/pci/pci.ids Mon Mar 17 13:44:06 2003 +++ linux-2.5.66/drivers/pci/pci.ids Mon Mar 31 12:45:36 2003 @@ -4911,6 +4911,8 @@ 0100 Lava Dual Serial 0101 Lava Quatro A 0102 Lava Quatro B + 0180 Lava Octo A + 0181 Lava Octo B 0200 Lava Port Plus 0201 Lava Quad A 0202 Lava Quad B diff -urN linux-2.5.65-bk5/drivers/pci/quirks.c linux-2.5.66/drivers/pci/quirks.c --- linux-2.5.65-bk5/drivers/pci/quirks.c Mon Mar 17 13:43:38 2003 +++ linux-2.5.66/drivers/pci/quirks.c Mon Mar 31 12:45:36 2003 @@ -719,6 +719,7 @@ * instead of 0x01. */ { PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82380FB, quirk_transparent_bridge }, + { PCI_FIXUP_HEADER, PCI_VENDOR_ID_TOSHIBA, 0x605, quirk_transparent_bridge }, { PCI_FIXUP_FINAL, PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_PCI_MASTER, quirk_mediagx_master }, diff -urN linux-2.5.65-bk5/drivers/sbus/char/riowatchdog.c linux-2.5.66/drivers/sbus/char/riowatchdog.c --- linux-2.5.65-bk5/drivers/sbus/char/riowatchdog.c Mon Mar 17 13:44:06 2003 +++ linux-2.5.66/drivers/sbus/char/riowatchdog.c Mon Mar 31 12:45:36 2003 @@ -1,4 +1,4 @@ -/* $Id: riowatchdog.c,v 1.3 2001/10/08 22:19:51 davem Exp $ +/* $Id: riowatchdog.c,v 1.3.2.2 2002/01/23 18:48:02 davem Exp $ * riowatchdog.c - driver for hw watchdog inside Super I/O of RIO * * Copyright (C) 2001 David S. Miller (davem@redhat.com) @@ -127,8 +127,11 @@ static int riowd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { - static struct watchdog_info info = { 0, 0, "Natl. Semiconductor PC97317" }; + static struct watchdog_info info = { + WDIOF_SETTIMEOUT, 0, "Natl. Semiconductor PC97317" + }; unsigned int options; + int new_margin; switch (cmd) { case WDIOC_GETSUPPORT: @@ -159,6 +162,18 @@ break; + case WDIOC_SETTIMEOUT: + if (get_user(new_margin, (int *)arg)) + return -EFAULT; + if ((new_margin < 60) || (new_margin > (255 * 60))) + return -EINVAL; + riowd_timeout = (new_margin + 59) / 60; + riowd_pingtimer(); + /* Fall */ + + case WDIOC_GETTIMEOUT: + return put_user(riowd_timeout * 60, (int *)arg); + default: return -EINVAL; }; diff -urN linux-2.5.65-bk5/drivers/scsi/scsi.h linux-2.5.66/drivers/scsi/scsi.h --- linux-2.5.65-bk5/drivers/scsi/scsi.h Mon Mar 17 13:43:49 2003 +++ linux-2.5.66/drivers/scsi/scsi.h Mon Mar 31 12:45:37 2003 @@ -193,7 +193,7 @@ #define SCSI_LOG_HLCOMPLETE_BITS 3 #define SCSI_LOG_IOCTL_BITS 3 -#if CONFIG_SCSI_LOGGING +#ifdef CONFIG_SCSI_LOGGING #define SCSI_CHECK_LOGGING(SHIFT, BITS, LEVEL, CMD) \ { \ diff -urN linux-2.5.65-bk5/drivers/serial/8250_pci.c linux-2.5.66/drivers/serial/8250_pci.c --- linux-2.5.65-bk5/drivers/serial/8250_pci.c Mon Mar 17 13:44:38 2003 +++ linux-2.5.66/drivers/serial/8250_pci.c Mon Mar 31 12:45:37 2003 @@ -897,6 +897,7 @@ pbn_b0_bt_1_460800, pbn_b0_bt_2_460800, + pbn_b0_bt_4_460800, pbn_b0_bt_1_921600, pbn_b0_bt_2_921600, @@ -1039,6 +1040,12 @@ .base_baud = 460800, .uart_offset = 8, }, + [pbn_b0_bt_4_460800] = { + .flags = FL_BASE0|FL_BASE_BARS, + .num_ports = 4, + .base_baud = 460800, + .uart_offset = 8, + }, [pbn_b0_bt_1_921600] = { .flags = FL_BASE0|FL_BASE_BARS, @@ -1928,6 +1935,12 @@ { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_QUATRO_B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b0_bt_2_115200 }, + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_A, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_b0_bt_4_460800 }, + { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_OCTO_B, + PCI_ANY_ID, PCI_ANY_ID, 0, 0, + pbn_b0_bt_4_460800 }, { PCI_VENDOR_ID_LAVA, PCI_DEVICE_ID_LAVA_PORT_PLUS, PCI_ANY_ID, PCI_ANY_ID, 0, 0, pbn_b0_bt_2_460800 }, diff -urN linux-2.5.65-bk5/drivers/usb/class/usblp.c linux-2.5.66/drivers/usb/class/usblp.c --- linux-2.5.65-bk5/drivers/usb/class/usblp.c Mon Mar 17 13:43:44 2003 +++ linux-2.5.66/drivers/usb/class/usblp.c Mon Mar 31 12:45:38 2003 @@ -186,8 +186,6 @@ } #endif -extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */ - /* Quirks: various printer quirks are handled by this table & its flags. */ struct quirk_printer_struct { @@ -820,7 +818,7 @@ struct usblp *usblp = 0; int protocol; int retval; - char name[6]; + char name[10]; /* Malloc and start initializing usblp structure so we can use it * directly. */ @@ -909,8 +907,8 @@ #endif /* If we have devfs, create with perms=660. */ - sprintf(name, "lp%d", usblp->minor); - usblp->devfs = devfs_register(usb_devfs_handle, name, + sprintf(name, "usb/lp%d", usblp->minor); + usblp->devfs = devfs_register(NULL, name, DEVFS_FL_DEFAULT, USB_MAJOR, usblp->minor, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | diff -urN linux-2.5.65-bk5/drivers/usb/core/file.c linux-2.5.66/drivers/usb/core/file.c --- linux-2.5.65-bk5/drivers/usb/core/file.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/drivers/usb/core/file.c Mon Mar 31 12:45:38 2003 @@ -28,8 +28,7 @@ #endif #include -devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */ -EXPORT_SYMBOL(usb_devfs_handle); +static devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */ #define MAX_USB_MINORS 256 static struct file_operations *usb_minors[MAX_USB_MINORS]; diff -urN linux-2.5.65-bk5/drivers/usb/image/scanner.c linux-2.5.66/drivers/usb/image/scanner.c --- linux-2.5.65-bk5/drivers/usb/image/scanner.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/drivers/usb/image/scanner.c Mon Mar 31 12:45:38 2003 @@ -878,7 +878,7 @@ char valid_device = 0; char have_bulk_in, have_bulk_out, have_intr; - char name[10]; + char name[14]; dbg("probe_scanner: USB dev address:%p", dev); @@ -1099,9 +1099,9 @@ scn->scn_minor = scn_minor; scn->isopen = 0; - sprintf(name, "scanner%d", scn->scn_minor - SCN_BASE_MNR); + sprintf(name, "usb/scanner%d", scn->scn_minor - SCN_BASE_MNR); - scn->devfs = devfs_register(usb_devfs_handle, name, + scn->devfs = devfs_register(NULL, name, DEVFS_FL_DEFAULT, USB_MAJOR, scn->scn_minor, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | diff -urN linux-2.5.65-bk5/drivers/usb/image/scanner.h linux-2.5.66/drivers/usb/image/scanner.h --- linux-2.5.65-bk5/drivers/usb/image/scanner.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/drivers/usb/image/scanner.h Mon Mar 31 12:45:38 2003 @@ -352,6 +352,4 @@ }; #define to_scanner(d) container_of(d, struct scn_usb_data, kobj) -extern devfs_handle_t usb_devfs_handle; - static struct usb_driver scanner_driver; diff -urN linux-2.5.65-bk5/drivers/usb/misc/auerswald.c linux-2.5.66/drivers/usb/misc/auerswald.c --- linux-2.5.65-bk5/drivers/usb/misc/auerswald.c Mon Mar 17 13:44:04 2003 +++ linux-2.5.66/drivers/usb/misc/auerswald.c Mon Mar 31 12:45:38 2003 @@ -72,9 +72,6 @@ #endif -/* prefix for the device descriptors in /dev/usb */ -#define AU_PREFIX "auer" - /* Number of read buffers for each device */ #define AU_RBUFFERS 10 @@ -243,7 +240,7 @@ typedef struct { struct semaphore mutex; /* protection in user context */ - char name[16]; /* name of the /dev/usb entry */ + char name[20]; /* name of the /dev/usb entry */ unsigned int dtindex; /* index in the device table */ devfs_handle_t devfs; /* devfs device node */ struct usb_device * usbdev; /* USB device handle */ @@ -260,9 +257,6 @@ wait_queue_head_t bufferwait; /* wait for a control buffer */ } auerswald_t,*pauerswald_t; -/* the global usb devfs handle */ -extern devfs_handle_t usb_devfs_handle; - /* array of pointers to our devices that are currently connected */ static pauerswald_t dev_table[AUER_MAX_DEVICES]; @@ -1440,7 +1434,7 @@ cp->open_count++; ccp->auerdev = cp; - dbg("open %s as /dev/usb/%s", cp->dev_desc, cp->name); + dbg("open %s as /dev/%s", cp->dev_desc, cp->name); up (&cp->mutex); /* file IO stuff */ @@ -1970,7 +1964,7 @@ } /* Give the device a name */ - sprintf (cp->name, AU_PREFIX "%d", dtindex); + sprintf (cp->name, "usb/auer%d", dtindex); /* Store the index */ cp->dtindex = dtindex; @@ -1978,8 +1972,7 @@ up (&dev_table_mutex); /* initialize the devfs node for this device and register it */ - cp->devfs = devfs_register (usb_devfs_handle, cp->name, - DEVFS_FL_DEFAULT, USB_MAJOR, + cp->devfs = devfs_register(NULL, cp->name, 0, USB_MAJOR, AUER_MINOR_BASE + dtindex, S_IFCHR | S_IRUGO | S_IWUGO, &auerswald_fops, NULL); @@ -2089,7 +2082,7 @@ return; down (&cp->mutex); - info ("device /dev/usb/%s now disconnecting", cp->name); + info ("device /dev/%s now disconnecting", cp->name); /* remove from device table */ /* Nobody can open() this device any more */ diff -urN linux-2.5.65-bk5/drivers/usb/misc/brlvger.c linux-2.5.66/drivers/usb/misc/brlvger.c --- linux-2.5.65-bk5/drivers/usb/misc/brlvger.c Mon Mar 17 13:44:06 2003 +++ linux-2.5.66/drivers/usb/misc/brlvger.c Mon Mar 31 12:45:38 2003 @@ -144,8 +144,6 @@ #define rcvcontrolmsg(priv,a,b,c,d,e,f) \ controlmsg(priv, USB_DIR_IN, a,b,c,d,e,f) -extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */ - /* ----------------------------------------------------------------------- */ /* Data */ @@ -294,7 +292,7 @@ /* protects against reentrance: once we've found a free slot we reserve it.*/ static DECLARE_MUTEX(reserve_sem); - char devfs_name[16]; + char devfs_name[20]; actifsettings = dev->actconfig->interface->altsetting; @@ -375,8 +373,8 @@ }; dbg("Display length: %d", priv->plength); - sprintf(devfs_name, "brlvger%d", priv->subminor); - priv->devfs = devfs_register(usb_devfs_handle, devfs_name, + sprintf(devfs_name, "usb/brlvger%d", priv->subminor); + priv->devfs = devfs_register(NULL, devfs_name, DEVFS_FL_DEFAULT, USB_MAJOR, BRLVGER_MINOR+priv->subminor, S_IFCHR |S_IRUSR|S_IWUSR |S_IRGRP|S_IWGRP, diff -urN linux-2.5.65-bk5/drivers/usb/misc/rio500.c linux-2.5.66/drivers/usb/misc/rio500.c --- linux-2.5.65-bk5/drivers/usb/misc/rio500.c Mon Mar 17 13:44:16 2003 +++ linux-2.5.66/drivers/usb/misc/rio500.c Mon Mar 31 12:45:38 2003 @@ -76,8 +76,6 @@ struct semaphore lock; /* general race avoidance */ }; -extern devfs_handle_t usb_devfs_handle; /* /dev/usb dir. */ - static struct rio_usb_data rio_instance; static int open_rio(struct inode *inode, struct file *file) @@ -478,7 +476,7 @@ } dbg("probe_rio: ibuf address:%p", rio->ibuf); - rio->devfs = devfs_register(usb_devfs_handle, "rio500", + rio->devfs = devfs_register(NULL, "usb/rio500", DEVFS_FL_DEFAULT, USB_MAJOR, RIO_MINOR, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | diff -urN linux-2.5.65-bk5/drivers/usb/net/rtl8150.c linux-2.5.66/drivers/usb/net/rtl8150.c --- linux-2.5.65-bk5/drivers/usb/net/rtl8150.c Mon Mar 17 13:44:09 2003 +++ linux-2.5.66/drivers/usb/net/rtl8150.c Mon Mar 31 12:45:38 2003 @@ -107,7 +107,6 @@ typedef struct rtl8150 rtl8150_t; /* the global usb devfs handle */ -extern devfs_handle_t usb_devfs_handle; unsigned long multicast_filter_limit = 32; static void fill_skb_pool(rtl8150_t *); diff -urN linux-2.5.65-bk5/drivers/usb/usb-skeleton.c linux-2.5.66/drivers/usb/usb-skeleton.c --- linux-2.5.65-bk5/drivers/usb/usb-skeleton.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/drivers/usb/usb-skeleton.c Mon Mar 31 12:45:38 2003 @@ -119,9 +119,6 @@ }; -/* the global usb devfs handle */ -extern devfs_handle_t usb_devfs_handle; - /* prevent races between open() and disconnect() */ static DECLARE_MUTEX (disconnect_sem); @@ -514,7 +511,7 @@ size_t buffer_size; int i; int retval; - char name[10]; + char name[14]; /* See if the device offered us matches what we can accept */ @@ -609,9 +606,9 @@ } /* initialize the devfs node for this device and register it */ - sprintf(name, "skel%d", dev->minor); + sprintf(name, "usb/skel%d", dev->minor); - dev->devfs = devfs_register (usb_devfs_handle, name, + dev->devfs = devfs_register(NULL, name, DEVFS_FL_DEFAULT, USB_MAJOR, dev->minor, S_IFCHR | S_IRUSR | S_IWUSR | diff -urN linux-2.5.65-bk5/fs/cramfs/inode.c linux-2.5.66/fs/cramfs/inode.c --- linux-2.5.65-bk5/fs/cramfs/inode.c Mon Mar 17 13:43:39 2003 +++ linux-2.5.66/fs/cramfs/inode.c Mon Mar 31 12:45:39 2003 @@ -51,6 +51,7 @@ inode->i_blocks = (cramfs_inode->size - 1) / 512 + 1; inode->i_blksize = PAGE_CACHE_SIZE; inode->i_gid = cramfs_inode->gid; + inode->i_mtime = inode->i_atime = inode->i_ctime = 0; inode->i_ino = CRAMINO(cramfs_inode); /* inode->i_nlink is left 1 - arguably wrong for directories, but it's the best we can do without reading the directory diff -urN linux-2.5.65-bk5/fs/dcache.c linux-2.5.66/fs/dcache.c --- linux-2.5.65-bk5/fs/dcache.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/fs/dcache.c Mon Mar 31 12:45:39 2003 @@ -784,7 +784,8 @@ struct dentry *res = NULL; if (root_inode) { - res = d_alloc(NULL, &(const struct qstr) { "/", 1, 0 }); + static const struct qstr name = { .name = "/", .len = 1, .hash = 0 }; + res = d_alloc(NULL, &name); if (res) { res->d_sb = root_inode->i_sb; res->d_parent = res; @@ -994,12 +995,12 @@ /* * If dentry is moved, fail the lookup */ - if (unlikely(move_count != dentry->d_move_count)) - break; - if (!d_unhashed(dentry)) { - atomic_inc(&dentry->d_count); - dentry->d_vfs_flags |= DCACHE_REFERENCED; - found = dentry; + if (likely(move_count == dentry->d_move_count)) { + if (!d_unhashed(dentry)) { + atomic_inc(&dentry->d_count); + dentry->d_vfs_flags |= DCACHE_REFERENCED; + found = dentry; + } } spin_unlock(&dentry->d_lock); break; diff -urN linux-2.5.65-bk5/fs/devfs/util.c linux-2.5.66/fs/devfs/util.c --- linux-2.5.65-bk5/fs/devfs/util.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/fs/devfs/util.c Mon Mar 31 12:45:39 2003 @@ -70,6 +70,7 @@ #include #include #include +#include #include #include "internal.h" @@ -266,6 +267,18 @@ up(&device_list_mutex); } +struct unique_numspace +{ + spinlock_t init_lock; + unsigned char sem_initialised; + unsigned int num_free; /* Num free in bits */ + unsigned int length; /* Array length in bytes */ + unsigned long *bits; + struct semaphore semaphore; +}; + +#define UNIQUE_NUMBERSPACE_INITIALISER {SPIN_LOCK_UNLOCKED, 0, 0, 0, NULL} + /** * devfs_alloc_unique_number - Allocate a unique (positive) number. @@ -339,3 +352,82 @@ if (!was_set) PRINTK ("(): number %d was already free\n", number); } /* End Function devfs_dealloc_unique_number */ EXPORT_SYMBOL(devfs_dealloc_unique_number); + +static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER; +static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER; + +void devfs_create_partitions(struct gendisk *dev) +{ + int pos = 0; + devfs_handle_t dir; + char dirname[64], symlink[16]; + + if (dev->flags & GENHD_FL_DEVFS) { + dir = dev->de; + if (!dir) /* Aware driver wants to block disc management */ + return; + pos = devfs_generate_path(dir, dirname + 3, sizeof dirname-3); + if (pos < 0) + return; + strncpy(dirname + pos, "../", 3); + } else { + /* Unaware driver: construct "real" directory */ + sprintf(dirname, "../%s/disc%d", dev->disk_name, + dev->first_minor >> dev->minor_shift); + dir = devfs_mk_dir(dirname + 3); + dev->de = dir; + } + dev->number = devfs_alloc_unique_number (&disc_numspace); + sprintf(symlink, "discs/disc%d", dev->number); + devfs_mk_symlink(symlink, dirname + pos); + dev->disk_de = devfs_register(dir, "disc", 0, + dev->major, dev->first_minor, + S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); +} + +void devfs_create_cdrom(struct gendisk *dev) +{ + char vname[23]; + + dev->number = devfs_alloc_unique_number(&cdrom_numspace); + sprintf(vname, "cdroms/cdrom%d", dev->number); + if (dev->de) { + int pos; + char rname[64]; + + dev->disk_de = devfs_register(dev->de, "cd", DEVFS_FL_DEFAULT, + dev->major, dev->first_minor, + S_IFBLK | S_IRUGO | S_IWUGO, + dev->fops, NULL); + + pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3); + if (pos >= 0) { + strncpy(rname + pos, "../", 3); + devfs_mk_symlink(vname, rname + pos); + } + } else { + dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT, + dev->major, dev->first_minor, + S_IFBLK | S_IRUGO | S_IWUGO, + dev->fops, NULL); + } +} + +void devfs_remove_partitions(struct gendisk *dev) +{ + devfs_unregister(dev->disk_de); + dev->disk_de = NULL; + + if (dev->flags & GENHD_FL_CD) { + if (dev->de) + devfs_remove("cdroms/cdrom%d", dev->number); + devfs_dealloc_unique_number(&cdrom_numspace, dev->number); + } else { + devfs_remove("discs/disc%d", dev->number); + if (!(dev->flags & GENHD_FL_DEVFS)) { + devfs_unregister(dev->de); + dev->de = NULL; + } + devfs_dealloc_unique_number(&disc_numspace, dev->number); + } +} diff -urN linux-2.5.65-bk5/fs/eventpoll.c linux-2.5.66/fs/eventpoll.c --- linux-2.5.65-bk5/fs/eventpoll.c Mon Mar 17 13:44:03 2003 +++ linux-2.5.66/fs/eventpoll.c Mon Mar 31 12:45:39 2003 @@ -1,6 +1,6 @@ /* * fs/eventpoll.c ( Efficent event polling implementation ) - * Copyright (C) 2001,...,2002 Davide Libenzi + * Copyright (C) 2001,...,2003 Davide Libenzi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -117,11 +117,6 @@ */ #define EP_MAX_BUF_EVENTS 32 -/* - * Used to optimize ready items collection by reducing the irqlock/irqunlock - * switching rate. This is kept in stack too, so do not go wild with this number. - */ -#define EP_MAX_COLLECT_ITEMS 64 /* @@ -223,6 +218,15 @@ /* List header used to link this item to the "struct file" items list */ struct list_head fllink; + + /* List header used to link the item to the transfer list */ + struct list_head txlink; + + /* + * This is used during the collection/transfer of events to userspace + * to pin items empty events set. + */ + unsigned int revents; }; /* Wrapper struct used by poll queueing */ @@ -256,9 +260,10 @@ static int ep_poll_callback(wait_queue_t *wait, unsigned mode, int sync); static int ep_eventpoll_close(struct inode *inode, struct file *file); static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait); -static int ep_collect_ready_items(struct eventpoll *ep, struct epitem **aepi, int maxepi); -static int ep_send_events(struct eventpoll *ep, struct epitem **aepi, int nepi, +static int ep_collect_ready_items(struct eventpoll *ep, struct list_head *txlist, int maxevents); +static int ep_send_events(struct eventpoll *ep, struct list_head *txlist, struct epoll_event *events); +static void ep_reinject_items(struct eventpoll *ep, struct list_head *txlist); static int ep_events_transfer(struct eventpoll *ep, struct epoll_event *events, int maxevents); static int ep_poll(struct eventpoll *ep, struct epoll_event *events, int maxevents, long timeout); @@ -340,13 +345,14 @@ unsigned long flags; task_t *this_task = current; struct list_head *lsthead = &psw->wake_task_list, *lnk; + struct wake_task_node *tncur; struct wake_task_node tnode; spin_lock_irqsave(&psw->lock, flags); /* Try to see if the current task is already inside this wakeup call */ list_for_each(lnk, lsthead) { - struct wake_task_node *tncur = list_entry(lnk, struct wake_task_node, llink); + tncur = list_entry(lnk, struct wake_task_node, llink); if (tncur->task == this_task) { if (tncur->wq == wq || ++wake_nests > EP_MAX_POLLWAKE_NESTS) { @@ -386,7 +392,7 @@ unsigned int i, val; for (i = 0, val = 1; val < hintsize && i < EP_MAX_HASH_BITS; i++, val <<= 1); - return i < EP_MIN_HASH_BITS ? EP_MIN_HASH_BITS: i; + return i < EP_MIN_HASH_BITS ? EP_MIN_HASH_BITS: i; } @@ -830,6 +836,7 @@ { unsigned int i, hsize; struct list_head *lsthead, *lnk; + struct epitem *epi; /* * We need to lock this because we could be hit by @@ -844,7 +851,7 @@ lsthead = ep_hash_entry(ep, i); list_for_each(lnk, lsthead) { - struct epitem *epi = list_entry(lnk, struct epitem, llink); + epi = list_entry(lnk, struct epitem, llink); ep_unregister_pollwait(ep, epi); } @@ -860,7 +867,7 @@ lsthead = ep_hash_entry(ep, i); while (!list_empty(lsthead)) { - struct epitem *epi = list_entry(lsthead->next, struct epitem, llink); + epi = list_entry(lsthead->next, struct epitem, llink); ep_remove(ep, epi); } @@ -939,17 +946,14 @@ struct epitem *epi = EP_ITEM_FROM_EPQUEUE(pt); struct eppoll_entry *pwq; - if (epi->nwait >= 0 && (pwq = PWQ_MEM_ALLOC())) - { + if (epi->nwait >= 0 && (pwq = PWQ_MEM_ALLOC())) { init_waitqueue_func_entry(&pwq->wait, ep_poll_callback); pwq->whead = whead; pwq->base = epi; add_wait_queue(whead, &pwq->wait); list_add_tail(&pwq->llink, &epi->pwqlist); epi->nwait++; - } - else - { + } else { /* We have to signal that an error occurred */ epi->nwait = -1; } @@ -971,6 +975,7 @@ INIT_LIST_HEAD(&epi->llink); INIT_LIST_HEAD(&epi->rdllink); INIT_LIST_HEAD(&epi->fllink); + INIT_LIST_HEAD(&epi->txlink); INIT_LIST_HEAD(&epi->pwqlist); epi->ep = ep; epi->file = tfile; @@ -1077,16 +1082,28 @@ /* Copy the data member from inside the lock */ epi->event.data = event->data; - /* If the file is already "ready" we drop it inside the ready list */ - if ((revents & event->events) && EP_IS_LINKED(&epi->llink) && - !EP_IS_LINKED(&epi->rdllink)) { - list_add_tail(&epi->rdllink, &ep->rdllist); - - /* Notify waiting tasks that events are available */ - if (waitqueue_active(&ep->wq)) - wake_up(&ep->wq); - if (waitqueue_active(&ep->poll_wait)) - pwake++; + /* + * If the item is not linked to the hash it means that it's on its + * way toward the removal. Do nothing in this case. + */ + if (EP_IS_LINKED(&epi->llink)) { + /* + * If the item is "hot" and it is not registered inside the ready + * list, push it inside. If the item is not "hot" and it is currently + * registered inside the ready list, unlink it. + */ + if (revents & event->events) { + if (!EP_IS_LINKED(&epi->rdllink)) { + list_add_tail(&epi->rdllink, &ep->rdllist); + + /* Notify waiting tasks that events are available */ + if (waitqueue_active(&ep->wq)) + wake_up(&ep->wq); + if (waitqueue_active(&ep->poll_wait)) + pwake++; + } + } else if (EP_IS_LINKED(&epi->rdllink)) + EP_LIST_DEL(&epi->rdllink); } write_unlock_irqrestore(&ep->lock, flags); @@ -1113,8 +1130,7 @@ /* This is called without locks, so we need the atomic exchange */ nwait = xchg(&epi->nwait, 0); - if (nwait) - { + if (nwait) { while (!list_empty(lsthead)) { pwq = list_entry(lsthead->next, struct eppoll_entry, llink); @@ -1143,6 +1159,13 @@ goto eexit_1; /* + * Clear the event mask for the unlinked item. This will avoid item + * notifications to be sent after the unlink operation from inside + * the kernel->userspace event transfer loop. + */ + epi->event.events = 0; + + /* * At this point is safe to do the job, unlink the item from our list. * This operation togheter with the above check closes the door to * double unlinks. @@ -1295,28 +1318,45 @@ * during the f_op->poll() call, we try to collect the maximum number of items * by reducing the irqlock/irqunlock switching rate. */ -static int ep_collect_ready_items(struct eventpoll *ep, struct epitem **aepi, int maxepi) +static int ep_collect_ready_items(struct eventpoll *ep, struct list_head *txlist, int maxevents) { int nepi; unsigned long flags; - struct list_head *lsthead = &ep->rdllist; + struct list_head *lsthead = &ep->rdllist, *lnk; + struct epitem *epi; write_lock_irqsave(&ep->lock, flags); - for (nepi = 0; nepi < maxepi && !list_empty(lsthead);) { - struct epitem *epi = list_entry(lsthead->next, struct epitem, rdllink); + for (nepi = 0, lnk = lsthead->next; lnk != lsthead && nepi < maxevents;) { + epi = list_entry(lnk, struct epitem, rdllink); - /* Remove the item from the ready list */ - EP_LIST_DEL(&epi->rdllink); + lnk = lnk->next; - /* - * We need to increase the usage count of the "struct epitem" because - * another thread might call EPOLL_CTL_DEL on this target and make the - * object to vanish underneath our nose. - */ - ep_use_epitem(epi); + /* If this file is already in the ready list we exit soon */ + if (!EP_IS_LINKED(&epi->txlink)) { + /* + * We need to increase the usage count of the "struct epitem" because + * another thread might call EPOLL_CTL_DEL on this target and make the + * object to vanish underneath our nose. + */ + ep_use_epitem(epi); - aepi[nepi++] = epi; + /* + * This is initialized in this way so that the default + * behaviour of the reinjecting code will be to push back + * the item inside the ready list. + */ + epi->revents = epi->event.events; + + /* Link the ready item into the transfer list */ + list_add(&epi->txlink, txlist); + nepi++; + + /* + * Unlink the item from the ready list. + */ + EP_LIST_DEL(&epi->rdllink); + } } write_unlock_irqrestore(&ep->lock, flags); @@ -1330,36 +1370,40 @@ * __copy_to_user() might sleep, and also f_op->poll() might reenable the IRQ * because of the way poll() is traditionally implemented in Linux. */ -static int ep_send_events(struct eventpoll *ep, struct epitem **aepi, int nepi, +static int ep_send_events(struct eventpoll *ep, struct list_head *txlist, struct epoll_event *events) { - int i, eventcnt, eventbuf, revents; + int eventcnt = 0, eventbuf = 0; + unsigned int revents; + struct list_head *lnk; struct epitem *epi; struct epoll_event event[EP_MAX_BUF_EVENTS]; - for (i = 0, eventcnt = 0, eventbuf = 0; i < nepi; i++, aepi++) { - epi = *aepi; + list_for_each(lnk, txlist) { + epi = list_entry(lnk, struct epitem, txlink); /* Get the ready file event set */ revents = epi->file->f_op->poll(epi->file, NULL); - if (revents & epi->event.events) { + /* + * Set the return event set for the current file descriptor. + * Note that only the task task was successfully able to link + * the item to its "txlist" will write this field. + */ + epi->revents = revents & epi->event.events; + + if (epi->revents) { event[eventbuf] = epi->event; event[eventbuf].events &= revents; eventbuf++; if (eventbuf == EP_MAX_BUF_EVENTS) { if (__copy_to_user(&events[eventcnt], event, - eventbuf * sizeof(struct epoll_event))) { - for (; i < nepi; i++, aepi++) - ep_release_epitem(*aepi); + eventbuf * sizeof(struct epoll_event))) return -EFAULT; - } eventcnt += eventbuf; eventbuf = 0; } } - - ep_release_epitem(epi); } if (eventbuf) { @@ -1374,12 +1418,68 @@ /* + * Walk through the transfer list we collected with ep_collect_ready_items() + * and, if 1) the item is still "alive" 2) its event set is not empty 3) it's + * not already linked, links it to the ready list. + */ +static void ep_reinject_items(struct eventpoll *ep, struct list_head *txlist) +{ + int ricnt = 0, pwake = 0; + unsigned long flags; + struct epitem *epi; + + write_lock_irqsave(&ep->lock, flags); + + while (!list_empty(txlist)) { + epi = list_entry(txlist->next, struct epitem, txlink); + + /* Unlink the current item from the transfer list */ + EP_LIST_DEL(&epi->txlink); + + /* + * If the item is no more linked to the interest set, we don't + * have to push it inside the ready list because the following + * ep_release_epitem() is going to drop it. Also, if the current + * item is set to have an Edge Triggered behaviour, we don't have + * to push it back either. + */ + if (EP_IS_LINKED(&epi->llink) && !(epi->event.events & EPOLLET) && + (epi->revents & epi->event.events) && !EP_IS_LINKED(&epi->rdllink)) { + list_add_tail(&epi->rdllink, &ep->rdllist); + ricnt++; + } + + ep_release_epitem(epi); + } + + if (ricnt) { + /* + * Wake up ( if active ) both the eventpoll wait list and the ->poll() + * wait list. + */ + if (waitqueue_active(&ep->wq)) + wake_up(&ep->wq); + if (waitqueue_active(&ep->poll_wait)) + pwake++; + } + + write_unlock_irqrestore(&ep->lock, flags); + + /* We have to call this outside the lock */ + if (pwake) + ep_poll_safewake(&psw, &ep->poll_wait); +} + + +/* * Perform the transfer of events to user space. */ static int ep_events_transfer(struct eventpoll *ep, struct epoll_event *events, int maxevents) { - int eventcnt, nepi, sepi, maxepi; - struct epitem *aepi[EP_MAX_COLLECT_ITEMS]; + int eventcnt = 0; + struct list_head txlist; + + INIT_LIST_HEAD(&txlist); /* * We need to lock this because we could be hit by @@ -1392,25 +1492,13 @@ */ down_read(&epsem); - for (eventcnt = 0; eventcnt < maxevents;) { - /* Maximum items we can extract this time */ - maxepi = min(EP_MAX_COLLECT_ITEMS, maxevents - eventcnt); - - /* Collect/extract ready items */ - nepi = ep_collect_ready_items(ep, aepi, maxepi); - - if (nepi) { - /* Send events to userspace */ - sepi = ep_send_events(ep, aepi, nepi, &events[eventcnt]); - if (sepi < 0) { - up_read(&epsem); - return sepi; - } - eventcnt += sepi; - } + /* Collect/extract ready items */ + if (ep_collect_ready_items(ep, &txlist, maxevents)) { + /* Build result set in userspace */ + eventcnt = ep_send_events(ep, &txlist, events); - if (nepi < maxepi) - break; + /* Reinject ready items into the ready list */ + ep_reinject_items(ep, &txlist); } up_read(&epsem); diff -urN linux-2.5.65-bk5/fs/partitions/check.c linux-2.5.66/fs/partitions/check.c --- linux-2.5.65-bk5/fs/partitions/check.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/fs/partitions/check.c Mon Mar 31 12:45:39 2003 @@ -176,93 +176,6 @@ #endif } -#ifdef CONFIG_DEVFS_FS -static struct unique_numspace disc_numspace = UNIQUE_NUMBERSPACE_INITIALISER; -static struct unique_numspace cdrom_numspace = UNIQUE_NUMBERSPACE_INITIALISER; -#endif - -static void devfs_create_partitions(struct gendisk *dev) -{ -#ifdef CONFIG_DEVFS_FS - int pos = 0; - devfs_handle_t dir; - char dirname[64], symlink[16]; - - if (dev->flags & GENHD_FL_DEVFS) { - dir = dev->de; - if (!dir) /* Aware driver wants to block disc management */ - return; - pos = devfs_generate_path(dir, dirname + 3, sizeof dirname-3); - if (pos < 0) - return; - strncpy(dirname + pos, "../", 3); - } else { - /* Unaware driver: construct "real" directory */ - sprintf(dirname, "../%s/disc%d", dev->disk_name, - dev->first_minor >> dev->minor_shift); - dir = devfs_mk_dir(dirname + 3); - dev->de = dir; - } - dev->number = devfs_alloc_unique_number (&disc_numspace); - sprintf(symlink, "discs/disc%d", dev->number); - devfs_mk_symlink(symlink, dirname + pos); - dev->disk_de = devfs_register(dir, "disc", 0, - dev->major, dev->first_minor, - S_IFBLK | S_IRUSR | S_IWUSR, dev->fops, NULL); -#endif -} - -static void devfs_create_cdrom(struct gendisk *dev) -{ -#ifdef CONFIG_DEVFS_FS - char vname[23]; - - dev->number = devfs_alloc_unique_number(&cdrom_numspace); - sprintf(vname, "cdroms/cdrom%d", dev->number); - if (dev->de) { - int pos; - char rname[64]; - - dev->disk_de = devfs_register(dev->de, "cd", DEVFS_FL_DEFAULT, - dev->major, dev->first_minor, - S_IFBLK | S_IRUGO | S_IWUGO, - dev->fops, NULL); - - pos = devfs_generate_path(dev->disk_de, rname+3, sizeof(rname)-3); - if (pos >= 0) { - strncpy(rname + pos, "../", 3); - devfs_mk_symlink(vname, rname + pos); - } - } else { - dev->disk_de = devfs_register (NULL, vname, DEVFS_FL_DEFAULT, - dev->major, dev->first_minor, - S_IFBLK | S_IRUGO | S_IWUGO, - dev->fops, NULL); - } -#endif -} - -static void devfs_remove_partitions(struct gendisk *dev) -{ -#ifdef CONFIG_DEVFS_FS - devfs_unregister(dev->disk_de); - dev->disk_de = NULL; - if (dev->flags & GENHD_FL_CD) { - if (dev->de) - devfs_remove("cdroms/cdrom%d", dev->number); - devfs_dealloc_unique_number(&cdrom_numspace, dev->number); - } else { - devfs_remove("discs/disc%d", dev->number); - if (!(dev->flags & GENHD_FL_DEVFS)) { - devfs_unregister(dev->de); - dev->de = NULL; - } - devfs_dealloc_unique_number(&disc_numspace, dev->number); - } -#endif -} - - /* * sysfs bindings for partitions */ @@ -522,6 +435,7 @@ { struct gendisk *hd; static char nomem [] = ""; + char b[BDEVNAME_SIZE]; struct dev_name *dname; struct list_head *tmp; int part; @@ -547,7 +461,7 @@ put_disk(hd); } if (!dname->name) { - sprintf(dname->namebuf, "[dev %s]", kdevname(to_kdev_t(dev))); + sprintf(dname->namebuf, "[dev %s]", __bdevname(dev, b)); dname->name = dname->namebuf; } diff -urN linux-2.5.65-bk5/include/asm-i386/bitops.h linux-2.5.66/include/asm-i386/bitops.h --- linux-2.5.65-bk5/include/asm-i386/bitops.h Mon Mar 17 13:44:17 2003 +++ linux-2.5.66/include/asm-i386/bitops.h Mon Mar 31 12:45:40 2003 @@ -458,7 +458,7 @@ __asm__("bsfl %1,%0\n\t" "jnz 1f\n\t" "movl $-1,%0\n" - "1:" : "=r" (r) : "g" (x)); + "1:" : "=r" (r) : "rm" (x)); return r+1; } diff -urN linux-2.5.65-bk5/include/asm-i386/io.h linux-2.5.66/include/asm-i386/io.h --- linux-2.5.65-bk5/include/asm-i386/io.h Mon Mar 17 13:44:50 2003 +++ linux-2.5.66/include/asm-i386/io.h Mon Mar 31 12:45:40 2003 @@ -49,7 +49,7 @@ * Temporary debugging check to catch old code using * unmapped ISA addresses. Will be removed in 2.4. */ -#if CONFIG_DEBUG_IOVIRT +#ifdef CONFIG_DEBUG_IOVIRT extern void *__io_virt_debug(unsigned long x, const char *file, int line); #define __io_virt(x) __io_virt_debug((unsigned long)(x), __FILE__, __LINE__) #else diff -urN linux-2.5.65-bk5/include/asm-i386/processor.h linux-2.5.66/include/asm-i386/processor.h --- linux-2.5.65-bk5/include/asm-i386/processor.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/asm-i386/processor.h Mon Mar 31 12:45:40 2003 @@ -419,7 +419,7 @@ { tss->esp0 = esp0; /* This can only happen when SEP is enabled, no need to test "SEP"arately */ - if (tss->ss1 != __KERNEL_CS) { + if ((unlikely(tss->ss1 != __KERNEL_CS))) { tss->ss1 = __KERNEL_CS; wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0); } diff -urN linux-2.5.65-bk5/include/asm-parisc/compat.h linux-2.5.66/include/asm-parisc/compat.h --- linux-2.5.65-bk5/include/asm-parisc/compat.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/asm-parisc/compat.h Mon Mar 31 12:45:40 2003 @@ -114,7 +114,7 @@ static inline void *compat_ptr(compat_uptr_t uptr) { - return (void *)uptr; + return (void *)(unsigned long)uptr; } #endif /* _ASM_PARISC_COMPAT_H */ diff -urN linux-2.5.65-bk5/include/asm-ppc64/compat.h linux-2.5.66/include/asm-ppc64/compat.h --- linux-2.5.65-bk5/include/asm-ppc64/compat.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/asm-ppc64/compat.h Mon Mar 31 12:45:40 2003 @@ -108,7 +108,7 @@ static inline void *compat_ptr(compat_uptr_t uptr) { - return (void *)uptr; + return (void *)(unsigned long)uptr; } #endif /* _ASM_PPC64_COMPAT_H */ diff -urN linux-2.5.65-bk5/include/asm-s390x/compat.h linux-2.5.66/include/asm-s390x/compat.h --- linux-2.5.65-bk5/include/asm-s390x/compat.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/asm-s390x/compat.h Mon Mar 31 12:45:40 2003 @@ -111,7 +111,7 @@ static inline void *compat_ptr(compat_uptr_t uptr) { - return (void *)(uptr & 0x7fffffffUL); + return (void *)(unsigned long)(uptr & 0x7fffffffUL); } #endif /* _ASM_S390X_COMPAT_H */ diff -urN linux-2.5.65-bk5/include/asm-x86_64/compat.h linux-2.5.66/include/asm-x86_64/compat.h --- linux-2.5.65-bk5/include/asm-x86_64/compat.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/asm-x86_64/compat.h Mon Mar 31 12:45:40 2003 @@ -117,7 +117,7 @@ static inline void *compat_ptr(compat_uptr_t uptr) { - return (void *)uptr; + return (void *)(unsigned long)uptr; } #endif /* _ASM_X86_64_COMPAT_H */ diff -urN linux-2.5.65-bk5/include/linux/cyclades.h linux-2.5.66/include/linux/cyclades.h --- linux-2.5.65-bk5/include/linux/cyclades.h Mon Mar 17 13:44:50 2003 +++ linux-2.5.66/include/linux/cyclades.h Mon Mar 31 12:45:40 2003 @@ -515,9 +515,7 @@ int nports; /* Number of ports in the card */ int bus_index; /* address shift - 0 for ISA, 1 for PCI */ int intr_enabled; /* FW Interrupt flag - 0 disabled, 1 enabled */ - struct resource *resource; - unsigned long res_start; - unsigned long res_len; + struct pci_dev *pdev; #ifdef __KERNEL__ spinlock_t card_lock; #else diff -urN linux-2.5.65-bk5/include/linux/devfs_fs_kernel.h linux-2.5.66/include/linux/devfs_fs_kernel.h --- linux-2.5.65-bk5/include/linux/devfs_fs_kernel.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/linux/devfs_fs_kernel.h Mon Mar 31 12:45:40 2003 @@ -20,20 +20,9 @@ typedef struct devfs_entry * devfs_handle_t; -#ifdef CONFIG_DEVFS_FS - -struct unique_numspace -{ - spinlock_t init_lock; - unsigned char sem_initialised; - unsigned int num_free; /* Num free in bits */ - unsigned int length; /* Array length in bytes */ - unsigned long *bits; - struct semaphore semaphore; -}; - -#define UNIQUE_NUMBERSPACE_INITIALISER {SPIN_LOCK_UNLOCKED, 0, 0, 0, NULL} +struct gendisk; +#ifdef CONFIG_DEVFS_FS extern devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, unsigned int flags, unsigned int major, unsigned int minor, @@ -47,21 +36,11 @@ extern int devfs_generate_path (devfs_handle_t de, char *path, int buflen); extern int devfs_register_tape (devfs_handle_t de); extern void devfs_unregister_tape(int num); -extern int devfs_alloc_unique_number (struct unique_numspace *space); -extern void devfs_dealloc_unique_number (struct unique_numspace *space, - int number); - +extern void devfs_create_partitions(struct gendisk *dev); +extern void devfs_create_cdrom(struct gendisk *dev); +extern void devfs_remove_partitions(struct gendisk *dev); extern void mount_devfs_fs (void); - #else /* CONFIG_DEVFS_FS */ - -struct unique_numspace -{ - char dummy; -}; - -#define UNIQUE_NUMBERSPACE_INITIALISER {0} - static inline devfs_handle_t devfs_register (devfs_handle_t dir, const char *name, unsigned int flags, @@ -99,14 +78,14 @@ static inline void devfs_unregister_tape(int num) { } -static inline int devfs_alloc_unique_number (struct unique_numspace *space) +static inline void devfs_create_partitions(struct gendisk *dev) { - return -1; } -static inline void devfs_dealloc_unique_number (struct unique_numspace *space, - int number) +static inline void devfs_create_cdrom(struct gendisk *dev) +{ +} +static inline void devfs_remove_partitions(struct gendisk *dev) { - return; } static inline void mount_devfs_fs (void) { diff -urN linux-2.5.65-bk5/include/linux/eventpoll.h linux-2.5.66/include/linux/eventpoll.h --- linux-2.5.65-bk5/include/linux/eventpoll.h Mon Mar 17 13:44:05 2003 +++ linux-2.5.66/include/linux/eventpoll.h Mon Mar 31 12:45:40 2003 @@ -1,6 +1,6 @@ /* * include/linux/eventpoll.h ( Efficent event polling implementation ) - * Copyright (C) 2001,...,2002 Davide Libenzi + * Copyright (C) 2001,...,2003 Davide Libenzi * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,9 @@ #define EPOLL_CTL_DEL 2 #define EPOLL_CTL_MOD 3 +/* Set the Edge Triggered behaviour for the target file descriptor */ +#define EPOLLET (1 << 31) + struct epoll_event { __u32 events; __u64 data; diff -urN linux-2.5.65-bk5/include/linux/pci_ids.h linux-2.5.66/include/linux/pci_ids.h --- linux-2.5.65-bk5/include/linux/pci_ids.h Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/include/linux/pci_ids.h Mon Mar 31 12:45:40 2003 @@ -397,6 +397,8 @@ #define PCI_DEVICE_ID_IBM_MPIC 0x0046 #define PCI_DEVICE_ID_IBM_3780IDSP 0x007d #define PCI_DEVICE_ID_IBM_CHUKAR 0x0096 +#define PCI_DEVICE_ID_IBM_CPC710_PCI64 0x00fc +#define PCI_DEVICE_ID_IBM_CPC710_PCI32 0x0105 #define PCI_DEVICE_ID_IBM_405GP 0x0156 #define PCI_DEVICE_ID_IBM_SERVERAIDI960 0x01bd #define PCI_DEVICE_ID_IBM_MPIC_2 0xffff @@ -1248,6 +1250,7 @@ #define PCI_DEVICE_ID_SERVERWORKS_LE 0x0009 #define PCI_DEVICE_ID_SERVERWORKS_CIOB30 0x0010 #define PCI_DEVICE_ID_SERVERWORKS_CMIC_HE 0x0011 +#define PCI_DEVICE_ID_SERVERWORKS_GCNB_LE 0x0017 #define PCI_DEVICE_ID_SERVERWORKS_OSB4 0x0200 #define PCI_DEVICE_ID_SERVERWORKS_CSB5 0x0201 #define PCI_DEVICE_ID_SERVERWORKS_CSB6 0x0203 @@ -1257,6 +1260,9 @@ #define PCI_DEVICE_ID_SERVERWORKS_CSB6IDE2 0x0217 #define PCI_DEVICE_ID_SERVERWORKS_OSB4USB 0x0220 #define PCI_DEVICE_ID_SERVERWORKS_CSB5USB PCI_DEVICE_ID_SERVERWORKS_OSB4USB +#define PCI_DEVICE_ID_SERVERWORKS_CSB6USB 0x0221 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE 0x0225 +#define PCI_DEVICE_ID_SERVERWORKS_GCLE2 0x0227 #define PCI_DEVICE_ID_SERVERWORKS_CSB5ISA 0x0230 #define PCI_VENDOR_ID_SBE 0x1176 @@ -1759,6 +1765,9 @@ #define PCI_DEVICE_ID_S3_ViRGE_MXPMV 0x8c03 #define PCI_DEVICE_ID_S3_SONICVIBES 0xca00 +#define PCI_VENDOR_ID_DUNORD 0x5544 +#define PCI_DEVICE_ID_DUNORD_I3000 0x0001 + #define PCI_VENDOR_ID_DCI 0x6666 #define PCI_DEVICE_ID_DCI_PCCOM4 0x0001 #define PCI_DEVICE_ID_DCI_PCCOM8 0x0002 diff -urN linux-2.5.65-bk5/net/decnet/dn_table.c linux-2.5.66/net/decnet/dn_table.c --- linux-2.5.65-bk5/net/decnet/dn_table.c Mon Mar 17 13:43:50 2003 +++ linux-2.5.66/net/decnet/dn_table.c Mon Mar 31 12:45:40 2003 @@ -836,8 +836,7 @@ return NULL; if (in_interrupt() && net_ratelimit()) { - printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table -from interrupt\n"); + printk(KERN_DEBUG "DECnet: BUG! Attempt to create routing table from interrupt\n"); return NULL; } if ((t = kmalloc(sizeof(struct dn_fib_table), GFP_KERNEL)) == NULL) diff -urN linux-2.5.65-bk5/net/ipv6/addrconf.c linux-2.5.66/net/ipv6/addrconf.c --- linux-2.5.65-bk5/net/ipv6/addrconf.c Mon Mar 31 12:45:28 2003 +++ linux-2.5.66/net/ipv6/addrconf.c Mon Mar 31 12:45:41 2003 @@ -1111,7 +1111,7 @@ if (time_before(idev->regen_timer.expires, jiffies)) { idev->regen_timer.expires = 0; printk(KERN_WARNING - "__ipv6_regen_rndid(): too short regeneration interval; timer diabled for %s.\n", + "__ipv6_regen_rndid(): too short regeneration interval; timer disabled for %s.\n", idev->dev->name); in6_dev_put(idev); return -1; diff -urN linux-2.5.65-bk5/sound/oss/cs4232.c linux-2.5.66/sound/oss/cs4232.c --- linux-2.5.65-bk5/sound/oss/cs4232.c Mon Mar 17 13:44:08 2003 +++ linux-2.5.66/sound/oss/cs4232.c Mon Mar 31 12:45:41 2003 @@ -34,6 +34,8 @@ * anyway. * * Changes + * John Rood Added Bose Sound System Support. + * Toshio Spoor * Alan Cox Modularisation, Basic cleanups. * Paul Barton-Davis Separated MPU configuration, added * Tropez+ (WaveFront) support @@ -58,6 +60,10 @@ #define KEY_PORT 0x279 /* Same as LPT1 status port */ #define CSN_NUM 0x99 /* Just a random number */ +#define INDEX_ADDRESS 0x00 /* (R0) Index Address Register */ +#define INDEX_DATA 0x01 /* (R1) Indexed Data Register */ +#define PIN_CONTROL 0x0a /* (I10) Pin Control */ +#define ENABLE_PINS 0xc0 /* XCTRL0/XCTRL1 enable */ static void CS_OUT(unsigned char a) { @@ -67,6 +73,7 @@ #define CS_OUT2(a, b) {CS_OUT(a);CS_OUT(b);} #define CS_OUT3(a, b, c) {CS_OUT(a);CS_OUT(b);CS_OUT(c);} +static int __initdata bss = 0; static int mpu_base = 0, mpu_irq = 0; static int synth_base = 0, synth_irq = 0; static int mpu_detected = 0; @@ -97,7 +104,31 @@ schedule_timeout(howlong); } -int probe_cs4232(struct address_info *hw_config, int isapnp_configured) +static void enable_xctrl(int baseio) +{ + unsigned char regd; + + /* + * Some IBM Aptiva's have the Bose Sound System. By default + * the Bose Amplifier is disabled. The amplifier will be + * activated, by setting the XCTRL0 and XCTRL1 bits. + * Volume of the monitor bose speakers/woofer, can then + * be set by changing the PCM volume. + * + */ + + printk("cs4232: enabling Bose Sound System Amplifier.\n"); + + /* Switch to Pin Control Address */ + regd = inb(baseio + INDEX_ADDRESS) & 0xe0; + outb(((unsigned char) (PIN_CONTROL | regd)), baseio + INDEX_ADDRESS ); + + /* Activate the XCTRL0 and XCTRL1 Pins */ + regd = inb(baseio + INDEX_DATA); + outb(((unsigned char) (ENABLE_PINS | regd)), baseio + INDEX_DATA ); +} + +int __init probe_cs4232(struct address_info *hw_config, int isapnp_configured) { int i, n; int base = hw_config->io_base, irq = hw_config->irq; @@ -218,7 +249,7 @@ return 0; } -void attach_cs4232(struct address_info *hw_config) +void __init attach_cs4232(struct address_info *hw_config) { int base = hw_config->io_base, irq = hw_config->irq, @@ -275,9 +306,14 @@ } hw_config->slots[1] = hw_config2.slots[1]; } + + if (bss) + { + enable_xctrl(base); + } } -static void unload_cs4232(struct address_info *hw_config) +static void __exit unload_cs4232(struct address_info *hw_config) { int base = hw_config->io_base, irq = hw_config->irq; int dma1 = hw_config->dma, dma2 = hw_config->dma2; @@ -349,6 +385,8 @@ MODULE_PARM_DESC(synthirq,"Maui WaveTable IRQ"); MODULE_PARM(isapnp,"i"); MODULE_PARM_DESC(isapnp,"Enable ISAPnP probing (default 1)"); +MODULE_PARM(bss,"i"); +MODULE_PARM_DESC(bss,"Enable Bose Sound System Support (default 0)"); /* * Install a CS4232 based card. Need to have ad1848 and mpu401 diff -urN linux-2.5.65-bk5/sound/oss/emu10k1/cardwo.c linux-2.5.66/sound/oss/emu10k1/cardwo.c --- linux-2.5.65-bk5/sound/oss/emu10k1/cardwo.c Mon Mar 31 12:45:29 2003 +++ linux-2.5.66/sound/oss/emu10k1/cardwo.c Mon Mar 31 12:45:41 2003 @@ -408,14 +408,17 @@ if (len > PAGE_SIZE - pgoff) { k = PAGE_SIZE - pgoff; - __copy_from_user((u8 *)dst[pg] + pgoff, src, k); + if (__copy_from_user((u8 *)dst[pg] + pgoff, src, k)) + return; len -= k; while (len > PAGE_SIZE) { - __copy_from_user(dst[++pg], src + k, PAGE_SIZE); + if (__copy_from_user(dst[++pg], src + k, PAGE_SIZE)) + return; k += PAGE_SIZE; len -= PAGE_SIZE; } - __copy_from_user(dst[++pg], src + k, len); + if (__copy_from_user(dst[++pg], src + k, len)) + return; } else __copy_from_user((u8 *)dst[pg] + pgoff, src, len); @@ -440,7 +443,8 @@ while (len) { for (voice_num = 0; voice_num < woinst->num_voices; voice_num++) { - __copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoicesample); + if (__copy_from_user((u8 *)(voice[voice_num].mem.addr[pg]) + pgoff, src, woinst->format.bytespervoicesample)) + return -EFAULT; src += woinst->format.bytespervoicesample; } diff -urN linux-2.5.65-bk5/sound/oss/mad16.c linux-2.5.66/sound/oss/mad16.c --- linux-2.5.65-bk5/sound/oss/mad16.c Mon Mar 17 13:44:22 2003 +++ linux-2.5.66/sound/oss/mad16.c Mon Mar 31 12:45:41 2003 @@ -99,7 +99,7 @@ #ifdef DDB #undef DDB #endif -#define DDB(x) {if (debug) x;} +#define DDB(x) do {if (debug) x;} while (0) static unsigned char mad_read(int port) { @@ -278,7 +278,8 @@ } for (i = 0xf8d; i <= 0xf98; i++) if (!c924pnp) - DDB(printk("Port %0x (init value) = %0x\n", i, mad_read(i))) else + DDB(printk("Port %0x (init value) = %0x\n", i, mad_read(i))); + else DDB(printk("Port %0x (init value) = %0x\n", i-0x80, mad_read(i))); if (board_type == C930) @@ -365,6 +366,8 @@ { unsigned char cfg = 0; + cfg |= (0x0f & mad16_conf); + if(c931_detected) { /* Bit 0 has reversd meaning. Bits 1 and 2 sese @@ -402,7 +405,10 @@ and the C931. */ cfg = c931_detected ? 0x04 : 0x00; - mad_write(MC4_PORT, 0x52|cfg); + if(mad16_cdsel & 0x20) + mad_write(MC4_PORT, 0x62|cfg); /* opl4 */ + else + mad_write(MC4_PORT, 0x52|cfg); /* opl3 */ mad_write(MC5_PORT, 0x3C); /* Init it into mode2 */ mad_write(MC6_PORT, 0x02); /* Enable WSS, Disable MPU and SB */ @@ -529,10 +535,12 @@ return init_c930(hw_config); - for (i = 0xf8d; i <= 0xf93; i++) + for (i = 0xf8d; i <= 0xf93; i++) { if (!c924pnp) - DDB(printk("port %03x = %02x\n", i, mad_read(i))) else + DDB(printk("port %03x = %02x\n", i, mad_read(i))) + else DDB(printk("port %03x = %02x\n", i-0x80, mad_read(i))); + } /* * Set the WSS address @@ -559,10 +567,10 @@ */ tmp &= ~0x0f; + tmp |= (mad16_conf & 0x0f); /* CD-ROM and joystick bits */ mad_write(MC1_PORT, tmp); - tmp = mad_read(MC2_PORT); - + tmp = mad16_cdsel; mad_write(MC2_PORT, tmp); mad_write(MC3_PORT, 0xf0); /* Disable SB */ @@ -590,9 +598,12 @@ mad_write(MC5_PORT, 0x30 | cs4231_mode); } - for (i = 0xf8d; i <= 0xf93; i++) if (!c924pnp) - DDB(printk("port %03x after init = %02x\n", i, mad_read(i))) else - DDB(printk("port %03x after init = %02x\n", i-0x80, mad_read(i))); + for (i = 0xf8d; i <= 0xf93; i++) { + if (!c924pnp) + DDB(printk("port %03x after init = %02x\n", i, mad_read(i))) + else + DDB(printk("port %03x after init = %02x\n", i-0x80, mad_read(i))); + } wss_init(hw_config); return 1; @@ -879,7 +890,7 @@ static int __initdata cdport = 0x340; static int __initdata cddma = -1; static int __initdata opl4 = 0; -static int __initdata joystick = 1; +static int __initdata joystick = 0; MODULE_PARM(mpu_io, "i"); MODULE_PARM(mpu_irq, "i"); @@ -953,14 +964,14 @@ return -EINVAL; } - /* - * Build the config words - */ + /* + * Build the config words + */ - mad16_conf = (joystick ^ 1) | cdtype; + mad16_conf = (joystick ^ 1) | cdtype; mad16_cdsel = 0; - if (opl4) - mad16_cdsel |= 0x20; + if (opl4) + mad16_cdsel |= 0x20; if(cdtype){ if (cddma > 7 || cddma < 0 || dma_map[dmatype][cddma] == -1) @@ -978,8 +989,8 @@ printk(", no IRQ"); else if (cdirq < 0 || cdirq > 15 || irq_map[cdirq] == -1) { - printk(", invalid IRQ (disabling)"); - cdirq = 0; + printk(", invalid IRQ (disabling)"); + cdirq = 0; } else printk(", IRQ %d", cdirq); @@ -1032,14 +1043,14 @@ found_mpu = probe_mad16_mpu(&cfg_mpu); if (joystick == 1) { - /* register gameport */ - if (!request_region(0x201, 1, "mad16 gameport")) - printk(KERN_ERR "mad16: gameport address 0x201 already in use\n"); - else { + /* register gameport */ + if (!request_region(0x201, 1, "mad16 gameport")) + printk(KERN_ERR "mad16: gameport address 0x201 already in use\n"); + else { printk(KERN_ERR "mad16: gameport enabled at 0x201\n"); - gameport.io = 0x201; - gameport_register_port(&gameport); - } + gameport.io = 0x201; + gameport_register_port(&gameport); + } } else printk(KERN_ERR "mad16: gameport disabled.\n"); return 0; @@ -1049,6 +1060,12 @@ { if (found_mpu) unload_mad16_mpu(&cfg_mpu); + if (gameport.io) { + /* the gameport was initialized so we must free it up */ + gameport_unregister_port(&gameport); + gameport.io = 0; + release_region(0x201, 1); + } unload_mad16(&cfg); } @@ -1058,9 +1075,9 @@ #ifndef MODULE static int __init setup_mad16(char *str) { - /* io, irq */ + /* io, irq */ int ints[8]; - + str = get_options(str, ARRAY_SIZE(ints), ints); io = ints[1]; diff -urN linux-2.5.65-bk5/sound/oss/sound_config.h linux-2.5.66/sound/oss/sound_config.h --- linux-2.5.65-bk5/sound/oss/sound_config.h Mon Mar 17 13:43:42 2003 +++ linux-2.5.66/sound/oss/sound_config.h Mon Mar 31 12:45:41 2003 @@ -137,7 +137,7 @@ #endif #ifndef DDB -#define DDB(x) {} +#define DDB(x) do {} while (0) #endif #ifndef MDB