[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZlkRZ7VKNVZSFi0X@google.com>
Date: Thu, 30 May 2024 16:53:11 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Charles Wang <charles.goodix@...il.com>
Cc: hadess@...ess.net, hdegoede@...hat.com, neil.armstrong@...aro.org,
hughsient@...il.com, broonie@...nel.org, jeff@...undy.com,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] Input: goodix-berlin - Add sysfs interface for
reading and writing touch IC registers
Hi Charles,
On Tue, May 14, 2024 at 07:44:43PM +0800, Charles Wang wrote:
> +static ssize_t registers_read(struct file *filp, struct kobject *kobj,
> + struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
> +{
> + struct regmap *regmap;
> + int error;
> +
> + regmap = dev_get_regmap(kobj_to_dev(kobj), NULL);
We already have goodix_berlin_core->regmap, going through drvdata should
be cheaper than scanning devres resources for the regmap data, so I'll
change this.
> + error = regmap_raw_read(regmap, (unsigned int)off,
> + buf, count);
> +
> + return error ? error : count;
> +}
> +
> +static ssize_t registers_write(struct file *filp, struct kobject *kobj,
> + struct bin_attribute *bin_attr, char *buf, loff_t off, size_t count)
> +{
> + struct regmap *regmap;
> + int error;
> +
> + regmap = dev_get_regmap(kobj_to_dev(kobj), NULL);
> + error = regmap_raw_write(regmap, (unsigned int)off,
> + buf, count);
> +
> + return error ? error : count;
> +}
> +
> +BIN_ATTR_RW(registers, 0);
I do not think it is a good idea to allow the world read all registers.
Any objection to make it BIN_ATTR_ADMIN_RW()?
Thanks.
--
Dmitry
Powered by blists - more mailing lists