On 03/10/2015 09:49 PM, Tao Chen wrote:
Add the {xen-pvscsi: } prefix in pr_fmt and remove DPRINTK, then
replace all DPRINTK with pr_debug.
Also fixed up some comments just as eliminate redundant whitespace
and format the code.
These will make the code easier to read.
Signed-off-by: Tao Chen boby.c...@huawei.com
Reviewed-by: Juergen Gross jgr...@suse.com
---
drivers/xen/xen-scsiback.c | 75 ++
1 file changed, 36 insertions(+), 39 deletions(-)
diff --git a/drivers/xen/xen-scsiback.c b/drivers/xen/xen-scsiback.c
index 9faca6a..d0b0bc5 100644
--- a/drivers/xen/xen-scsiback.c
+++ b/drivers/xen/xen-scsiback.c
@@ -31,6 +31,8 @@
* IN THE SOFTWARE.
*/
+#define pr_fmt(fmt) xen-pvscsi: fmt
+
#include stdarg.h
#include linux/module.h
@@ -69,9 +71,6 @@
#include xen/interface/grant_table.h
#include xen/interface/io/vscsiif.h
-#define DPRINTK(_f, _a...) \
- pr_debug((file=%s, line=%d) _f, __FILE__ , __LINE__ , ## _a)
-
#define VSCSI_VERSION v0.1
#define VSCSI_NAMELEN 32
@@ -271,7 +270,7 @@ static void scsiback_print_status(char *sense_buffer, int
errors,
{
struct scsiback_tpg *tpg = pending_req-v2p-tpg;
- pr_err(xen-pvscsi[%s:%d] cmnd[0]=%02x - st=%02x msg=%02x host=%02x
drv=%02x\n,
+ pr_err([%s:%d] cmnd[0]=%02x - st=%02x msg=%02x host=%02x drv=%02x\n,
tpg-tport-tport_name, pending_req-v2p-lun,
pending_req-cmnd[0], status_byte(errors), msg_byte(errors),
host_byte(errors), driver_byte(errors));
@@ -427,7 +426,7 @@ static int scsiback_gnttab_data_map_batch(struct
gnttab_map_grant_ref *map,
BUG_ON(err);
for (i = 0; i cnt; i++) {
if (unlikely(map[i].status != GNTST_okay)) {
- pr_err(xen-pvscsi: invalid buffer -- could not remap
it\n);
+ pr_err(invalid buffer -- could not remap it\n);
map[i].handle = SCSIBACK_INVALID_HANDLE;
err = -ENOMEM;
} else {
@@ -449,7 +448,7 @@ static int scsiback_gnttab_data_map_list(struct
vscsibk_pend *pending_req,
for (i = 0; i cnt; i++) {
if (get_free_page(pg + mapcount)) {
put_free_pages(pg, mapcount);
- pr_err(xen-pvscsi: no grant page\n);
+ pr_err(no grant page\n);
return -ENOMEM;
}
gnttab_set_map_op(map[mapcount], vaddr_page(pg[mapcount]),
@@ -492,7 +491,7 @@ static int scsiback_gnttab_data_map(struct vscsiif_request
*ring_req,
return 0;
if (nr_segments VSCSIIF_SG_TABLESIZE) {
- DPRINTK(xen-pvscsi: invalid parameter nr_seg = %d\n,
+ pr_debug(invalid parameter nr_seg = %d\n,
ring_req-nr_segments);
return -EINVAL;
}
@@ -516,13 +515,12 @@ static int scsiback_gnttab_data_map(struct
vscsiif_request *ring_req,
nr_segments += n_segs;
}
if (nr_segments SG_ALL) {
- DPRINTK(xen-pvscsi: invalid nr_seg = %d\n,
- nr_segments);
+ pr_debug(invalid nr_seg = %d\n, nr_segments);
return -EINVAL;
}
}
- /* free of (sgl) in fast_flush_area()*/
+ /* free of (sgl) in fast_flush_area() */
pending_req-sgl = kmalloc_array(nr_segments,
sizeof(struct scatterlist), GFP_KERNEL);
if (!pending_req-sgl)
@@ -679,7 +677,8 @@ static int prepare_pending_reqs(struct vscsibk_info *info,
v2p = scsiback_do_translation(info, vir);
if (!v2p) {
pending_req-v2p = NULL;
- DPRINTK(xen-pvscsi: doesn't exist.\n);
+ pr_debug(the v2p of (chn:%d, tgt:%d, lun:%d) doesn't exist.\n,
+ vir.chn, vir.tgt, vir.lun);
return -ENODEV;
}
pending_req-v2p = v2p;
@@ -690,14 +689,14 @@ static int prepare_pending_reqs(struct vscsibk_info *info,
(pending_req-sc_data_direction != DMA_TO_DEVICE)
(pending_req-sc_data_direction != DMA_FROM_DEVICE)
(pending_req-sc_data_direction != DMA_NONE)) {
- DPRINTK(xen-pvscsi: invalid parameter data_dir = %d\n,
+ pr_debug(invalid parameter data_dir = %d\n,
pending_req-sc_data_direction);
return -EINVAL;
}
pending_req-cmd_len = ring_req-cmd_len;
if (pending_req-cmd_len VSCSIIF_MAX_COMMAND_SIZE) {
- DPRINTK(xen-pvscsi: invalid parameter cmd_len = %d\n,
+ pr_debug(invalid parameter cmd_len = %d\n,
pending_req-cmd_len);
return -EINVAL;
}
@@ -721,7 +720,7 @@ static int scsiback_do_cmd_fn(struct