From: Jean Delvare <jdelvare@suse.de>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: LKML <linux-kernel@vger.kernel.org>,
Linux I2C <linux-i2c@vger.kernel.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: VAIO EEPROM support in at24
Date: Thu, 6 Aug 2020 14:14:36 +0200 [thread overview]
Message-ID: <20200806141436.4dcdfe08@endymion> (raw)
In-Reply-To: <CAMRc=MeoWUaL_qvwL6bkpaVUvxh4x3ZN6V4UNQr+bjnLo3NubQ@mail.gmail.com>
On Wed, 5 Aug 2020 20:14:28 +0200, Bartosz Golaszewski wrote:
> On Wed, Aug 5, 2020 at 4:36 PM Jean Delvare <jdelvare@suse.de> wrote:
> > I finally found the time to give it a try. Here's what my (tested)
> > prototype looks like:
>
> Hi Jean,
>
> this looks good at first glance.
>
> > --- a/drivers/misc/eeprom/at24.c
> > +++ b/drivers/misc/eeprom/at24.c
> > (...)
> > @@ -427,6 +450,15 @@ static int at24_read(void *priv, unsigne
> >
> > pm_runtime_put(dev);
> >
> > + if ((at24->flags & AT24_FLAG_MASKED_RANGE) && !capable(CAP_SYS_ADMIN)) {
>
> Maybe use unlikely() here? It's not necessarily a hotpath but at least
> it would be obvious it's a corner case.
Sure.
> > (...)
> > 1* Do we actually need to use a struct resource? With the current
> > requirements, that looks overkill to me. We really only need the
> > start and end offsets of the masked area (or start and length). Or
> > do you plan to ever support multiple masked ranges, and
> > resource.child would be used to daisy-chain these ranges? Personally
> > I would wait until the need exists.
>
> Yes, since this change doesn't seem to commit to any stable ABI, I'd
> say we can drop the reference to struct resource and possibly add it
> in the future. This just was the first thing that came to mind when I
> suggested it.
OK, I changed it to simple integers for now.
> > Note that if we would just store mstart and mlen in struct
> > at24_chip_data then we could even get rid of AT24_FLAG_MASKED_RANGE,
> > as mlen > 0 would imply a masked range.
>
> Makes sense.
Done.
> > 2* I chose the name "eeprom-vaio" because "vaio" would be too generic.
> > I'm open to suggestions if you don't like that name.
>
> Are you sure there won't be any different models of vaio eeproms? How
> about '24c02-vaio' or 'eeprom-vaio-24c02'?
All I've seen were 24C02 but last time was a decade ago. I have no idea
if recent Vaio laptops still have this EEPROM, at this address, of that
size. 'eeprom-vaio-24c02' is too long to my taste, and kind of
redundant as '24c02' implies 'eeprom'. I like '24c02-vaio' very much
though, it is both concise and accurate, and is future-proof too. I'll
go for that, thanks for the suggestion.
> > 3* at24_read() was pretty elegant before my changes, but with the need
> > to remember the original value of many parameters, it no longer is.
> > I'm considering rewriting it in a way that does not modify the
> > parameters needed to process the masked range, either as part of
> > this patch or as a subsequent clean-up patch. That would hopefully
> > make the code elegant again.
>
> All clean-ups are welcome.
OK, I'll give it a try and see if I can tidy it up.
> > 4* I made the masking active only for non-root users as this is what
> > the legacy eeprom driver was doing. I hope that's OK with you.
> >
>
> Yes, it's fine with me. If more fine-grained control is needed we can
> probably extend it.
OK :-)
I have a patch almost ready, I'll submit v2 later today.
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2020-08-06 17:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-17 14:14 VAIO EEPROM support in at24 Jean Delvare
2020-03-17 14:32 ` Bartosz Golaszewski
2020-03-17 15:01 ` Wolfram Sang
2020-08-03 14:53 ` Jean Delvare
2020-08-05 14:36 ` Jean Delvare
2020-08-05 18:14 ` Bartosz Golaszewski
2020-08-06 12:14 ` Jean Delvare [this message]
2020-08-07 9:31 ` Jean Delvare
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=20200806141436.4dcdfe08@endymion \
--to=jdelvare@suse.de \
--cc=arnd@arndb.de \
--cc=bgolaszewski@baylibre.com \
--cc=brgl@bgdev.pl \
--cc=gregkh@linuxfoundation.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.