public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	linux-i2c@vger.kernel.org
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH v3 4/4] nvmem: core: Implement force_ro sysfs attribute
Date: Fri, 28 Jun 2024 01:39:07 +0200	[thread overview]
Message-ID: <21a0fec1-c133-4acc-a447-0632a232e45f@denx.de> (raw)
In-Reply-To: <92f0bec8-283b-4619-9b0b-d5a678fa200c@linaro.org>

On 6/27/24 6:21 PM, Srinivas Kandagatla wrote:
> 
> 
> On 27/06/2024 16:55, Marek Vasut wrote:
>> On 6/27/24 4:58 PM, Srinivas Kandagatla wrote:
>>>
>>>
>>> On 26/06/2024 17:07, Marek Vasut wrote:
>>>> On 6/26/24 3:07 PM, Srinivas Kandagatla wrote:
>>>>>
>>>>>
>>>>> On 26/06/2024 05:11, Marek Vasut wrote:
>>>>>>   static const struct attribute_group *nvmem_dev_groups[] = {
>>>>>> @@ -945,6 +988,7 @@ struct nvmem_device *nvmem_register(const 
>>>>>> struct nvmem_config *config)
>>>>>>       nvmem->read_only = device_property_present(config->dev, 
>>>>>> "read-only") ||
>>>>>>                  config->read_only || !nvmem->reg_write;
>>>>>> +    nvmem->default_read_only = nvmem->read_only;
>>>>>>   #ifdef CONFIG_NVMEM_SYSFS
>>>>>>       nvmem->dev.groups = nvmem_dev_groups;
>>>>>> diff --git a/drivers/nvmem/internals.h b/drivers/nvmem/internals.h
>>>>>> index 18fed57270e5e..0667937ebb86b 100644
>>>>>> --- a/drivers/nvmem/internals.h
>>>>>> +++ b/drivers/nvmem/internals.h
>>>>>> @@ -16,6 +16,7 @@ struct nvmem_device {
>>>>>>       int            id;
>>>>>>       struct kref        refcnt;
>>>>>>       size_t            size;
>>>>>> +    bool            default_read_only;
>>>>>
>>>>>
>>>>> Its not very clear what is the need for this?
>>>>
>>>> This field is used to discern devices which are by default read-write 
>>> provider drivers or any drivers should not be accessing this struct 
>>> directly.
>>>
>>>> from ones which are by default read-only. Only the former can be 
>>> Why should the drivers care about this?
>>> If the read_only flag is set in the core, nvmem core should prohibit 
>>> any writes for this provider.
>>
>> I think this is a nvmem core patch , isn't it ?
> All that I see in this patch is setting default_read_only and no user 
> for it. unless am looking at wrong patch.

Oh, now I understand, doh ... this is a remnant which should be removed. 
The force_ro attribute is now hidden for read-only devices outright in 
nvmem_attr_is_visible, so they cannot be switched to read-write mode.

Fixed in V4, thanks.

      reply	other threads:[~2024-06-28  1:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-26  4:11 [PATCH v3 1/4] nvmem: Replace spaces with tab in documentation Marek Vasut
2024-06-26  4:11 ` [PATCH v3 2/4] nvmem: Document type attribute Marek Vasut
2024-06-26  4:11 ` [PATCH v3 3/4] nvmem: Use sysfs_emit() for " Marek Vasut
2024-06-26  4:11 ` [PATCH v3 4/4] nvmem: core: Implement force_ro sysfs attribute Marek Vasut
2024-06-26 13:07   ` Srinivas Kandagatla
2024-06-26 16:07     ` Marek Vasut
2024-06-27 14:58       ` Srinivas Kandagatla
2024-06-27 15:55         ` Marek Vasut
2024-06-27 16:21           ` Srinivas Kandagatla
2024-06-27 23:39             ` Marek Vasut [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=21a0fec1-c133-4acc-a447-0632a232e45f@denx.de \
    --to=marex@denx.de \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=brgl@bgdev.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=srinivas.kandagatla@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