diff mbox series

[2/5] srp_daemon: Move the pkey_index_to_pkey() definition

Message ID 20180723164815.26448-3-bart.vanassche@wdc.com (mailing list archive)
State Not Applicable
Headers show
Series srp_daemon: Fix pkey handling | expand

Commit Message

Bart Van Assche July 23, 2018, 4:48 p.m. UTC
This patch does not change any functionality.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
---
 srp_daemon/srp_daemon.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
diff mbox series

Patch

diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 6356e1373f9a..08d1134dca7d 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -793,6 +793,24 @@  static int check_sm_cap(struct umad_resources *umad_res, int *mask_match)
 	return 0;
 }
 
+int pkey_index_to_pkey(struct umad_resources *umad_res, int pkey_index,
+		       uint16_t *pkey)
+{
+	char pkey_file[18], pkey_str[16];
+
+	/* Read pkey */
+	snprintf(pkey_file, sizeof(pkey_file), "pkeys/%d", pkey_index);
+	if (srpd_sys_read_string(umad_res->port_sysfs_path, pkey_file,
+				 pkey_str, sizeof(pkey_str)) < 0)
+		return -1;
+
+	*pkey = strtoul(pkey_str, NULL, 0);
+	if (*pkey)
+		pr_debug("discover Targets for P_key %04x (index %d)\n",
+			 *pkey, pkey_index);
+	return 0;
+}
+
 static int set_class_port_info(struct umad_resources *umad_res, uint16_t dlid)
 {
 	struct srp_ib_user_mad		in_mad, out_mad;
@@ -1071,24 +1089,6 @@  static int get_port_info(struct umad_resources *umad_res, uint16_t dlid,
 	return 0;
 }
 
-int pkey_index_to_pkey(struct umad_resources *umad_res, int pkey_index,
-		       uint16_t *pkey)
-{
-	char pkey_file[18], pkey_str[16];
-
-	/* Read pkey */
-	snprintf(pkey_file, sizeof(pkey_file), "pkeys/%d", pkey_index);
-	if (srpd_sys_read_string(umad_res->port_sysfs_path, pkey_file,
-				 pkey_str, sizeof(pkey_str)) < 0)
-		return -1;
-
-	*pkey = strtoul(pkey_str, NULL, 0);
-	if (*pkey)
-		pr_debug("discover Targets for P_key %04x (index %d)\n",
-			 *pkey, pkey_index);
-	return 0;
-}
-
 static int get_shared_pkeys(struct resources *res,
 			    uint16_t dest_port_lid,
 			    uint16_t *pkeys)