public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <michael@walle.cc>
To: "Marco Felsch" <m.felsch@pengutronix.de>,
	<srinivas.kandagatla@linaro.org>, <gregkh@linuxfoundation.org>,
	<miquel.raynal@bootlin.com>, <rafal@milecki.pl>
Cc: <linux-kernel@vger.kernel.org>, <kernel@pengutronix.de>
Subject: Re: [RFC PATCH] nvmem: core: add sysfs cell write support
Date: Fri, 16 Feb 2024 09:47:27 +0100	[thread overview]
Message-ID: <CZ6DFL6061FS.2WMDPMSSBXX8S@walle.cc> (raw)
In-Reply-To: <20240215211401.1201004-1-m.felsch@pengutronix.de>

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

Hi,

On Thu Feb 15, 2024 at 10:14 PM CET, Marco Felsch wrote:
> @@ -432,6 +466,7 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
>  	struct bin_attribute **cells_attrs, *attrs;
>  	struct nvmem_cell_entry *entry;
>  	unsigned int ncells = 0, i = 0;
> +	umode_t mode;
>  	int ret = 0;
>  
>  	mutex_lock(&nvmem_mutex);
> @@ -456,15 +491,18 @@ static int nvmem_populate_sysfs_cells(struct nvmem_device *nvmem)
>  		goto unlock_mutex;
>  	}
>  
> +	mode = nvmem_bin_attr_get_umode(nvmem);
> +
>  	/* Initialize each attribute to take the name and size of the cell */
>  	list_for_each_entry(entry, &nvmem->cells, node) {
>  		sysfs_bin_attr_init(&attrs[i]);
>  		attrs[i].attr.name = devm_kasprintf(&nvmem->dev, GFP_KERNEL,
>  						    "%s@%x", entry->name,
>  						    entry->offset);
> -		attrs[i].attr.mode = 0444;

cells are not writable if there is a read post process hook, see
__nvmem_cell_entry_write().

if (entry->read_post_processing)
	mode &= ~0222;

-michael

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 252 bytes --]

  reply	other threads:[~2024-02-16  8:53 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 21:14 [RFC PATCH] nvmem: core: add sysfs cell write support Marco Felsch
2024-02-16  8:47 ` Michael Walle [this message]
2024-02-16 10:07   ` Marco Felsch
2024-02-19 11:04     ` Miquel Raynal
2024-02-19 11:53       ` Marco Felsch
2024-02-19 13:26         ` Michael Walle
2024-02-20  9:18           ` Miquel Raynal
2024-02-20  9:50             ` Marco Felsch
2024-02-20 10:07               ` Miquel Raynal
2024-02-20 10:16               ` Michael Walle

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=CZ6DFL6061FS.2WMDPMSSBXX8S@walle.cc \
    --to=michael@walle.cc \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=miquel.raynal@bootlin.com \
    --cc=rafal@milecki.pl \
    --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