return;
        }
  
-       /*
-        * The parent irqchip is already using the chip_data for this
-        * irqchip, so our callbacks simply use the handler_data.
-        */
-       irq_set_handler_data(parent_irq, gpiochip);
-       irq_set_chained_handler(parent_irq, parent_handler);
+       if (parent_handler) {
+               if (gpiochip->can_sleep) {
+                       chip_err(gpiochip,
+                                "you cannot have chained interrupts on a "
+                                "chip that may sleep\n");
+                       return;
+               }
 -              irq_set_chained_handler(parent_irq, parent_handler);
+               /*
+                * The parent irqchip is already using the chip_data for this
+                * irqchip, so our callbacks simply use the handler_data.
+                */
+               irq_set_handler_data(parent_irq, gpiochip);
++              irq_set_chained_handler(parent_irq, parent_handler);
+       }
+ 
+       /* Set the parent IRQ for all affected IRQs */
+       for (offset = 0; offset < gpiochip->ngpio; offset++)
+               irq_set_parent(irq_find_mapping(gpiochip->irqdomain, offset),
+                              parent_irq);
  }
  EXPORT_SYMBOL_GPL(gpiochip_set_chained_irqchip);
  
 
  int msm_pinctrl_remove(struct platform_device *pdev)
  {
        struct msm_pinctrl *pctrl = platform_get_drvdata(pdev);
-       int ret;
- 
-       ret = gpiochip_remove(&pctrl->chip);
-       if (ret) {
-               dev_err(&pdev->dev, "Failed to remove gpiochip\n");
-               return ret;
-       }
  
+       gpiochip_remove(&pctrl->chip);
        pinctrl_unregister(pctrl->pctrl);
 +
 +      unregister_restart_handler(&pctrl->restart_nb);
 +
        return 0;
  }
  EXPORT_SYMBOL(msm_pinctrl_remove);
 
                irq_flow_handler_t handler,
                unsigned int type);
  
 -#endif /* CONFIG_GPIO_IRQCHIP */
 +#endif /* CONFIG_GPIOLIB_IRQCHIP */
  
- int gpiochip_request_own_desc(struct gpio_desc *desc, const char *label);
+ struct gpio_desc *gpiochip_request_own_desc(struct gpio_chip *chip, u16 hwnum,
+                                           const char *label);
  void gpiochip_free_own_desc(struct gpio_desc *desc);
  
  #else /* CONFIG_GPIOLIB */