Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
authorDmitry Torokhov <dtor@insightbb.com>
Sun, 5 Nov 2006 03:42:39 +0000 (22:42 -0500)
committerDmitry Torokhov <dtor@insightbb.com>
Sun, 5 Nov 2006 03:42:39 +0000 (22:42 -0500)
drivers/char/keyboard.c
drivers/input/gameport/gameport.c
drivers/input/gameport/lightning.c
drivers/input/input.c
drivers/input/mouse/lifebook.c
drivers/input/mouse/logips2pp.c
drivers/input/mouse/trackpoint.c
drivers/input/serio/i8042.c
drivers/input/serio/serio.c
drivers/input/touchscreen/ads7846.c

index 20b6c8b30248f354f4bfcf5b3d6fffbb4a07a112..7a6c1c0b7a95861f9e4a70c4d6dca302491e5987 100644 (file)
@@ -710,7 +710,7 @@ static void k_fn(struct vc_data *vc, unsigned char value, char up_flag)
 
 static void k_cur(struct vc_data *vc, unsigned char value, char up_flag)
 {
-       static const char *cur_chars = "BDCA";
+       static const char cur_chars[] = "BDCA";
 
        if (up_flag)
                return;
index a0af97efe6ac0e23fd440cc1608db170890a005d..bba5894fcecd515945b62e078a33af9dc6ebf93f 100644 (file)
@@ -730,12 +730,6 @@ static int gameport_driver_remove(struct device *dev)
        return 0;
 }
 
-static struct bus_type gameport_bus = {
-       .name   = "gameport",
-       .probe  = gameport_driver_probe,
-       .remove = gameport_driver_remove,
-};
-
 static void gameport_add_driver(struct gameport_driver *drv)
 {
        int error;
@@ -781,6 +775,15 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
        return !gameport_drv->ignore;
 }
 
