sony-laptop: call sonypi_compat_init earlier
authorMattia Dongili <malattia@linux.it>
Sun, 12 Aug 2007 07:20:27 +0000 (16:20 +0900)
committerLen Brown <len.brown@intel.com>
Fri, 24 Aug 2007 04:57:20 +0000 (00:57 -0400)
sonypi_compat uses a kfifo that needs to be present before _SRS is
called to be able to cope with the IRQs triggered when setting
resources.

Signed-off-by: Mattia Dongili <malattia@linux.it>
Signed-off-by: Len Brown <len.brown@intel.com>
drivers/misc/sony-laptop.c

index 7707cc25f3a23f66aeb6ec2ec8bea14f44e360c1..7d8bebec2961d7c899006e8f7aba1a8390a5ed8e 100644 (file)
@@ -2317,8 +2317,6 @@ static int sony_pic_remove(struct acpi_device *device, int type)
        struct sony_pic_ioport *io, *tmp_io;
        struct sony_pic_irq *irq, *tmp_irq;
 
-       sonypi_compat_exit();
-
        if (sony_pic_disable(device)) {
                printk(KERN_ERR DRV_PFX "Couldn't disable device.\n");
                return -ENXIO;
@@ -2328,6 +2326,8 @@ static int sony_pic_remove(struct acpi_device *device, int type)
        release_region(spic_dev.cur_ioport->io.minimum,
                        spic_dev.cur_ioport->io.address_length);
 
+       sonypi_compat_exit();
+
        sony_laptop_remove_input();
 
        /* pf attrs */
@@ -2393,6 +2393,9 @@ static int sony_pic_add(struct acpi_device *device)
                goto err_free_resources;
        }
 
+       if (sonypi_compat_init())
+               goto err_remove_input;
+
        /* request io port */
        list_for_each_entry(io, &spic_dev.ioports, list) {
                if (request_region(io->io.minimum, io->io.address_length,
@@ -2407,7 +2410,7 @@ static int sony_pic_add(struct acpi_device *device)
        if (!spic_dev.cur_ioport) {
                printk(KERN_ERR DRV_PFX "Failed to request_region.\n");
                result = -ENODEV;
-               goto err_remove_input;
+               goto err_remove_compat;
        }
 
        /* request IRQ */
@@ -2447,9 +2450,6 @@ static int sony_pic_add(struct acpi_device *device)
        if (result)
                goto err_remove_pf;
 
-       if (sonypi_compat_init())
-               goto err_remove_pf;
-
        return 0;
 
 err_remove_pf:
@@ -2465,6 +2465,9 @@ err_release_region:
        release_region(spic_dev.cur_ioport->io.minimum,
                        spic_dev.cur_ioport->io.address_length);
 
+err_remove_compat:
+       sonypi_compat_exit();
+
 err_remove_input:
        sony_laptop_remove_input();