Skip to contentSkip to conversation

Three small UFS patches

PATCH Applied Bart Van Assche 4 participants 15 messages Oct 29, 2019 – Nov 6, 2019 SCSI

lore
Share & tools
lore
#0 lore raw

cover Three small UFS patches

Hi Martin,

These three patches are what I came up with after having reviewed the compiler warnings triggered by the UFS driver and after having reviewed its source code. Please consider these patches for kernel version v5.5.

Thanks,

Bart.

Bart Van Assche (3):
ufs: Fix kernel-doc warnings
ufs: Use enum dev_cmd_type where appropriate
ufs: Remove .setup_xfer_req()

 drivers/scsi/ufs/ufs_bsg.c |  1 +
 drivers/scsi/ufs/ufshcd.c  |  8 +++-----
 drivers/scsi/ufs/ufshcd.h  | 10 ----------
 3 files changed, 4 insertions(+), 15 deletions(-)
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
#1 lore raw

PATCH 1/3 ufs: Fix kernel-doc warnings

Fix the following three kernel-doc warnings:

drivers/scsi/ufs/ufs_bsg.c:165: warning: Function parameter or member 'hba' not described in 'ufs_bsg_remove' drivers/scsi/ufs/ufshcd.c:5789: warning: Function parameter or member 'cmd_type' not described in 'ufshcd_issue_devman_upiu_cmd' drivers/scsi/ufs/ufshcd.c:5789: warning: Excess function parameter 'msgcode' description in 'ufshcd_issue_devman_upiu_cmd'

Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
---
 drivers/scsi/ufs/ufs_bsg.c | 1 +
 drivers/scsi/ufs/ufshcd.c  | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/ufs/ufs_bsg.c +1 -0
index a9344eb4e047..3a2e68f1ad42 100644
@@ -158,6 +158,7 @@ static int ufs_bsg_request(struct bsg_job *job)
 
 /**
  * ufs_bsg_remove - detach and remove the added ufs-bsg node
+ * @hba: per adapter object
  *
  * Should be called when unloading the driver.
  */