+static struct bus_type gameport_bus = {
+       .name           = "gameport",
+       .dev_attrs      = gameport_device_attrs,
+       .drv_attrs      = gameport_driver_attrs,
+       .match          = gameport_bus_match,
+       .probe          = gameport_driver_probe,
+       .remove         = gameport_driver_remove,
+};
+
 static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *drv)
 {
        mutex_lock(&gameport->drv_mutex);
@@ -790,7 +793,6 @@ static void gameport_set_drv(struct gameport *gameport, struct gameport_driver *
 
 int gameport_open(struct gameport *gameport, struct gameport_driver *drv, int mode)
 {
-
        if (gameport->open) {
                if (gameport->open(gameport, mode)) {
                        return -1;
@@ -818,9 +820,6 @@ static int __init gameport_init(void)
 {
        int error;
 
-       gameport_bus.dev_attrs = gameport_device_attrs;
-       gameport_bus.drv_attrs = gameport_driver_attrs;
-       gameport_bus.match = gameport_bus_match;
        error = bus_register(&gameport_bus);
        if (error) {
                printk(KERN_ERR "gameport: failed to register gameport bus, error: %d\n", error);
index d65d81080257ef6355a913d49fe39f8b9075d8a6..6b4d4561d465bb133cb33d688c5fc4a4036f0de3 100644 (file)
@@ -309,7 +309,7 @@ static int __init l4_init(void)
        int i, cards = 0;
 
        if (!request_region(L4_PORT, 1, "lightning"))
-               return -1;
+               return -EBUSY;
 
        for (i = 0; i < 2; i++)
                if (l4_add_card(i) == 0)
@@ -319,7 +319,7 @@ static int __init l4_init(void)
 
        if (!cards) {
                release_region(L4_PORT, 1);
-               return -1;
+               return -ENODEV;
        }
 
        return 0;
index 1c8c8a5bc4a91c0076c9af4539ef3a768102afed..7cf2b4f603a36c278736b7e257e8318285ab2948 100644 (file)
@@ -37,7 +37,7 @@ static struct input_handler *input_table[8];
 
 /**
  * input_event() - report new input event
- * @handle: device that generated the event
+ * @dev: device that generated the event
  * @type: type of the event
  * @code: event code
  * @value: value of the event
@@ -900,6 +900,15 @@ struct class input_class = {
 };
 EXPORT_SYMBOL_GPL(input_class);
 
+/**
+ * input_allocate_device - allocate memory for new input device
+ *
+ * Returns prepared struct input_dev or NULL.
+ *
+ * NOTE: Use input_free_device() to free devices that have not been
+ * registered; input_unregister_device() should be used for already
+ * registered devices.
+ */
 struct input_dev *input_allocate_device(void)
 {
        struct input_dev *dev;
@@ -919,6 +928,20 @@ struct input_dev *input_allocate_device(void)
 }
 EXPORT_SYMBOL(input_allocate_device);
 
+/**
+ * input_free_device - free memory occupied by input_dev structure
+ * @dev: input device to free
+ *
+ * This function should only be used if input_register_device()
+ * was not called yet or if it failed. Once device was registered
+ * use input_unregister_device() and memory will be freed once last
+ * refrence to the device is dropped.
+ *
+ * Device should be allocated by input_allocate_device().
+ *
+ * NOTE: If there are references to the input device then memory
+ * will not be freed until last reference is dropped.
+ */
 void input_free_device(struct input_dev *dev)
 {
        if (dev) {
index c57e8853b94900a42d795ddaf4af86f38aa59f7e..29542f0631cbba2e01516c693185e5d9180be8e6 100644 (file)
 #include "lifebook.h"
 
 static struct dmi_system_id lifebook_dmi_table[] = {
-       {
-               .ident = "LifeBook B",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
-               },
-       },
-       {
-               .ident = "Lifebook B",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
-               },
-       },
-       {
-               .ident = "Lifebook B213x/B2150",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
-               },
-       },
-       {
-               .ident = "Zephyr",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
-               },
-       },
-       {
-               .ident = "CF-18",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
-               },
-       },
-       {
-               .ident = "Lifebook B142",
-               .matches = {
-                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"),
-               },
-
-       },
-       { }
+       {
+               .ident = "FLORA-ie 55mi",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "FLORA-ie 55mi"),
+               },
+       },
+       {
+               .ident = "LifeBook B",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B Series"),
+               },
+       },
+       {
+               .ident = "Lifebook B",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK B Series"),
+               },
+       },
+       {
+               .ident = "Lifebook B213x/B2150",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B2131/B2133/B2150"),
+               },
+       },
+       {
+               .ident = "Zephyr",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "ZEPHYR"),
+               },
+       },
+       {
+               .ident = "CF-18",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "CF-18"),
+               },
+       },
+       {
+               .ident = "Lifebook B142",
+               .matches = {
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LifeBook B142"),
+               },
+       },
+       { }
 };
 
-
 static psmouse_ret_t lifebook_process_byte(struct psmouse *psmouse)
 {
        unsigned char *packet = psmouse->packet;
index 8a4f862709e7490c33cdeba1a3d2adb3ac8737d5..d3ddea26b8ca65fec6f714032425d50e801bda3a 100644 (file)
@@ -328,6 +328,7 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
        unsigned char model, buttons;
        const struct ps2pp_info *model_info;
        int use_ps2pp = 0;
+       int error;
 
        param[0] = 0;
        ps2_command(ps2dev, param, PSMOUSE_CMD_SETRES);
@@ -393,8 +394,14 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties)
                                psmouse->set_resolution = ps2pp_set_resolution;
                                psmouse->disconnect = ps2pp_disconnect;
 
-                               device_create_file(&psmouse->ps2dev.serio->dev,
-                                                  &psmouse_attr_smartscroll.dattr);
+                               error = device_create_file(&psmouse->ps2dev.serio->dev,
+                                                          &psmouse_attr_smartscroll.dattr);
+                               if (error) {
+                                       printk(KERN_ERR
+                                               "logips2pp.c: failed to create smartscroll "
+                                               "sysfs attribute, error: %d\n", error);
+                                       return -1;
+                               }
                        }
                }
 
index ae5871a0e060fac36f5899436dc9bea9037b53d0..9ab5b5ea809d1a9c00820dd4937d6419be1e9733 100644 (file)
@@ -293,6 +293,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
        struct ps2dev *ps2dev = &psmouse->ps2dev;
        unsigned char firmware_id;
        unsigned char button_info;
+       int error;
 
        if (trackpoint_start_protocol(psmouse, &firmware_id))
                return -1;
