[U-Boot] [PATCH 4/9] drivers: nand: implement a NAND uclass

Mugunthan V N
2016-04-05T08:27:08Z

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