Re: [PATCH v2 3/3] remoteporc: ingenic: Simplify with devm_platform_ioremap_resource_byname()

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

 





在 2024/9/7 0:00, Mathieu Poirier 写道:

You still have missed several instances.  I am dropping this set.

Hi, Mathieu,

I have checked the subsystem again and does not find the missing instances that can make such conversion.

Instance like this would require storing the resource size or the res->start, so we can not conversion likt that:

------------------------code start---------------------------------
da8xx_remoteproc.c:

res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
                                   mem_names[i]);
drproc->mem[i].cpu_addr = devm_ioremap_resource(dev, res);
if (IS_ERR(drproc->mem[i].cpu_addr)) {
        dev_err(dev, "failed to parse and map %s memory\n",
                mem_names[i]);
        return PTR_ERR(drproc->mem[i].cpu_addr);
}
drproc->mem[i].bus_addr = res->start;
drproc->mem[i].dev_addr =
                res->start & DA8XX_RPROC_LOCAL_ADDRESS_MASK;
drproc->mem[i].size = resource_size(res);

------------------------------------------------------------------

I have thought about adding a devm_platform_get_and_ioremap_resource_byname() to make conversion for these instances, but the function name seems to be too long...


For other instance like below, we will have code logic broken, because devm_platform_ioremap_resource_byname() will return error if res is NULL:

---------------------------code start------------------------------
mtk_scp.c:

 /* l1tcm is an optional memory region */
 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "l1tcm");
 if (res) {
         scp_cluster->l1tcm_base = devm_ioremap_resource(dev, res);
         if (IS_ERR(scp_cluster->l1tcm_base))
return dev_err_probe(dev, PTR_ERR(scp_cluster->l1tcm_base),
                                      "Failed to map l1tcm memory\n");

         scp_cluster->l1tcm_size = resource_size(res);
         scp_cluster->l1tcm_phys = res->start;
 }
-------------------------------------------------------------------

Best Regards,
Zekun






[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Photo Sharing]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux