diff mbox series

[v2,1/1] tpm_tis: Use DEFINE_RES_MEM() to simplify code

Message ID 20210603074955.11653-2-thunder.leizhen@huawei.com (mailing list archive)
State New, archived
Headers show
Series tpm_tis: Use DEFINE_RES_MEM() to simplify code | expand

Commit Message

Zhen Lei June 3, 2021, 7:49 a.m. UTC
Use DEFINE_RES_MEM() to save a couple of lines of code, which is simpler
and more readable. The start address does not need to appear twice.

Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
 drivers/char/tpm/tpm_tis.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Jarkko Sakkinen June 9, 2021, 12:23 p.m. UTC | #1
On Thu, Jun 03, 2021 at 03:49:55PM +0800, Zhen Lei wrote:
> Use DEFINE_RES_MEM() to save a couple of lines of code, which is simpler
> and more readable. The start address does not need to appear twice.
> 
> Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>


Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

/Jarkko

> ---
>  drivers/char/tpm/tpm_tis.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
> index 4ed6e660273a414..d3f2e5364c275f4 100644
> --- a/drivers/char/tpm/tpm_tis.c
> +++ b/drivers/char/tpm/tpm_tis.c
> @@ -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)
> -- 
> 2.26.0.106.g9fadedd
> 
> 
>
diff mbox series

Patch

diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c
index 4ed6e660273a414..d3f2e5364c275f4 100644
--- a/drivers/char/tpm/tpm_tis.c
+++ b/drivers/char/tpm/tpm_tis.c
@@ -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)