Done.diff --git a/drivers/gpio/Kconfig b/drivers/gpio/KconfigThis doesn't actually rely on ARCH_MSM anymore so I think we can
index 87d5670..f3c1978 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -165,7 +165,7 @@ config GPIO_MSM_V1
config GPIO_MSM_V2
tristate "Qualcomm MSM GPIO v2"
- depends on GPIOLIB && ARCH_MSM
+ depends on GPIOLIB && ARCH_MSM && OF
drop that dependency.
Thanks for catching this. Will fix this.
helpLooks like intstat is used uninitialized now?
Say yes here to support the GPIO interface on ARM v7 based
Qualcomm MSM chips. Most of the pins on the MSM can be
@@ -222,7 +229,6 @@ static void msm_gpio_update_dual_edge_pos(unsigned gpio)
else
set_gpio_bits(BIT(INTR_POL_CTL), GPIO_INTR_CFG(gpio));
val2 = readl(GPIO_IN_OUT(gpio)) & BIT(GPIO_IN);
- intstat = readl(GPIO_INTR_STATUS(gpio)) & BIT(INTR_STATUS);
if (intstat || val == val2)
Done.
+Fail probe if the property isn't there?
+static int msm_gpio_probe(struct platform_device *pdev)
+{
+ int i, irq, ret, ngpio;
+ struct resource *res;
+
+ msm_gpio.gpio_chip.label = pdev->name;
+ msm_gpio.gpio_chip.dev = &pdev->dev;
+ of_property_read_u32(pdev->dev.of_node, "ngpio", &ngpio);
Done.
+ msm_gpio.gpio_chip.ngpio = ngpio;devm_ioremap_resource() returns an ERR_PTR on failure, not NULL.
+
+ res = platform_get_resource(&pdev->dev, IORESOURCE_MEM, 0);
+ if (!res) {
+ dev_err(&pdev->dev, "%s: no mem resource\n", __func__);
+ return -EINVAL;
+ }
+
+ msm_tlmm_base = devm_ioremap_resource(pdev->dev, res);
+ if (!msm_tlmm_base) {
+ dev_err(&pdev->dev, "Couldn't allocate memory for msm tlmm base\n");
+ return -ENOMEM;
+ }
Also, it already prints messages on errors so you can drop all the
prints around this. Just do
res = platform_get_resource(&pdev->dev, IORESOURCE_MEM, 0);
msm_tlmm_base = devm_ioremap_resource(pdev->dev, res);
if (IS_ERR(msm_tlmm_base))
return ERR_PTR(msm_tlmm_base);
Done. Thanks for the comments.static int __init msm_gpio_init(void)You could use module_platform_driver here now too.
{
- int rc;
-
- rc = platform_driver_register(&msm_gpio_driver);
- if (!rc) {
- rc = platform_device_register(&msm_device_gpio);
- if (rc)
- platform_driver_unregister(&msm_gpio_driver);
- }
-
- return rc;
+ return platform_driver_register(&msm_gpio_driver);
}
static void __exit msm_gpio_exit(void)
{
- platform_device_unregister(&msm_device_gpio);
platform_driver_unregister(&msm_gpio_driver);
}