Input: ili210x - fix return value of is_visible function

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: cc12ba1872 ("Input: ili210x - optionally show calibrate sysfs attribute")
Signed-off-by: Luca Weiss <luca@z3ntu.xyz>
Reviewed-by: Sven Van Asbroeck <TheSven73@gmail.com>
Link: https://lore.kernel.org/r/20200209145628.649409-1-luca@z3ntu.xyz
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
This commit is contained in:
Luca Weiss 2020-02-09 14:42:36 -08:00 committed by Dmitry Torokhov
parent b19efcabb5
commit fbd1ec0002

View File

@ -321,7 +321,7 @@ static umode_t ili210x_calibrate_visible(struct kobject *kobj,
struct i2c_client *client = to_i2c_client(dev); struct i2c_client *client = to_i2c_client(dev);
struct ili210x *priv = i2c_get_clientdata(client); 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 = { static const struct attribute_group ili210x_attr_group = {