Merge master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 10 Mar 2007 05:58:28 +0000 (21:58 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 10 Mar 2007 05:58:28 +0000 (21:58 -0800)
* master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6:
  kobject: new_device->kref wasn't putted after error in kobject_move()
  driver core: export device_rename
  Remove devfs from MAINTAINERS
  Driver core: add device symlink back to sysfs
  Revert "driver core: refcounting fix"

38 files changed:
Documentation/kernel-parameters.txt
arch/i386/kernel/acpi/boot.c
arch/ia64/sn/kernel/io_acpi_init.c
arch/ia64/sn/kernel/setup.c
drivers/acpi/Kconfig
drivers/acpi/blacklist.c
drivers/acpi/ec.c
drivers/acpi/events/evmisc.c
drivers/acpi/ibm_acpi.c
drivers/acpi/power.c
drivers/acpi/resources/rscreate.c
drivers/acpi/video.c
drivers/ata/libata-acpi.c
drivers/misc/asus-laptop.c
drivers/misc/sony-laptop.c
drivers/pci/pci.c
drivers/pci/pcie/aer/aerdrv.c
drivers/pci/pcie/portdrv_pci.c
drivers/pci/search.c
drivers/pnp/pnpacpi/rsparser.c
drivers/usb/class/cdc-acm.c
drivers/usb/core/devio.c
drivers/usb/core/hub.c
drivers/usb/core/message.c
drivers/usb/gadget/at91_udc.c
drivers/usb/gadget/goku_udc.c
drivers/usb/gadget/pxa2xx_udc.c
drivers/usb/host/ehci-hub.c
drivers/usb/host/uhci-hub.c
drivers/usb/misc/ftdi-elan.c
drivers/usb/net/dm9601.c
drivers/usb/serial/airprime.c
drivers/usb/serial/cp2101.c
drivers/usb/serial/ftdi_sio.c
drivers/usb/serial/ftdi_sio.h
drivers/usb/serial/ipaq.c
drivers/usb/serial/usb-serial.c
drivers/usb/storage/unusual_devs.h

index 9141193..856c8b1 100644 (file)
@@ -126,7 +126,8 @@ and is between 256 and 4096 characters. It is defined in the file
                        See header of drivers/scsi/53c7xx.c.
                        See also Documentation/scsi/ncr53c7xx.txt.
 
-       acpi=           [HW,ACPI] Advanced Configuration and Power Interface
+       acpi=           [HW,ACPI,X86-64,i386]
+                       Advanced Configuration and Power Interface
                        Format: { force | off | ht | strict | noirq }
                        force -- enable ACPI if default was off
                        off -- disable ACPI if default was on
index e5eb97a..9ea5b8e 100644 (file)
@@ -1072,7 +1072,28 @@ static struct dmi_system_id __initdata acpi_dmi_table[] = {
                               "ASUS A7V ACPI BIOS Revision 1007"),
                     },
         },
-
+       {
+               /*
+                * Latest BIOS for IBM 600E (1.16) has bad pcinum
+                * for LPC bridge, which is needed for the PCI
+                * interrupt links to work. DSDT fix is in bug 5966.
+                * 2645, 2646 model numbers are shared with 600/600E/600X
+                */
+        .callback = disable_acpi_irq,
+        .ident = "IBM Thinkpad 600 Series 2645",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "2645"),
+                    },
+        },
+       {
+        .callback = disable_acpi_irq,
+        .ident = "IBM Thinkpad 600 Series 2646",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "IBM"),
+                    DMI_MATCH(DMI_BOARD_NAME, "2646"),
+                    },
+        },
        /*
         * Boxes that need ACPI PCI IRQ routing and PCI scan disabled
         */
index 8c331ca..c6216f4 100644 (file)
@@ -53,12 +53,15 @@ sal_ioif_init(u64 *result)
 }
 
 /*
- * sn_hubdev_add - The 'add' function of the acpi_sn_hubdev_driver.
- *                Called for every "SGIHUB" or "SGITIO" device defined
- *                in the ACPI namespace.
+ * sn_acpi_hubdev_init() - This function is called by acpi_ns_get_device_callback()
+ *                        for all SGIHUB and SGITIO acpi devices defined in the
+ *                        DSDT. It obtains the hubdev_info pointer from the
+ *                        ACPI vendor resource, which the PROM setup, and sets up the
+ *                        hubdev_info in the pda.
  */
-static int __init
-sn_hubdev_add(struct acpi_device *device)
+
+static acpi_status __init
+sn_acpi_hubdev_init(acpi_handle handle, u32 depth, void *context, void **ret)
 {
        struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
        u64 addr;
@@ -67,18 +70,19 @@ sn_hubdev_add(struct acpi_device *device)
        int i;
        u64 nasid;
        struct acpi_resource *resource;
-       int ret = 0;
        acpi_status status;
        struct acpi_resource_vendor_typed *vendor;
        extern void sn_common_hubdev_init(struct hubdev_info *);
 
-       status = acpi_get_vendor_resource(device->handle, METHOD_NAME__CRS,
+       status = acpi_get_vendor_resource(handle, METHOD_NAME__CRS,
                                          &sn_uuid, &buffer);
        if (ACPI_FAILURE(status)) {
                printk(KERN_ERR
-                      "sn_hubdev_add: acpi_get_vendor_resource() failed: %d\n",
-                       status);
-               return 1;
+                      "sn_acpi_hubdev_init: acpi_get_vendor_resource() "
+                      "(0x%x) failed for: ", status);
+               acpi_ns_print_node_pathname(handle, NULL);
+               printk("\n");
+               return AE_OK;           /* Continue walking namespace */
        }
 
        resource = buffer.pointer;
@@ -86,9 +90,10 @@ sn_hubdev_add(struct acpi_device *device)
        if ((vendor->byte_length - sizeof(struct acpi_vendor_uuid)) !=
            sizeof(struct hubdev_info *)) {
                printk(KERN_ERR
-                      "sn_hubdev_add: Invalid vendor data length: %d\n",
+                      "sn_acpi_hubdev_init: Invalid vendor data length: %d for: ",
                        vendor->byte_length);
-               ret = 1;
+               acpi_ns_print_node_pathname(handle, NULL);
+               printk("\n");
                goto exit;
        }
 
@@ -103,7 +108,7 @@ sn_hubdev_add(struct acpi_device *device)
 
 exit:
        kfree(buffer.pointer);
-       return ret;
+       return AE_OK;           /* Continue walking namespace */
 }
 
 /*
@@ -441,14 +446,6 @@ sn_acpi_slot_fixup(struct pci_dev *dev)
 
 EXPORT_SYMBOL(sn_acpi_slot_fixup);
 
-static struct acpi_driver acpi_sn_hubdev_driver = {
-       .name = "SGI HUBDEV Driver",
-       .ids = "SGIHUB,SGITIO",
-       .ops = {
-               .add = sn_hubdev_add,
-               },
-};
-
 
 /*
  * sn_acpi_bus_fixup -  Perform SN specific setup of software structs
@@ -492,7 +489,10 @@ sn_io_acpi_init(void)
        /* SN Altix does not follow the IOSAPIC IRQ routing model */
        acpi_irq_model = ACPI_IRQ_MODEL_PLATFORM;
 
-       acpi_bus_register_driver(&acpi_sn_hubdev_driver);
+       /* Setup hubdev_info for all SGIHUB/SGITIO devices */
+       acpi_get_devices("SGIHUB", sn_acpi_hubdev_init, NULL, NULL);
+       acpi_get_devices("SGITIO", sn_acpi_hubdev_init, NULL, NULL);
+
        status = sal_ioif_init(&result);
        if (status || result)
                panic("sal_ioif_init failed: [%lx] %s\n",
index 8571e52..bd5373d 100644 (file)
@@ -397,6 +397,8 @@ void __init sn_setup(char **cmdline_p)
        ia64_sn_set_os_feature(OSF_PCISEGMENT_ENABLE);
        ia64_sn_set_os_feature(OSF_ACPI_ENABLE);
 
+       /* Load the new DSDT and SSDT tables into the global table list. */
+       acpi_table_init();
 
 #if defined(CONFIG_VT) && defined(CONFIG_VGA_CONSOLE)
        /*
index 7c49e10..e2ce4a9 100644 (file)
@@ -7,6 +7,7 @@ menu "ACPI (Advanced Configuration and Power Interface) Support"
        depends on !X86_VISWS
        depends on !IA64_HP_SIM
        depends on IA64 || X86
+       depends on PM
 
 config ACPI
        bool "ACPI Support"
@@ -243,6 +244,17 @@ config ACPI_IBM_DOCK
 
          If you are not sure, say N here.
 
+config ACPI_IBM_BAY
+       bool "Legacy Removable Bay Support"
+       depends on ACPI_IBM
+       default y
+       ---help---
+         Allows the ibm_acpi driver to handle removable bays.  It will allow
+         disabling the device in the bay, and also generate notifications when
+         the bay lever is ejected or inserted.
+
+         If you are not sure, say Y here.
+
 config ACPI_TOSHIBA
        tristate "Toshiba Laptop Extras"
        depends on X86
index f289fd4..3ec110c 100644 (file)
@@ -79,11 +79,17 @@ static int __init blacklist_by_year(void)
 {
        int year = dmi_get_year(DMI_BIOS_DATE);
        /* Doesn't exist? Likely an old system */
-       if (year == -1)
+       if (year == -1) {
+               printk(KERN_ERR PREFIX "no DMI BIOS year, "
+                       "acpi=force is required to enable ACPI\n" );
                return 1;
+       }
        /* 0? Likely a buggy new BIOS */
-       if (year == 0)
+       if (year == 0) {
+               printk(KERN_ERR PREFIX "DMI BIOS year==0, "
+                       "assuming ACPI-capable machine\n" );
                return 0;
+       }
        if (year < CONFIG_ACPI_BLACKLIST_YEAR) {
                printk(KERN_ERR PREFIX "BIOS age (%d) fails cutoff (%d), "
                       "acpi=force is required to enable ACPI\n",
index ab68883..a802962 100644 (file)
@@ -100,6 +100,7 @@ static struct acpi_ec {
        unsigned long global_lock;
        struct mutex lock;
        atomic_t query_pending;
+       atomic_t event_count;
        atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort */
        wait_queue_head_t wait;
 } *ec_ecdt;
@@ -131,10 +132,12 @@ static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data)
        outb(data, ec->data_addr);
 }
 
-static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
+static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event,
+                                      unsigned old_count)
 {
        u8 status = acpi_ec_read_status(ec);
-
+       if (old_count == atomic_read(&ec->event_count))
+               return 0;
        if (event == ACPI_EC_EVENT_OBF_1) {
                if (status & ACPI_EC_FLAG_OBF)
                        return 1;
@@ -146,19 +149,19 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event)
        return 0;
 }
 
