diff mbox series

[v5,04/10] scsi: ufs: core: Introduce ufshcd_process_device_init_result()

Message ID 20240910215139.3352387-5-bvanassche@acm.org (mailing list archive)
State Changes Requested
Headers show
Series Combine the UFS driver scsi_add_host() calls | expand

Commit Message

Bart Van Assche Sept. 10, 2024, 9:50 p.m. UTC
Prepare for moving a ufshcd_device_init() call from inside
ufshcd_probe_hba() into the ufshcd_probe_hba() callers by introducing the
function ufshcd_process_device_init_result(). No functionality has been
changed.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/ufs/core/ufshcd.c | 35 ++++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 11 deletions(-)

Comments

Bao D. Nguyen Sept. 13, 2024, 4:31 a.m. UTC | #1
On 9/10/2024 2:50 PM, Bart Van Assche wrote:

> +/**
> + * ufshcd_process_device_init_result - Process the ufshcd_device_init() result.
> + * @hba: UFS host controller instance.
> + * @start: time when the ufshcd_device_init() call started.

Replace @start with @device_init_start?

> + * @ret: ufshcd_device_init() return value.
> + */
> +static void ufshcd_process_device_init_result(struct ufs_hba *hba,
> +					ktime_t device_init_start, int ret)
> +{
kernel test robot Sept. 13, 2024, 8:40 p.m. UTC | #2
Hi Bart,

kernel test robot noticed the following build warnings:

[auto build test WARNING on mkp-scsi/for-next]
[cannot apply to jejb-scsi/for-next linus/master v6.11-rc7 next-20240913]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Bart-Van-Assche/scsi-ufs-core-Introduce-ufshcd_add_scsi_host/20240911-055406
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
patch link:    https://lore.kernel.org/r/20240910215139.3352387-5-bvanassche%40acm.org
patch subject: [PATCH v5 04/10] scsi: ufs: core: Introduce ufshcd_process_device_init_result()
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20240914/202409140417.VXgks1dM-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240914/202409140417.VXgks1dM-lkp@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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409140417.VXgks1dM-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/ufs/core/ufshcd.c:7675: warning: Function parameter or struct member 'device_init_start' not described in 'ufshcd_process_device_init_result'
>> drivers/ufs/core/ufshcd.c:7675: warning: Excess function parameter 'start' description in 'ufshcd_process_device_init_result'


vim +7675 drivers/ufs/core/ufshcd.c

  7666	
  7667	/**
  7668	 * ufshcd_process_device_init_result - Process the ufshcd_device_init() result.
  7669	 * @hba: UFS host controller instance.
  7670	 * @start: time when the ufshcd_device_init() call started.
  7671	 * @ret: ufshcd_device_init() return value.
  7672	 */
  7673	static void ufshcd_process_device_init_result(struct ufs_hba *hba,
  7674						ktime_t device_init_start, int ret)
> 7675	{
  7676		unsigned long flags;
  7677	
  7678		spin_lock_irqsave(hba->host->host_lock, flags);
  7679		if (ret)
  7680			hba->ufshcd_state = UFSHCD_STATE_ERROR;
  7681		else if (hba->ufshcd_state == UFSHCD_STATE_RESET)
  7682			hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
  7683		spin_unlock_irqrestore(hba->host->host_lock, flags);
  7684	
  7685		trace_ufshcd_init(dev_name(hba->dev), ret,
  7686				ktime_to_us(ktime_sub(ktime_get(), device_init_start)),
  7687				hba->curr_dev_pwr_mode, hba->uic_link_state);
  7688	}
  7689
Bart Van Assche Oct. 9, 2024, 9:19 p.m. UTC | #3
On 9/12/24 9:31 PM, Bao D. Nguyen wrote:
> On 9/10/2024 2:50 PM, Bart Van Assche wrote:
> 
>> +/**
>> + * ufshcd_process_device_init_result - Process the 
>> ufshcd_device_init() result.
>> + * @hba: UFS host controller instance.
>> + * @start: time when the ufshcd_device_init() call started.
> 
> Replace @start with @device_init_start?

I will fix this.

Thanks,

Bart.
diff mbox series

Patch

diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index 6ebafd08ad6e..1094c1ba2212 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -7664,6 +7664,29 @@  static int ufshcd_abort(struct scsi_cmnd *cmd)
 	return err;
 }
 
+/**
+ * ufshcd_process_device_init_result - Process the ufshcd_device_init() result.
+ * @hba: UFS host controller instance.
+ * @start: time when the ufshcd_device_init() call started.
+ * @ret: ufshcd_device_init() return value.
+ */
+static void ufshcd_process_device_init_result(struct ufs_hba *hba,
+					ktime_t device_init_start, int ret)
+{
+	unsigned long flags;
+
+	spin_lock_irqsave(hba->host->host_lock, flags);
+	if (ret)
+		hba->ufshcd_state = UFSHCD_STATE_ERROR;
+	else if (hba->ufshcd_state == UFSHCD_STATE_RESET)
+		hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
+	spin_unlock_irqrestore(hba->host->host_lock, flags);
+
+	trace_ufshcd_init(dev_name(hba->dev), ret,
+			ktime_to_us(ktime_sub(ktime_get(), device_init_start)),
+			hba->curr_dev_pwr_mode, hba->uic_link_state);
+}
+
 /**
  * ufshcd_host_reset_and_restore - reset and restore host controller
  * @hba: per-adapter instance
@@ -8827,7 +8850,6 @@  static int ufshcd_device_init(struct ufs_hba *hba, bool init_dev_params)
 static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
 {
 	ktime_t start = ktime_get();
-	unsigned long flags;
 	int ret;
 
 	ret = ufshcd_device_init(hba, init_dev_params);
@@ -8873,16 +8895,7 @@  static int ufshcd_probe_hba(struct ufs_hba *hba, bool init_dev_params)
 	ufshcd_configure_auto_hibern8(hba);
 
 out:
-	spin_lock_irqsave(hba->host->host_lock, flags);
-	if (ret)
-		hba->ufshcd_state = UFSHCD_STATE_ERROR;
-	else if (hba->ufshcd_state == UFSHCD_STATE_RESET)
-		hba->ufshcd_state = UFSHCD_STATE_OPERATIONAL;
-	spin_unlock_irqrestore(hba->host->host_lock, flags);
-
-	trace_ufshcd_init(dev_name(hba->dev), ret,
-		ktime_to_us(ktime_sub(ktime_get(), start)),
-		hba->curr_dev_pwr_mode, hba->uic_link_state);
+	ufshcd_process_device_init_result(hba, start, ret);
 	return ret;
 }