diff mbox series

[-next] scsi: ufs: fix build warning without CONFIG_PM

Message ID 20210611130601.34336-1-yuehaibing@huawei.com
State New
Headers show
Series [-next] scsi: ufs: fix build warning without CONFIG_PM | expand

Commit Message

Yue Haibing June 11, 2021, 1:06 p.m. UTC
drivers/scsi/ufs/ufshcd.c:9770:12: warning: ‘ufshcd_rpmb_resume’ defined but not used [-Wunused-function]
 static int ufshcd_rpmb_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~
drivers/scsi/ufs/ufshcd.c:9037:12: warning: ‘ufshcd_wl_runtime_resume’ defined but not used [-Wunused-function]
 static int ufshcd_wl_runtime_resume(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~~~~~
drivers/scsi/ufs/ufshcd.c:9017:12: warning: ‘ufshcd_wl_runtime_suspend’ defined but not used [-Wunused-function]
 static int ufshcd_wl_runtime_suspend(struct device *dev)
            ^~~~~~~~~~~~~~~~~~~~~~~~~

Move it into #ifdef block to fix this.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/scsi/ufs/ufshcd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

kernel test robot June 16, 2021, 4:52 p.m. UTC | #1
Hi YueHaibing,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on next-20210615]

url:    https://github.com/0day-ci/linux/commits/YueHaibing/scsi-ufs-fix-build-warning-without-CONFIG_PM/20210616-183217
base:    19ae1f2bd9c091059f80646604ccef8a1e614f57
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/6874b79b80a6d8905fe434342e4233b23c3b2104
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review YueHaibing/scsi-ufs-fix-build-warning-without-CONFIG_PM/20210616-183217
        git checkout 6874b79b80a6d8905fe434342e4233b23c3b2104
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   In file included from include/linux/device.h:25,
                    from include/linux/async.h:14,
                    from drivers/scsi/ufs/ufshcd.c:12:
>> drivers/scsi/ufs/ufshcd.c:9728:21: error: 'ufshcd_wl_runtime_suspend' undeclared here (not in a function); did you mean 'ufshcd_runtime_suspend'?

    9728 |  SET_RUNTIME_PM_OPS(ufshcd_wl_runtime_suspend, ufshcd_wl_runtime_resume, NULL)
         |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:341:21: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     341 |  .runtime_suspend = suspend_fn, \
         |                     ^~~~~~~~~~
>> drivers/scsi/ufs/ufshcd.c:9728:48: error: 'ufshcd_wl_runtime_resume' undeclared here (not in a function); did you mean 'ufshcd_runtime_resume'?

    9728 |  SET_RUNTIME_PM_OPS(ufshcd_wl_runtime_suspend, ufshcd_wl_runtime_resume, NULL)
         |                                                ^~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/pm.h:342:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     342 |  .runtime_resume = resume_fn, \
         |                    ^~~~~~~~~
