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

Simon Glass sjg at chromium.org
Thu Dec 3 19:56:57 CET 2015


Hi Michal,

On 2 December 2015 at 22:00, Bin Meng <bmeng.cn at gmail.com> wrote:
> 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).

You could create a 'dm remove' command which operates on the full
device path, if you like. It think that would be useful for testing.

Regards,
Simon


More information about the U-Boot mailing list