Linux Input Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] Input: ili210x - fix return value of is_visible function
@ 2020-02-09 14:56 Luca Weiss
  2020-02-10 15:07 ` Sven Van Asbroeck
  0 siblings, 1 reply; 3+ messages in thread
From: Luca Weiss @ 2020-02-09 14:56 UTC (permalink / raw)
  To: linux-input
  Cc: ~postmarketos/upstreaming, Luca Weiss, Dmitry Torokhov,
	Sven Van Asbroeck, Marek Vasut, Thomas Gleixner, linux-kernel

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: ili210x - fix return value of is_visible function
  2020-02-09 14:56 [PATCH] Input: ili210x - fix return value of is_visible function Luca Weiss
@ 2020-02-10 15:07 ` Sven Van Asbroeck
  2020-02-15 23:48   ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Van Asbroeck @ 2020-02-10 15:07 UTC (permalink / raw)
  To: Luca Weiss
  Cc: linux-input, ~postmarketos/upstreaming, Dmitry Torokhov,
	Marek Vasut, Thomas Gleixner, Linux Kernel Mailing List

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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: ili210x - fix return value of is_visible function
  2020-02-10 15:07 ` Sven Van Asbroeck
@ 2020-02-15 23:48   ` Dmitry Torokhov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Torokhov @ 2020-02-15 23:48 UTC (permalink / raw)
  To: Sven Van Asbroeck
  Cc: Luca Weiss, linux-input, ~postmarketos/upstreaming, Marek Vasut,
	Thomas Gleixner, Linux Kernel Mailing List

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

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-09 14:56 [PATCH] Input: ili210x - fix return value of is_visible function Luca Weiss
2020-02-10 15:07 ` Sven Van Asbroeck
2020-02-15 23:48   ` Dmitry Torokhov

Linux Input Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-input/0 linux-input/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-input linux-input/ https://lore.kernel.org/linux-input \
		linux-input@vger.kernel.org
	public-inbox-index linux-input

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-input


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git