Skip to contentSkip to conversation

tpm_tis: Use DEFINE_RES_MEM() to simplify code

PATCH Superseded Zhen Lei 2 participants 5 messages Jun 1, 2021 – Jun 3, 2021

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

PATCH 1/1 tpm_tis: Use DEFINE_RES_MEM() to simplify code

No functional change.

---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/tpm/tpm_tis.c +1 -5
index 4ed6e660273a414..d3f2e5364c275f4 100644
@@ -363,11 +363,7 @@ static int tpm_tis_force_device(void)
 {
 	struct platform_device *pdev;
 	static const struct resource x86_resources[] = {
-		{
-			.start = 0xFED40000,
-			.end = 0xFED40000 + TIS_MEM_LEN - 1,
-			.flags = IORESOURCE_MEM,
-		},
+		DEFINE_RES_MEM(0xFED40000, TIS_MEM_LEN)
 	};
 
 	if (!force)
Signature · 1 line
2.26.0.106.g9fadedd
maintainer
#1 lore raw
Quoted 3 lines · Zhen Lei

No functional change.

No change, no need to apply?

/Jarkko

Quoted 26 lines
---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/tpm/tpm_tis.c +1 -5
index 4ed6e660273a414..d3f2e5364c275f4 100644
@@ -363,11 +363,7 @@ static int tpm_tis_force_device(void)
 {
 	struct platform_device *pdev;
 	static const struct resource x86_resources[] = {
-		{
-			.start = 0xFED40000,
-			.end = 0xFED40000 + TIS_MEM_LEN - 1,
-			.flags = IORESOURCE_MEM,
-		},
+		DEFINE_RES_MEM(0xFED40000, TIS_MEM_LEN)
 	};
 
 	if (!force)
Signature · 1 line
2.26.0.106.g9fadedd
#2 lore raw
Quoted 6 lines · Jarkko Sakkinen
Quoted 3 lines · Zhen Lei

No functional change.

No change, no need to apply?

But it can make the code look simpler, easier to read and maintain(The start address does not need to appear twice). I think that's why these DEFINE_RES_* macros are defined.

By the way, would it be better to change the letters in 0xFED40000 to lowercase?

Quoted 32 lines

/Jarkko

Quoted 26 lines
---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/tpm/tpm_tis.c +1 -5
index 4ed6e660273a414..d3f2e5364c275f4 100644
@@ -363,11 +363,7 @@ static int tpm_tis_force_device(void)
 {
 	struct platform_device *pdev;
 	static const struct resource x86_resources[] = {
-		{
-			.start = 0xFED40000,
-			.end = 0xFED40000 + TIS_MEM_LEN - 1,
-			.flags = IORESOURCE_MEM,
-		},
+		DEFINE_RES_MEM(0xFED40000, TIS_MEM_LEN)
 	};
 
 	if (!force)
Signature · 1 line
2.26.0.106.g9fadedd

.

maintainer
#3 lore raw
Quoted 8 lines · Leizhen (ThunderTown)
Quoted 5 lines · Jarkko Sakkinen
Quoted 3 lines · Zhen Lei

No functional change.

Quoted 7 lines
Quoted 1 line

No change, no need to apply?

But it can make the code look simpler, easier to read and maintain(The start address does not need to appear twice). I think that's why these DEFINE_RES_* macros are defined.

By the way, would it be better to change the letters in 0xFED40000 to lowercase?

I mean "No functional change" does not really tell anything about anything.

Please just describe what the commit does.

/Jarkko

Quoted 35 lines
Quoted 33 lines

/Jarkko

Quoted 26 lines
---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/tpm/tpm_tis.c +1 -5
index 4ed6e660273a414..d3f2e5364c275f4 100644
@@ -363,11 +363,7 @@ static int tpm_tis_force_device(void)
 {
 	struct platform_device *pdev;
 	static const struct resource x86_resources[] = {
-		{
-			.start = 0xFED40000,
-			.end = 0xFED40000 + TIS_MEM_LEN - 1,
-			.flags = IORESOURCE_MEM,
-		},
+		DEFINE_RES_MEM(0xFED40000, TIS_MEM_LEN)
 	};
 
 	if (!force)
Signature · 1 line
2.26.0.106.g9fadedd

.

#4 lore raw
Quoted 15 lines · Jarkko Sakkinen
Quoted 14 lines · Leizhen (ThunderTown)
Quoted 6 lines · Jarkko Sakkinen
Quoted 3 lines · Zhen Lei

No functional change.

No change, no need to apply?

But it can make the code look simpler, easier to read and maintain(The start address does not need to appear twice). I think that's why these DEFINE_RES_* macros are defined.

Quoted 5 lines
Quoted 1 line

By the way, would it be better to change the letters in 0xFED40000 to lowercase?

I mean "No functional change" does not really tell anything about anything.

Please just describe what the commit does.

I'm sorry to have misunderstood your intention. OK, I rewrite the commit message.

Quoted 41 lines

/Jarkko

Quoted 24 lines
Quoted 24 lines

/Jarkko

Quoted 20 lines
---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/char/tpm/tpm_tis.c +1 -5
index 4ed6e660273a414..d3f2e5364c275f4 100644
@@ -363,11 +363,7 @@ static int tpm_tis_force_device(void)
 {
 	struct platform_device *pdev;
 	static const struct resource x86_resources[] = {
-		{
-			.start = 0xFED40000,
-			.end = 0xFED40000 + TIS_MEM_LEN - 1,
-			.flags = IORESOURCE_MEM,
-		},
+		DEFINE_RES_MEM(0xFED40000, TIS_MEM_LEN)
 	};
 
Quoted 11 lines
Quoted 9 lines
Quoted 6 lines
drivers/char/tpm/tpm_tis.c +0 -0
 	if (!force)
Signature · 1 line
2.26.0.106.g9fadedd

.

.