lkml.org 
[lkml]   [2020]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH v1 0/3] nvmem: Add support for write-only instances, and clean-up
Date
On Tue, Feb 25, 2020 at 02:59:46PM +0000, Srinivas Kandagatla wrote:
>
>
> On 24/02/2020 17:41, Nicholas Johnson wrote:
> > [Based on Linux v5.6-rc3, does not apply successfully to Linux v5.6-rc2]
> >
> > Hello all,
> >
> > I offer the first patch in this series to support write-only instances
> > of nvmem. The use-case is the Thunderbolt driver, for which Mika
> > Westerberg needs write-only nvmem. Refer to 03cd45d2e219 ("thunderbolt:
> > Prevent crash if non-active NVMem file is read").
> >
>
> Had a look at the crash trace from the mentioned patch.
>
> Why can not we add a check for reg_read in bin_attr_nvmem_read() before
> dereferencing it?
That can be easily done in PATCH v2. What error code should be returned?

>
> The reason I ask this is because removing read_only is not that simple as
> you think.
> Firstly because a there is no way to derive this flag by just looking at
> read/write callbacks.
> Providers are much more generic drivers ex: at24 which can have read/write
> interfaces implemented, however read only flag is enforced at board/platform
> level config either via device tree property bindings or a write protection
> gpio.
> Removing this is also going to break the device tree bindings.
>
> only alternative I can see ATM is the mentioned check.
>
> --srini
Noted. However, the .read_only flag is only removed in the third patch,
which can be discarded if you feel that is the best plan of action.

The write-only will not have a flag added, which should not be a
problem, as nothing relies on there being one yet.

Regards,
Nicholas

\
 
 \ /
  Last update: 2020-02-25 16:24    [W:0.129 / U:5.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site