@@ -305,7 +306,7 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
                button_info = 0;
        }
 
-       psmouse->private = priv = kcalloc(1, sizeof(struct trackpoint_data), GFP_KERNEL);
+       psmouse->private = priv = kzalloc(sizeof(struct trackpoint_data), GFP_KERNEL);
        if (!priv)
                return -1;
 
@@ -318,7 +319,14 @@ int trackpoint_detect(struct psmouse *psmouse, int set_properties)
        trackpoint_defaults(priv);
        trackpoint_sync(psmouse);
 
-       sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+       error = sysfs_create_group(&ps2dev->serio->dev.kobj, &trackpoint_attr_group);
+       if (error) {
+               printk(KERN_ERR
+                       "trackpoint.c: failed to create sysfs attributes, error: %d\n",
+                       error);
+               kfree(priv);
+               return -1;
+       }
 
        printk(KERN_INFO "IBM TrackPoint firmware: 0x%02x, buttons: %d/%d\n",
                firmware_id, (button_info & 0xf0) >> 4, button_info & 0x0f);
index 7e3141f37e32a7907fa2d00b15266652b2b6bb9e..d365f227ac562930389bae2e7ab590565916a11d 100644 (file)
@@ -255,25 +255,10 @@ static int i8042_kbd_write(struct serio *port, unsigned char c)
 static int i8042_aux_write(struct serio *serio, unsigned char c)
 {
        struct i8042_port *port = serio->port_data;
-       int retval;
-
-/*
- * Send the byte out.
- */
-
-       if (port->mux == -1)
-               retval = i8042_command(&c, I8042_CMD_AUX_SEND);
-       else
-               retval = i8042_command(&c, I8042_CMD_MUX_SEND + port->mux);
 
-/*
- * Make sure the interrupt happens and the character is received even
- * in the case the IRQ isn't wired, so that we can receive further
- * characters later.
- */
-
-       i8042_interrupt(0, NULL);
-       return retval;
+       return i8042_command(&c, port->mux == -1 ?
+                                       I8042_CMD_AUX_SEND :
+                                       I8042_CMD_MUX_SEND + port->mux);
 }
 
 /*
index 211943f85cb66e1dee2b77aac5c3e30ce3d6c07a..3cb99d454ecd89b7bb4006b7b20c304935f7ef8a 100644 (file)
@@ -784,12 +784,6 @@ static int serio_driver_remove(struct device *dev)
        return 0;
 }
 
-static struct bus_type serio_bus = {
-       .name = "serio",
-       .probe = serio_driver_probe,
-       .remove = serio_driver_remove,
-};
-
 static void serio_add_driver(struct serio_driver *drv)
 {
        int error;
@@ -946,15 +940,21 @@ irqreturn_t serio_interrupt(struct serio *serio,
        return ret;
 }
 
+static struct bus_type serio_bus = {
+       .name           = "serio",
+       .dev_attrs      = serio_device_attrs,
+       .drv_attrs      = serio_driver_attrs,
+       .match          = serio_bus_match,
+       .uevent         = serio_uevent,
+       .probe          = serio_driver_probe,
+       .remove         = serio_driver_remove,
+       .resume         = serio_resume,
+};
+
 static int __init serio_init(void)
 {
        int error;
 
-       serio_bus.dev_attrs = serio_device_attrs;
-       serio_bus.drv_attrs = serio_driver_attrs;
-       serio_bus.match = serio_bus_match;
-       serio_bus.uevent = serio_uevent;
-       serio_bus.resume = serio_resume;
        error = bus_register(&serio_bus);
        if (error) {
                printk(KERN_ERR "serio: failed to register serio bus, error: %d\n", error);
index f56d6a0f0624ad06c602e52e52e39833959d0e17..8f56af8cd7a093643ab8c594656f2edbf7561ee4 100644 (file)
@@ -76,6 +76,7 @@ struct ads7846 {
        char                    phys[32];
 
        struct spi_device       *spi;
+       struct attribute_group  *attr_group;
        u16                     model;
        u16                     vref_delay_usecs;
        u16                     x_plate_ohms;
@@ -317,6 +318,48 @@ static ssize_t ads7846_disable_store(struct device *dev,
 
 static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
 
+static struct attribute *ads7846_attributes[] = {
+       &dev_attr_temp0.attr,
+       &dev_attr_temp1.attr,
+       &dev_attr_vbatt.attr,
+       &dev_attr_vaux.attr,
+       &dev_attr_pen_down.attr,
+       &dev_attr_disable.attr,
+       NULL,
+};
+
+static struct attribute_group ads7846_attr_group = {
+       .attrs = ads7846_attributes,
+};
+
+/*
+ * ads7843/7845 don't have temperature sensors, and
+ * use the other sensors a bit differently too
+ */
+
+static struct attribute *ads7843_attributes[] = {
+       &dev_attr_vbatt.attr,
+       &dev_attr_vaux.attr,
+       &dev_attr_pen_down.attr,
+       &dev_attr_disable.attr,
+       NULL,
+};
+
+static struct attribute_group ads7843_attr_group = {
+       .attrs = ads7843_attributes,
+};
+
+static struct attribute *ads7845_attributes[] = {
+       &dev_attr_vaux.attr,
+       &dev_attr_pen_down.attr,
+       &dev_attr_disable.attr,
+       NULL,
+};
+
+static struct attribute_group ads7845_attr_group = {
+       .attrs = ads7845_attributes,
+};
+
 /*--------------------------------------------------------------------------*/
 
 /*
@@ -788,38 +831,30 @@ static int __devinit ads7846_probe(struct spi_device *spi)
        (void) ads7846_read12_ser(&spi->dev,
                          READ_12BIT_SER(vaux) | ADS_PD10_ALL_ON);
 
-       /* ads7843/7845 don't have temperature sensors, and
-        * use the other sensors a bit differently too
-        */
-       if (ts->model == 7846) {
-               device_create_file(&spi->dev, &dev_attr_temp0);
-               device_create_file(&spi->dev, &dev_attr_temp1);
+       switch (ts->model) {
+       case 7846:
+               ts->attr_group = &ads7846_attr_group;
+               break;
+       case 7845:
+               ts->attr_group = &ads7845_attr_group;
+               break;
+       default:
+               ts->attr_group = &ads7843_attr_group;
+               break;
        }
-       if (ts->model != 7845)
-               device_create_file(&spi->dev, &dev_attr_vbatt);
-       device_create_file(&spi->dev, &dev_attr_vaux);
-
-       device_create_file(&spi->dev, &dev_attr_pen_down);
-
-       device_create_file(&spi->dev, &dev_attr_disable);
+       err = sysfs_create_group(&spi->dev.kobj, ts->attr_group);
+       if (err)
+               goto err_free_irq;
 
        err = input_register_device(input_dev);
        if (err)
-               goto err_remove_attr;
+               goto err_remove_attr_group;
 
        return 0;
 
- err_remove_attr:
-       device_remove_file(&spi->dev, &dev_attr_disable);
-       device_remove_file(&spi->dev, &dev_attr_pen_down);
-       if (ts->model == 7846) {
-               device_remove_file(&spi->dev, &dev_attr_temp1);
-               device_remove_file(&spi->dev, &dev_attr_temp0);
-       }
-       if (ts->model != 7845)
-               device_remove_file(&spi->dev, &dev_attr_vbatt);
-       device_remove_file(&spi->dev, &dev_attr_vaux);
-
+ err_remove_attr_group:
+       sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
+ err_free_irq:
        free_irq(spi->irq, ts);
  err_free_mem:
        input_free_device(input_dev);
@@ -835,15 +870,7 @@ static int __devexit ads7846_remove(struct spi_device *spi)
 
        ads7846_suspend(spi, PMSG_SUSPEND);
 
-       device_remove_file(&spi->dev, &dev_attr_disable);
-       device_remove_file(&spi->dev, &dev_attr_pen_down);
-       if (ts->model == 7846) {
-               device_remove_file(&spi->dev, &dev_attr_temp1);
-               device_remove_file(&spi->dev, &dev_attr_temp0);
-       }
-       if (ts->model != 7845)
-               device_remove_file(&spi->dev, &dev_attr_vbatt);
-       device_remove_file(&spi->dev, &dev_attr_vaux);
+       sysfs_remove_group(&spi->dev.kobj, ts->attr_group);
 
        free_irq(ts->spi->irq, ts);
        /* suspend left the IRQ disabled */