>> drivers/scsi/ufs/ufshcd.c:9781:27: error: 'ufshcd_rpmb_resume' undeclared here (not in a function); did you mean 'ufshcd_vops_resume'?

    9781 |  SET_RUNTIME_PM_OPS(NULL, ufshcd_rpmb_resume, NULL)
         |                           ^~~~~~~~~~~~~~~~~~
   include/linux/pm.h:342:20: note: in definition of macro 'SET_RUNTIME_PM_OPS'
     342 |  .runtime_resume = resume_fn, \
         |                    ^~~~~~~~~
   In file included from include/linux/perf_event.h:25,
                    from include/linux/trace_events.h:10,
                    from include/trace/trace_events.h:21,
                    from include/trace/define_trace.h:102,
                    from include/trace/events/ufs.h:396,
                    from drivers/scsi/ufs/ufshcd.c:31:
   arch/arc/include/asm/perf_event.h:126:23: warning: 'arc_pmu_cache_map' defined but not used [-Wunused-const-variable=]
     126 | static const unsigned arc_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
         |                       ^~~~~~~~~~~~~~~~~
   arch/arc/include/asm/perf_event.h:91:27: warning: 'arc_pmu_ev_hw_map' defined but not used [-Wunused-const-variable=]
      91 | static const char * const arc_pmu_ev_hw_map[] = {
         |                           ^~~~~~~~~~~~~~~~~


vim +9728 drivers/scsi/ufs/ufshcd.c

b294ff3e34490f Asutosh Das 2021-04-23  9718  
b294ff3e34490f Asutosh Das 2021-04-23  9719  static const struct dev_pm_ops ufshcd_wl_pm_ops = {
b294ff3e34490f Asutosh Das 2021-04-23  9720  #ifdef CONFIG_PM_SLEEP
b294ff3e34490f Asutosh Das 2021-04-23  9721  	.suspend = ufshcd_wl_suspend,
b294ff3e34490f Asutosh Das 2021-04-23  9722  	.resume = ufshcd_wl_resume,
b294ff3e34490f Asutosh Das 2021-04-23  9723  	.freeze = ufshcd_wl_suspend,
b294ff3e34490f Asutosh Das 2021-04-23  9724  	.thaw = ufshcd_wl_resume,
b294ff3e34490f Asutosh Das 2021-04-23  9725  	.poweroff = ufshcd_wl_poweroff,
b294ff3e34490f Asutosh Das 2021-04-23  9726  	.restore = ufshcd_wl_resume,
b294ff3e34490f Asutosh Das 2021-04-23  9727  #endif
b294ff3e34490f Asutosh Das 2021-04-23 @9728  	SET_RUNTIME_PM_OPS(ufshcd_wl_runtime_suspend, ufshcd_wl_runtime_resume, NULL)
b294ff3e34490f Asutosh Das 2021-04-23  9729  };
b294ff3e34490f Asutosh Das 2021-04-23  9730  
b294ff3e34490f Asutosh Das 2021-04-23  9731  /*
b294ff3e34490f Asutosh Das 2021-04-23  9732   * ufs_dev_wlun_template - describes ufs device wlun
b294ff3e34490f Asutosh Das 2021-04-23  9733   * ufs-device wlun - used to send pm commands
b294ff3e34490f Asutosh Das 2021-04-23  9734   * All luns are consumers of ufs-device wlun.
b294ff3e34490f Asutosh Das 2021-04-23  9735   *
b294ff3e34490f Asutosh Das 2021-04-23  9736   * Currently, no sd driver is present for wluns.
b294ff3e34490f Asutosh Das 2021-04-23  9737   * Hence the no specific pm operations are performed.
b294ff3e34490f Asutosh Das 2021-04-23  9738   * With ufs design, SSU should be sent to ufs-device wlun.
b294ff3e34490f Asutosh Das 2021-04-23  9739   * Hence register a scsi driver for ufs wluns only.
b294ff3e34490f Asutosh Das 2021-04-23  9740   */
b294ff3e34490f Asutosh Das 2021-04-23  9741  static struct scsi_driver ufs_dev_wlun_template = {
b294ff3e34490f Asutosh Das 2021-04-23  9742  	.gendrv = {
b294ff3e34490f Asutosh Das 2021-04-23  9743  		.name = "ufs_device_wlun",
b294ff3e34490f Asutosh Das 2021-04-23  9744  		.owner = THIS_MODULE,
b294ff3e34490f Asutosh Das 2021-04-23  9745  		.probe = ufshcd_wl_probe,
b294ff3e34490f Asutosh Das 2021-04-23  9746  		.remove = ufshcd_wl_remove,
b294ff3e34490f Asutosh Das 2021-04-23  9747  		.pm = &ufshcd_wl_pm_ops,
b294ff3e34490f Asutosh Das 2021-04-23  9748  		.shutdown = ufshcd_wl_shutdown,
b294ff3e34490f Asutosh Das 2021-04-23  9749  	},
b294ff3e34490f Asutosh Das 2021-04-23  9750  };
b294ff3e34490f Asutosh Das 2021-04-23  9751  
b294ff3e34490f Asutosh Das 2021-04-23  9752  static int ufshcd_rpmb_probe(struct device *dev)
b294ff3e34490f Asutosh Das 2021-04-23  9753  {
b294ff3e34490f Asutosh Das 2021-04-23  9754  	return is_rpmb_wlun(to_scsi_device(dev)) ? 0 : -ENODEV;
b294ff3e34490f Asutosh Das 2021-04-23  9755  }
b294ff3e34490f Asutosh Das 2021-04-23  9756  
b294ff3e34490f Asutosh Das 2021-04-23  9757  static inline int ufshcd_clear_rpmb_uac(struct ufs_hba *hba)
b294ff3e34490f Asutosh Das 2021-04-23  9758  {
b294ff3e34490f Asutosh Das 2021-04-23  9759  	int ret = 0;
b294ff3e34490f Asutosh Das 2021-04-23  9760  
b294ff3e34490f Asutosh Das 2021-04-23  9761  	if (!hba->wlun_rpmb_clr_ua)
b294ff3e34490f Asutosh Das 2021-04-23  9762  		return 0;
b294ff3e34490f Asutosh Das 2021-04-23  9763  	ret = ufshcd_clear_ua_wlun(hba, UFS_UPIU_RPMB_WLUN);
b294ff3e34490f Asutosh Das 2021-04-23  9764  	if (!ret)
b294ff3e34490f Asutosh Das 2021-04-23  9765  		hba->wlun_rpmb_clr_ua = 0;
b294ff3e34490f Asutosh Das 2021-04-23  9766  	return ret;
b294ff3e34490f Asutosh Das 2021-04-23  9767  }
b294ff3e34490f Asutosh Das 2021-04-23  9768  
6874b79b80a6d8 YueHaibing  2021-06-11  9769  #ifdef CONFIG_PM_SLEEP
b294ff3e34490f Asutosh Das 2021-04-23  9770  static int ufshcd_rpmb_resume(struct device *dev)
b294ff3e34490f Asutosh Das 2021-04-23  9771  {
b294ff3e34490f Asutosh Das 2021-04-23  9772  	struct ufs_hba *hba = wlun_dev_to_hba(dev);
b294ff3e34490f Asutosh Das 2021-04-23  9773  
b294ff3e34490f Asutosh Das 2021-04-23  9774  	if (hba->sdev_rpmb)
b294ff3e34490f Asutosh Das 2021-04-23  9775  		ufshcd_clear_rpmb_uac(hba);
b294ff3e34490f Asutosh Das 2021-04-23  9776  	return 0;
b294ff3e34490f Asutosh Das 2021-04-23  9777  }
6874b79b80a6d8 YueHaibing  2021-06-11  9778  #endif
b294ff3e34490f Asutosh Das 2021-04-23  9779  
b294ff3e34490f Asutosh Das 2021-04-23  9780  static const struct dev_pm_ops ufs_rpmb_pm_ops = {
b294ff3e34490f Asutosh Das 2021-04-23 @9781  	SET_RUNTIME_PM_OPS(NULL, ufshcd_rpmb_resume, NULL)
b294ff3e34490f Asutosh Das 2021-04-23  9782  	SET_SYSTEM_SLEEP_PM_OPS(NULL, ufshcd_rpmb_resume)
b294ff3e34490f Asutosh Das 2021-04-23  9783  };
b294ff3e34490f Asutosh Das 2021-04-23  9784  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Bart Van Assche July 26, 2021, 5:59 p.m. UTC | #2
On 6/11/21 6:06 AM, YueHaibing wrote:
> drivers/scsi/ufs/ufshcd.c:9770:12: warning: ‘ufshcd_rpmb_resume’ defined but not used [-Wunused-function]

>   static int ufshcd_rpmb_resume(struct device *dev)

>              ^~~~~~~~~~~~~~~~~~

> drivers/scsi/ufs/ufshcd.c:9037:12: warning: ‘ufshcd_wl_runtime_resume’ defined but not used [-Wunused-function]

>   static int ufshcd_wl_runtime_resume(struct device *dev)

>              ^~~~~~~~~~~~~~~~~~~~~~~~

> drivers/scsi/ufs/ufshcd.c:9017:12: warning: ‘ufshcd_wl_runtime_suspend’ defined but not used [-Wunused-function]

>   static int ufshcd_wl_runtime_suspend(struct device *dev)

>              ^~~~~~~~~~~~~~~~~~~~~~~~~

> 

> Move it into #ifdef block to fix this.

> 

> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

> ---

>   drivers/scsi/ufs/ufshcd.c | 4 +++-

>   1 file changed, 3 insertions(+), 1 deletion(-)

> 

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

> index b87ff68aa9aa..0c54589e186a 100644

> --- a/drivers/scsi/ufs/ufshcd.c

> +++ b/drivers/scsi/ufs/ufshcd.c

> @@ -8926,6 +8926,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)

