* [PATCH] scsi: ufs: core: Do not open code SZ_x
@ 2023-05-30 7:50 Avri Altman
2023-05-30 11:11 ` Bean Huo
[not found] ` <CGME20230530075120epcas2p10917546a2e01da2a17c34b7460f85eef@epcms2p3>
0 siblings, 2 replies; 5+ messages in thread
From: Avri Altman @ 2023-05-30 7:50 UTC (permalink / raw)
To: James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-kernel, Avri Altman
A tad cleanup - No functional change.
Signed-off-by: Avri Altman <avri.altman@wdc.com>
---
drivers/ufs/core/ufshcd.c | 8 ++++----
include/ufs/ufshci.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
index fdf5073c7c6c..1f206bd453cf 100644
--- a/drivers/ufs/core/ufshcd.c
+++ b/drivers/ufs/core/ufshcd.c
@@ -2519,7 +2519,7 @@ static void ufshcd_sgl_to_prdt(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, int
* 11b to indicate Dword granularity. A value of '3'
* indicates 4 bytes, '7' indicates 8 bytes, etc."
*/
- WARN_ONCE(len > 256 * 1024, "len = %#x\n", len);
+ WARN_ONCE(len > SZ_256K, "len = %#x\n", len);
prd->size = cpu_to_le32(len - 1);
prd->addr = cpu_to_le64(sg->dma_address);
prd->reserved = 0;
@@ -3765,7 +3765,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
/*
* Allocate memory for UTP Transfer descriptors
- * UFSHCI requires 1024 byte alignment of UTRD
+ * UFSHCI requires 1KB alignment of UTRD
*/
utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs);
hba->utrdl_base_addr = dmam_alloc_coherent(hba->dev,
@@ -3773,7 +3773,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
&hba->utrdl_dma_addr,
GFP_KERNEL);
if (!hba->utrdl_base_addr ||
- WARN_ON(hba->utrdl_dma_addr & (1024 - 1))) {
+ WARN_ON(hba->utrdl_dma_addr & (SZ_1K - 1))) {
dev_err(hba->dev,
"Transfer Descriptor Memory allocation failed\n");
goto out;
@@ -8760,7 +8760,7 @@ static const struct scsi_host_template ufshcd_driver_template = {
.cmd_per_lun = UFSHCD_CMD_PER_LUN,
.can_queue = UFSHCD_CAN_QUEUE,
.max_segment_size = PRDT_DATA_BYTE_COUNT_MAX,
- .max_sectors = (1 << 20) / SECTOR_SIZE, /* 1 MiB */
+ .max_sectors = SZ_1M / SECTOR_SIZE,
.max_host_blocked = 1,
.track_queue_depth = 1,
.skip_settle_delay = 1,
diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
index 11424bb03814..db2d5db5c88e 100644
--- a/include/ufs/ufshci.h
+++ b/include/ufs/ufshci.h
@@ -453,7 +453,7 @@ enum {
};
/* The maximum length of the data byte count field in the PRDT is 256KB */
-#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024)
+#define PRDT_DATA_BYTE_COUNT_MAX SZ_256K
/* The granularity of the data byte count field in the PRDT is 32-bit */
#define PRDT_DATA_BYTE_COUNT_PAD 4
--
2.40.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Do not open code SZ_x
2023-05-30 7:50 [PATCH] scsi: ufs: core: Do not open code SZ_x Avri Altman
@ 2023-05-30 11:11 ` Bean Huo
2023-05-30 13:35 ` Stanley Chu
[not found] ` <CGME20230530075120epcas2p10917546a2e01da2a17c34b7460f85eef@epcms2p3>
1 sibling, 1 reply; 5+ messages in thread
From: Bean Huo @ 2023-05-30 11:11 UTC (permalink / raw)
To: Avri Altman, James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-kernel
On Tue, 2023-05-30 at 10:50 +0300, Avri Altman wrote:
> A tad cleanup - No functional change.
>
> Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Bean Huo <beanhuo@micron.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] scsi: ufs: core: Do not open code SZ_x
2023-05-30 11:11 ` Bean Huo
@ 2023-05-30 13:35 ` Stanley Chu
0 siblings, 0 replies; 5+ messages in thread
From: Stanley Chu @ 2023-05-30 13:35 UTC (permalink / raw)
To: Bean Huo
Cc: Avri Altman, James E . J . Bottomley, Martin K . Petersen,
linux-scsi, linux-kernel
On Tue, May 30, 2023 at 7:22 PM Bean Huo <huobean@gmail.com> wrote:
>
> On Tue, 2023-05-30 at 10:50 +0300, Avri Altman wrote:
> > A tad cleanup - No functional change.
> >
> > Signed-off-by: Avri Altman <avri.altman@wdc.com>
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] scsi: ufs: core: Do not open code SZ_x
[not found] ` <CGME20230530075120epcas2p10917546a2e01da2a17c34b7460f85eef@epcms2p3>
@ 2023-05-30 14:08 ` Keoseong Park
2023-05-31 5:05 ` Avri Altman
0 siblings, 1 reply; 5+ messages in thread
From: Keoseong Park @ 2023-05-30 14:08 UTC (permalink / raw)
To: Avri Altman, James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-kernel
Hi Avri,
>A tad cleanup - No functional change.
>
>Signed-off-by: Avri Altman <avri.altman@wdc.com>
>---
> drivers/ufs/core/ufshcd.c | 8 ++++----
> include/ufs/ufshci.h | 2 +-
> 2 files changed, 5 insertions(+), 5 deletions(-)
>
>diff --git a/drivers/ufs/core/ufshcd.c b/drivers/ufs/core/ufshcd.c
>index fdf5073c7c6c..1f206bd453cf 100644
>--- a/drivers/ufs/core/ufshcd.c
>+++ b/drivers/ufs/core/ufshcd.c
>@@ -2519,7 +2519,7 @@ static void ufshcd_sgl_to_prdt(struct ufs_hba *hba, struct ufshcd_lrb *lrbp, int
> * 11b to indicate Dword granularity. A value of '3'
> * indicates 4 bytes, '7' indicates 8 bytes, etc."
> */
>- WARN_ONCE(len > 256 * 1024, "len = %#x\n", len);
>+ WARN_ONCE(len > SZ_256K, "len = %#x\n", len);
> prd->size = cpu_to_le32(len - 1);
> prd->addr = cpu_to_le64(sg->dma_address);
> prd->reserved = 0;
>@@ -3765,7 +3765,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
>
> /*
> * Allocate memory for UTP Transfer descriptors
>- * UFSHCI requires 1024 byte alignment of UTRD
>+ * UFSHCI requires 1KB alignment of UTRD
> */
> utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs);
> hba->utrdl_base_addr = dmam_alloc_coherent(hba->dev,
>@@ -3773,7 +3773,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
> &hba->utrdl_dma_addr,
> GFP_KERNEL);
> if (!hba->utrdl_base_addr ||
>- WARN_ON(hba->utrdl_dma_addr & (1024 - 1))) {
>+ WARN_ON(hba->utrdl_dma_addr & (SZ_1K - 1))) {
How about changing the UTMRD part inside ufshcd_memory_alloc() as well?
Best Regards,
Keoseong
> dev_err(hba->dev,
> "Transfer Descriptor Memory allocation failed\n");
> goto out;
>@@ -8760,7 +8760,7 @@ static const struct scsi_host_template ufshcd_driver_template = {
> .cmd_per_lun = UFSHCD_CMD_PER_LUN,
> .can_queue = UFSHCD_CAN_QUEUE,
> .max_segment_size = PRDT_DATA_BYTE_COUNT_MAX,
>- .max_sectors = (1 << 20) / SECTOR_SIZE, /* 1 MiB */
>+ .max_sectors = SZ_1M / SECTOR_SIZE,
> .max_host_blocked = 1,
> .track_queue_depth = 1,
> .skip_settle_delay = 1,
>diff --git a/include/ufs/ufshci.h b/include/ufs/ufshci.h
>index 11424bb03814..db2d5db5c88e 100644
>--- a/include/ufs/ufshci.h
>+++ b/include/ufs/ufshci.h
>@@ -453,7 +453,7 @@ enum {
> };
>
> /* The maximum length of the data byte count field in the PRDT is 256KB */
>-#define PRDT_DATA_BYTE_COUNT_MAX (256 * 1024)
>+#define PRDT_DATA_BYTE_COUNT_MAX SZ_256K
> /* The granularity of the data byte count field in the PRDT is 32-bit */
> #define PRDT_DATA_BYTE_COUNT_PAD 4
>
>--
>2.40.0
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] scsi: ufs: core: Do not open code SZ_x
2023-05-30 14:08 ` Keoseong Park
@ 2023-05-31 5:05 ` Avri Altman
0 siblings, 0 replies; 5+ messages in thread
From: Avri Altman @ 2023-05-31 5:05 UTC (permalink / raw)
To: keosung.park, James E . J . Bottomley, Martin K . Petersen
Cc: linux-scsi, linux-kernel
> >int ufshcd_memory_alloc(struct ufs_hba *hba)
> >
> > /*
> > * Allocate memory for UTP Transfer descriptors
> >- * UFSHCI requires 1024 byte alignment of UTRD
> >+ * UFSHCI requires 1KB alignment of UTRD
> > */
> > utrdl_size = (sizeof(struct utp_transfer_req_desc) * hba->nutrs);
> > hba->utrdl_base_addr = dmam_alloc_coherent(hba->dev, @@ -3773,7
> >+3773,7 @@ static int ufshcd_memory_alloc(struct ufs_hba *hba)
> > &hba->utrdl_dma_addr,
> > GFP_KERNEL);
> > if (!hba->utrdl_base_addr ||
> >- WARN_ON(hba->utrdl_dma_addr & (1024 - 1))) {
> >+ WARN_ON(hba->utrdl_dma_addr & (SZ_1K - 1))) {
>
> How about changing the UTMRD part inside ufshcd_memory_alloc() as well?
Oops - missed that.
Thanks,
Avri
>
> Best Regards,
> Keoseong
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-05-31 5:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 7:50 [PATCH] scsi: ufs: core: Do not open code SZ_x Avri Altman
2023-05-30 11:11 ` Bean Huo
2023-05-30 13:35 ` Stanley Chu
[not found] ` <CGME20230530075120epcas2p10917546a2e01da2a17c34b7460f85eef@epcms2p3>
2023-05-30 14:08 ` Keoseong Park
2023-05-31 5:05 ` Avri Altman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.