linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: p.zabel@pengutronix.de (Philipp Zabel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 1/9] nvmem: Add a simple NVMEM framework for nvmem providers
Date: Mon, 13 Jul 2015 18:50:29 +0200	[thread overview]
Message-ID: <1436806229.11945.5.camel@pengutronix.de> (raw)
In-Reply-To: <1436521486-10682-1-git-send-email-srinivas.kandagatla@linaro.org>

Hi Srinivas,

Am Freitag, den 10.07.2015, 10:44 +0100 schrieb Srinivas Kandagatla:
> This patch adds just providers part of the framework just to enable easy
> review.
[...]
> +/**
> + * nvmem_register() - Register a nvmem device for given nvmem_config.
> + * Also creates an binary entry in /sys/bus/nvmem/devices/dev-name/nvmem
> + *
> + * @config: nvmem device configuration with which nvmem device is created.
> + *
> + * The return value will be an ERR_PTR() on error or a valid pointer
> + * to nvmem_device.
> + */
> +
> +struct nvmem_device *nvmem_register(struct nvmem_config *config)
> +{
[...]
> +	nvmem->read_only = nvmem->dev.of_node ?
> +				of_property_read_bool(nvmem->dev.of_node,
> +				"read-only") :
> +				config->read_only;

I think read_only should be set if any of the device node property or
nvmem_config->read_only request it. That way, even if the nvmem is
theoretically writeable (no read-only property in DT), the driver still
can make it read-only if writing isn't implemented:

+	nvmem->read_only = nvmem->dev.of_node ?
+				of_property_read_bool(nvmem->dev.of_node,
+				"read-only") : 0;
+	nvmem->read_only |= config->read_only;

[...]
> new file mode 100644
> index 0000000..f589d3b
> --- /dev/null
> +++ b/include/linux/nvmem-provider.h
[...]
> +struct nvmem_config {
> +	struct device		*dev;
> +	const char		*name;
> +	int			id;
> +	struct module		*owner;
> +	struct nvmem_cell_info	*cells;

Should that be const?

> +	int			ncells;
> +	bool			read_only;
> +};
> +
> +#if IS_ENABLED(CONFIG_NVMEM)
> +
> +struct nvmem_device *nvmem_register(struct nvmem_config *cfg);

Then that could be made const, too.

best regards
Philipp

  parent reply	other threads:[~2015-07-13 16:50 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10  9:43 [PATCH v7 0/9] Add simple NVMEM Framework via regmap Srinivas Kandagatla
2015-07-10  9:44 ` [PATCH v7 1/9] nvmem: Add a simple NVMEM framework for nvmem providers Srinivas Kandagatla
2015-07-10 10:29   ` Joe Perches
2015-07-10 10:39     ` Srinivas Kandagatla
2015-07-13 16:50   ` Philipp Zabel [this message]
2015-07-10  9:44 ` [PATCH v7 2/9] nvmem: Add a simple NVMEM framework for consumers Srinivas Kandagatla
2015-07-10 10:42   ` Joe Perches
2015-07-13 19:06   ` Stefan Wahren
2015-07-13 19:24     ` Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 3/9] nvmem: Add nvmem_device based consumer apis Srinivas Kandagatla
2015-07-10 10:49   ` Joe Perches
2015-07-14 22:06   ` Stephen Boyd
2015-07-15  8:21     ` Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 4/9] nvmem: Add bindings for simple nvmem framework Srinivas Kandagatla
2015-07-10 19:04   ` Rob Herring
2015-07-13 10:21     ` Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 5/9] Documentation: nvmem: add nvmem api level and how-to doc Srinivas Kandagatla
2015-07-14 21:32   ` Stephen Boyd
2015-07-14 22:00     ` Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 6/9] nvmem: qfprom: Add Qualcomm QFPROM support Srinivas Kandagatla
2015-07-14 21:18   ` Stephen Boyd
2015-07-14 22:02     ` Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 7/9] nvmem: qfprom: Add bindings for qfprom Srinivas Kandagatla
2015-07-10  9:45 ` [PATCH v7 8/9] nvmem: sunxi: Move the SID driver to the nvmem framework Srinivas Kandagatla
2015-07-10  9:46 ` [PATCH v7 9/9] nvmem: Add to MAINTAINERS for " Srinivas Kandagatla
2015-07-13 18:54 ` [PATCH v7 0/9] Add simple NVMEM Framework via regmap Stefan Wahren
2015-07-13 19:35   ` Srinivas Kandagatla
2015-07-13 20:11     ` Stefan Wahren
2015-07-13 21:39       ` Srinivas Kandagatla

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=1436806229.11945.5.camel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.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).