Re: [PATCH 03/23] zfcp: move SG table helper from aux to fc and make them static

2018-11-16 Thread Hannes Reinecke

On 11/8/18 3:44 PM, Steffen Maier wrote:

Since commit 663e0890e31c ("[SCSI] zfcp: remove access control tables
interface") these helper functions are only used for auto port scan in
zfcp_fc.c. Also change them to the corresponding namespace prefix.

This is a small cleanup for the miscellaneous catchall compile unit
zfcp_aux.c.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
  drivers/s390/scsi/zfcp_aux.c | 44 +-
  drivers/s390/scsi/zfcp_fc.c  | 46 ++--
  2 files changed, 45 insertions(+), 45 deletions(-)


Reviewed-by: Hannes Reinecke 

Cheers,

Hannes
--
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)


[PATCH 03/23] zfcp: move SG table helper from aux to fc and make them static

2018-11-08 Thread Steffen Maier
Since commit 663e0890e31c ("[SCSI] zfcp: remove access control tables
interface") these helper functions are only used for auto port scan in
zfcp_fc.c. Also change them to the corresponding namespace prefix.

This is a small cleanup for the miscellaneous catchall compile unit
zfcp_aux.c.

Signed-off-by: Steffen Maier 
Reviewed-by: Benjamin Block 
---
 drivers/s390/scsi/zfcp_aux.c | 44 +-
 drivers/s390/scsi/zfcp_fc.c  | 46 ++--
 2 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 8818a3a290f6..df10f4e07a4a 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -4,7 +4,7 @@
  *
  * Module interface and handling of zfcp data structures.
  *
- * Copyright IBM Corp. 2002, 2013
+ * Copyright IBM Corp. 2002, 2017
  */
 
 /*
@@ -538,45 +538,3 @@ struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter 
*adapter, u64 wwpn,
zfcp_ccw_adapter_put(adapter);
return ERR_PTR(retval);
 }
-
-/**
- * zfcp_sg_free_table - free memory used by scatterlists
- * @sg: pointer to scatterlist
- * @count: number of scatterlist which are to be free'ed
- * the scatterlist are expected to reference pages always
- */
-void zfcp_sg_free_table(struct scatterlist *sg, int count)
-{
-   int i;
-
-   for (i = 0; i < count; i++, sg++)
-   if (sg)
-   free_page((unsigned long) sg_virt(sg));
-   else
-   break;
-}
-
-/**
- * zfcp_sg_setup_table - init scatterlist and allocate, assign buffers
- * @sg: pointer to struct scatterlist
- * @count: number of scatterlists which should be assigned with buffers
- * of size page
- *
- * Returns: 0 on success, -ENOMEM otherwise
- */
-int zfcp_sg_setup_table(struct scatterlist *sg, int count)
-{
-   void *addr;
-   int i;
-
-   sg_init_table(sg, count);
-   for (i = 0; i < count; i++, sg++) {
-   addr = (void *) get_zeroed_page(GFP_KERNEL);
-   if (!addr) {
-   zfcp_sg_free_table(sg, i);
-   return -ENOMEM;
-   }
-   sg_set_buf(sg, addr, PAGE_SIZE);
-   }
-   return 0;
-}
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index f6c415d6ef48..84a9c69cdd56 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -597,6 +597,48 @@ void zfcp_fc_test_link(struct zfcp_port *port)
put_device(>dev);
 }
 
+/**
+ * zfcp_fc_sg_free_table - free memory used by scatterlists
+ * @sg: pointer to scatterlist
+ * @count: number of scatterlist which are to be free'ed
+ * the scatterlist are expected to reference pages always
+ */
+static void zfcp_fc_sg_free_table(struct scatterlist *sg, int count)
+{
+   int i;
+
+   for (i = 0; i < count; i++, sg++)
+   if (sg)
+   free_page((unsigned long) sg_virt(sg));
+   else
+   break;
+}
+
+/**
+ * zfcp_fc_sg_setup_table - init scatterlist and allocate, assign buffers
+ * @sg: pointer to struct scatterlist
+ * @count: number of scatterlists which should be assigned with buffers
+ * of size page
+ *
+ * Returns: 0 on success, -ENOMEM otherwise
+ */
+static int zfcp_fc_sg_setup_table(struct scatterlist *sg, int count)
+{
+   void *addr;
+   int i;
+
+   sg_init_table(sg, count);
+   for (i = 0; i < count; i++, sg++) {
+   addr = (void *) get_zeroed_page(GFP_KERNEL);
+   if (!addr) {
+   zfcp_fc_sg_free_table(sg, i);
+   return -ENOMEM;
+   }
+   sg_set_buf(sg, addr, PAGE_SIZE);
+   }
+   return 0;
+}
+
 static struct zfcp_fc_req *zfcp_fc_alloc_sg_env(int buf_num)
 {
struct zfcp_fc_req *fc_req;
@@ -605,7 +647,7 @@ static struct zfcp_fc_req *zfcp_fc_alloc_sg_env(int buf_num)
if (!fc_req)
return NULL;
 
-   if (zfcp_sg_setup_table(_req->sg_rsp, buf_num)) {
+   if (zfcp_fc_sg_setup_table(_req->sg_rsp, buf_num)) {
kmem_cache_free(zfcp_fc_req_cache, fc_req);
return NULL;
}
@@ -763,7 +805,7 @@ void zfcp_fc_scan_ports(struct work_struct *work)
break;
}
}
-   zfcp_sg_free_table(_req->sg_rsp, buf_num);
+   zfcp_fc_sg_free_table(_req->sg_rsp, buf_num);
kmem_cache_free(zfcp_fc_req_cache, fc_req);
 out:
zfcp_fc_wka_port_put(>gs->ds);
-- 
2.16.4