diff mbox series

Input: ili210x - fix return value of is_visible function

Message ID 20200209145628.649409-1-luca@z3ntu.xyz (mailing list archive)
State Mainlined
Commit fbd1ec000213c8b457dd4fb15b6de9ba02ec5482
Headers show
Series Input: ili210x - fix return value of is_visible function | expand

Commit Message

Luca Weiss Feb. 9, 2020, 2:56 p.m. UTC
The is_visible function expects the permissions associated with an
attribute of the sysfs group or 0 if an attribute is not visible.

Change the code to return the attribute permissions when the attribute
should be visible which resolves the warning:

  Attribute calibrate: Invalid permissions 01

Fixes: cc12ba1872c6 ("Input: ili210x - optionally show calibrate sysfs attribute")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
---
 drivers/input/touchscreen/ili210x.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Sven Van Asbroeck Feb. 10, 2020, 3:07 p.m. UTC | #1
Luca,

Good catch. That's what happens when I post a patch I can't test :)

Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com>

On Sun, Feb 9, 2020 at 9:58 AM Luca Weiss <luca@z3ntu.xyz> wrote:
>
> The is_visible function expects the permissions associated with an
> attribute of the sysfs group or 0 if an attribute is not visible.
>
> Change the code to return the attribute permissions when the attribute
> should be visible which resolves the warning:
>
>   Attribute calibrate: Invalid permissions 01
>
> Fixes: cc12ba1872c6 ("Input: ili210x - optionally show calibrate sysfs attribute")
> Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> ---
>  drivers/input/touchscreen/ili210x.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> index 37526baff8a6..199cf3daec10 100644
> --- a/drivers/input/touchscreen/ili210x.c
> +++ b/drivers/input/touchscreen/ili210x.c
> @@ -351,7 +351,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj,
>         struct i2c_client *client = to_i2c_client(dev);
>         struct ili210x *priv = i2c_get_clientdata(client);
>
> -       return priv->chip->has_calibrate_reg;
> +       return priv->chip->has_calibrate_reg ? attr->mode : 0;
>  }
>
>  static const struct attribute_group ili210x_attr_group = {
> --
> 2.25.0
>
Dmitry Torokhov Feb. 15, 2020, 11:48 p.m. UTC | #2
On Mon, Feb 10, 2020 at 10:07:34AM -0500, Sven Van Asbroeck wrote:
> Luca,
> 
> Good catch. That's what happens when I post a patch I can't test :)
> 
> Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com>

Applied, thank you.

> 
> On Sun, Feb 9, 2020 at 9:58 AM Luca Weiss <luca@z3ntu.xyz> wrote:
> >
> > The is_visible function expects the permissions associated with an
> > attribute of the sysfs group or 0 if an attribute is not visible.
> >
> > Change the code to return the attribute permissions when the attribute
> > should be visible which resolves the warning:
> >
> >   Attribute calibrate: Invalid permissions 01
> >
> > Fixes: cc12ba1872c6 ("Input: ili210x - optionally show calibrate sysfs attribute")
> > Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
> > ---
> >  drivers/input/touchscreen/ili210x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> > index 37526baff8a6..199cf3daec10 100644
> > --- a/drivers/input/touchscreen/ili210x.c
> > +++ b/drivers/input/touchscreen/ili210x.c
> > @@ -351,7 +351,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj,
> >         struct i2c_client *client = to_i2c_client(dev);
> >         struct ili210x *priv = i2c_get_clientdata(client);
> >
> > -       return priv->chip->has_calibrate_reg;
> > +       return priv->chip->has_calibrate_reg ? attr->mode : 0;
> >  }
> >
> >  static const struct attribute_group ili210x_attr_group = {
> > --
> > 2.25.0
> >
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
index 37526baff8a6..199cf3daec10 100644
--- a/drivers/input/touchscreen/ili210x.c
+++ b/drivers/input/touchscreen/ili210x.c
@@ -351,7 +351,7 @@  static umode_t ili210x_calibrate_visible(struct kobject *kobj,
 	struct i2c_client *client = to_i2c_client(dev);
 	struct ili210x *priv = i2c_get_clientdata(client);
 
-	return priv->chip->has_calibrate_reg;
+	return priv->chip->has_calibrate_reg ? attr->mode : 0;
 }
 
 static const struct attribute_group ili210x_attr_group = {