>   	return ret;

>   }

>   

> +#ifdef CONFIG_PM_SLEEP

>   static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)

>   {

>   	int ret;

> @@ -9053,7 +9054,6 @@ static int ufshcd_wl_runtime_resume(struct device *dev)

>   	return ret;

>   }

>   

> -#ifdef CONFIG_PM_SLEEP

>   static int ufshcd_wl_suspend(struct device *dev)

>   {

>   	struct scsi_device *sdev = to_scsi_device(dev);

> @@ -9766,6 +9766,7 @@ static inline int ufshcd_clear_rpmb_uac(struct ufs_hba *hba)

>   	return ret;

>   }

>   

> +#ifdef CONFIG_PM_SLEEP

>   static int ufshcd_rpmb_resume(struct device *dev)

>   {

>   	struct ufs_hba *hba = wlun_dev_to_hba(dev);

> @@ -9774,6 +9775,7 @@ static int ufshcd_rpmb_resume(struct device *dev)

>   		ufshcd_clear_rpmb_uac(hba);

>   	return 0;

>   }

> +#endif

>   

>   static const struct dev_pm_ops ufs_rpmb_pm_ops = {

>   	SET_RUNTIME_PM_OPS(NULL, ufshcd_rpmb_resume, NULL)


Hi YueHaibing,

Can you take a look at 
https://lore.kernel.org/linux-scsi/20210722033439.26550-1-bvanassche@acm.org/T/#m6e7a02fc79634b5b77cfb77849253ac41d021389? 
I let the kernel robot verify that patch before I posted it on the 
linux-scsi mailing list.

Thanks,

Bart.
Yue Haibing July 27, 2021, 2:57 a.m. UTC | #3
On 2021/7/27 1:59, Bart Van Assche wrote:
> On 6/11/21 6:06 AM, YueHaibing wrote:

>> drivers/scsi/ufs/ufshcd.c:9770:12: warning: ‘ufshcd_rpmb_resume’ defined but not used [-Wunused-function]

>>   static int ufshcd_rpmb_resume(struct device *dev)

>>              ^~~~~~~~~~~~~~~~~~

>> drivers/scsi/ufs/ufshcd.c:9037:12: warning: ‘ufshcd_wl_runtime_resume’ defined but not used [-Wunused-function]

>>   static int ufshcd_wl_runtime_resume(struct device *dev)

>>              ^~~~~~~~~~~~~~~~~~~~~~~~

>> drivers/scsi/ufs/ufshcd.c:9017:12: warning: ‘ufshcd_wl_runtime_suspend’ defined but not used [-Wunused-function]

>>   static int ufshcd_wl_runtime_suspend(struct device *dev)

>>              ^~~~~~~~~~~~~~~~~~~~~~~~~

>>

>> Move it into #ifdef block to fix this.

>>

>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>

>> ---

>>   drivers/scsi/ufs/ufshcd.c | 4 +++-

>>   1 file changed, 3 insertions(+), 1 deletion(-)

>>

>> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c

>> index b87ff68aa9aa..0c54589e186a 100644

>> --- a/drivers/scsi/ufs/ufshcd.c

>> +++ b/drivers/scsi/ufs/ufshcd.c

>> @@ -8926,6 +8926,7 @@ static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)

