Skip to content

Commit e75dfba

Browse files
committed
Merge tag 'gpio-fixes-for-v5.7-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes
gpio fixes for v5.7-rc6 - fix probing for chips without PWM in gpio-mvebu - fix ida_simple_get() error path in gpio-exar - fix user-space notifications for line state changes
2 parents b9bbe6e + 9fefca7 commit e75dfba

File tree

3 files changed

+27
-10
lines changed

3 files changed

+27
-10
lines changed

drivers/gpio/gpio-exar.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ static int gpio_exar_probe(struct platform_device *pdev)
148148
mutex_init(&exar_gpio->lock);
149149

150150
index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL);
151-
if (index < 0)
152-
goto err_destroy;
151+
if (index < 0) {
152+
ret = index;
153+
goto err_mutex_destroy;
154+
}
153155

154156
sprintf(exar_gpio->name, "exar_gpio%d", index);
155157
exar_gpio->gpio_chip.label = exar_gpio->name;
@@ -176,6 +178,7 @@ static int gpio_exar_probe(struct platform_device *pdev)
176178

177179
err_destroy:
178180
ida_simple_remove(&ida_index, index);
181+
err_mutex_destroy:
179182
mutex_destroy(&exar_gpio->lock);
180183
return ret;
181184
}

drivers/gpio/gpio-mvebu.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -782,6 +782,15 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
782782
"marvell,armada-370-gpio"))
783783
return 0;
784784

785+
/*
786+
* There are only two sets of PWM configuration registers for
787+
* all the GPIO lines on those SoCs which this driver reserves
788+
* for the first two GPIO chips. So if the resource is missing
789+
* we can't treat it as an error.
790+
*/
791+
if (!platform_get_resource_byname(pdev, IORESOURCE_MEM, "pwm"))
792+
return 0;
793+
785794
if (IS_ERR(mvchip->clk))
786795
return PTR_ERR(mvchip->clk);
787796

@@ -804,12 +813,6 @@ static int mvebu_pwm_probe(struct platform_device *pdev,
804813
mvchip->mvpwm = mvpwm;
805814
mvpwm->mvchip = mvchip;
806815

807-
/*
808-
* There are only two sets of PWM configuration registers for
809-
* all the GPIO lines on those SoCs which this driver reserves
810-
* for the first two GPIO chips. So if the resource is missing
811-
* we can't treat it as an error.
812-
*/
813816
mvpwm->membase = devm_platform_ioremap_resource_byname(pdev, "pwm");
814817
if (IS_ERR(mvpwm->membase))
815818
return PTR_ERR(mvpwm->membase);

drivers/gpio/gpiolib.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,10 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
729729
if (ret)
730730
goto out_free_descs;
731731
}
732+
733+
atomic_notifier_call_chain(&desc->gdev->notifier,
734+
GPIOLINE_CHANGED_REQUESTED, desc);
735+
732736
dev_dbg(&gdev->dev, "registered chardev handle for line %d\n",
733737
offset);
734738
}
@@ -1083,6 +1087,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
10831087
if (ret)
10841088
goto out_free_desc;
10851089

1090+
atomic_notifier_call_chain(&desc->gdev->notifier,
1091+
GPIOLINE_CHANGED_REQUESTED, desc);
1092+
10861093
le->irq = gpiod_to_irq(desc);
10871094
if (le->irq <= 0) {
10881095
ret = -ENODEV;
@@ -2998,8 +3005,6 @@ static int gpiod_request_commit(struct gpio_desc *desc, const char *label)
29983005
}
29993006
done:
30003007
spin_unlock_irqrestore(&gpio_lock, flags);
3001-
atomic_notifier_call_chain(&desc->gdev->notifier,
3002-
GPIOLINE_CHANGED_REQUESTED, desc);
30033008
return ret;
30043009
}
30053010

@@ -4961,6 +4966,9 @@ struct gpio_desc *__must_check gpiod_get_index(struct device *dev,
49614966
return ERR_PTR(ret);
49624967
}
49634968

4969+
atomic_notifier_call_chain(&desc->gdev->notifier,
4970+
GPIOLINE_CHANGED_REQUESTED, desc);
4971+
49644972
return desc;
49654973
}
49664974
EXPORT_SYMBOL_GPL(gpiod_get_index);
@@ -5026,6 +5034,9 @@ struct gpio_desc *fwnode_get_named_gpiod(struct fwnode_handle *fwnode,
50265034
return ERR_PTR(ret);
50275035
}
50285036

5037+
atomic_notifier_call_chain(&desc->gdev->notifier,
5038+
GPIOLINE_CHANGED_REQUESTED, desc);
5039+
50295040
return desc;
50305041
}
50315042
EXPORT_SYMBOL_GPL(fwnode_get_named_gpiod);

0 commit comments

Comments
 (0)