mbox series

[v3,0/4] Re-use device management code fragments

Message ID 20240309081104.5006-1-avri.altman@wdc.com
Headers show
Series Re-use device management code fragments | expand

Message

Avri Altman March 9, 2024, 8:10 a.m. UTC
v2->v3:
 - 2/4 - Clarify commit log (Bean)
 - 4/4 - pass cmd_type to ufshcd_prepare_req_desc_hdr (Bean)

v1->v2:
 - Attend Bart's comments


Device management commands are constructed for query commands that are
being issued by the driver, but also for raw device management commands
originated by the bsg module, and recently, by the advanced rpmb
handler. Thus, the same code fragments, e.g. locking, composing the
command, composing the upiu etc., appear over and over. Remove those
duplications.  Theoretically, there should be no functional change.

Avri Altman (4):
  scsi: ufs: Re-use device management locking code
  scsi: ufs: Re-use exec_dev_cmd
  scsi: ufs: Re-use compose_dev_cmd
  scsi: ufs: Re-use compose_devman_upiu

 drivers/ufs/core/ufshcd.c | 204 ++++++++++++++++----------------------
 include/ufs/ufshci.h      |   2 +-
 2 files changed, 87 insertions(+), 119 deletions(-)

Comments

Avri Altman March 23, 2024, 10:06 a.m. UTC | #1
Martin,
Can you take a look at this?
I have a follow-up series waiting.

Thanks,
Avri

> v2->v3:
>  - 2/4 - Clarify commit log (Bean)
>  - 4/4 - pass cmd_type to ufshcd_prepare_req_desc_hdr (Bean)
> 
> v1->v2:
>  - Attend Bart's comments
> 
> 
> Device management commands are constructed for query commands that are
> being issued by the driver, but also for raw device management commands
> originated by the bsg module, and recently, by the advanced rpmb handler.
> Thus, the same code fragments, e.g. locking, composing the command,
> composing the upiu etc., appear over and over. Remove those duplications.
> Theoretically, there should be no functional change.
> 
> Avri Altman (4):
>   scsi: ufs: Re-use device management locking code
>   scsi: ufs: Re-use exec_dev_cmd
>   scsi: ufs: Re-use compose_dev_cmd
>   scsi: ufs: Re-use compose_devman_upiu
> 
>  drivers/ufs/core/ufshcd.c | 204 ++++++++++++++++----------------------
>  include/ufs/ufshci.h      |   2 +-
>  2 files changed, 87 insertions(+), 119 deletions(-)
> 
> --
> 2.42.0
Martin K. Petersen March 25, 2024, 8:52 p.m. UTC | #2
Avri,

> Device management commands are constructed for query commands that are
> being issued by the driver, but also for raw device management
> commands originated by the bsg module, and recently, by the advanced
> rpmb handler. Thus, the same code fragments, e.g. locking, composing
> the command, composing the upiu etc., appear over and over. Remove
> those duplications. Theoretically, there should be no functional
> change.

Applied to 6.10/scsi-staging, thanks!