[PATCH 12/14] skd: reorder skd_flush_cmd_[en,de]queue() code

From: Bartlomiej Zolnierkiewicz
Date: Mon Sep 30 2013 - 09:27:34 EST


Reorder placement of skd_flush_cmd_[en,de]queue() functions.
Then remove no longer needed function prototypes.

Cc: Akhil Bhansali <abhansali@xxxxxxxxxxxx>
Cc: Jeff Moyer <jmoyer@xxxxxxxxxx>
Signed-off-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@xxxxxxxxxxx>
Signed-off-by: Kyungmin Park <kyungmin.park@xxxxxxxxxxx>
---
drivers/block/skd_main.c | 61 +++++++++++++++++++++---------------------------
1 file changed, 27 insertions(+), 34 deletions(-)

diff --git a/drivers/block/skd_main.c b/drivers/block/skd_main.c
index c72b0e4..4d8e94c 100644
--- a/drivers/block/skd_main.c
+++ b/drivers/block/skd_main.c
@@ -530,11 +530,6 @@ static void skd_log_skmsg(struct skd_device *skdev,
static void skd_log_skreq(struct skd_device *skdev,
struct skd_request_context *skreq, const char *event);

-/* FLUSH FUA flag handling. */
-static int skd_flush_cmd_enqueue(struct skd_device *, void *);
-static void *skd_flush_cmd_dequeue(struct skd_device *);
-
-
/*
*****************************************************************************
* READ/WRITE REQUESTS
@@ -699,6 +694,33 @@ skd_prep_discard_cdb(struct skd_scsi_request *scsi_req,
}
}

+static int skd_flush_cmd_enqueue(struct skd_device *skdev, void *cmd)
+{
+ struct skd_flush_cmd *item;
+
+ item = kmem_cache_zalloc(skd_flush_slab, GFP_ATOMIC);
+ if (!item) {
+ pr_err("skd_flush_cmd_enqueue: Failed to allocated item.\n");
+ return -ENOMEM;
+ }
+
+ item->cmd = cmd;
+ list_add_tail(&item->flist, &skdev->flush_list);
+ return 0;
+}
+
+static void *skd_flush_cmd_dequeue(struct skd_device *skdev)
+{
+ void *cmd;
+ struct skd_flush_cmd *item;
+
+ item = list_entry(skdev->flush_list.next, struct skd_flush_cmd, flist);
+ list_del_init(&item->flist);
+ cmd = item->cmd;
+ kmem_cache_free(skd_flush_slab, item);
+ return cmd;
+}
+
static void skd_request_fn_not_online(struct request_queue *q);

static void skd_request_fn(struct request_queue *q)
@@ -5743,34 +5765,5 @@ static void __exit skd_exit(void)
kmem_cache_destroy(skd_flush_slab);
}

-static int
-skd_flush_cmd_enqueue(struct skd_device *skdev, void *cmd)
-{
- struct skd_flush_cmd *item;
-
- item = kmem_cache_zalloc(skd_flush_slab, GFP_ATOMIC);
- if (!item) {
- pr_err("skd_flush_cmd_enqueue: Failed to allocated item.\n");
- return -ENOMEM;
- }
-
- item->cmd = cmd;
- list_add_tail(&item->flist, &skdev->flush_list);
- return 0;
-}
-
-static void *
-skd_flush_cmd_dequeue(struct skd_device *skdev)
-{
- void *cmd;
- struct skd_flush_cmd *item;
-
- item = list_entry(skdev->flush_list.next, struct skd_flush_cmd, flist);
- list_del_init(&item->flist);
- cmd = item->cmd;
- kmem_cache_free(skd_flush_slab, item);
- return cmd;
-}
-
module_init(skd_init);
module_exit(skd_exit);
--
1.8.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/