Merge branch 'for-linus' to bring in change ensuring that drivers that
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 7 Jul 2012 23:07:48 +0000 (16:07 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Sat, 7 Jul 2012 23:07:48 +0000 (16:07 -0700)
use threaded IRQs use IRQF_ONESHOT.

1  2 
drivers/input/joystick/as5011.c
drivers/input/tablet/wacom_sys.c
drivers/input/touchscreen/ad7879.c

index 57d19d4e0a2d94a22f68d13c6f0ee44a9ab8807b,feeefcb09e78b1e6e0eb4792abdc77c740882741..c96653b58867deb406a13913774a7e35c074dec7
@@@ -231,7 -231,6 +231,7 @@@ static int __devinit as5011_probe(struc
        }
  
        if (!i2c_check_functionality(client->adapter,
 +                                   I2C_FUNC_NOSTART |
                                     I2C_FUNC_PROTOCOL_MANGLING)) {
                dev_err(&client->dev,
                        "need i2c bus that supports protocol mangling\n");
  
        error = request_threaded_irq(as5011->button_irq,
                                     NULL, as5011_button_interrupt,
-                                    IRQF_TRIGGER_RISING | IRQF_TRIGGER_FALLING,
+                                    IRQF_TRIGGER_RISING |
+                                       IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                                     "as5011_button", as5011);
        if (error < 0) {
                dev_err(&client->dev,
  
        error = request_threaded_irq(as5011->axis_irq, NULL,
                                     as5011_axis_interrupt,
-                                    plat_data->axis_irqflags,
+                                    plat_data->axis_irqflags | IRQF_ONESHOT,
                                     "as5011_joystick", as5011);
        if (error) {
                dev_err(&client->dev,
index 9a854e2d15dcbdecd985bb6e43c40550f2dd9604,b145841bdbe7daddbc8eb3745e94839434e978d4..0d3219f297448cbbc10d3a20319ed0ea287ddcb5
@@@ -100,7 -100,6 +100,7 @@@ static int wacom_set_report(struct usb_
  static void wacom_sys_irq(struct urb *urb)
  {
        struct wacom *wacom = urb->context;
 +      struct device *dev = &wacom->intf->dev;
        int retval;
  
        switch (urb->status) {
        case -ENOENT:
        case -ESHUTDOWN:
                /* this urb is terminated, clean up */
 -              dbg("%s - urb shutting down with status: %d", __func__, urb->status);
 +              dev_dbg(dev, "%s - urb shutting down with status: %d\n",
 +                      __func__, urb->status);
                return;
        default:
 -              dbg("%s - nonzero urb status received: %d", __func__, urb->status);
 +              dev_dbg(dev, "%s - nonzero urb status received: %d\n",
 +                      __func__, urb->status);
                goto exit;
        }
  
        usb_mark_last_busy(wacom->usbdev);
        retval = usb_submit_urb(urb, GFP_ATOMIC);
        if (retval)
 -              err ("%s - usb_submit_urb failed with result %d",
 -                   __func__, retval);
 +              dev_err(dev, "%s - usb_submit_urb failed with result %d\n",
 +                      __func__, retval);
  }
  
  static int wacom_open(struct input_dev *dev)
@@@ -216,7 -213,7 +216,7 @@@ static void wacom_retrieve_report_data(
  
                rep_data[0] = 12;
                result = wacom_get_report(intf, WAC_HID_FEATURE_REPORT,
-                                         rep_data[0], &rep_data, 2,
+                                         rep_data[0], rep_data, 2,
                                          WAC_MSG_RETRIES);
  
                if (result >= 0 && rep_data[1] > 2)
@@@ -401,7 -398,9 +401,9 @@@ static int wacom_parse_hid(struct usb_i
                                break;
  
                        case HID_USAGE_CONTACTMAX:
-                               wacom_retrieve_report_data(intf, features);
+                               /* leave touch_max as is if predefined */
+                               if (!features->touch_max)
+                                       wacom_retrieve_report_data(intf, features);
                                i++;
                                break;
                        }
@@@ -443,7 -442,8 +445,7 @@@ static int wacom_query_tablet_data(stru
        /* ask to report Wacom data */
        if (features->device_type == BTN_TOOL_FINGER) {
                /* if it is an MT Tablet PC touch */
 -              if (features->type == TABLETPC2FG ||
 -                  features->type == MTSCREEN) {
 +              if (features->type > TABLETPC) {
                        do {
                                rep_data[0] = 3;
                                rep_data[1] = 4;
                        } while ((error < 0 || rep_data[1] != 4) &&
                                 limit++ < WAC_MSG_RETRIES);
                }
 -      } else if (features->type != TABLETPC &&
 +      } else if (features->type <= BAMBOO_PT &&
                   features->type != WIRELESS &&
                   features->device_type == BTN_TOOL_PEN) {
                do {
@@@ -506,13 -506,16 +508,13 @@@ static int wacom_retrieve_hid_descripto
                if (intf->cur_altsetting->desc.bInterfaceNumber == 0) {
                        features->device_type = 0;
                } else if (intf->cur_altsetting->desc.bInterfaceNumber == 2) {
 -                      features->device_type = BTN_TOOL_DOUBLETAP;
 +                      features->device_type = BTN_TOOL_FINGER;
                        features->pktlen = WACOM_PKGLEN_BBTOUCH3;
                }
        }
  
        /* only devices that support touch need to retrieve the info */
 -      if (features->type != TABLETPC &&
 -          features->type != TABLETPC2FG &&
 -          features->type != BAMBOO_PT &&
 -          features->type != MTSCREEN) {
 +      if (features->type < BAMBOO_PT) {
                goto out;
        }
  
@@@ -854,7 -857,6 +856,7 @@@ static int wacom_initialize_leds(struc
  
        /* Initialize default values */
        switch (wacom->wacom_wac.features.type) {
 +      case INTUOS4S:
        case INTUOS4:
        case INTUOS4L:
                wacom->led.select[0] = 0;
  static void wacom_destroy_leds(struct wacom *wacom)
  {
        switch (wacom->wacom_wac.features.type) {
 +      case INTUOS4S:
        case INTUOS4:
        case INTUOS4L:
                sysfs_remove_group(&wacom->intf->dev.kobj,
@@@ -968,10 -969,6 +970,10 @@@ static int wacom_initialize_battery(str
  
                error = power_supply_register(&wacom->usbdev->dev,
                                              &wacom->battery);
 +
 +              if (!error)
 +                      power_supply_powers(&wacom->battery,
 +                                          &wacom->usbdev->dev);
        }
  
        return error;
  
  static void wacom_destroy_battery(struct wacom *wacom)
  {
 -      if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR)
 +      if (wacom->wacom_wac.features.quirks & WACOM_QUIRK_MONITOR &&
 +          wacom->battery.dev) {
                power_supply_unregister(&wacom->battery);
 +              wacom->battery.dev = NULL;
 +      }
  }
  
  static int wacom_register_input(struct wacom *wacom)
@@@ -1030,30 -1024,23 +1032,30 @@@ static void wacom_wireless_work(struct 
        struct wacom *wacom = container_of(work, struct wacom, work);
        struct usb_device *usbdev = wacom->usbdev;
        struct wacom_wac *wacom_wac = &wacom->wacom_wac;
 +      struct wacom *wacom1, *wacom2;
 +      struct wacom_wac *wacom_wac1, *wacom_wac2;
 +      int error;
  
        /*
         * Regardless if this is a disconnect or a new tablet,
 -       * remove any existing input devices.
 +       * remove any existing input and battery devices.
         */
  
 +      wacom_destroy_battery(wacom);
 +
        /* Stylus interface */
 -      wacom = usb_get_intfdata(usbdev->config->interface[1]);
 -      if (wacom->wacom_wac.input)
 -              input_unregister_device(wacom->wacom_wac.input);
 -      wacom->wacom_wac.input = NULL;
 +      wacom1 = usb_get_intfdata(usbdev->config->interface[1]);
 +      wacom_wac1 = &(wacom1->wacom_wac);
 +      if (wacom_wac1->input)
 +              input_unregister_device(wacom_wac1->input);
 +      wacom_wac1->input = NULL;
  
        /* Touch interface */
 -      wacom = usb_get_intfdata(usbdev->config->interface[2]);
 -      if (wacom->wacom_wac.input)
 -              input_unregister_device(wacom->wacom_wac.input);
 -      wacom->wacom_wac.input = NULL;
 +      wacom2 = usb_get_intfdata(usbdev->config->interface[2]);
 +      wacom_wac2 = &(wacom2->wacom_wac);
 +      if (wacom_wac2->input)
 +              input_unregister_device(wacom_wac2->input);
 +      wacom_wac2->input = NULL;
  
        if (wacom_wac->pid == 0) {
                dev_info(&wacom->intf->dev, "wireless tablet disconnected\n");
                }
  
                /* Stylus interface */
 -              wacom = usb_get_intfdata(usbdev->config->interface[1]);
 -              wacom_wac = &wacom->wacom_wac;
 -              wacom_wac->features =
 +              wacom_wac1->features =
                        *((struct wacom_features *)id->driver_info);
 -              wacom_wac->features.device_type = BTN_TOOL_PEN;
 -              wacom_register_input(wacom);
 +              wacom_wac1->features.device_type = BTN_TOOL_PEN;
 +              error = wacom_register_input(wacom1);
 +              if (error)
 +                      goto fail1;
  
                /* Touch interface */
 -              wacom = usb_get_intfdata(usbdev->config->interface[2]);
 -              wacom_wac = &wacom->wacom_wac;
 -              wacom_wac->features =
 +              wacom_wac2->features =
                        *((struct wacom_features *)id->driver_info);
 -              wacom_wac->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
 -              wacom_wac->features.device_type = BTN_TOOL_FINGER;
 -              wacom_set_phy_from_res(&wacom_wac->features);
 -              wacom_wac->features.x_max = wacom_wac->features.y_max = 4096;
 -              wacom_register_input(wacom);
 +              wacom_wac2->features.pktlen = WACOM_PKGLEN_BBTOUCH3;
 +              wacom_wac2->features.device_type = BTN_TOOL_FINGER;
 +              wacom_set_phy_from_res(&wacom_wac2->features);
 +              wacom_wac2->features.x_max = wacom_wac2->features.y_max = 4096;
 +              error = wacom_register_input(wacom2);
 +              if (error)
 +                      goto fail2;
 +
 +              error = wacom_initialize_battery(wacom);
 +              if (error)
 +                      goto fail3;
        }
 +
 +      return;
 +
 +fail3:
 +      input_unregister_device(wacom_wac2->input);
 +      wacom_wac2->input = NULL;
 +fail2:
 +      input_unregister_device(wacom_wac1->input);
 +      wacom_wac1->input = NULL;
 +fail1:
 +      return;
  }
  
  static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *id)
                        features->device_type = BTN_TOOL_FINGER;
                        features->pktlen = WACOM_PKGLEN_BBTOUCH3;
  
 -                      features->x_phy =
 -                              (features->x_max * 100) / features->x_resolution;
 -                      features->y_phy =
 -                              (features->y_max * 100) / features->y_resolution;
 +                      wacom_set_phy_from_res(features);
  
                        features->x_max = 4096;
                        features->y_max = 4096;
        if (error)
                goto fail4;
  
 -      error = wacom_initialize_battery(wacom);
 -      if (error)
 -              goto fail5;
 -
        if (!(features->quirks & WACOM_QUIRK_NO_INPUT)) {
                error = wacom_register_input(wacom);
                if (error)
 -                      goto fail6;
 +                      goto fail5;
        }
  
        /* Note that if query fails it is not a hard failure */
  
        return 0;
  
 - fail6: wacom_destroy_battery(wacom);
   fail5: wacom_destroy_leds(wacom);
   fail4:       wacom_remove_shared_data(wacom_wac);
   fail3:       usb_free_urb(wacom->irq);
index e60709261951a423592ab1b0b0484ec12448eda8,bd4eb42776973b211aee79e40f51b47e2f5e8d27..facd3057b62dcb4aa634c41a674197ad1c5871e2
@@@ -118,7 -118,6 +118,7 @@@ struct ad7879 
        unsigned int            irq;
        bool                    disabled;       /* P: input->mutex */
        bool                    suspended;      /* P: input->mutex */
 +      bool                    swap_xy;
        u16                     conversion_data[AD7879_NR_SENSE];
        char                    phys[32];
        u8                      first_conversion_delay;
@@@ -162,9 -161,6 +162,9 @@@ static int ad7879_report(struct ad7879 
        z1 = ts->conversion_data[AD7879_SEQ_Z1] & MAX_12BIT;
        z2 = ts->conversion_data[AD7879_SEQ_Z2] & MAX_12BIT;
  
 +      if (ts->swap_xy)
 +              swap(x, y);
 +
        /*
         * The samples processed here are already preprocessed by the AD7879.
         * The preprocessing function consists of a median and an averaging
@@@ -524,7 -520,6 +524,7 @@@ struct ad7879 *ad7879_probe(struct devi
        ts->dev = dev;
        ts->input = input_dev;
        ts->irq = irq;
 +      ts->swap_xy = pdata->swap_xy;
  
        setup_timer(&ts->timer, ad7879_timer, (unsigned long) ts);
  
                        AD7879_TMR(ts->pen_down_acc_interval);
  
        err = request_threaded_irq(ts->irq, NULL, ad7879_irq,
-                                  IRQF_TRIGGER_FALLING,
+                                  IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
                                   dev_name(dev), ts);
        if (err) {
                dev_err(dev, "irq %d busy?\n", ts->irq);