diff mbox

[3.11,032/121] pinctrl: do not init debugfs entries for unimplemented functionalities

Message ID 1392986945-9693-33-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Feb. 21, 2014, 12:47 p.m. UTC
3.11.10.5 -stable review patch.  If anyone has any objections, please let me know.

------------------

From: Florian Vaussard <florian.vaussard@epfl.ch>

commit e7f2a444891cb39f11d5429467d0fd7e011fe7fe upstream.

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).

Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/pinctrl/core.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Florian Vaussard Feb. 21, 2014, 12:59 p.m. UTC | #1
Hi,

On 02/21/2014 01:47 PM, Luis Henriques wrote:
> 3.11.10.5 -stable review patch.  If anyone has any objections, please let me know.
> 

This was nack'ed by Greg KH a few days ago. Please see [1].

Regards,
Florian

[1] http://www.spinics.net/lists/stable/msg35959.html

> ------------------
> 
> From: Florian Vaussard <florian.vaussard@epfl.ch>
> 
> commit e7f2a444891cb39f11d5429467d0fd7e011fe7fe upstream.
> 
> 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).
> 
> Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> ---
>  drivers/pinctrl/core.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> index dbcf284..dec5787 100644
> --- a/drivers/pinctrl/core.c
> +++ b/drivers/pinctrl/core.c
> @@ -1621,8 +1621,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)
>
Luis Henriques Feb. 24, 2014, 10:01 a.m. UTC | #2
On Fri, Feb 21, 2014 at 01:59:50PM +0100, Florian Vaussard wrote:
> Hi,
> 
> On 02/21/2014 01:47 PM, Luis Henriques wrote:
> > 3.11.10.5 -stable review patch.  If anyone has any objections, please let me know.
> > 
> 
> This was nack'ed by Greg KH a few days ago. Please see [1].
> 

Ok, thank you for bringing this to my attention.  I'll drop this patch
from 3.5 and 3.11 kernels queues.

Cheers,
--
Luís

> Regards,
> Florian
> 
> [1] http://www.spinics.net/lists/stable/msg35959.html
> 
> > ------------------
> > 
> > From: Florian Vaussard <florian.vaussard@epfl.ch>
> > 
> > commit e7f2a444891cb39f11d5429467d0fd7e011fe7fe upstream.
> > 
> > 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).
> > 
> > Signed-off-by: Florian Vaussard <florian.vaussard@epfl.ch>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
> > ---
> >  drivers/pinctrl/core.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
> > index dbcf284..dec5787 100644
> > --- a/drivers/pinctrl/core.c
> > +++ b/drivers/pinctrl/core.c
> > @@ -1621,8 +1621,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)
> >
diff mbox

Patch

diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index dbcf284..dec5787 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1621,8 +1621,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)