lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20151102002758.51e34a71@bbrezillon>
Date:	Mon, 2 Nov 2015 00:27:58 +0100
From:	Boris Brezillon <boris.brezillon@...e-electrons.com>
To:	Brian Norris <computersforpeace@...il.com>
Cc:	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
	Ezequiel Garcia <ezequiel@...guardiasur.com.ar>,
	Marek Vasut <marex@...x.de>,
	Scott Wood <scottwood@...escale.com>,
	Josh Wu <josh.wu@...el.com>,
	Robert Jarzmik <robert.jarzmik@...e.fr>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	Han Xu <han.xu@...escale.com>
Subject: Re: [PATCH v2 01/11] mtd: add get/set of_node/flash_node helpers

On Fri, 30 Oct 2015 20:33:20 -0700
Brian Norris <computersforpeace@...il.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@...il.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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