[PATCH v3 2/2] drm/msm/a6xx: request memory region

2024-06-03 Thread Kiarash Hajian
The devm_iounmap function is being used unnecessarily,
managed resource mechanisms (devres) are handling resource cleanup automatically

This commit removes the calls to devm_iounmap and relies on devres

Signed-off-by: Kiarash Hajian 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 --
 1 file changed, 18 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index aa83cb461a75..d64bf6212d6f 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -524,9 +524,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
uint32_t pdc_address_offset;
bool pdc_in_aop = false;
 
-   if (IS_ERR(pdcptr))
-   goto err;
-
if (adreno_is_a650(adreno_gpu) ||
adreno_is_a660_family(adreno_gpu) ||
adreno_is_a7xx(adreno_gpu))
@@ -540,8 +537,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
 
if (!pdc_in_aop) {
seqptr = a6xx_gmu_get_mmio(pdev, "gmu_pdc_seq");
-   if (IS_ERR(seqptr))
-   goto err;
}
 
/* Disable SDE clock gating */
@@ -633,12 +628,6 @@ static void a6xx_gmu_rpmh_init(struct a6xx_gmu *gmu)
wmb();
 
a6xx_rpmh_stop(gmu);
-
-err:
-   if (!IS_ERR_OR_NULL(pdcptr))
-   devm_iounmap(>dev,pdcptr);
-   if (!IS_ERR_OR_NULL(seqptr))
-   devm_iounmap(>dev,seqptr);
 }
 
 /*
@@ -1635,7 +1624,6 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, 
struct device_node *node)
gmu->gxpd = dev_pm_domain_attach_by_name(gmu->dev, "gx");
if (IS_ERR(gmu->gxpd)) {
ret = PTR_ERR(gmu->gxpd);
-   goto err_mmio;
}
 
gmu->initialized = true;
@@ -1645,9 +1633,6 @@ int a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, 
struct device_node *node)
 detach_cxpd:
dev_pm_domain_detach(gmu->cxpd, false);
 
-err_mmio:
-   devm_iounmap(gmu->dev ,gmu->mmio);
-
/* Drop reference taken in of_find_device_by_node */
put_device(gmu->dev);
 
@@ -1825,9 +1810,6 @@ int a6xx_gmu_init(struct a6xx_gpu *a6xx_gpu, struct 
device_node *node)
dev_pm_domain_detach(gmu->cxpd, false);
 
 err_mmio:
-   devm_iounmap(gmu->dev ,gmu->mmio);
-   if (platform_get_resource_byname(pdev, IORESOURCE_MEM, "rscc"))
-   devm_iounmap(gmu->dev ,gmu->rscc);
free_irq(gmu->gmu_irq, gmu);
free_irq(gmu->hfi_irq, gmu);
 

-- 
2.43.0



Re: [PATCH v3 2/2] drm/msm/a6xx: request memory region

2024-05-12 Thread kernel test robot
Hi Kiarash,

kernel test robot noticed the following build errors:

[auto build test ERROR on cf87f46fd34d6c19283d9625a7822f20d90b64a4]

