[U-Boot] [PATCH v2 12/14] net: gem: Move driver to DM

Bin Meng bmeng.cn at gmail.com
Thu Dec 3 06:00:50 CET 2015


Hi Michal,

On Wed, Dec 2, 2015 at 9:51 PM, Michal Simek <michal.simek at xilinx.com> wrote:
> On 2.12.2015 14:16, Bin Meng wrote:
>> Hi Michal,
>>
>> On Wed, Dec 2, 2015 at 7:36 PM, Michal Simek <michal.simek at xilinx.com> wrote:
>
> ...
>
>>> +
>>> +       offset = fdtdec_lookup_phandle(gd->fdt_blob, dev->of_offset,
>>> +                                      "phy-handle");
>>> +       if (offset > 0)
>>> +               priv->phyaddr = fdtdec_get_int(gd->fdt_blob, offset, "reg", 0);
>>
>> I don't see where is this priv->phyaddr used in this driver?
>
> phy_detection function called from zynq_phy_init/
>
>>
>>>
>>> -       return 1;
>>> +       printf("ZYNQ GEM: %lx, phyaddr %d\n", (ulong)priv->iobase,
>>> +              priv->phyaddr);
>>> +
>>> +       return 0;
>>>  }
>>> +
>>> +static const struct udevice_id zynq_gem_ids[] = {
>>> +       { .compatible = "cdns,zynqmp-gem" },
>>> +       { .compatible = "cdns,zynq-gem" },
>>> +       { .compatible = "cdns,gem" },
>>> +       { }
>>> +};
>>> +
>>> +U_BOOT_DRIVER(zynq_gem) = {
>>> +       .name   = "zynq_gem",
>>> +       .id     = UCLASS_ETH,
>>> +       .of_match = zynq_gem_ids,
>>> +       .ofdata_to_platdata = zynq_gem_ofdata_to_platdata,
>>> +       .probe  = zynq_gem_probe,
>>
>> Please add .remove function, otherwise there will be memory leak when
>> removing the device. See designware.c for example.
>
> No problem to do it. It will be almost c&p from that driver.
> Do we have any way how to detect these leaks?

None that I am aware of.

>
> I have never tried to remove devices. How to do it?
>

This can be tested by adding test codes to call device_remove(dev).

Regards,
Bin


More information about the U-Boot mailing list