Skip to content

Commit 5f40adb

Browse files
committed
Merge tag 'gpio-v4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: "Here are some late but important fixes for the v4.6 kernel series. ACPI and RCAR, so two driver fixes (PM related) and a self-evident string lookup fix for ACPI GPIOs: - A serious ACPI fix targeted for stable: lookup strings were being free'd. - Revert two patches from the RCAR driver" * tag 'gpio-v4.6-4' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpiolib-acpi: Duplicate con_id string when adding it to the crs lookup list Revert "gpio: rcar: Fine-grained Runtime PM support" Revert "gpio: rcar: Add Runtime PM handling for interrupts"
2 parents 9c5d1bc + 7df89e9 commit 5f40adb

File tree

2 files changed

+7
-60
lines changed

2 files changed

+7
-60
lines changed

drivers/gpio/gpio-rcar.c

Lines changed: 6 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -196,44 +196,6 @@ static int gpio_rcar_irq_set_wake(struct irq_data *d, unsigned int on)
196196
return 0;
197197
}
198198

199-
static void gpio_rcar_irq_bus_lock(struct irq_data *d)
200-
{
201-
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
202-
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
203-
204-
pm_runtime_get_sync(&p->pdev->dev);
205-
}
206-
207-
static void gpio_rcar_irq_bus_sync_unlock(struct irq_data *d)
208-
{
209-
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
210-
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
211-
212-
pm_runtime_put(&p->pdev->dev);
213-
}
214-
215-
216-
static int gpio_rcar_irq_request_resources(struct irq_data *d)
217-
{
218-
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
219-
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
220-
int error;
221-
222-
error = pm_runtime_get_sync(&p->pdev->dev);
223-
if (error < 0)
224-
return error;
225-
226-
return 0;
227-
}
228-
229-
static void gpio_rcar_irq_release_resources(struct irq_data *d)
230-
{
231-
struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
232-
struct gpio_rcar_priv *p = gpiochip_get_data(gc);
233-
234-
pm_runtime_put(&p->pdev->dev);
235-
}
236-
237199
static irqreturn_t gpio_rcar_irq_handler(int irq, void *dev_id)
238200
{
239201
struct gpio_rcar_priv *p = dev_id;
@@ -280,32 +242,18 @@ static void gpio_rcar_config_general_input_output_mode(struct gpio_chip *chip,
280242

281243
static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset)
282244
{
283-
struct gpio_rcar_priv *p = gpiochip_get_data(chip);
284-
int error;
285-
286-
error = pm_runtime_get_sync(&p->pdev->dev);
287-
if (error < 0)
288-
return error;
289-
290-
error = pinctrl_request_gpio(chip->base + offset);
291-
if (error)
292-
pm_runtime_put(&p->pdev->dev);
293-
294-
return error;
245+
return pinctrl_request_gpio(chip->base + offset);
295246
}
296247

297248
static void gpio_rcar_free(struct gpio_chip *chip, unsigned offset)
298249
{
299-
struct gpio_rcar_priv *p = gpiochip_get_data(chip);
300-
301250
pinctrl_free_gpio(chip->base + offset);
302251

303-
/* Set the GPIO as an input to ensure that the next GPIO request won't
252+
/*
253+
* Set the GPIO as an input to ensure that the next GPIO request won't
304254
* drive the GPIO pin as an output.
305255
*/
306256
gpio_rcar_config_general_input_output_mode(chip, offset, false);
307-
308-
pm_runtime_put(&p->pdev->dev);
309257
}
310258

311259
static int gpio_rcar_direction_input(struct gpio_chip *chip, unsigned offset)
@@ -452,6 +400,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
452400
}
453401

454402
pm_runtime_enable(dev);
403+
pm_runtime_get_sync(dev);
455404

456405
io = platform_get_resource(pdev, IORESOURCE_MEM, 0);
457406
irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
@@ -488,10 +437,6 @@ static int gpio_rcar_probe(struct platform_device *pdev)
488437
irq_chip->irq_unmask = gpio_rcar_irq_enable;
489438
irq_chip->irq_set_type = gpio_rcar_irq_set_type;
490439
irq_chip->irq_set_wake = gpio_rcar_irq_set_wake;
491-
irq_chip->irq_bus_lock = gpio_rcar_irq_bus_lock;
492-
irq_chip->irq_bus_sync_unlock = gpio_rcar_irq_bus_sync_unlock;
493-
irq_chip->irq_request_resources = gpio_rcar_irq_request_resources;
494-
irq_chip->irq_release_resources = gpio_rcar_irq_release_resources;
495440
irq_chip->flags = IRQCHIP_SET_TYPE_MASKED | IRQCHIP_MASK_ON_SUSPEND;
496441

497442
ret = gpiochip_add_data(gpio_chip, p);
@@ -522,6 +467,7 @@ static int gpio_rcar_probe(struct platform_device *pdev)
522467
err1:
523468
gpiochip_remove(gpio_chip);
524469
err0:
470+
pm_runtime_put(dev);
525471
pm_runtime_disable(dev);
526472
return ret;
527473
}
@@ -532,6 +478,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
532478

533479
gpiochip_remove(&p->gpio_chip);
534480

481+
pm_runtime_put(&pdev->dev);
535482
pm_runtime_disable(&pdev->dev);
536483
return 0;
537484
}

drivers/gpio/gpiolib-acpi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -977,7 +977,7 @@ bool acpi_can_fallback_to_crs(struct acpi_device *adev, const char *con_id)
977977
lookup = kmalloc(sizeof(*lookup), GFP_KERNEL);
978978
if (lookup) {
979979
lookup->adev = adev;
980-
lookup->con_id = con_id;
980+
lookup->con_id = kstrdup(con_id, GFP_KERNEL);
981981
list_add_tail(&lookup->node, &acpi_crs_lookup_list);
982982
}
983983
}

0 commit comments

Comments
 (0)