url:
https://github.com/intel-lab-lkp/linux/commits/Kiarash-Hajian/drm-msm-a6xx-request-memory-region/20240512-135215
base:   cf87f46fd34d6c19283d9625a7822f20d90b64a4
patch link:
https://lore.kernel.org/r/20240512-msm-adreno-memory-region-v3-2-0a728ad45010%40gmail.com
patch subject: [PATCH v3 2/2] drm/msm/a6xx: request memory region
config: i386-buildonly-randconfig-003-20240513 
(https://download.01.org/0day-ci/archive/20240513/202405130628.7lsm1hpa-...@intel.com/config)
compiler: gcc-13 (Ubuntu 13.2.0-4ubuntu3) 13.2.0
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240513/202405130628.7lsm1hpa-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405130628.7lsm1hpa-...@intel.com/

All errors (new ones prefixed by >>):

   drivers/gpu/drm/msm/adreno/a6xx_gmu.c: In function 'a6xx_gmu_wrapper_init':
>> drivers/gpu/drm/msm/adreno/a6xx_gmu.c:1611:17: error: label 'err_mmio' used 
>> but not defined
1611 | goto err_mmio;
 | ^~~~


vim +/err_mmio +1611 drivers/gpu/drm/msm/adreno/a6xx_gmu.c

c11fa1204fe940 Akhil P Oommen 2023-01-02  1582  
5a903a44a98471 Konrad Dybcio  2023-06-16  1583  int 
a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
5a903a44a98471 Konrad Dybcio  2023-06-16  1584  {
5a903a44a98471 Konrad Dybcio  2023-06-16  1585  struct platform_device 
*pdev = of_find_device_by_node(node);
5a903a44a98471 Konrad Dybcio  2023-06-16  1586  struct a6xx_gmu *gmu = 
_gpu->gmu;
5a903a44a98471 Konrad Dybcio  2023-06-16  1587  int ret;
5a903a44a98471 Konrad Dybcio  2023-06-16  1588  
5a903a44a98471 Konrad Dybcio  2023-06-16  1589  if (!pdev)
5a903a44a98471 Konrad Dybcio  2023-06-16  1590  return -ENODEV;
5a903a44a98471 Konrad Dybcio  2023-06-16  1591  
5a903a44a98471 Konrad Dybcio  2023-06-16  1592  gmu->dev = >dev;
5a903a44a98471 Konrad Dybcio  2023-06-16  1593  
5a903a44a98471 Konrad Dybcio  2023-06-16  1594  
of_dma_configure(gmu->dev, node, true);
5a903a44a98471 Konrad Dybcio  2023-06-16  1595  
5a903a44a98471 Konrad Dybcio  2023-06-16  1596  
pm_runtime_enable(gmu->dev);
5a903a44a98471 Konrad Dybcio  2023-06-16  1597  
5a903a44a98471 Konrad Dybcio  2023-06-16  1598  /* Mark legacy for 
manual SPTPRAC control */
5a903a44a98471 Konrad Dybcio  2023-06-16  1599  gmu->legacy = true;
5a903a44a98471 Konrad Dybcio  2023-06-16  1600  
5a903a44a98471 Konrad Dybcio  2023-06-16  1601  /* Map the GMU 
registers */
5a903a44a98471 Konrad Dybcio  2023-06-16  1602  gmu->mmio = 
a6xx_gmu_get_mmio(pdev, "gmu");
5a903a44a98471 Konrad Dybcio  2023-06-16  1603  if (IS_ERR(gmu->mmio)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1604  ret = 
PTR_ERR(gmu->mmio);
5a903a44a98471 Konrad Dybcio  2023-06-16  1605  goto err_mmio;
5a903a44a98471 Konrad Dybcio  2023-06-16  1606  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1607  
5a903a44a98471 Konrad Dybcio  2023-06-16  1608  gmu->cxpd = 
dev_pm_domain_attach_by_name(gmu->dev, "cx");
5a903a44a98471 Konrad Dybcio  2023-06-16  1609  if (IS_ERR(gmu->cxpd)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1610  ret = 
PTR_ERR(gmu->cxpd);
5a903a44a98471 Konrad Dybcio  2023-06-16 @1611  goto err_mmio;
5a903a44a98471 Konrad Dybcio  2023-06-16  1612  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1613  
5a903a44a98471 Konrad Dybcio  2023-06-16  1614  if 
(!device_link_add(gmu->dev, gmu->cxpd, DL_FLAG_PM_RUNTIME)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1615  ret = -ENODEV;
5a903a44a98471 Konrad Dybcio  2023-06-16  1616  goto 
detach_cxpd;
5a903a44a98471 Konrad Dybcio  2023-06-16  1617  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1618  
5a903a44a98471 Konrad Dybcio  2023-06-16  1619  
init_completion(>pd_gate);
5a903a44a98471 Konrad Dybcio  2023-06-16  1620  
complete_all(>pd_gate);
5a903a44a98471 Konrad Dybcio  2023-06-16  1621  
gmu->pd_nb.notifier_call = cxpd_notifier_cb;
5a903a44a98471 Konrad Dybcio  2023-06-16  1622  
5a903a44a98471 Konrad Dybcio  2023-06-16  1623  /* Get a link to the GX 
power domain to reset the GPU */
5a903a44a98471 Konrad Dybcio  2023-06-16  1624  gmu->gxpd = 
dev_pm_domain_attach_by_name(gmu->dev, "gx");
5a903a44a98471 Konrad Dybcio  2023-06-16  1625  if (IS_ERR(gmu->gxpd)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1626  re

Re: [PATCH v3 2/2] drm/msm/a6xx: request memory region

2024-05-12 Thread kernel test robot
Hi Kiarash,

kernel test robot noticed the following build errors:

[auto build test ERROR on cf87f46fd34d6c19283d9625a7822f20d90b64a4]

url:
https://github.com/intel-lab-lkp/linux/commits/Kiarash-Hajian/drm-msm-a6xx-request-memory-region/20240512-135215
base:   cf87f46fd34d6c19283d9625a7822f20d90b64a4
patch link:
https://lore.kernel.org/r/20240512-msm-adreno-memory-region-v3-2-0a728ad45010%40gmail.com
patch subject: [PATCH v3 2/2] drm/msm/a6xx: request memory region
config: i386-buildonly-randconfig-001-20240513 
(https://download.01.org/0day-ci/archive/20240513/202405130618.n7qkeg94-...@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 
617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): 
(https://download.01.org/0day-ci/archive/20240513/202405130618.n7qkeg94-...@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot 
| Closes: 
https://lore.kernel.org/oe-kbuild-all/202405130618.n7qkeg94-...@intel.com/

All errors (new ones prefixed by >>):

>> drivers/gpu/drm/msm/adreno/a6xx_gmu.c:1605:8: error: use of undeclared label 
>> 'err_mmio'
1605 | goto err_mmio;
 |  ^
   1 error generated.


vim +/err_mmio +1605 drivers/gpu/drm/msm/adreno/a6xx_gmu.c

c11fa1204fe940 Akhil P Oommen 2023-01-02  1582  
5a903a44a98471 Konrad Dybcio  2023-06-16  1583  int 
a6xx_gmu_wrapper_init(struct a6xx_gpu *a6xx_gpu, struct device_node *node)
5a903a44a98471 Konrad Dybcio  2023-06-16  1584  {
5a903a44a98471 Konrad Dybcio  2023-06-16  1585  struct platform_device 
*pdev = of_find_device_by_node(node);
5a903a44a98471 Konrad Dybcio  2023-06-16  1586  struct a6xx_gmu *gmu = 
_gpu->gmu;
5a903a44a98471 Konrad Dybcio  2023-06-16  1587  int ret;
5a903a44a98471 Konrad Dybcio  2023-06-16  1588  
5a903a44a98471 Konrad Dybcio  2023-06-16  1589  if (!pdev)
5a903a44a98471 Konrad Dybcio  2023-06-16  1590  return -ENODEV;
5a903a44a98471 Konrad Dybcio  2023-06-16  1591  
5a903a44a98471 Konrad Dybcio  2023-06-16  1592  gmu->dev = >dev;
5a903a44a98471 Konrad Dybcio  2023-06-16  1593  
5a903a44a98471 Konrad Dybcio  2023-06-16  1594  
of_dma_configure(gmu->dev, node, true);
5a903a44a98471 Konrad Dybcio  2023-06-16  1595  
5a903a44a98471 Konrad Dybcio  2023-06-16  1596  
pm_runtime_enable(gmu->dev);
5a903a44a98471 Konrad Dybcio  2023-06-16  1597  
5a903a44a98471 Konrad Dybcio  2023-06-16  1598  /* Mark legacy for 
manual SPTPRAC control */
5a903a44a98471 Konrad Dybcio  2023-06-16  1599  gmu->legacy = true;
5a903a44a98471 Konrad Dybcio  2023-06-16  1600  
5a903a44a98471 Konrad Dybcio  2023-06-16  1601  /* Map the GMU 
registers */
5a903a44a98471 Konrad Dybcio  2023-06-16  1602  gmu->mmio = 
a6xx_gmu_get_mmio(pdev, "gmu");
5a903a44a98471 Konrad Dybcio  2023-06-16  1603  if (IS_ERR(gmu->mmio)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1604  ret = 
PTR_ERR(gmu->mmio);
5a903a44a98471 Konrad Dybcio  2023-06-16 @1605  goto err_mmio;
5a903a44a98471 Konrad Dybcio  2023-06-16  1606  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1607  
5a903a44a98471 Konrad Dybcio  2023-06-16  1608  gmu->cxpd = 
dev_pm_domain_attach_by_name(gmu->dev, "cx");
5a903a44a98471 Konrad Dybcio  2023-06-16  1609  if (IS_ERR(gmu->cxpd)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1610  ret = 
PTR_ERR(gmu->cxpd);
5a903a44a98471 Konrad Dybcio  2023-06-16  1611  goto err_mmio;
5a903a44a98471 Konrad Dybcio  2023-06-16  1612  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1613  
5a903a44a98471 Konrad Dybcio  2023-06-16  1614  if 
(!device_link_add(gmu->dev, gmu->cxpd, DL_FLAG_PM_RUNTIME)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1615  ret = -ENODEV;
5a903a44a98471 Konrad Dybcio  2023-06-16  1616  goto 
detach_cxpd;
5a903a44a98471 Konrad Dybcio  2023-06-16  1617  }
5a903a44a98471 Konrad Dybcio  2023-06-16  1618  
5a903a44a98471 Konrad Dybcio  2023-06-16  1619  
init_completion(>pd_gate);
5a903a44a98471 Konrad Dybcio  2023-06-16  1620  
complete_all(>pd_gate);
5a903a44a98471 Konrad Dybcio  2023-06-16  1621  
gmu->pd_nb.notifier_call = cxpd_notifier_cb;
5a903a44a98471 Konrad Dybcio  2023-06-16  1622  
5a903a44a98471 Konrad Dybcio  2023-06-16  1623  /* Get a link to the GX 
power domain to reset the GPU */
5a903a44a98471 Konrad Dybcio  2023-06-16  1624  gmu->gxpd = 
dev_pm_domain_attach_by_name(gmu->dev, "gx");
5a903a44a98471 Konrad Dybcio  2023-06-16  1625  if (IS_ERR(gmu->gxpd)) {
5a903a44a98471 Konrad Dybcio  2023-06-16  1626  re

Re: [PATCH v3 2/2] drm/msm/a6xx: request memory region

2024-05-12 Thread Dmitry Baryshkov
On Sun, May 12, 2024 at 01:49:39AM -0400, Kiarash Hajian wrote:
> The devm_iounmap function is being used unnecessarily,
> managed resource mechanisms (devres) are handling resource cleanup 
> automatically
> 
> This commit removes the calls to devm_iounmap and relies on devres
> 
> Signed-off-by: Kiarash Hajian 
> ---
>  drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 18 --
>  1 file changed, 18 deletions(-)

In my opinion, this patch is better be squashed into the first patch.
Though I'd leave a final word here to Rob and Konrad.

BTW: for some reason your patches don't appear on freedreno's patchwork,
although they definitely hit the list and appear on lore.kernel.org.

-- 
With best wishes
Dmitry