-static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event)
+static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count)
 {
        if (acpi_ec_mode == EC_POLL) {
                unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
                while (time_before(jiffies, delay)) {
-                       if (acpi_ec_check_status(ec, event))
+                       if (acpi_ec_check_status(ec, event, 0))
                                return 0;
                }
        } else {
                if (wait_event_timeout(ec->wait,
-                                      acpi_ec_check_status(ec, event),
+                                      acpi_ec_check_status(ec, event, count),
                                       msecs_to_jiffies(ACPI_EC_DELAY)) ||
-                   acpi_ec_check_status(ec, event)) {
+                   acpi_ec_check_status(ec, event, 0)) {
                        return 0;
                } else {
                        printk(KERN_ERR PREFIX "acpi_ec_wait timeout,"
@@ -225,21 +228,22 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
                                        u8 * rdata, unsigned rdata_len)
 {
        int result = 0;
-
+       unsigned count = atomic_read(&ec->event_count);
        acpi_ec_write_cmd(ec, command);
 
        for (; wdata_len > 0; --wdata_len) {
-               result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
+               result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
                if (result) {
                        printk(KERN_ERR PREFIX
                               "write_cmd timeout, command = %d\n", command);
                        goto end;
                }
+               count = atomic_read(&ec->event_count);
                acpi_ec_write_data(ec, *(wdata++));
        }
 
        if (!rdata_len) {
-               result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
+               result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
                if (result) {
                        printk(KERN_ERR PREFIX
                               "finish-write timeout, command = %d\n", command);
@@ -250,13 +254,13 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
        }
 
        for (; rdata_len > 0; --rdata_len) {
-               result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1);
+               result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count);
                if (result) {
                        printk(KERN_ERR PREFIX "read timeout, command = %d\n",
                               command);
                        goto end;
                }
-
+               count = atomic_read(&ec->event_count);
                *(rdata++) = acpi_ec_read_data(ec);
        }
       end:
@@ -288,7 +292,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
        /* Make sure GPE is enabled before doing transaction */
        acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);
 
-       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0);
+       status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
        if (status) {
                printk(KERN_DEBUG PREFIX
                       "input buffer is not empty, aborting transaction\n");
@@ -369,8 +373,8 @@ int ec_write(u8 addr, u8 val)
 EXPORT_SYMBOL(ec_write);
 
 int ec_transaction(u8 command,
-                         const u8 * wdata, unsigned wdata_len,
-                         u8 * rdata, unsigned rdata_len)
+                  const u8 * wdata, unsigned wdata_len,
+                  u8 * rdata, unsigned rdata_len)
 {
        struct acpi_ec *ec;
 
@@ -435,7 +439,7 @@ static u32 acpi_ec_gpe_handler(void *data)
        acpi_status status = AE_OK;
        u8 value;
        struct acpi_ec *ec = (struct acpi_ec *)data;
-
+       atomic_inc(&ec->event_count);
        if (acpi_ec_mode == EC_INTR) {
                wake_up(&ec->wait);
        }
@@ -633,6 +637,7 @@ static int acpi_ec_add(struct acpi_device *device)
        ec->uid = -1;
        mutex_init(&ec->lock);
        atomic_set(&ec->query_pending, 0);
+       atomic_set(&ec->event_count, 1);
        if (acpi_ec_mode == EC_INTR) {
                atomic_set(&ec->leaving_burst, 1);
                init_waitqueue_head(&ec->wait);
@@ -807,6 +812,7 @@ acpi_fake_ecdt_callback(acpi_handle handle,
        acpi_status status;
 
        mutex_init(&ec_ecdt->lock);
+       atomic_set(&ec_ecdt->event_count, 1);
        if (acpi_ec_mode == EC_INTR) {
                init_waitqueue_head(&ec_ecdt->wait);
        }
@@ -888,6 +894,7 @@ static int __init acpi_ec_get_real_ecdt(void)
                return -ENOMEM;
 
        mutex_init(&ec_ecdt->lock);
+       atomic_set(&ec_ecdt->event_count, 1);
        if (acpi_ec_mode == EC_INTR) {
                init_waitqueue_head(&ec_ecdt->wait);
        }
@@ -1016,8 +1023,7 @@ static int __init acpi_ec_set_intr_mode(char *str)
                acpi_ec_mode = EC_POLL;
        }
        acpi_ec_driver.ops.add = acpi_ec_add;
-       printk(KERN_NOTICE PREFIX "%s mode.\n",
-                         intr ? "interrupt" : "polling");
+       printk(KERN_NOTICE PREFIX "%s mode.\n", intr ? "interrupt" : "polling");
 
        return 1;
 }
index d572700..8dcade6 100644 (file)
@@ -423,6 +423,8 @@ static acpi_status acpi_ev_remove_global_lock_handler(void)
  * the global lock appear as a standard mutex on the OS side.
  *
  *****************************************************************************/
+static acpi_thread_id acpi_ev_global_lock_thread_id;
+static int acpi_ev_global_lock_acquired;
 
 acpi_status acpi_ev_acquire_global_lock(u16 timeout)
 {
@@ -435,11 +437,24 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
         * Only one thread can acquire the GL at a time, the global_lock_mutex
         * enforces this. This interface releases the interpreter if we must wait.
         */
-       status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout);
+       status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, 0);
+       if (status == AE_TIME) {
+               if (acpi_ev_global_lock_thread_id == acpi_os_get_thread_id()) {
+                       acpi_ev_global_lock_acquired++;
+                       return AE_OK;
+               }
+       }
+
+       if (ACPI_FAILURE(status)) {
+               status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout);
+       }
        if (ACPI_FAILURE(status)) {
                return_ACPI_STATUS(status);
        }
 
+       acpi_ev_global_lock_thread_id = acpi_os_get_thread_id();
+       acpi_ev_global_lock_acquired++;
+
        /*
         * Make sure that a global lock actually exists. If not, just treat
         * the lock as a standard mutex.
@@ -506,6 +521,11 @@ acpi_status acpi_ev_release_global_lock(void)
                return_ACPI_STATUS(AE_NOT_ACQUIRED);
        }
 
+       acpi_ev_global_lock_acquired--;
+       if (acpi_ev_global_lock_acquired > 0) {
+               return AE_OK;
+       }
+
        if (acpi_gbl_global_lock_present) {
 
                /* Allow any thread to release the lock */
@@ -529,7 +549,8 @@ acpi_status acpi_ev_release_global_lock(void)
        acpi_gbl_global_lock_acquired = FALSE;
 
        /* Release the local GL mutex */
-
+       acpi_ev_global_lock_thread_id = 0;
+       acpi_ev_global_lock_acquired = 0;
        acpi_os_release_mutex(acpi_gbl_global_lock_mutex);
        return_ACPI_STATUS(status);
 }
index 4cc534e..3690136 100644 (file)
@@ -86,6 +86,7 @@
 
 #include <linux/proc_fs.h>
 #include <linux/backlight.h>
+#include <linux/fb.h>
 #include <asm/uaccess.h>
 
 #include <linux/dmi.h>
@@ -157,6 +158,7 @@ IBM_HANDLE(dock, root, "\\_SB.GDCK",        /* X30, X31, X40 */
           "\\_SB.PCI.ISA.SLCE",        /* 570 */
     );                         /* A21e,G4x,R30,R31,R32,R40,R40e,R50e */
 #endif
+#ifdef CONFIG_ACPI_IBM_BAY
 IBM_HANDLE(bay, root, "\\_SB.PCI.IDE.SECN.MAST",       /* 570 */
           "\\_SB.PCI0.IDE0.IDES.IDSM", /* 600e/x, 770e, 770x */
           "\\_SB.PCI0.SATA.SCND.MSTR", /* T60, X60, Z60 */ 
@@ -174,6 +176,7 @@ IBM_HANDLE(bay2, root, "\\_SB.PCI0.IDE0.PRIM.SLAV", /* A3x, R32 */
 IBM_HANDLE(bay2_ej, bay2, "_EJ3",      /* 600e/x, 770e, A3x */
           "_EJ0",              /* 770x */
     );                         /* all others */
+#endif /* CONFIG_ACPI_IBM_BAY */
 
 /* don't list other alternatives as we install a notify handler on the 570 */
 IBM_HANDLE(pci, root, "\\_SB.PCI");    /* 570 */
@@ -1044,6 +1047,7 @@ static int light_write(char *buf)
        return 0;
 }
 
+#if defined(CONFIG_ACPI_IBM_DOCK) || defined(CONFIG_ACPI_IBM_BAY)
 static int _sta(acpi_handle handle)
 {
        int status;
@@ -1053,6 +1057,7 @@ static int _sta(acpi_handle handle)
 
        return status;
 }
+#endif
 
 #ifdef CONFIG_ACPI_IBM_DOCK
 #define dock_docked() (_sta(dock_handle) & 1)
@@ -1119,6 +1124,7 @@ static void dock_notify(struct ibm_struct *ibm, u32 event)
 }
 #endif
 
+#ifdef CONFIG_ACPI_IBM_BAY
 static int bay_status_supported;
 static int bay_status2_supported;
 static int bay_eject_supported;
