Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1a3e323907dc5991cba2d715d5db3ae2eac78280
Commit:     1a3e323907dc5991cba2d715d5db3ae2eac78280
Parent:     74a882e4857414a98ca5904b3be90fb6aba2f25e
Author:     [EMAIL PROTECTED] <[EMAIL PROTECTED]>
AuthorDate: Sat Apr 28 23:34:10 2007 +0900
Committer:  Len Brown <[EMAIL PROTECTED]>
CommitDate: Sat Apr 28 22:05:59 2007 -0400

    sonypi: try to detect if sony-laptop has already taken one of the known 
ioports
    
    Get the IO resources list in sony-laptop in the same order as listed
    in sonypi and make sonypi check if one of those is already busy.
    The sonypi check can be disabled by a module parameter in case the user
    thinks we are plainly wrong (check_ioport=0).
    
    Signed-off-by: Mattia Dongili <[EMAIL PROTECTED]>
    Signed-off-by: Len Brown <[EMAIL PROTECTED]>
---
 drivers/char/sonypi.c      |   27 +++++++++++++++++++++++++++
 drivers/misc/sony-laptop.c |    4 ++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c
index 72cdddb..b699890 100644
--- a/drivers/char/sonypi.c
+++ b/drivers/char/sonypi.c
@@ -97,6 +97,11 @@ module_param(useinput, int, 0444);
 MODULE_PARM_DESC(useinput,
                 "set this if you would like sonypi to feed events to the input 
subsystem");
 
+static int check_ioport = 1;
+module_param(check_ioport, int, 0444);
+MODULE_PARM_DESC(check_ioport,
+                "set this to 0 if you think the automatic ioport check for 
sony-laptop is wrong");
+
 #define SONYPI_DEVICE_MODEL_TYPE1      1
 #define SONYPI_DEVICE_MODEL_TYPE2      2
 #define SONYPI_DEVICE_MODEL_TYPE3      3
@@ -1262,6 +1267,28 @@ static int __devinit sonypi_create_input_devices(void)
 static int __devinit sonypi_setup_ioports(struct sonypi_device *dev,
                                const struct sonypi_ioport_list *ioport_list)
 {
+       /* try to detect if sony-laptop is being used and thus
+        * has already requested one of the known ioports.
+        * As in the deprecated check_region this is racy has we have
+        * multiple ioports available and one of them can be requested
+        * between this check and the subsequent request. Anyway, as an
+        * attempt to be some more user-friendly as we currently are,
+        * this is enough.
+        */
+       const struct sonypi_ioport_list *check = ioport_list;
+       while (check_ioport && check->port1) {
+               if (!request_region(check->port1,
+                                  sonypi_device.region_size,
+                                  "Sony Programable I/O Device Check")) {
+                       printk(KERN_ERR "sonypi: ioport 0x%.4x busy, using 
sony-laptop? "
+                                       "if not use check_ioport=0\n",
+                                       check->port1);
+                       return -EBUSY;
+               }
+               release_region(check->port1, sonypi_device.region_size);
+               check++;
+       }
+
        while (ioport_list->port1) {
 
                if (request_region(ioport_list->port1,
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 141284d..2787e1c 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -1801,7 +1801,7 @@ sony_pic_read_possible_resource(struct acpi_resource 
*resource, void *context)
                                if (!interrupt)
                                        return AE_ERROR;
 
-                               list_add(&interrupt->list, &dev->interrupts);
+                               list_add_tail(&interrupt->list, 
&dev->interrupts);
                                interrupt->irq.triggering = p->triggering;
                                interrupt->irq.polarity = p->polarity;
                                interrupt->irq.sharable = p->sharable;
@@ -1823,7 +1823,7 @@ sony_pic_read_possible_resource(struct acpi_resource 
*resource, void *context)
                        if (!ioport)
                                return AE_ERROR;
 
-                       list_add(&ioport->list, &dev->ioports);
+                       list_add_tail(&ioport->list, &dev->ioports);
                        memcpy(&ioport->io, io, sizeof(*io));
                        return AE_OK;
                }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to