diff mbox series

[net-next,2/4] s390/ism: Cleanups

Message ID 20220725141000.70347-3-wenjia@linux.ibm.com (mailing list archive)
State Accepted
Commit 0a2f4f9893c83bd722bd55a903fb682da2eb24ba
Delegated to: Netdev Maintainers
Headers show
Series net/smc: updates 2022-7-25 | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 6 maintainers not CCed: gor@linux.ibm.com borntraeger@linux.ibm.com pabeni@redhat.com agordeev@linux.ibm.com edumazet@google.com svens@linux.ibm.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch fail ERROR: Unrecognized email address: 'Wenjia Zhang < wenjia@linux.ibm.com>'
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Wenjia Zhang July 25, 2022, 2:09 p.m. UTC
From: Stefan Raspl <raspl@linux.ibm.com>

Reworked signature of the function to retrieve the system EID: No plausible
reason to use a double pointer. And neither to pass in the device as an
argument, as this identifier is by definition per system, not per device.
Plus some minor consistency edits.

Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
Signed-off-by: Wenjia Zhang < wenjia@linux.ibm.com>
---
 drivers/s390/net/ism_drv.c | 11 +++++------
 include/net/smc.h          |  2 +-
 net/smc/smc_ism.c          |  2 +-
 3 files changed, 7 insertions(+), 8 deletions(-)

Comments

Tony Lu July 26, 2022, 3:13 a.m. UTC | #1
On Mon, Jul 25, 2022 at 04:09:58PM +0200, Wenjia Zhang wrote:
> From: Stefan Raspl <raspl@linux.ibm.com>
> 
> Reworked signature of the function to retrieve the system EID: No plausible
> reason to use a double pointer. And neither to pass in the device as an
> argument, as this identifier is by definition per system, not per device.
> Plus some minor consistency edits.
> 
> Signed-off-by: Stefan Raspl <raspl@linux.ibm.com>
> Signed-off-by: Wenjia Zhang < wenjia@linux.ibm.com>

LGTM.

Reviewed-by: Tony Lu <tonylu@linux.alibaba.com>

> ---
>  drivers/s390/net/ism_drv.c | 11 +++++------
>  include/net/smc.h          |  2 +-
>  net/smc/smc_ism.c          |  2 +-
>  3 files changed, 7 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
> index 5f7e28de8b15..4665e9a0e048 100644
> --- a/drivers/s390/net/ism_drv.c
> +++ b/drivers/s390/net/ism_drv.c
> @@ -409,20 +409,19 @@ static void ism_create_system_eid(void)
>  	memcpy(&SYSTEM_EID.type, tmp, 4);
>  }
>  
> -static void ism_get_system_eid(struct smcd_dev *smcd, u8 **eid)
> +static u8 *ism_get_system_eid(void)
>  {
> -	*eid = &SYSTEM_EID.seid_string[0];
> +	return SYSTEM_EID.seid_string;
>  }
>  
>  static u16 ism_get_chid(struct smcd_dev *smcd)
>  {
> -	struct ism_dev *ismdev;
> +	struct ism_dev *ism = (struct ism_dev *)smcd->priv;
>  
> -	ismdev = (struct ism_dev *)smcd->priv;
> -	if (!ismdev || !ismdev->pdev)
> +	if (!ism || !ism->pdev)
>  		return 0;
>  
> -	return to_zpci(ismdev->pdev)->pchid;
> +	return to_zpci(ism->pdev)->pchid;
>  }
>  
>  static void ism_handle_event(struct ism_dev *ism)
> diff --git a/include/net/smc.h b/include/net/smc.h
> index 37f829d9c6e5..1868a5014dea 100644
> --- a/include/net/smc.h
> +++ b/include/net/smc.h
> @@ -72,7 +72,7 @@ struct smcd_ops {
>  	int (*move_data)(struct smcd_dev *dev, u64 dmb_tok, unsigned int idx,
>  			 bool sf, unsigned int offset, void *data,
>  			 unsigned int size);
> -	void (*get_system_eid)(struct smcd_dev *dev, u8 **eid);
> +	u8* (*get_system_eid)(void);
>  	u16 (*get_chid)(struct smcd_dev *dev);
>  };
>  
> diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
> index c656ef25ee4b..e51c0cdff8e0 100644
> --- a/net/smc/smc_ism.c
> +++ b/net/smc/smc_ism.c
> @@ -429,7 +429,7 @@ int smcd_register_dev(struct smcd_dev *smcd)
>  	if (list_empty(&smcd_dev_list.list)) {
>  		u8 *system_eid = NULL;
>  
> -		smcd->ops->get_system_eid(smcd, &system_eid);
> +		system_eid = smcd->ops->get_system_eid();
>  		if (system_eid[24] != '0' || system_eid[28] != '0') {
>  			smc_ism_v2_capable = true;
>  			memcpy(smc_ism_v2_system_eid, system_eid,
> -- 
> 2.35.2
diff mbox series

Patch

diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c
index 5f7e28de8b15..4665e9a0e048 100644
--- a/drivers/s390/net/ism_drv.c
+++ b/drivers/s390/net/ism_drv.c
@@ -409,20 +409,19 @@  static void ism_create_system_eid(void)
 	memcpy(&SYSTEM_EID.type, tmp, 4);
 }
 
-static void ism_get_system_eid(struct smcd_dev *smcd, u8 **eid)
+static u8 *ism_get_system_eid(void)
 {
-	*eid = &SYSTEM_EID.seid_string[0];
+	return SYSTEM_EID.seid_string;
 }
 
 static u16 ism_get_chid(struct smcd_dev *smcd)
 {
-	struct ism_dev *ismdev;
+	struct ism_dev *ism = (struct ism_dev *)smcd->priv;
 
-	ismdev = (struct ism_dev *)smcd->priv;
-	if (!ismdev || !ismdev->pdev)
+	if (!ism || !ism->pdev)
 		return 0;
 
-	return to_zpci(ismdev->pdev)->pchid;
+	return to_zpci(ism->pdev)->pchid;
 }
 
 static void ism_handle_event(struct ism_dev *ism)
diff --git a/include/net/smc.h b/include/net/smc.h
index 37f829d9c6e5..1868a5014dea 100644
--- a/include/net/smc.h
+++ b/include/net/smc.h
@@ -72,7 +72,7 @@  struct smcd_ops {
 	int (*move_data)(struct smcd_dev *dev, u64 dmb_tok, unsigned int idx,
 			 bool sf, unsigned int offset, void *data,
 			 unsigned int size);
-	void (*get_system_eid)(struct smcd_dev *dev, u8 **eid);
+	u8* (*get_system_eid)(void);
 	u16 (*get_chid)(struct smcd_dev *dev);
 };
 
diff --git a/net/smc/smc_ism.c b/net/smc/smc_ism.c
index c656ef25ee4b..e51c0cdff8e0 100644
--- a/net/smc/smc_ism.c
+++ b/net/smc/smc_ism.c
@@ -429,7 +429,7 @@  int smcd_register_dev(struct smcd_dev *smcd)
 	if (list_empty(&smcd_dev_list.list)) {
 		u8 *system_eid = NULL;
 
-		smcd->ops->get_system_eid(smcd, &system_eid);
+		system_eid = smcd->ops->get_system_eid();
 		if (system_eid[24] != '0' || system_eid[28] != '0') {
 			smc_ism_v2_capable = true;
 			memcpy(smc_ism_v2_system_eid, system_eid,