Merge branch 'next' into for-linus
[linux-2.6-microblaze.git] / drivers / gpio / gpio-thunderx.c
index d16e9d4..715371b 100644 (file)
@@ -363,22 +363,16 @@ static int thunderx_gpio_irq_request_resources(struct irq_data *data)
 {
        struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
        struct thunderx_gpio *txgpio = txline->txgpio;
-       struct irq_data *parent_data = data->parent_data;
        int r;
 
        r = gpiochip_lock_as_irq(&txgpio->chip, txline->line);
        if (r)
                return r;
 
-       if (parent_data && parent_data->chip->irq_request_resources) {
-               r = parent_data->chip->irq_request_resources(parent_data);
-               if (r)
-                       goto error;
-       }
+       r = irq_chip_request_resources_parent(data);
+       if (r)
+               gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
 
-       return 0;
-error:
-       gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
        return r;
 }
 
@@ -386,10 +380,8 @@ static void thunderx_gpio_irq_release_resources(struct irq_data *data)
 {
        struct thunderx_line *txline = irq_data_get_irq_chip_data(data);
        struct thunderx_gpio *txgpio = txline->txgpio;
-       struct irq_data *parent_data = data->parent_data;
 
-       if (parent_data && parent_data->chip->irq_release_resources)
-               parent_data->chip->irq_release_resources(parent_data);
+       irq_chip_release_resources_parent(data);
 
        gpiochip_unlock_as_irq(&txgpio->chip, txline->line);
 }
@@ -504,16 +496,17 @@ static int thunderx_gpio_probe(struct pci_dev *pdev,
                txgpio->base_msi = (c >> 8) & 0xff;
        }
 
-       txgpio->msix_entries = devm_kzalloc(dev,
-                                         sizeof(struct msix_entry) * ngpio,
+       txgpio->msix_entries = devm_kcalloc(dev,
+                                         ngpio, sizeof(struct msix_entry),
                                          GFP_KERNEL);
        if (!txgpio->msix_entries) {
                err = -ENOMEM;
                goto out;
        }
 
-       txgpio->line_entries = devm_kzalloc(dev,
-                                           sizeof(struct thunderx_line) * ngpio,
+       txgpio->line_entries = devm_kcalloc(dev,
+                                           ngpio,
+                                           sizeof(struct thunderx_line),
                                            GFP_KERNEL);
        if (!txgpio->line_entries) {
                err = -ENOMEM;