>>       return ret;

>>   }

>>   +#ifdef CONFIG_PM_SLEEP

>>   static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)

>>   {

>>       int ret;

>> @@ -9053,7 +9054,6 @@ static int ufshcd_wl_runtime_resume(struct device *dev)

>>       return ret;

>>   }

>>   -#ifdef CONFIG_PM_SLEEP

>>   static int ufshcd_wl_suspend(struct device *dev)

>>   {

>>       struct scsi_device *sdev = to_scsi_device(dev);

>> @@ -9766,6 +9766,7 @@ static inline int ufshcd_clear_rpmb_uac(struct ufs_hba *hba)

>>       return ret;

>>   }

>>   +#ifdef CONFIG_PM_SLEEP

>>   static int ufshcd_rpmb_resume(struct device *dev)

>>   {

>>       struct ufs_hba *hba = wlun_dev_to_hba(dev);

>> @@ -9774,6 +9775,7 @@ static int ufshcd_rpmb_resume(struct device *dev)

>>           ufshcd_clear_rpmb_uac(hba);

>>       return 0;

>>   }

>> +#endif

>>     static const struct dev_pm_ops ufs_rpmb_pm_ops = {

>>       SET_RUNTIME_PM_OPS(NULL, ufshcd_rpmb_resume, NULL)

> 

> Hi YueHaibing,

> 

> Can you take a look at https://lore.kernel.org/linux-scsi/20210722033439.26550-1-bvanassche@acm.org/T/#m6e7a02fc79634b5b77cfb77849253ac41d021389? I let the kernel robot verify that patch before I posted it on the linux-scsi mailing list.


__ufshcd_wl_resume() is needed while CONFIG_PM is enabled, and my patch v2 has been Applied. See:

https://lore.kernel.org/r/20210617031326.36908-1-yuehaibing@huawei.com

I will let Hulk Robot test your patch serials, and report if any.

> 

> Thanks,

> 

> Bart.

> .
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
index b87ff68aa9aa..0c54589e186a 100644
--- a/drivers/scsi/ufs/ufshcd.c
+++ b/drivers/scsi/ufs/ufshcd.c
@@ -8926,6 +8926,7 @@  static int __ufshcd_wl_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 	return ret;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int __ufshcd_wl_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op)
 {
 	int ret;
@@ -9053,7 +9054,6 @@  static int ufshcd_wl_runtime_resume(struct device *dev)
 	return ret;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static int ufshcd_wl_suspend(struct device *dev)
 {
 	struct scsi_device *sdev = to_scsi_device(dev);
@@ -9766,6 +9766,7 @@  static inline int ufshcd_clear_rpmb_uac(struct ufs_hba *hba)
 	return ret;
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int ufshcd_rpmb_resume(struct device *dev)
 {
 	struct ufs_hba *hba = wlun_dev_to_hba(dev);
@@ -9774,6 +9775,7 @@  static int ufshcd_rpmb_resume(struct device *dev)
 		ufshcd_clear_rpmb_uac(hba);
 	return 0;
 }
+#endif
 
 static const struct dev_pm_ops ufs_rpmb_pm_ops = {
 	SET_RUNTIME_PM_OPS(NULL, ufshcd_rpmb_resume, NULL)