Re: [PATCH v3 10/13] memory: tegra: Add EMC (external memory controller) driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 6 November 2014 12:35, Mikko Perttunen <mikko.perttunen@xxxxxxxx> wrote:
> On 11/06/2014 09:56 AM, Alexandre Courbot wrote:
>>
>> On 10/30/2014 01:22 AM, Tomeu Vizoso wrote:
>>> +static int tegra_emc_probe(struct platform_device *pdev)
>>> +{
>>> +    struct tegra_emc *tegra;
>>> +    struct device_node *node;
>>> +    struct platform_device *mc_pdev;
>>> +    struct resource *res;
>>> +    u32 ram_code, node_ram_code;
>>> +    int err;
>>> +
>>> +    tegra = devm_kzalloc(&pdev->dev, sizeof(*tegra), GFP_KERNEL);
>>> +    if (!tegra)
>>> +        return -ENOMEM;
>>> +
>>> +    tegra->pdev = pdev;
>>> +
>>> +    res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>> +    tegra->emc_regs = devm_ioremap_resource(&pdev->dev, res);
>>> +    if (IS_ERR(tegra->emc_regs)) {
>>> +        dev_err(&pdev->dev, "failed to map EMC regs\n");
>>> +        return PTR_ERR(tegra->emc_regs);
>>> +    }
>>> +
>>> +    node = of_parse_phandle(pdev->dev.of_node,
>>> +                "nvidia,memory-controller", 0);
>>> +    if (!node) {
>>> +        dev_err(&pdev->dev, "could not get memory controller\n");
>>> +        return -ENOENT;
>>> +    }
>>> +
>>> +    mc_pdev = of_find_device_by_node(node);
>>> +    if (!mc_pdev)
>>> +        return -ENOENT;
>>
>>
>> Isn't there a risk that we will return -ENOENT depending on the probe
>> order? I.e. if this device is probed before the MC device?
>
>
> Yes.. I remember having some trouble with this code. IIRC, I couldn't figure
> out a way to sanely detect if the MC driver had been probed or not. Clearly
> this is not good, though.

Yeah, I found this issue during testing and resorted to
subsys_initcall(). Any better ideas?

Thanks,

Tomeu
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux