Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161934AbbKTC6q (ORCPT ); Thu, 19 Nov 2015 21:58:46 -0500 Received: from mail-pa0-f44.google.com ([209.85.220.44]:33726 "EHLO mail-pa0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161161AbbKTC6p (ORCPT ); Thu, 19 Nov 2015 21:58:45 -0500 Date: Thu, 19 Nov 2015 18:58:42 -0800 From: Brian Norris To: Boris Brezillon Cc: David Woodhouse , linux-mtd@lists.infradead.org, Ezequiel Garcia , Marek Vasut , Scott Wood , Josh Wu , Robert Jarzmik , Kyungmin Park , Han Xu , Stefan Agner , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 13/11] mtd: assign mtd->dev.of_node when creating partition devices Message-ID: <20151120025842.GT64635@google.com> References: <1446262410-45754-1-git-send-email-computersforpeace@gmail.com> <1446424721-23471-1-git-send-email-boris.brezillon@free-electrons.com> <20151112001550.GD96199@google.com> <20151112142220.374154b7@bbrezillon> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151112142220.374154b7@bbrezillon> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1300 Lines: 30 On Thu, Nov 12, 2015 at 02:22:20PM +0100, Boris Brezillon wrote: > On Wed, 11 Nov 2015 16:15:50 -0800 > Brian Norris wrote: > > IOW, I think we can grab the reference in add_mtd_device() and drop it > > in del_mtd_device(). This would handle both the partition and > > non-partition case the same. > > Hm, actually I think we need it. When you iterate over child nodes with > for_each_child_of_node(), the node is released (of_node_put() is > called) after each iteration. While this is not a problem for mtd > device registration (because the controller usually retain the > reference when add_mtd_device() is called), this is not true for the > partitions. And if the partitions are ever defined using an overlay, > this can be a problem. Yep. > To sum-up, I think we should retain the node reference until > add_mtd_device() has retained it, so maybe we should have a ->cleanup() > function in mtd part parsers. OK. I'll drop my patch and send out my ->cleanup() stuff instead, so you can patch on top of that. Brian -- 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/