Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1260262

Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Boris Brezillon <boris.brezillon@free-electrons.com>
Newsgroups linux.kernel
Subject Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers
Date Mon, 02 Nov 2015 00:30:03 +0100
Message-ID <qqaev-6c1-35@gated-at.bofh.it> (permalink)
References <qpvbj-69C-5@gated-at.bofh.it> <qpvbj-69C-19@gated-at.bofh.it>
X-Original-To Brian Norris <computersforpeace@gmail.com>
X-Mailer Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-pc-linux-gnu)
MIME-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>, Marek Vasut <marex@denx.de>, Scott Wood <scottwood@freescale.com>, Josh Wu <josh.wu@atmel.com>, Robert Jarzmik <robert.jarzmik@free.fr>, Kyungmin Park <kyungmin.park@samsung.com>, Han Xu <han.xu@freescale.com>
X-Original-Date Mon, 2 Nov 2015 00:27:58 +0100
X-Original-Message-ID <20151102002758.51e34a71@bbrezillon>
X-Original-References <1446262410-45754-1-git-send-email-computersforpeace@gmail.com> <1446262410-45754-2-git-send-email-computersforpeace@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1260262

Show key headers only | View raw


On Fri, 30 Oct 2015 20:33:20 -0700
Brian Norris <computersforpeace@gmail.com> wrote:

> We are going to begin using the mtd->dev.of_node field for MTD device
> nodes, so let's add helpers for it. Also, we'll be making some
> conversions on spi_nor (and nand_chip eventually) too, so get that ready
> with their own helpers.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> ---
> v2: new
> 
>  include/linux/mtd/mtd.h     | 11 +++++++++++
>  include/linux/mtd/nand.h    | 11 +++++++++++
>  include/linux/mtd/spi-nor.h | 11 +++++++++++
>  3 files changed, 33 insertions(+)
> 
> diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
> index f17fa75809aa..cc84923011c0 100644
> --- a/include/linux/mtd/mtd.h
> +++ b/include/linux/mtd/mtd.h
> @@ -254,6 +254,17 @@ struct mtd_info {
>  	int usecount;
>  };
>  
> +static inline void mtd_set_of_node(struct mtd_info *mtd,
> +				   struct device_node *np)
> +{
> +	mtd->dev.of_node = np;

Maybe we should retain a reference to the device_node here (IOW,
replace '= np' by '= of_node_get(np)'). Of course this implies calling
of_node_put() when the mtd device is unregistered.

> +}
> +
> +static inline struct device_node *mtd_get_of_node(struct mtd_info *mtd)
> +{
> +	return mtd->dev.of_node;

Not sure this is relevant to to the same here before returning the
device_node because it's mostly used by the MTD drivers and those are
the ones who called mtd_set_of_node() in the first place, so we can
assume it's safe to return an non-retained reference to a device_node.


-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers Brian Norris <computersforpeace@gmail.com> - 2015-10-31 04:40 +0100
  Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers Boris Brezillon <boris.brezillon@free-electrons.com> - 2015-11-02 00:30 +0100
    Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers Brian Norris <computersforpeace@gmail.com> - 2015-11-02 22:20 +0100
  Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers Brian Norris <computersforpeace@gmail.com> - 2015-11-11 22:50 +0100

csiph-web