@@ -1194,6 +1200,7 @@ static void bay_notify(struct ibm_struct *ibm, u32 event)
 {
        acpi_bus_generate_event(ibm->device, event, 0);
 }
+#endif /* CONFIG_ACPI_IBM_BAY */
 
 static int cmos_read(char *p)
 {
@@ -1701,7 +1708,10 @@ static int brightness_write(char *buf)
 
 static int brightness_update_status(struct backlight_device *bd)
 {
-       return brightness_set(bd->props.brightness);
+       return brightness_set(
+               (bd->props.fb_blank == FB_BLANK_UNBLANK &&
+                bd->props.power == FB_BLANK_UNBLANK) ?
+                               bd->props.brightness : 0);
 }
 
 static struct backlight_ops ibm_backlight_data = {
@@ -1711,6 +1721,12 @@ static struct backlight_ops ibm_backlight_data = {
 
 static int brightness_init(void)
 {
+       int b;
+
+       b = brightness_get(NULL);
+       if (b < 0)
+               return b;
+
        ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
                                                         &ibm_backlight_data);
        if (IS_ERR(ibm_backlight_device)) {
@@ -1718,7 +1734,9 @@ static int brightness_init(void)
                return PTR_ERR(ibm_backlight_device);
        }
 
-        ibm_backlight_device->props.max_brightness = 7;
+       ibm_backlight_device->props.max_brightness = 7;
+       ibm_backlight_device->props.brightness = b;
+       backlight_update_status(ibm_backlight_device);
 
        return 0;
 }
@@ -2353,6 +2371,7 @@ static struct ibm_struct ibms[] = {
         .type = ACPI_SYSTEM_NOTIFY,
         },
 #endif
+#ifdef CONFIG_ACPI_IBM_BAY
        {
         .name = "bay",
         .init = bay_init,
@@ -2362,6 +2381,7 @@ static struct ibm_struct ibms[] = {
         .handle = &bay_handle,
         .type = ACPI_SYSTEM_NOTIFY,
         },
+#endif /* CONFIG_ACPI_IBM_BAY */
        {
         .name = "cmos",
         .read = cmos_read,
@@ -2647,7 +2667,9 @@ IBM_PARAM(light);
 #ifdef CONFIG_ACPI_IBM_DOCK
 IBM_PARAM(dock);
 #endif
+#ifdef CONFIG_ACPI_IBM_BAY
 IBM_PARAM(bay);
+#endif /* CONFIG_ACPI_IBM_BAY */
 IBM_PARAM(cmos);
 IBM_PARAM(led);
 IBM_PARAM(beep);
@@ -2723,12 +2745,14 @@ static int __init acpi_ibm_init(void)
        IBM_HANDLE_INIT(dock);
 #endif
        IBM_HANDLE_INIT(pci);
+#ifdef CONFIG_ACPI_IBM_BAY
        IBM_HANDLE_INIT(bay);
        if (bay_handle)
                IBM_HANDLE_INIT(bay_ej);
        IBM_HANDLE_INIT(bay2);
        if (bay2_handle)
                IBM_HANDLE_INIT(bay2_ej);
+#endif /* CONFIG_ACPI_IBM_BAY */
        IBM_HANDLE_INIT(beep);
        IBM_HANDLE_INIT(ecrd);
        IBM_HANDLE_INIT(ecwr);
index 1ef3385..4ffecd1 100644 (file)
@@ -436,8 +436,6 @@ int acpi_power_transition(struct acpi_device *device, int state)
        cl = &device->power.states[device->power.state].resources;
        tl = &device->power.states[state].resources;
 
-       device->power.state = ACPI_STATE_UNKNOWN;
-
        if (!cl->count && !tl->count) {
                result = -ENODEV;
                goto end;
@@ -468,12 +466,15 @@ int acpi_power_transition(struct acpi_device *device, int state)
                        goto end;
        }
 
-       /* We shouldn't change the state till all above operations succeed */
-       device->power.state = state;
-      end:
-       if (result)
+     end:
+       if (result) {
+               device->power.state = ACPI_STATE_UNKNOWN;
                printk(KERN_WARNING PREFIX "Transitioning device [%s] to D%d\n",
                              device->pnp.bus_id, state);
+       } else {
+       /* We shouldn't change the state till all above operations succeed */
+               device->power.state = state;
+       }
 
        return result;
 }
@@ -687,13 +688,6 @@ static int acpi_power_resume(struct acpi_device *device)
                return result;
 
        mutex_lock(&resource->resource_lock);
-       if ((resource->state == ACPI_POWER_RESOURCE_STATE_ON) &&
-           list_empty(&resource->reference)) {
-               mutex_unlock(&resource->resource_lock);
-               result = acpi_power_off_device(device->handle, NULL);
-               return result;
-       }
-
        if ((resource->state == ACPI_POWER_RESOURCE_STATE_OFF) &&
            !list_empty(&resource->reference)) {
                ref = container_of(resource->reference.next, struct acpi_power_reference, node);
index 1358c06..cc48ab0 100644 (file)
@@ -191,6 +191,9 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
        user_prt = ACPI_CAST_PTR(struct acpi_pci_routing_table, buffer);
 
        for (index = 0; index < number_of_elements; index++) {
+               int source_name_index = 2;
+               int source_index_index = 3;
+
                /*
                 * Point user_prt past this current structure
                 *
@@ -260,11 +263,29 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
                        return_ACPI_STATUS(AE_BAD_DATA);
                }
 
+               /*
+                * If BIOS erroneously reversed the _PRT source_name and source_index,
+                * then reverse them back.
+                */
+               if (ACPI_GET_OBJECT_TYPE (sub_object_list[3]) != ACPI_TYPE_INTEGER) {
+                       if (acpi_gbl_enable_interpreter_slack) {
+                               source_name_index = 3;
+                               source_index_index = 2;
+                               printk(KERN_WARNING "ACPI: Handling Garbled _PRT entry\n");
+                       } else {
+                               ACPI_ERROR((AE_INFO,
+                                       "(PRT[%X].source_index) Need Integer, found %s",
+                                       index,
+                                       acpi_ut_get_object_type_name(sub_object_list[3])));
+                               return_ACPI_STATUS(AE_BAD_DATA);
+                       }
+               }
+
                /*
                 * 3) Third subobject: Dereference the PRT.source_name
                 * The name may be unresolved (slack mode), so allow a null object
                 */
-               obj_desc = sub_object_list[2];
+               obj_desc = sub_object_list[source_name_index];
                if (obj_desc) {
                        switch (ACPI_GET_OBJECT_TYPE(obj_desc)) {
                        case ACPI_TYPE_LOCAL_REFERENCE:
@@ -339,7 +360,7 @@ acpi_rs_create_pci_routing_table(union acpi_operand_object *package_object,
 
                /* 4) Fourth subobject: Dereference the PRT.source_index */
 
-               obj_desc = sub_object_list[3];
+               obj_desc = sub_object_list[source_index_index];
                if (ACPI_GET_OBJECT_TYPE(obj_desc) == ACPI_TYPE_INTEGER) {
                        user_prt->source_index = (u32) obj_desc->integer.value;
                } else {
index 0771b43..00d25b3 100644 (file)
@@ -102,9 +102,9 @@ struct acpi_video_bus_cap {
 
 struct acpi_video_device_attrib {
        u32 display_index:4;    /* A zero-based instance of the Display */
-       u32 display_port_attachment:4;  /*This field differenates displays type */
+       u32 display_port_attachment:4;  /*This field differentiates the display type */
        u32 display_type:4;     /*Describe the specific type in use */
-       u32 vendor_specific:4;  /*Chipset Vendor Specifi */
+       u32 vendor_specific:4;  /*Chipset Vendor Specific */
        u32 bios_can_detect:1;  /*BIOS can detect the device */
        u32 depend_on_vga:1;    /*Non-VGA output device whose power is related to 
                                   the VGA device. */
@@ -484,16 +484,16 @@ acpi_video_bus_POST_options(struct acpi_video_bus *video,
  *             0.      The system BIOS should NOT automatically switch(toggle)
  *                     the active display output.
  *             1.      The system BIOS should automatically switch (toggle) the
- *                     active display output. No swich event.
+ *                     active display output. No switch event.
  *             2.      The _DGS value should be locked.
  *             3.      The system BIOS should not automatically switch (toggle) the
  *                     active display output, but instead generate the display switch
  *                     event notify code.
  *     lcd_flag        :
  *             0.      The system BIOS should automatically control the brightness level
- *                     of the LCD, when the power changes from AC to DC
+ *                     of the LCD when the power changes from AC to DC
  *             1.      The system BIOS should NOT automatically control the brightness 
- *                     level of the LCD, when the power changes from AC to DC.
+ *                     level of the LCD when the power changes from AC to DC.
  * Return Value:
  *             -1      wrong arg.
  */
@@ -525,7 +525,7 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
  *  Return Value:
  *     None
  *
- *  Find out all required AML method defined under the output
+ *  Find out all required AML methods defined under the output
  *  device.
  */
 
@@ -636,7 +636,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
  *  Return Value:
  *     None
  *
- *  Find out all required AML method defined under the video bus device.
+ *  Find out all required AML methods defined under the video bus device.
  */
 
 static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
@@ -681,19 +681,19 @@ static int acpi_video_bus_check(struct acpi_video_bus *video)
         * to check well known required nodes.
         */
 
-       /* Does this device able to support video switching ? */
+       /* Does this device support video switching? */
        if (video->cap._DOS) {
                video->flags.multihead = 1;
                status = 0;
        }
 
-       /* Does this device able to retrieve a retrieve a video ROM ? */
+       /* Does this device support retrieving a video ROM? */
        if (video->cap._ROM) {
                video->flags.rom = 1;
                status = 0;
        }
 
-       /* Does this device able to configure which video device to POST ? */
+       /* Does this device support configuring which video device to POST? */
        if (video->cap._GPD && video->cap._SPD && video->cap._VPO) {
                video->flags.post = 1;
                status = 0;
@@ -860,7 +860,7 @@ acpi_video_device_write_brightness(struct file *file,
        if (level > 100)
                return -EFAULT;
 
-       /* validate though the list of available levels */
+       /* validate through the list of available levels */
        for (i = 0; i < dev->brightness->count; i++)
                if (level == dev->brightness->levels[i]) {
                        if (ACPI_SUCCESS
@@ -1065,10 +1065,10 @@ static int acpi_video_bus_POST_info_seq_show(struct seq_file *seq, void *offset)
                        printk(KERN_WARNING PREFIX
                               "The motherboard VGA device is not listed as a possible POST device.\n");
                        printk(KERN_WARNING PREFIX
-                              "This indicate a BIOS bug.  Please contact the manufacturer.\n");
+                              "This indicates a BIOS bug. Please contact the manufacturer.\n");
                }
                printk("%lx\n", options);
-               seq_printf(seq, "can POST: <intgrated video>");
+               seq_printf(seq, "can POST: <integrated video>");
                if (options & 2)
                        seq_printf(seq, " <PCI video>");
                if (options & 4)
@@ -1102,7 +1102,7 @@ static int acpi_video_bus_POST_seq_show(struct seq_file *seq, void *offset)
                seq_printf(seq, "<not supported>\n");
                goto end;
        }
-       seq_printf(seq, "device posted is <%s>\n", device_decode[id & 3]);
+       seq_printf(seq, "device POSTed is <%s>\n", device_decode[id & 3]);
 
       end:
        return 0;
@@ -1156,7 +1156,7 @@ acpi_video_bus_write_POST(struct file *file,
        if (opt > 3)
                return -EFAULT;
 
-       /* just in case an OEM 'forget' the motherboard... */
+       /* just in case an OEM 'forgot' the motherboard... */
        options |= 1;
 
        if (options & (1ul << opt)) {
@@ -1527,13 +1527,13 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video)
 /*
  *  Arg:
  *     video   : video bus device 
- *     event   : Nontify Event
+ *     event   : notify event
  *
  *  Return:
  *     < 0     : error
  *  
  *     1. Find out the current active output device.
- *     2. Identify the next output device to switch
+ *     2. Identify the next output device to switch to.
  *     3. call _DSS to do actual switch.
  */
 
@@ -1723,12 +1723,12 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
        device = video->device;
 
        switch (event) {
-       case ACPI_VIDEO_NOTIFY_SWITCH:  /* User request that a switch occur,
+       case ACPI_VIDEO_NOTIFY_SWITCH:  /* User requested a switch,
                                         * most likely via hotkey. */
                acpi_bus_generate_event(device, event, 0);
                break;
 
-       case ACPI_VIDEO_NOTIFY_PROBE:   /* User plug or remove a video
+       case ACPI_VIDEO_NOTIFY_PROBE:   /* User plugged in or removed a video
                                         * connector. */
                acpi_video_device_enumerate(video);
                acpi_video_device_rebind(video);
index 019d8ff..c428a56 100644 (file)
@@ -576,6 +576,13 @@ int ata_acpi_exec_tfs(struct ata_port *ap)
 
        if (noacpi)
                return 0;
+       /*
+        * TBD - implement PATA support.  For now,
+        * we should not run GTF on PATA devices since some
+        * PATA require execution of GTM/STM before GTF.
+        */
+       if (!(ap->cbl == ATA_CBL_SATA))
+               return 0;
 
        for (ix = 0; ix < ATA_MAX_DEVICES; ix++) {
                if (!ata_dev_enabled(&ap->device[ix]))
index 295e931..4b23212 100644 (file)
@@ -211,7 +211,7 @@ static struct workqueue_struct *led_workqueue;
                                     enum led_brightness value);        \
        static void object##_led_update(struct work_struct *ignored);   \
        static int object##_led_wk;                                     \
-       DECLARE_WORK(object##_led_work, object##_led_update);           \
+       static DECLARE_WORK(object##_led_work, object##_led_update);    \
        static struct led_classdev object##_led = {                     \
                .name           = "asus:" ledname,                      \
                .brightness_set = object##_led_set,                     \
index 2ebe240..ac708bc 100644 (file)
@@ -453,7 +453,7 @@ static int sony_acpi_resume(struct acpi_device *device)
 static int sony_acpi_add(struct acpi_device *device)
 {
        acpi_status status;
-       int result;
+       int result = 0;
        acpi_handle handle;
 
        sony_acpi_acpi_device = device;
index df49530..a32db06 100644 (file)
@@ -757,7 +757,8 @@ int pci_enable_device(struct pci_dev *dev)
  * when a device is enabled using managed PCI device enable interface.
  */
 struct pci_devres {
-       unsigned int disable:1;
+       unsigned int enabled:1;
+       unsigned int pinned:1;
        unsigned int orig_intx:1;
        unsigned int restore_intx:1;
        u32 region_mask;
@@ -781,7 +782,7 @@ static void pcim_release(struct device *gendev, void *res)
        if (this->restore_intx)
                pci_intx(dev, this->orig_intx);
 
-       if (this->disable)
+       if (this->enabled && !this->pinned)
                pci_disable_device(dev);
 }
 
@@ -820,12 +821,12 @@ int pcim_enable_device(struct pci_dev *pdev)
        dr = get_pci_dr(pdev);
        if (unlikely(!dr))
                return -ENOMEM;
-       WARN_ON(!!dr->disable);
+       WARN_ON(!!dr->enabled);
 
        rc = pci_enable_device(pdev);
        if (!rc) {
                pdev->is_managed = 1;
-               dr->disable = 1;
+               dr->enabled = 1;
        }
        return rc;
 }
@@ -843,9 +844,9 @@ void pcim_pin_device(struct pci_dev *pdev)
        struct pci_devres *dr;
 
        dr = find_pci_dr(pdev);
-       WARN_ON(!dr || !dr->disable);
+       WARN_ON(!dr || !dr->enabled);
        if (dr)
-               dr->disable = 0;
+               dr->pinned = 1;
 }
 
 /**
@@ -876,7 +877,7 @@ pci_disable_device(struct pci_dev *dev)
 
        dr = find_pci_dr(dev);
        if (dr)
-               dr->disable = 0;
+               dr->enabled = 0;
 
        if (atomic_sub_return(1, &dev->enable_cnt) != 0)
                return;
index b164de0..db6ad8e 100644 (file)
@@ -66,7 +66,7 @@ static struct pci_error_handlers aer_error_handlers = {
        .resume = aer_error_resume,
 };
 
-static struct pcie_port_service_driver aerdrv = {
+static struct pcie_port_service_driver aerdriver = {
        .name           = "aer",
        .id_table       = &aer_id[0],
 
@@ -328,7 +328,7 @@ static void aer_error_resume(struct pci_dev *dev)
  **/
 static int __init aer_service_init(void)
 {
-       return pcie_port_service_register(&aerdrv);
+       return pcie_port_service_register(&aerdriver);
 }
 
 /**
@@ -338,7 +338,7 @@ static int __init aer_service_init(void)
  **/
 static void __exit aer_service_exit(void)
 {
-       pcie_port_service_unregister(&aerdrv);
+       pcie_port_service_unregister(&aerdriver);
 }
 
 module_init(aer_service_init);
index f17e7ed..0be5a0b 100644 (file)
@@ -276,7 +276,7 @@ static struct pci_error_handlers pcie_portdrv_err_handler = {
                .resume = pcie_portdrv_err_resume,
 };
 
-static struct pci_driver pcie_portdrv = {
+static struct pci_driver pcie_portdriver = {
        .name           = (char *)device_name,
        .id_table       = &port_pci_ids[0],
 
@@ -298,7 +298,7 @@ static int __init pcie_portdrv_init(void)
                printk(KERN_WARNING "PCIE: bus_register error: %d\n", retval);
                goto out;
        }
-       retval = pci_register_driver(&pcie_portdrv);
+       retval = pci_register_driver(&pcie_portdriver);
        if (retval)
                pcie_port_bus_unregister();
  out:
@@ -307,7 +307,7 @@ static int __init pcie_portdrv_init(void)
 
 static void __exit pcie_portdrv_exit(void) 
 {
-       pci_unregister_driver(&pcie_portdrv);
+       pci_unregister_driver(&pcie_portdriver);
        pcie_port_bus_unregister();
 }
 
index ff98ead..2dd8681 100644 (file)
@@ -15,7 +15,7 @@
 
 DECLARE_RWSEM(pci_bus_sem);
 
-static struct pci_bus * __devinit
+static struct pci_bus *
 pci_do_find_bus(struct pci_bus* bus, unsigned char busnr)
 {
        struct pci_bus* child;
index 7a53554..118ac97 100644 (file)
@@ -89,6 +89,7 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
                return;
 
        res->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+       res->irq_resource[i].flags |= irq_flags(triggering, polarity);
        irq = acpi_register_gsi(gsi, triggering, polarity);
        if (irq < 0) {
                res->irq_resource[i].flags |= IORESOURCE_DISABLED;
@@ -103,8 +104,52 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
        pcibios_penalize_isa_irq(irq, 1);
 }
 
+static int dma_flags(int type, int bus_master, int transfer)
+{
+       int flags = 0;
+
+       if (bus_master)
+               flags |= IORESOURCE_DMA_MASTER;
+       switch (type) {
+       case ACPI_COMPATIBILITY:
+               flags |= IORESOURCE_DMA_COMPATIBLE;
+               break;
+       case ACPI_TYPE_A:
+               flags |= IORESOURCE_DMA_TYPEA;
+               break;
+       case ACPI_TYPE_B:
+               flags |= IORESOURCE_DMA_TYPEB;
+               break;
+       case ACPI_TYPE_F:
+               flags |= IORESOURCE_DMA_TYPEF;
+               break;
+       default:
+               /* Set a default value ? */
+               flags |= IORESOURCE_DMA_COMPATIBLE;
+               pnp_err("Invalid DMA type");
+       }
+       switch (transfer) {
+       case ACPI_TRANSFER_8:
+               flags |= IORESOURCE_DMA_8BIT;
+               break;
+       case ACPI_TRANSFER_8_16:
+               flags |= IORESOURCE_DMA_8AND16BIT;
+               break;
+       case ACPI_TRANSFER_16:
+               flags |= IORESOURCE_DMA_16BIT;
+               break;
+       default:
+               /* Set a default value ? */
+               flags |= IORESOURCE_DMA_8AND16BIT;
+               pnp_err("Invalid DMA transfer type");
+       }
+
+       return flags;
+}
+
 static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
+pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
+       int type, int bus_master, int transfer)
 {
        int i = 0;
        while (i < PNP_MAX_DMA &&
@@ -112,6 +157,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
                i++;
        if (i < PNP_MAX_DMA) {
                res->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
+               res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer);
                if (dma == -1) {
                        res->dma_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
@@ -123,7 +169,7 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma)
 
 static void
 pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
-       u64 io, u64 len)
+       u64 io, u64 len, int io_decode)
 {
        int i = 0;
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
@@ -131,6 +177,8 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
                i++;
        if (i < PNP_MAX_PORT) {
                res->port_resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
+               if (io_decode == ACPI_DECODE_16)
+                       res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR;
                if (len <= 0 || (io + len -1) >= 0x10003) {
                        res->port_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
@@ -142,7 +190,7 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
 
 static void
 pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
-       u64 mem, u64 len)
+       u64 mem, u64 len, int write_protect)
 {
        int i = 0;
        while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
@@ -154,6 +202,9 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
                        res->mem_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
+               if(write_protect == ACPI_READ_WRITE_MEMORY)
+                       res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE;
+
                res->mem_resource[i].start = mem;
                res->mem_resource[i].end = mem + len - 1;
        }
@@ -178,10 +229,11 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
 
        if (p->resource_type == ACPI_MEMORY_RANGE)
                pnpacpi_parse_allocated_memresource(res_table,
-                               p->minimum, p->address_length);
+                               p->minimum, p->address_length, p->info.mem.write_protect);
        else if (p->resource_type == ACPI_IO_RANGE)
                pnpacpi_parse_allocated_ioresource(res_table,
-                               p->minimum, p->address_length);
+                               p->minimum, p->address_length,
+                               p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16);
 }
 
 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
@@ -208,13 +260,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        case ACPI_RESOURCE_TYPE_DMA:
                if (res->data.dma.channel_count > 0)
                        pnpacpi_parse_allocated_dmaresource(res_table,
-                                       res->data.dma.channels[0]);
+                                       res->data.dma.channels[0],
+                                       res->data.dma.type,
+                                       res->data.dma.bus_master,
+                                       res->data.dma.transfer);
                break;
 
        case ACPI_RESOURCE_TYPE_IO:
                pnpacpi_parse_allocated_ioresource(res_table,
                                res->data.io.minimum,
-                               res->data.io.address_length);
+                               res->data.io.address_length,
+                               res->data.io.io_decode);
                break;
 
        case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -224,7 +280,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        case ACPI_RESOURCE_TYPE_FIXED_IO:
                pnpacpi_parse_allocated_ioresource(res_table,
                                res->data.fixed_io.address,
-                               res->data.fixed_io.address_length);
+                               res->data.fixed_io.address_length,
+                               ACPI_DECODE_10);
                break;
 
        case ACPI_RESOURCE_TYPE_VENDOR:
@@ -236,17 +293,20 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        case ACPI_RESOURCE_TYPE_MEMORY24:
                pnpacpi_parse_allocated_memresource(res_table,
                                res->data.memory24.minimum,
-                               res->data.memory24.address_length);
+                               res->data.memory24.address_length,
+                               res->data.memory24.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_MEMORY32:
                pnpacpi_parse_allocated_memresource(res_table,
                                res->data.memory32.minimum,
-                               res->data.memory32.address_length);
+                               res->data.memory32.address_length,
+                               res->data.memory32.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
                pnpacpi_parse_allocated_memresource(res_table,
                                res->data.fixed_memory32.address,
-                               res->data.fixed_memory32.address_length);
+                               res->data.fixed_memory32.address_length,
+                               res->data.fixed_memory32.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_ADDRESS16:
        case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -304,42 +364,8 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
 
        for(i = 0; i < p->channel_count; i++)
                dma->map |= 1 << p->channels[i];
-       dma->flags = 0;
-       if (p->bus_master)
-               dma->flags |= IORESOURCE_DMA_MASTER;
-       switch (p->type) {
-       case ACPI_COMPATIBILITY:
-               dma->flags |= IORESOURCE_DMA_COMPATIBLE;
-               break;
-       case ACPI_TYPE_A:
-               dma->flags |= IORESOURCE_DMA_TYPEA;
-               break;
-       case ACPI_TYPE_B:
-               dma->flags |= IORESOURCE_DMA_TYPEB;
-               break;
-       case ACPI_TYPE_F:
-               dma->flags |= IORESOURCE_DMA_TYPEF;
-               break;
-       default:
-               /* Set a default value ? */
-               dma->flags |= IORESOURCE_DMA_COMPATIBLE;
-               pnp_err("Invalid DMA type");
-       }
-       switch (p->transfer) {
-       case ACPI_TRANSFER_8:
-               dma->flags |= IORESOURCE_DMA_8BIT;
-               break;
-       case ACPI_TRANSFER_8_16:
-               dma->flags |= IORESOURCE_DMA_8AND16BIT;
-               break;
-       case ACPI_TRANSFER_16:
-               dma->flags |= IORESOURCE_DMA_16BIT;
-               break;
-       default:
-               /* Set a default value ? */
-               dma->flags |= IORESOURCE_DMA_8AND16BIT;
-               pnp_err("Invalid DMA transfer type");
-       }
+
+       dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
 
        pnp_register_dma_resource(option, dma);
        return;
index d38a25f..31ae661 100644 (file)
@@ -332,9 +332,9 @@ static void acm_rx_tasklet(unsigned long _acm)
        if (!ACM_READY(acm))
                return;
 
-       spin_lock(&acm->throttle_lock);
+       spin_lock_irqsave(&acm->throttle_lock, flags);
        throttled = acm->throttle;
-       spin_unlock(&acm->throttle_lock);
+       spin_unlock_irqrestore(&acm->throttle_lock, flags);
        if (throttled)
                return;
 
@@ -352,9 +352,9 @@ next_buffer:
        dbg("acm_rx_tasklet: procesing buf 0x%p, size = %d", buf, buf->size);
 
        tty_buffer_request_room(tty, buf->size);
-       spin_lock(&acm->throttle_lock);
+       spin_lock_irqsave(&acm->throttle_lock, flags);
        throttled = acm->throttle;
-       spin_unlock(&acm->throttle_lock);
+       spin_unlock_irqrestore(&acm->throttle_lock, flags);
        if (!throttled)
                tty_insert_flip_string(tty, buf->base, buf->size);
        tty_flip_buffer_push(tty);
index 274f14f..36e7a84 100644 (file)
@@ -912,7 +912,7 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
        struct async *as;
        struct usb_ctrlrequest *dr = NULL;
        unsigned int u, totlen, isofrmlen;
-       int ret, interval = 0, ifnum = -1;
+       int ret, ifnum = -1;
 
        if (uurb->flags & ~(USBDEVFS_URB_ISO_ASAP|USBDEVFS_URB_SHORT_NOT_OK|
                           URB_NO_FSBR|URB_ZERO_PACKET))
@@ -992,7 +992,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
                if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
                                != USB_ENDPOINT_XFER_ISOC)
                        return -EINVAL;
-               interval = 1 << min (15, ep->desc.bInterval - 1);
                isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) * uurb->number_of_packets;
                if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
                        return -ENOMEM;
@@ -1021,10 +1020,6 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
                if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK)
                                != USB_ENDPOINT_XFER_INT)
                        return -EINVAL;
-               if (ps->dev->speed == USB_SPEED_HIGH)
-                       interval = 1 << min (15, ep->desc.bInterval - 1);
-               else
-                       interval = ep->desc.bInterval;
                if (uurb->buffer_length > MAX_USBFS_BUFFER_SIZE)
                        return -EINVAL;
                if (!access_ok((uurb->endpoint & USB_DIR_IN) ? VERIFY_WRITE : VERIFY_READ, uurb->buffer, uurb->buffer_length))
@@ -1053,7 +1048,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb,
        as->urb->setup_packet = (unsigned char*)dr;
        as->urb->start_frame = uurb->start_frame;
        as->urb->number_of_packets = uurb->number_of_packets;
-       as->urb->interval = interval;
+       if (uurb->type == USBDEVFS_URB_TYPE_ISO ||
+                       ps->dev->speed == USB_SPEED_HIGH)
+               as->urb->interval = 1 << min(15, ep->desc.bInterval - 1);
+       else
+               as->urb->interval = ep->desc.bInterval;
         as->urb->context = as;
         as->urb->complete = async_completed;
        for (totlen = u = 0; u < uurb->number_of_packets; u++) {
index 4140074..b89a98e 100644 (file)
@@ -1281,12 +1281,6 @@ int usb_new_device(struct usb_device *udev)
 {
        int err;
 
-       /* Lock ourself into memory in order to keep a probe sequence
-        * sleeping in a new thread from allowing us to be unloaded.
-        */
-       if (!try_module_get(THIS_MODULE))
-               return -EINVAL;
-
        /* Determine quirks */
        usb_detect_quirks(udev);
 
@@ -1390,7 +1384,6 @@ int usb_new_device(struct usb_device *udev)
                usb_autoresume_device(udev->parent);
 
 exit:
-       module_put(THIS_MODULE);
        return err;
 
 fail:
@@ -2443,7 +2436,7 @@ static void hub_port_connect_change(struct usb_hub *hub, int port1,
 
        if (portchange & USB_PORT_STAT_C_CONNECTION) {
                status = hub_port_debounce(hub, port1);
-               if (status < 0) {
+               if (status < 0 && printk_ratelimit()) {
                        dev_err (hub_dev,
                                "connect-debounce failed, port %d disabled\n",
                                port1);
index 2f17468..217a3d6 100644 (file)
@@ -221,10 +221,15 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
 
        if ((ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
                        USB_ENDPOINT_XFER_INT) {
+               int interval;
+
+               if (usb_dev->speed == USB_SPEED_HIGH)
+                       interval = 1 << min(15, ep->desc.bInterval - 1);
+               else
+                       interval = ep->desc.bInterval;
                pipe = (pipe & ~(3 << 30)) | (PIPE_INTERRUPT << 30);
                usb_fill_int_urb(urb, usb_dev, pipe, data, len,
-                               usb_api_blocking_completion, NULL,
-                               ep->desc.bInterval);
+                               usb_api_blocking_completion, NULL, interval);
        } else
                usb_fill_bulk_urb(urb, usb_dev, pipe, data, len,
                                usb_api_blocking_completion, NULL);
index a467780..2a6e316 100644 (file)
@@ -1835,7 +1835,7 @@ static int at91udc_resume(struct platform_device *pdev)
 #define        at91udc_resume  NULL
 #endif
 
-static struct platform_driver at91_udc = {
+static struct platform_driver at91_udc_driver = {
        .remove         = __exit_p(at91udc_remove),
        .shutdown       = at91udc_shutdown,
        .suspend        = at91udc_suspend,
@@ -1848,13 +1848,13 @@ static struct platform_driver at91_udc = {
 
 static int __init udc_init_module(void)
 {
-       return platform_driver_probe(&at91_udc, at91udc_probe);
+       return platform_driver_probe(&at91_udc_driver, at91udc_probe);
 }
 module_init(udc_init_module);
 
 static void __exit udc_exit_module(void)
 {
-       platform_driver_unregister(&at91_udc);
+       platform_driver_unregister(&at91_udc_driver);
 }
 module_exit(udc_exit_module);
 
index 7b3a326..65c91d3 100644 (file)
@@ -297,27 +297,6 @@ goku_free_request(struct usb_ep *_ep, struct usb_request *_req)
 
 /*-------------------------------------------------------------------------*/
 
-#undef USE_KMALLOC
-
-/* many common platforms have dma-coherent caches, which means that it's
- * safe to use kmalloc() memory for all i/o buffers without using any
- * cache flushing calls.  (unless you're trying to share cache lines
- * between dma and non-dma activities, which is a slow idea in any case.)
- *
- * other platforms need more care, with 2.6 having a moderately general
- * solution except for the common "buffer is smaller than a page" case.
- */
-#if    defined(CONFIG_X86)
-#define USE_KMALLOC
-
-#elif  defined(CONFIG_MIPS) && !defined(CONFIG_DMA_NONCOHERENT)
-#define USE_KMALLOC
-
-#elif  defined(CONFIG_PPC) && !defined(CONFIG_NOT_COHERENT_CACHE)
-#define USE_KMALLOC
-
-#endif
-
 /* allocating buffers this way eliminates dma mapping overhead, which
  * on some platforms will mean eliminating a per-io buffer copy.  with
  * some kinds of system caches, further tweaks may still be needed.
@@ -334,11 +313,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
                return NULL;
        *dma = DMA_ADDR_INVALID;
 
-#if    defined(USE_KMALLOC)
-       retval = kmalloc(bytes, gfp_flags);
-       if (retval)
-               *dma = virt_to_phys(retval);
-#else
        if (ep->dma) {
                /* the main problem with this call is that it wastes memory
                 * on typical 1/N page allocations: it allocates 1-N pages.
@@ -348,7 +322,6 @@ goku_alloc_buffer(struct usb_ep *_ep, unsigned bytes,
                                bytes, dma, gfp_flags);
        } else
                retval = kmalloc(bytes, gfp_flags);
-#endif
        return retval;
 }
 
@@ -356,7 +329,6 @@ static void
 goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
 {
        /* free memory into the right allocator */
-#ifndef        USE_KMALLOC
        if (dma != DMA_ADDR_INVALID) {
                struct goku_ep  *ep;
 
@@ -365,7 +337,6 @@ goku_free_buffer(struct usb_ep *_ep, void *buf, dma_addr_t dma, unsigned bytes)
                        return;
                dma_free_coherent(&ep->dev->pdev->dev, bytes, buf, dma);
        } else
-#endif
                kfree (buf);
 }
 
index f01890d..571f3eb 100644 (file)
@@ -2616,7 +2616,7 @@ lubbock_fail0:
                if (retval != 0) {
                        printk(KERN_ERR "%s: can't get irq %i, err %d\n",
                                driver_name, vbus_irq, retval);
-                       free_irq(IRQ_USB, dev);
+                       free_irq(irq, dev);
                        return -EBUSY;
                }
        }
index 9af529d..1813b7c 100644 (file)
@@ -653,8 +653,7 @@ static int ehci_hub_control (
        if (status & ~0xffff)   /* only if wPortChange is interesting */
 #endif
                dbg_port (ehci, "GetStatus", wIndex + 1, temp);
-               // we "know" this alignment is good, caller used kmalloc()...
-               *((__le32 *) buf) = cpu_to_le32 (status);
+               put_unaligned(cpu_to_le32 (status), (__le32 *) buf);
                break;
        case SetHubFeature:
                switch (wValue) {
index bacc25c..8e4427a 100644 (file)
@@ -33,6 +33,9 @@ static __u8 root_hub_hub_des[] =
 /* status change bits:  nonzero writes will clear */
 #define RWC_BITS       (USBPORTSC_OCC | USBPORTSC_PEC | USBPORTSC_CSC)
 
+/* suspend/resume bits: port suspended or port resuming */
+#define SUSPEND_BITS   (USBPORTSC_SUSP | USBPORTSC_RD)
+
 /* A port that either is connected or has a changed-bit set will prevent
  * us from AUTO_STOPPING.
  */
@@ -96,8 +99,8 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
        int status;
        int i;
 
-       if (inw(port_addr) & (USBPORTSC_SUSP | USBPORTSC_RD)) {
-               CLR_RH_PORTSTAT(USBPORTSC_SUSP | USBPORTSC_RD);
+       if (inw(port_addr) & SUSPEND_BITS) {
+               CLR_RH_PORTSTAT(SUSPEND_BITS);
                if (test_bit(port, &uhci->resuming_ports))
                        set_bit(port, &uhci->port_c_suspend);
 
@@ -107,7 +110,7 @@ static void uhci_finish_suspend(struct uhci_hcd *uhci, int port,
                 * Experiments show that some controllers take longer, so
                 * we'll poll for completion. */
                for (i = 0; i < 10; ++i) {
-                       if (!(inw(port_addr) & USBPORTSC_RD))
+                       if (!(inw(port_addr) & SUSPEND_BITS))
                                break;
                        udelay(1);
                }
@@ -289,7 +292,7 @@ static int uhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
                        wPortStatus |= USB_PORT_STAT_CONNECTION;
                if (status & USBPORTSC_PE) {
                        wPortStatus |= USB_PORT_STAT_ENABLE;
-                       if (status & (USBPORTSC_SUSP | USBPORTSC_RD))
+                       if (status & SUSPEND_BITS)
                                wPortStatus |= USB_PORT_STAT_SUSPEND;
                }
                if (status & USBPORTSC_OC)
index 0c1d66d..bc3327e 100644 (file)
@@ -2905,17 +2905,31 @@ static int __init ftdi_elan_init(void)
 {
         int result;
         printk(KERN_INFO "driver %s built at %s on %s\n", ftdi_elan_driver.name,
-                 __TIME__, __DATE__);
+              __TIME__, __DATE__);
         init_MUTEX(&ftdi_module_lock);
         INIT_LIST_HEAD(&ftdi_static_list);
         status_queue = create_singlethread_workqueue("ftdi-status-control");
+       if (!status_queue)
+               goto err1;
         command_queue = create_singlethread_workqueue("ftdi-command-engine");
+       if (!command_queue)
+               goto err2;
         respond_queue = create_singlethread_workqueue("ftdi-respond-engine");
+       if (!respond_queue)
+               goto err3;
         result = usb_register(&ftdi_elan_driver);
         if (result)
                 printk(KERN_ERR "usb_register failed. Error number %d\n",
-                        result);
+                      result);
         return result;
+
+ err3:
+       destroy_workqueue(command_queue);
+ err2:
+       destroy_workqueue(status_queue);
+ err1:
+       printk(KERN_ERR "%s couldn't create workqueue\n", ftdi_elan_driver.name);
+       return -ENOMEM;
 }
 
 static void __exit ftdi_elan_exit(void)
index 4a932e1..c0bc52b 100644 (file)
@@ -570,6 +570,10 @@ static const struct driver_info dm9601_info = {
 };
 
 static const struct usb_device_id products[] = {
+       {
+        USB_DEVICE(0x07aa, 0x9601),    /* Corega FEther USB-TXC */
+        .driver_info = (unsigned long)&dm9601_info,
+        },
        {
         USB_DEVICE(0x0a46, 0x9601),    /* Davicom USB-100 */
         .driver_info = (unsigned long)&dm9601_info,
index 18816bf..310a8b5 100644 (file)
@@ -44,8 +44,43 @@ struct airprime_private {
        int outstanding_urbs;
        int throttled;
        struct urb *read_urbp[NUM_READ_URBS];
+
+       /* Settings for the port */
+       int rts_state;  /* Handshaking pins (outputs) */
+       int dtr_state;
+       int cts_state;  /* Handshaking pins (inputs) */
+       int dsr_state;
+       int dcd_state;
+       int ri_state;
 };
 
+static int airprime_send_setup(struct usb_serial_port *port)
+{
+       struct usb_serial *serial = port->serial;
+       struct airprime_private *priv;
+
+       dbg("%s", __FUNCTION__);
+
+       if (port->number != 0)
+               return 0;
+
+       priv = usb_get_serial_port_data(port);
+
+       if (port->tty) {
+               int val = 0;
+               if (priv->dtr_state)
+                       val |= 0x01;
+               if (priv->rts_state)
+                       val |= 0x02;
+
+               return usb_control_msg(serial->dev,
+                               usb_rcvctrlpipe(serial->dev, 0),
+                               0x22,0x21,val,0,NULL,0,USB_CTRL_SET_TIMEOUT);
+       }
+
+       return 0;
+}
+
 static void airprime_read_bulk_callback(struct urb *urb)
 {
        struct usb_serial_port *port = urb->context;
@@ -118,6 +153,10 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
                usb_set_serial_port_data(port, priv);
        }
 
+       /* Set some sane defaults */
+       priv->rts_state = 1;
+       priv->dtr_state = 1;
+
        for (i = 0; i < NUM_READ_URBS; ++i) {
                buffer = kmalloc(buffer_size, GFP_KERNEL);
                if (!buffer) {
@@ -151,6 +190,9 @@ static int airprime_open(struct usb_serial_port *port, struct file *filp)
                /* remember this urb so we can kill it when the port is closed */
                priv->read_urbp[i] = urb;
        }
+
+       airprime_send_setup(port);
+
        goto out;
 
  errout:
@@ -176,6 +218,11 @@ static void airprime_close(struct usb_serial_port *port, struct file * filp)
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
+       priv->rts_state = 0;
+       priv->dtr_state = 0;
+
+       airprime_send_setup(port);
+
        for (i = 0; i < NUM_READ_URBS; ++i) {
                usb_kill_urb (priv->read_urbp[i]);
                kfree (priv->read_urbp[i]->transfer_buffer);
index db623e7..d7d0ba9 100644 (file)
@@ -63,6 +63,8 @@ static struct usb_device_id id_table [] = {
        { USB_DEVICE(0x10C4, 0x80CA) }, /* Degree Controls Inc */
        { USB_DEVICE(0x10C4, 0x80F6) }, /* Suunto sports instrument */
        { USB_DEVICE(0x10C4, 0x813D) }, /* Burnside Telecom Deskmobile */
+       { USB_DEVICE(0x10C4, 0x814A) }, /* West Mountain Radio RIGblaster P&P */
+       { USB_DEVICE(0x10C4, 0x814B) }, /* West Mountain Radio RIGtalk */
        { USB_DEVICE(0x10C4, 0x815E) }, /* Helicomm IP-Link 1220-DVM */
        { USB_DEVICE(0x10C4, 0x81C8) }, /* Lipowsky Industrie Elektronik GmbH, Baby-JTAG */
        { USB_DEVICE(0x10C4, 0x81E2) }, /* Lipowsky Industrie Elektronik GmbH, Baby-LIN */
index c525b42..1633a0f 100644 (file)
@@ -315,6 +315,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_SIO_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_8U232AM_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_8U232AM_ALT_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_232RL_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_8U2232C_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_MICRO_CHAMELEON_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_RELAIS_PID) },
@@ -420,6 +421,14 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FTDI_VID, FTDI_ELV_ALC8500_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_PYRAMID_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_ELV_FHZ1000PC_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_US485_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_PICPRO_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_PCMCIA_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_PK1_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_RS232MON_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_APP70_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_PEDO_PID) },
+       { USB_DEVICE(FTDI_VID, FTDI_IBS_PROD_PID) },
        /*
         * These will probably use user-space drivers.  Uncomment them if
         * you need them or use the user-specified vendor/product module
@@ -459,6 +468,7 @@ static struct usb_device_id id_table_combined [] = {
        { USB_DEVICE(FALCOM_VID, FALCOM_TWIST_PID) },
        { USB_DEVICE(FALCOM_VID, FALCOM_SAMBA_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_SUUNTO_SPORTS_PID) },
+       { USB_DEVICE(TTI_VID, TTI_QL355P_PID) },
        { USB_DEVICE(FTDI_VID, FTDI_RM_CANVIEW_PID) },
        { USB_DEVICE(BANDB_VID, BANDB_USOTL4_PID) },
        { USB_DEVICE(BANDB_VID, BANDB_USTL4_PID) },
@@ -533,6 +543,7 @@ static const char *ftdi_chip_name[] = {
        [FT8U232AM] = "FT8U232AM",
        [FT232BM] = "FT232BM",
        [FT2232C] = "FT2232C",
+       [FT232RL] = "FT232RL",
 };
 
 
@@ -588,6 +599,8 @@ struct ftdi_private {
 static int  ftdi_sio_probe     (struct usb_serial *serial, const struct usb_device_id *id);
 static int  ftdi_sio_attach            (struct usb_serial *serial);
 static void ftdi_shutdown              (struct usb_serial *serial);
+static int  ftdi_sio_port_probe        (struct usb_serial_port *port);
+static int  ftdi_sio_port_remove       (struct usb_serial_port *port);
 static int  ftdi_open                  (struct usb_serial_port *port, struct file *filp);
 static void ftdi_close                 (struct usb_serial_port *port, struct file *filp);
 static int  ftdi_write                 (struct usb_serial_port *port, const unsigned char *buf, int count);
@@ -622,6 +635,8 @@ static struct usb_serial_driver ftdi_sio_device = {
        .num_bulk_out =         1,
        .num_ports =            1,
        .probe =                ftdi_sio_probe,
+       .port_probe =           ftdi_sio_port_probe,
+       .port_remove =          ftdi_sio_port_remove,
        .open =                 ftdi_open,
        .close =                ftdi_close,
        .throttle =             ftdi_throttle,
@@ -1024,11 +1039,10 @@ static ssize_t show_latency_timer(struct device *dev, struct device_attribute *a
 {
        struct usb_serial_port *port = to_usb_serial_port(dev);
        struct ftdi_private *priv = usb_get_serial_port_data(port);
-       struct usb_device *udev;
+       struct usb_device *udev = port->serial->dev;
        unsigned short latency = 0;
        int rv = 0;
 
-       udev = to_usb_device(dev);
 
        dbg("%s",__FUNCTION__);
 
@@ -1052,13 +1066,11 @@ static ssize_t store_latency_timer(struct device *dev, struct device_attribute *
 {
        struct usb_serial_port *port = to_usb_serial_port(dev);
        struct ftdi_private *priv = usb_get_serial_port_data(port);
-       struct usb_device *udev;
+       struct usb_device *udev = port->serial->dev;
        char buf[1];
        int v = simple_strtoul(valbuf, NULL, 10);
        int rv = 0;
 
-       udev = to_usb_device(dev);
-
        dbg("%s: setting latency timer = %i", __FUNCTION__, v);
 
        rv = usb_control_msg(udev,
@@ -1083,13 +1095,11 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
 {
        struct usb_serial_port *port = to_usb_serial_port(dev);
        struct ftdi_private *priv = usb_get_serial_port_data(port);
-       struct usb_device *udev;
+       struct usb_device *udev = port->serial->dev;
        char buf[1];
        int v = simple_strtoul(valbuf, NULL, 10);
        int rv = 0;
 
-       udev = to_usb_device(dev);
-
        dbg("%s: setting event char = %i", __FUNCTION__, v);
 
        rv = usb_control_msg(udev,
@@ -1110,46 +1120,38 @@ static ssize_t store_event_char(struct device *dev, struct device_attribute *att
 static DEVICE_ATTR(latency_timer, S_IWUSR | S_IRUGO, show_latency_timer, store_latency_timer);
 static DEVICE_ATTR(event_char, S_IWUSR, NULL, store_event_char);
 
-static int create_sysfs_attrs(struct usb_serial *serial)
+static int create_sysfs_attrs(struct usb_serial_port *port)
 {
-       struct ftdi_private *priv;
-       struct usb_device *udev;
+       struct ftdi_private *priv = usb_get_serial_port_data(port);
        int retval = 0;
 
        dbg("%s",__FUNCTION__);
 
-       priv = usb_get_serial_port_data(serial->port[0]);
-       udev = serial->dev;
-
        /* XXX I've no idea if the original SIO supports the event_char
         * sysfs parameter, so I'm playing it safe.  */
        if (priv->chip_type != SIO) {
                dbg("sysfs attributes for %s", ftdi_chip_name[priv->chip_type]);
-               retval = device_create_file(&udev->dev, &dev_attr_event_char);
+               retval = device_create_file(&port->dev, &dev_attr_event_char);
                if ((!retval) &&
                    (priv->chip_type == FT232BM || priv->chip_type == FT2232C)) {
-                       retval = device_create_file(&udev->dev,
+                       retval = device_create_file(&port->dev,
                                                    &dev_attr_latency_timer);
                }
        }
        return retval;
 }
 
-static void remove_sysfs_attrs(struct usb_serial *serial)
+static void remove_sysfs_attrs(struct usb_serial_port *port)
 {
-       struct ftdi_private *priv;
-       struct usb_device *udev;
+       struct ftdi_private *priv = usb_get_serial_port_data(port);
 
        dbg("%s",__FUNCTION__);
 
-       priv = usb_get_serial_port_data(serial->port[0]);
-       udev = serial->dev;
-
        /* XXX see create_sysfs_attrs */
        if (priv->chip_type != SIO) {
-               device_remove_file(&udev->dev, &dev_attr_event_char);
+               device_remove_file(&port->dev, &dev_attr_event_char);
                if (priv->chip_type == FT232BM || priv->chip_type == FT2232C) {
-                       device_remove_file(&udev->dev, &dev_attr_latency_timer);
+                       device_remove_file(&port->dev, &dev_attr_latency_timer);
                }
        }
 
@@ -1169,13 +1171,9 @@ static int ftdi_sio_probe (struct usb_serial *serial, const struct usb_device_id
        return (0);
 }
 
-/* attach subroutine */
-static int ftdi_sio_attach (struct usb_serial *serial)
+static int ftdi_sio_port_probe(struct usb_serial_port *port)
 {
-       struct usb_serial_port *port = serial->port[0];
        struct ftdi_private *priv;
-       struct ftdi_sio_quirk *quirk;
-       int retval;
 
        dbg("%s",__FUNCTION__);
 
@@ -1215,19 +1213,21 @@ static int ftdi_sio_attach (struct usb_serial *serial)
        kfree(port->bulk_out_buffer);
        port->bulk_out_buffer = NULL;
 
-       usb_set_serial_port_data(serial->port[0], priv);
+       usb_set_serial_port_data(port, priv);
 
-       ftdi_determine_type (serial->port[0]);
-       retval = create_sysfs_attrs(serial);
-       if (retval)
-               dev_err(&serial->dev->dev, "Error creating sysfs files, "
-                       "continuing\n");
+       ftdi_determine_type (port);
+       create_sysfs_attrs(port);
+       return 0;
+}
 
+/* attach subroutine */
+static int ftdi_sio_attach (struct usb_serial *serial)
+{
        /* Check for device requiring special set up. */
-       quirk = (struct ftdi_sio_quirk *)usb_get_serial_data(serial);
-       if (quirk && quirk->setup) {
+       struct ftdi_sio_quirk *quirk = usb_get_serial_data(serial);
+
+       if (quirk && quirk->setup)
                quirk->setup(serial);
-       }
 
        return 0;
 } /* ftdi_sio_attach */
@@ -1271,17 +1271,18 @@ static void ftdi_HE_TIRA1_setup (struct usb_serial *serial)
  *      calls __serial_close for each open of the port
  *      shutdown is called then (ie ftdi_shutdown)
  */
-
-
 static void ftdi_shutdown (struct usb_serial *serial)
-{ /* ftdi_shutdown */
+{
+       dbg("%s", __FUNCTION__);
+}
 
-       struct usb_serial_port *port = serial->port[0];
+static int ftdi_sio_port_remove(struct usb_serial_port *port)
+{
        struct ftdi_private *priv = usb_get_serial_port_data(port);
 
        dbg("%s", __FUNCTION__);
 
-       remove_sysfs_attrs(serial);
+       remove_sysfs_attrs(port);
 
        /* all open ports are closed at this point
          *    (by usbserial.c:__serial_close, which calls ftdi_close)
@@ -1291,8 +1292,9 @@ static void ftdi_shutdown (struct usb_serial *serial)
                usb_set_serial_port_data(port, NULL);
                kfree(priv);
        }
-} /* ftdi_shutdown */
 
+       return 0;
+}
 
 static int  ftdi_open (struct usb_serial_port *port, struct file *filp)
 { /* ftdi_open */
index 1bdda93..513cfe1 100644 (file)
@@ -27,6 +27,7 @@
 #define FTDI_8U232AM_PID 0x6001 /* Similar device to SIO above */
 #define FTDI_8U232AM_ALT_PID 0x6006 /* FTDI's alternate PID for above */
 #define FTDI_8U2232C_PID 0x6010 /* Dual channel device */
+#define FTDI_232RL_PID  0xFBFA  /* Product ID for FT232RL */
 #define FTDI_RELAIS_PID        0xFA10  /* Relais device from Rudolf Gugler */
 #define FTDI_NF_RIC_VID        0x0DCD  /* Vendor Id */
 #define FTDI_NF_RIC_PID        0x0001  /* Product Id */
  */
 #define FTDI_SUUNTO_SPORTS_PID 0xF680  /* Suunto Sports instrument */
 
+/*
+ * TTi (Thurlby Thandar Instruments)
+ */
+#define TTI_VID                        0x103E  /* Vendor Id */
+#define TTI_QL355P_PID         0x03E8  /* TTi QL355P power supply */
+
 /*
  * Definitions for B&B Electronics products.
  */
 #define TELLDUS_VID                    0x1781  /* Vendor ID */
 #define TELLDUS_TELLSTICK_PID          0x0C30  /* RF control dongle 433 MHz using FT232RL */
 
+/*
+ * IBS elektronik product ids
+ * Submitted by Thomas Schleusener
+ */
+#define FTDI_IBS_US485_PID     0xff38  /* IBS US485 (USB<-->RS422/485 interface) */
+#define FTDI_IBS_PICPRO_PID    0xff39  /* IBS PIC-Programmer */
+#define FTDI_IBS_PCMCIA_PID    0xff3a  /* IBS Card reader for PCMCIA SRAM-cards */
+#define FTDI_IBS_PK1_PID       0xff3b  /* IBS PK1 - Particel counter */
+#define FTDI_IBS_RS232MON_PID  0xff3c  /* IBS RS232 - Monitor */
+#define FTDI_IBS_APP70_PID     0xff3d  /* APP 70 (dust monitoring system) */
+#define FTDI_IBS_PEDO_PID      0xff3e  /* IBS PEDO-Modem (RF modem 868.35 MHz) */
+#define FTDI_IBS_PROD_PID      0xff3f  /* future device */
+
 /* Commands */
 #define FTDI_SIO_RESET                 0 /* Reset the port */
 #define FTDI_SIO_MODEM_CTRL    1 /* Set the modem control register */
@@ -620,6 +640,7 @@ typedef enum {
        FT8U232AM = 2,
        FT232BM = 3,
        FT2232C = 4,
+       FT232RL = 5,
 } ftdi_chip_type_t;
 
 typedef enum {
index a408184..d16e2e1 100644 (file)
@@ -247,6 +247,8 @@ static struct usb_device_id ipaq_id_table [] = {
        { USB_DEVICE(0x04AD, 0x0301) }, /* USB Sync 0301 */
        { USB_DEVICE(0x04AD, 0x0302) }, /* USB Sync 0302 */
        { USB_DEVICE(0x04AD, 0x0303) }, /* USB Sync 0303 */
+       { USB_DEVICE(0x04AD, 0x0306) }, /* GPS Pocket PC USB Sync */
+       { USB_DEVICE(0x04B7, 0x0531) }, /* MyGuide 7000 XL USB Sync */
        { USB_DEVICE(0x04C5, 0x1058) }, /* FUJITSU USB Sync */
        { USB_DEVICE(0x04C5, 0x1079) }, /* FUJITSU USB Sync */
        { USB_DEVICE(0x04DA, 0x2500) }, /* Panasonic USB Sync */
index 6bf22a2..8511352 100644 (file)
@@ -99,9 +99,12 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
                        continue;
 
                *minor = i;
+               j = 0;
                dbg("%s - minor base = %d", __FUNCTION__, *minor);
-               for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i)
+               for (i = *minor; (i < (*minor + num_ports)) && (i < SERIAL_TTY_MINORS); ++i) {
                        serial_table[i] = serial;
+                       serial->port[j++]->number = i;
+               }
                spin_unlock(&table_lock);
                return serial;
        }
@@ -135,11 +138,6 @@ static void destroy_serial(struct kref *kref)
 
        dbg("%s - %s", __FUNCTION__, serial->type->description);
 
-       serial->type->shutdown(serial);
-
-       /* return the minor range that this device had */
-       return_serial(serial);
-
        for (i = 0; i < serial->num_ports; ++i)
                serial->port[i]->open_count = 0;
 
@@ -150,6 +148,12 @@ static void destroy_serial(struct kref *kref)
                        serial->port[i] = NULL;
                }
 
+       if (serial->type->shutdown)
+               serial->type->shutdown(serial);
+
+       /* return the minor range that this device had */
+       return_serial(serial);
+
        /* If this is a "fake" port, we have to clean it up here, as it will
         * not get cleaned up in port_release() as it was never registered with
         * the driver core */
@@ -826,7 +830,6 @@ int usb_serial_probe(struct usb_interface *interface,
                        num_ports = type->num_ports;
        }
 
-       serial->minor = minor;
        serial->num_ports = num_ports;
        serial->num_bulk_in = num_bulk_in;
        serial->num_bulk_out = num_bulk_out;
@@ -847,7 +850,6 @@ int usb_serial_probe(struct usb_interface *interface,
                port = kzalloc(sizeof(struct usb_serial_port), GFP_KERNEL);
                if (!port)
                        goto probe_error;
-               port->number = i + serial->minor;
                port->serial = serial;
                spin_lock_init(&port->lock);
                mutex_init(&port->mutex);
@@ -980,6 +982,7 @@ int usb_serial_probe(struct usb_interface *interface,
                dev_err(&interface->dev, "No more free serial devices\n");
                goto probe_error;
        }
+       serial->minor = minor;
 
        /* register all of the individual ports with the driver core */
        for (i = 0; i < num_ports; ++i) {
@@ -1034,9 +1037,6 @@ probe_error:
                kfree(port->interrupt_out_buffer);
        }
 
-       /* return the minor range that this device had */
-       return_serial (serial);
-
        /* free up any memory that we allocated */
        for (i = 0; i < serial->num_port_pointers; ++i)
                kfree(serial->port[i]);
index 9644a8e..2dd31e3 100644 (file)
@@ -146,6 +146,13 @@ UNUSUAL_DEV(  0x0420, 0x0001, 0x0100, 0x0100,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_IGNORE_RESIDUE ),
 
+/* Reported by Andrew Nayenko <relan@bk.ru> */
+UNUSUAL_DEV(  0x0421, 0x0019, 0x0592, 0x0592,
+               "Nokia",
+               "Nokia 6288",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_MAX_SECTORS_64 ),
+
 /* Reported by Mario Rettig <mariorettig@web.de> */
 UNUSUAL_DEV(  0x0421, 0x042e, 0x0100, 0x0100,
                "Nokia",
@@ -1395,16 +1402,6 @@ UNUSUAL_DEV(  0x1652, 0x6600, 0x0201, 0x0201,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_IGNORE_RESIDUE ),
 
-/* Reported by Thomas Baechler <thomas@archlinux.org>
- * Fixes I/O errors with Teac HD-35PU devices
- */
-
-UNUSUAL_DEV( 0x1652, 0x6600, 0x0201, 0x0201,
-               "Super Top",
-               "USB 2.0  IDE DEVICE",
-               US_SC_DEVICE, US_PR_DEVICE, NULL,
-               US_FL_IGNORE_RESIDUE),
-
 /* patch submitted by Davide Perini <perini.davide@dpsoftware.org>
  * and Renato Perini <rperini@email.it>
  */