drivers/scsi/ufs/ufshcd.c +1 -1
index c28c144d9b4a..7ced77c8cc4d 100644
@@ -5768,9 +5768,9 @@ static int ufshcd_issue_tm_cmd(struct ufs_hba *hba, int lun_id, int task_id,
  * @hba:	per-adapter instance
  * @req_upiu:	upiu request
  * @rsp_upiu:	upiu reply
- * @msgcode:	message code, one of UPIU Transaction Codes Initiator to Target
  * @desc_buff:	pointer to descriptor buffer, NULL if NA
  * @buff_len:	descriptor size, 0 if NA
+ * @cmd_type:	specifies the type (NOP, Query...)
  * @desc_op:	descriptor operation
  *
  * Those type of requests uses UTP Transfer Request Descriptor - utrd.
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
Reviewed-by on v1 1/3
#2 lore raw

RE: [PATCH 1/3] ufs: Fix kernel-doc warnings

Quoted 11 lines

Fix the following three kernel-doc warnings:

drivers/scsi/ufs/ufs_bsg.c:165: warning: Function parameter or member 'hba' not described in 'ufs_bsg_remove' drivers/scsi/ufs/ufshcd.c:5789: warning: Function parameter or member 'cmd_type' not described in 'ufshcd_issue_devman_upiu_cmd' drivers/scsi/ufs/ufshcd.c:5789: warning: Excess function parameter 'msgcode' description in 'ufshcd_issue_devman_upiu_cmd'

Quoted 6 lines
Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
#3 lore raw

Re: [PATCH 1/3] ufs: Fix kernel-doc warnings

In reply to Bart Van Assche

Bart,

Quoted 5 lines

Fix the following three kernel-doc warnings:

drivers/scsi/ufs/ufs_bsg.c:165: warning: Function parameter or member 'hba' not described in 'ufs_bsg_remove' drivers/scsi/ufs/ufshcd.c:5789: warning: Function parameter or member 'cmd_type' not described in 'ufshcd_issue_devman_upiu_cmd' drivers/scsi/ufs/ufshcd.c:5789: warning: Excess function parameter 'msgcode' description in 'ufshcd_issue_devman_upiu_cmd'

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#4 lore raw

PATCH 2/3 ufs: Use enum dev_cmd_type where appropriate

In reply to Bart Van Assche

Declare all variables that hold dev_cmd_type values as an enum instead of as an int.

Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
---
 drivers/scsi/ufs/ufshcd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd.c +2 -2
index 7ced77c8cc4d..180033b4b515 100644
@@ -5784,7 +5784,7 @@ static int ufshcd_issue_devman_upiu_cmd(struct ufs_hba *hba,
 					struct utp_upiu_req *req_upiu,
 					struct utp_upiu_req *rsp_upiu,
 					u8 *desc_buff, int *buff_len,
-					int cmd_type,
+					enum dev_cmd_type cmd_type,
 					enum query_opcode desc_op)
 {
 	struct ufshcd_lrb *lrbp;
@@ -5899,7 +5899,7 @@ int ufshcd_exec_raw_upiu_cmd(struct ufs_hba *hba,
 			     enum query_opcode desc_op)
 {
 	int err;
-	int cmd_type = DEV_CMD_TYPE_QUERY;
+	enum dev_cmd_type cmd_type = DEV_CMD_TYPE_QUERY;
 	struct utp_task_req_desc treq = { { 0 }, };
 	int ocs_value;
 	u8 tm_f = be32_to_cpu(req_upiu->header.dword_1) >> 16 & MASK_TM_FUNC;
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
Reviewed-by on v1 2/3
#5 lore raw

RE: [PATCH 2/3] ufs: Use enum dev_cmd_type where appropriate

Quoted 10 lines

Declare all variables that hold dev_cmd_type values as an enum instead of as an int.

Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
#6 lore raw

Re: [PATCH 2/3] ufs: Use enum dev_cmd_type where appropriate

In reply to Bart Van Assche

Bart,

Quoted 2 lines

Declare all variables that hold dev_cmd_type values as an enum instead of as an int.

Applied to 5.5/scsi-queue, thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#7 lore raw

PATCH 3/3 ufs: Remove .setup_xfer_req()

In reply to Bart Van Assche

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
---
 drivers/scsi/ufs/ufshcd.c |  2 --
 drivers/scsi/ufs/ufshcd.h | 10 ----------
 2 files changed, 12 deletions(-)
drivers/scsi/ufs/ufshcd.c +0 -2
index 180033b4b515..9fc05a535624 100644
@@ -2487,7 +2487,6 @@ static int ufshcd_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
 
 	/* issue command to the controller */
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	ufshcd_vops_setup_xfer_req(hba, tag, (lrbp->cmd ? true : false));
 	ufshcd_send_command(hba, tag);
 out_unlock:
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
@@ -2704,7 +2703,6 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba,
 	/* Make sure descriptors are ready before ringing the doorbell */
 	wmb();
 	spin_lock_irqsave(hba->host->host_lock, flags);
-	ufshcd_vops_setup_xfer_req(hba, tag, (lrbp->cmd ? true : false));
 	ufshcd_send_command(hba, tag);
 	spin_unlock_irqrestore(hba->host->host_lock, flags);
 
drivers/scsi/ufs/ufshcd.h +0 -10
index e0fe247c719e..e3593cce23c1 100644
@@ -288,8 +288,6 @@ struct ufs_pwr_mode_info {
  * @pwr_change_notify: called before and after a power mode change
  *			is carried out to allow vendor spesific capabilities
  *			to be set.
- * @setup_xfer_req: called before any transfer request is issued
- *                  to set some things
  * @setup_task_mgmt: called before any task management request is issued
  *                  to set some things
  * @hibern8_notify: called around hibern8 enter/exit
@@ -318,7 +316,6 @@ struct ufs_hba_variant_ops {
 					enum ufs_notify_change_status status,
 					struct ufs_pa_layer_attr *,
 					struct ufs_pa_layer_attr *);
-	void	(*setup_xfer_req)(struct ufs_hba *, int, bool);
 	void	(*setup_task_mgmt)(struct ufs_hba *, int, u8);
 	void    (*hibern8_notify)(struct ufs_hba *, enum uic_cmd_dme,
 					enum ufs_notify_change_status);
@@ -1031,13 +1028,6 @@ static inline int ufshcd_vops_pwr_change_notify(struct ufs_hba *hba,
 	return -ENOTSUPP;
 }
 
-static inline void ufshcd_vops_setup_xfer_req(struct ufs_hba *hba, int tag,
-					bool is_scsi_cmd)
-{
-	if (hba->vops && hba->vops->setup_xfer_req)
-		return hba->vops->setup_xfer_req(hba, tag, is_scsi_cmd);
-}
-
 static inline void ufshcd_vops_setup_task_mgmt(struct ufs_hba *hba,
 					int tag, u8 tm_function)
 {
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
#8 lore raw

RE: [PATCH 3/3] ufs: Remove .setup_xfer_req()

+ Kiwoong Kim

Quoted 6 lines

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Quoted 6 lines
Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>

Since this was introduced only a couple of years ago, Maybe better to CC the author Kiwoong Kim <[email protected]> Before removing this altogether.

Reviewed-by
#9 lore raw

RE: [PATCH 3/3] ufs: Remove .setup_xfer_req()

As no response from Kiwoong Kim:

Quoted 16 lines

+ Kiwoong Kim

Quoted 6 lines

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Quoted 6 lines
Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
Quoted 3 lines

Since this was introduced only a couple of years ago, Maybe better to CC the author Kiwoong Kim <[email protected]> Before removing this altogether.

#10 lore raw

Re: [PATCH 3/3] ufs: Remove .setup_xfer_req()

Hi

Quoted 6 lines · Avri Altman

As no response from Kiwoong Kim:

Quoted 3 lines

+ Kiwoong Kim

Looks like he is not active here.

Quoted 13 lines
Quoted 13 lines
Quoted 13 lines

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>
Quoted 4 lines
Quoted 3 lines

Since this was introduced only a couple of years ago, Maybe better to CC the author Kiwoong Kim <[email protected]> Before removing this altogether.

Let me check and reconfirm this, give a day or two. It will be good if am copied to the ufs patch (I hope get_maintainer.pl still pointout my email) thanks

Signature · 2 lines
Regards,
Alim
#11 lore raw

Re: [PATCH 3/3] ufs: Remove .setup_xfer_req()

Hi Bart / Avri

Quoted 27 lines · Alim Akhtar

Hi

Quoted 6 lines · Avri Altman

As no response from Kiwoong Kim:

Quoted 3 lines

+ Kiwoong Kim

Looks like he is not active here.

Quoted 16 lines
Quoted 16 lines
Quoted 7 lines

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Quoted 6 lines
Cc Yaniv Gardi <[email protected]>
Cc Subhash Jadavani <[email protected]>
Cc Stanley Chu <[email protected]>
Cc Avri Altman <[email protected]>
Cc Tomas Winkler <[email protected]>

Since this was introduced only a couple of years ago, Maybe better to CC the author Kiwoong Kim <[email protected]> Before removing this altogether.

Quoted 7 lines
Quoted 1 line

Let me check and reconfirm this, give a day or two. It will be good if am copied to the ufs patch (I hope get_maintainer.pl still pointout my email) thanks

I checked the brief history of this adding "setup_xfer_req" to support Samsung UFSHCI (this was the ground work done)
We need this to support vendor specific NEXUS_TYPE settings. The Samsung UFSHCI driver will be up for review in near future For usecase of the function pointer please see an older version of the patch https://patchwork.kernel.org/patch/7306321/

Quoted 3 lines

--
Regards,
Alim

Signature · 2 lines
Regards,
Alim
#12 lore raw

Re: [PATCH 3/3] ufs: Remove .setup_xfer_req()

Quoted 6 lines · Alim Akhtar

I checked the brief history of this adding "setup_xfer_req" to support Samsung UFSHCI (this was the ground work done)
We need this to support vendor specific NEXUS_TYPE settings. The Samsung UFSHCI driver will be up for review in near future For usecase of the function pointer please see an older version of the patch https://patchwork.kernel.org/patch/7306321/

Thanks Alim for having looked up this information. Let's drop this patch.

Bart.

#13 lore raw

Re: [PATCH 3/3] ufs: Remove .setup_xfer_req()

Bart,

Quoted 2 lines

Thanks Alim for having looked up this information. Let's drop this patch.

Dropped from 5.5/scsi-queue.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#14 lore raw

Re: [PATCH 3/3] ufs: Remove .setup_xfer_req()

In reply to Bart Van Assche

Bart,

Quoted 4 lines

Since the function ufshcd_vops_setup_xfer_req() is the only user of the setup_xfer_req function pointer and since that function pointer is always zero, remove both this function and the function pointer. This patch does not change any functionality.

Applied to 5.5/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering