Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1721568 > unrolled thread

[PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible

Started byAlim Akhtar <alim.akhtar@samsung.com>
First post2017-08-28 14:30 +0200
Last post2017-08-29 13:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible Alim Akhtar <alim.akhtar@samsung.com> - 2017-08-28 14:30 +0200
    Re: [PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible Bart Van Assche <Bart.VanAssche@wdc.com> - 2017-08-28 17:50 +0200
      Re: [PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible Alim Akhtar <alim.akhtar@samsung.com> - 2017-08-29 13:20 +0200

#1721568 — [PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible

FromAlim Akhtar <alim.akhtar@samsung.com>
Date2017-08-28 14:30 +0200
Subject[PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible
Message-ID<ujrkZ-5xq-3@gated-at.bofh.it>
This entire file uses UFS_BIT macro for bits definition, expect for few
places. This patch convert those defines to use UFS_BIT macro to be aligned
with reset of the file.

Signed-off-by: Alim Akhtar <alim.akhtar@samsung.com>
---
 drivers/scsi/ufs/ufshci.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/ufs/ufshci.h b/drivers/scsi/ufs/ufshci.h
index f60145d..588094a 100644
--- a/drivers/scsi/ufs/ufshci.h
+++ b/drivers/scsi/ufs/ufshci.h
@@ -186,9 +186,9 @@ enum {
 /* UECDL - Host UIC Error Code Data Link Layer 3Ch */
 #define UIC_DATA_LINK_LAYER_ERROR		UFS_BIT(31)
 #define UIC_DATA_LINK_LAYER_ERROR_CODE_MASK	0x7FFF
-#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	0x2000
-#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	0x0001
-#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT 0x0002
+#define UIC_DATA_LINK_LAYER_ERROR_PA_INIT	UFS_BIT(13)
+#define UIC_DATA_LINK_LAYER_ERROR_NAC_RECEIVED	UFS_BIT(1)
+#define UIC_DATA_LINK_LAYER_ERROR_TCx_REPLAY_TIMEOUT UFS_BIT(2)
 
 /* UECN - Host UIC Error Code Network Layer 40h */
 #define UIC_NETWORK_LAYER_ERROR			UFS_BIT(31)
-- 
2.7.4

[toc] | [next] | [standalone]


#1721765

FromBart Van Assche <Bart.VanAssche@wdc.com>
Date2017-08-28 17:50 +0200
Message-ID<ujusy-7mE-15@gated-at.bofh.it>
In reply to#1721568
On Mon, 2017-08-28 at 17:49 +0530, Alim Akhtar wrote:
> This entire file uses UFS_BIT macro for bits definition, expect for few
> places. This patch convert those defines to use UFS_BIT macro to be aligned
> with reset of the file.

This is the definition of the UFS_BIT() macro I found in
drivers/scsi/ufs/ufshci.h:

#define UFS_BIT(x)	(1L << (x))

Using this macro makes code longer instead of shorter and does not improve
code readability. Is this macro really useful? Wouldn't it be better to
remove the UFS_BIT() macro instead of introducing more uses of it?

Thanks,

Bart.

[toc] | [prev] | [next] | [standalone]


#1722341

FromAlim Akhtar <alim.akhtar@samsung.com>
Date2017-08-29 13:20 +0200
Message-ID<ujMIQ-1VL-35@gated-at.bofh.it>
In reply to#1721765
Hi Bart,
Thanks for your review.

On 08/28/2017 09:15 PM, Bart Van Assche wrote:
> On Mon, 2017-08-28 at 17:49 +0530, Alim Akhtar wrote:
>> This entire file uses UFS_BIT macro for bits definition, expect for few
>> places. This patch convert those defines to use UFS_BIT macro to be aligned
>> with reset of the file.
> 
> This is the definition of the UFS_BIT() macro I found in
> drivers/scsi/ufs/ufshci.h:
> 
> #define UFS_BIT(x)	(1L << (x))
> 
> Using this macro makes code longer instead of shorter and does not improve
> code readability. Is this macro really useful? Wouldn't it be better to
> remove the UFS_BIT() macro instead of introducing more uses of it?
> 
Well, the intension of this patch is to make use of already existing 
UFS_BIT() macro.

I am not aware of the history why this macro was created at first place.

Well, it does improve code readability, for me at least, no need for one 
to do a calculation to see which bit it is, as we pass _bit_ number to 
UFS_BIT.

I am totally okay, if you or other reviewers suggests me to change 
UFS_BIT to actual bit position, something like the original case, which 
this patch is trying to change.

> Thanks,
> 
> Bart.
> 
Thanks!
Alim

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web