From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mugunthan V N Date: Tue, 5 Apr 2016 13:57:08 +0530 Subject: [U-Boot] [PATCH 4/9] drivers: nand: implement a NAND uclass In-Reply-To: <1459553484.32510.54.camel@buserror.net> References: <1459510190-26306-1-git-send-email-mugunthanvnm@ti.com> <1459510190-26306-5-git-send-email-mugunthanvnm@ti.com> <1459553139.32510.49.camel@buserror.net> <1459553484.32510.54.camel@buserror.net> Message-ID: <570376DC.8060402@ti.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Scott On Saturday 02 April 2016 05:01 AM, Scott Wood wrote: > On Fri, 2016-04-01 at 18:25 -0500, Scott Wood wrote: >> On Fri, 2016-04-01 at 16:59 +0530, Mugunthan V N wrote: >>> +static int nand_child_pre_probe(struct udevice *dev) >>> +{ >>> + nand_info_t *nand = dev_get_uclass_priv(dev); >>> + void *priv = dev_get_priv(dev); >>> + >>> + /* >>> + * Store nand device priv pointer in nand_info so that >>> + * it can be used by nand command >>> + */ >>> + nand->priv = priv; >> >> Wouldn't it make more sense to have a pointer to the device in the NAND >> struct, and let the driver manage both privs as it chooses? > > This makes even less sense after seeing patch 5/9, which assumes dev priv is > nand_info_t, and stores its own data in nand->priv. Won't this overwrite > that? This nand is not the same as in omap_gpmc driver priv nand, here nand specifies nand_info_t which is "struct mtd_info" and in omap_gpmc driver it is "struct nand_chip". In class: (nand_info_t) nand->priv = driver priv, ie nand_chip In driver: (nand_chip) nand->priv = struct omap_nand_info * (internal to driver) So both are different and used for different purposes. Regards Mugunthan V N