]> Pileus Git - ~andy/linux/commitdiff
pinctrl: do not init debugfs entries for unimplemented functionalities
authorFlorian Vaussard <florian.vaussard@epfl.ch>
Wed, 5 Feb 2014 06:51:22 +0000 (07:51 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Thu, 6 Feb 2014 12:48:17 +0000 (13:48 +0100)
Commit c420619 "pinctrl: pinconf: remove checks on ops->pin_config_get"
removed the check on (ops != NULL) when performing pinconf_pins_show() or
pinconf_groups_show(). As these entries are always enabled, even if
pinconf is not supported, reading will result in an oops due to NULL
ops.

Instead of checking for ops, remove the corresponding debugfs entries if
pinconf and/or pinmux are not implemented.

Tested on OMAP3 (pinctrl-single).

Cc: stable@vger.kernel.org
Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/pinctrl/core.c

index cab020a58bf5131380e4a83a035e5cf947e006a9..c0fe6091566a4766cffbe515ed796fe7e2a3bee5 100644 (file)
@@ -1644,8 +1644,10 @@ static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
                            device_root, pctldev, &pinctrl_groups_ops);
        debugfs_create_file("gpio-ranges", S_IFREG | S_IRUGO,
                            device_root, pctldev, &pinctrl_gpioranges_ops);
-       pinmux_init_device_debugfs(device_root, pctldev);
-       pinconf_init_device_debugfs(device_root, pctldev);
+       if (pctldev->desc->pmxops)
+               pinmux_init_device_debugfs(device_root, pctldev);
+       if (pctldev->desc->confops)
+               pinconf_init_device_debugfs(device_root, pctldev);
 }
 
 static void pinctrl_remove_device_debugfs(struct pinctrl_dev *pctldev)