Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752174AbbGMQuq (ORCPT ); Mon, 13 Jul 2015 12:50:46 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:48048 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991AbbGMQup (ORCPT ); Mon, 13 Jul 2015 12:50:45 -0400 Message-ID: <1436806229.11945.5.camel@pengutronix.de> Subject: Re: [PATCH v7 1/9] nvmem: Add a simple NVMEM framework for nvmem providers From: Philipp Zabel To: Srinivas Kandagatla Cc: linux-arm-kernel@lists.infradead.org, Greg Kroah-Hartman , stefan.wahren@i2se.com, devicetree@vger.kernel.org, arnd@arndb.de, linux-api@vger.kernel.org, s.hauer@pengutronix.de, sboyd@codeaurora.org, linux-kernel@vger.kernel.org, Rob Herring , pantelis.antoniou@konsulko.com, Mark Brown , Kumar Gala , mporter@konsulko.com, Maxime Ripard , linux-arm-msm@vger.kernel.org, wxt@rock-chips.com Date: Mon, 13 Jul 2015 18:50:29 +0200 In-Reply-To: <1436521486-10682-1-git-send-email-srinivas.kandagatla@linaro.org> References: <1436521427-10568-1-git-send-email-srinivas.kandagatla@linaro.org> <1436521486-10682-1-git-send-email-srinivas.kandagatla@linaro.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.12.9-1+b1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 2001:67c:670:100:96de:80ff:fec2:9969 X-SA-Exim-Mail-From: p.zabel@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1908 Lines: 67 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/