From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Charles Wang <charles.goodix@gmail.com>
Cc: hadess@hadess.net, hdegoede@redhat.com,
neil.armstrong@linaro.org, hughsient@gmail.com,
broonie@kernel.org, jeff@labundy.com,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Input: goodix-berlin - Add sysfs interface for reading and writing touch IC registers
Date: Fri, 19 Jul 2024 14:59:02 -0700 [thread overview]
Message-ID: <ZprhpkN0gBTrwyOt@google.com> (raw)
In-Reply-To: <ZlkRZ7VKNVZSFi0X@google.com>
On Thu, May 30, 2024 at 04:53:11PM -0700, Dmitry Torokhov wrote:
> 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()?
OK, since I have not heard anything I made the changes and applied the
patch.
Thanks.
--
Dmitry
prev parent reply other threads:[~2024-07-19 21:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 11:44 [PATCH v3] Input: goodix-berlin - Add sysfs interface for reading and writing touch IC registers Charles Wang
2024-05-30 23:53 ` Dmitry Torokhov
2024-07-19 21:59 ` Dmitry Torokhov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZprhpkN0gBTrwyOt@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=broonie@kernel.org \
--cc=charles.goodix@gmail.com \
--cc=hadess@hadess.net \
--cc=hdegoede@redhat.com \
--cc=hughsient@gmail.com \
--cc=jeff@labundy.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neil.armstrong@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).