From: "Pranay Kr. Srivastava" <pranjas@gmail.com>
To: mpa@pengutronix.de, nbd-general@lists.sourceforge.net,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org
Cc: "Pranay Kr. Srivastava" <pranjas@gmail.com>
Subject: [PATCH v2 2/2] nbd: Fix checkpatch errors.
Date: Tue, 3 May 2016 19:38:27 +0300 [thread overview]
Message-ID: <1462293507-5010-3-git-send-email-pranjas@gmail.com> (raw)
In-Reply-To: <1462293507-5010-1-git-send-email-pranjas@gmail.com>
Signed-off-by: Pranay Kr. Srivastava <pranjas@gmail.com>
---
drivers/block/nbd.c | 33 ++++++++++++++++++---------------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index c79bcd7..9ab3a27 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -3,7 +3,7 @@
*
* Note that you can not swap over this thing, yet. Seems to work but
* deadlocks sometimes - you can not swap over TCP in general.
- *
+ *
* Copyright 1997-2000, 2008 Pavel Machek <pavel@ucw.cz>
* Parts copyright 2001 Steven Whitehouse <steve@chygwyn.com>
*
@@ -35,14 +35,14 @@
#include <linux/types.h>
#include <linux/debugfs.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include <asm/types.h>
#include <linux/nbd.h>
struct nbd_device {
u32 flags;
- struct socket * sock; /* If == NULL, device is not ready, yet */
+ struct socket *sock; /* If == NULL, device is not ready, yet */
int magic;
spinlock_t queue_lock;
@@ -257,6 +257,7 @@ static inline int sock_send_bvec(struct nbd_device *nbd, struct bio_vec *bvec,
{
int result;
void *kaddr = kmap(bvec->bv_page);
+
result = sock_xmit(nbd, 1, kaddr + bvec->bv_offset,
bvec->bv_len, flags);
kunmap(bvec->bv_page);
@@ -354,6 +355,7 @@ static inline int sock_recv_bvec(struct nbd_device *nbd, struct bio_vec *bvec)
{
int result;
void *kaddr = kmap(bvec->bv_page);
+
result = sock_xmit(nbd, 0, kaddr + bvec->bv_offset, bvec->bv_len,
MSG_WAITALL);
kunmap(bvec->bv_page);
@@ -585,8 +587,7 @@ static int nbd_thread_send(void *data)
nbd_send_req(nbd, &sreq);
mutex_unlock(&nbd->tx_lock);
dev_err(disk_to_dev(nbd->disk),
- "Device Timeout occured.Shutting down"
- " socket.");
+ "Device Timeout occured.Shutting down socket.");
}
mutex_unlock(&nbd->sock_lock);
sock_shutdown(nbd);
@@ -616,8 +617,8 @@ static int nbd_thread_send(void *data)
}
/*
- * We always wait for result of write, for now. It would be nice to make it optional
- * in future
+ * We always wait for result of write, for now. It would be nice to make it
+ * optional in future
* if ((rq_data_dir(req) == WRITE) && (nbd->flags & NBD_WRITE_NOCHK))
* { printk( "Warning: Ignoring result!\n"); nbd_end_request( req ); }
*/
@@ -626,7 +627,7 @@ static void nbd_request_handler(struct request_queue *q)
__releases(q->queue_lock) __acquires(q->queue_lock)
{
struct request *req;
-
+
while ((req = blk_fetch_request(q)) != NULL) {
struct nbd_device *nbd;
@@ -744,7 +745,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
nbd_send_req(nbd, &sreq);
return 0;
}
-
+
case NBD_CLEAR_SOCK:
sock_shutdown(nbd);
nbd_clear_que(nbd);
@@ -869,8 +870,7 @@ static int nbd_ioctl(struct block_device *bdev, fmode_t mode,
return error;
}
-static const struct block_device_operations nbd_fops =
-{
+static const struct block_device_operations nbd_fops = {
.owner = THIS_MODULE,
.ioctl = nbd_ioctl,
.compat_ioctl = nbd_ioctl,
@@ -1005,7 +1005,7 @@ static void nbd_dbg_close(void)
#endif
/*
- * And here should be modules and kernel interface
+ * And here should be modules and kernel interface
* (Just smiley confuses emacs :-)
*/
@@ -1018,7 +1018,7 @@ static int __init nbd_init(void)
BUILD_BUG_ON(sizeof(struct nbd_request) != 28);
if (max_part < 0) {
- printk(KERN_ERR "nbd: max_part must be >= 0\n");
+ pr_err("nbd: max_part must be >= 0\n");
return -EINVAL;
}
@@ -1049,6 +1049,7 @@ static int __init nbd_init(void)
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = alloc_disk(1 << part_shift);
+
if (!disk)
goto out;
nbd_dev[i].disk = disk;
@@ -1079,12 +1080,13 @@ static int __init nbd_init(void)
goto out;
}
- printk(KERN_INFO "nbd: registered device at major %d\n", NBD_MAJOR);
+ pr_info("nbd: registered device at major %d\n", NBD_MAJOR);
nbd_dbg_init();
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = nbd_dev[i].disk;
+
nbd_dev[i].magic = NBD_MAGIC;
INIT_LIST_HEAD(&nbd_dev[i].waiting_queue);
spin_lock_init(&nbd_dev[i].queue_lock);
@@ -1123,6 +1125,7 @@ static void __exit nbd_cleanup(void)
for (i = 0; i < nbds_max; i++) {
struct gendisk *disk = nbd_dev[i].disk;
+
nbd_dev[i].magic = 0;
if (disk) {
del_gendisk(disk);
@@ -1132,7 +1135,7 @@ static void __exit nbd_cleanup(void)
}
unregister_blkdev(NBD_MAJOR, "nbd");
kfree(nbd_dev);
- printk(KERN_INFO "nbd: unregistered device at major %d\n", NBD_MAJOR);
+ pr_info("nbd: unregistered device at major %d\n", NBD_MAJOR);
}
module_init(nbd_init);
--
2.6.2
next prev parent reply other threads:[~2016-05-03 16:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-03 16:38 [PATCH v2 0/2] nbd: fix might_sleep warning and checkpatch fixes Pranay Kr. Srivastava
2016-05-03 16:38 ` [PATCH v2 1/2] nbd: Fix might_sleep warning on xmit timeout Pranay Kr. Srivastava
2016-05-03 16:38 ` Pranay Kr. Srivastava [this message]
2016-05-03 18:16 ` [PATCH v2 2/2] nbd: Fix checkpatch errors Greg KH
2016-06-02 1:03 ` Pavel Machek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1462293507-5010-3-git-send-email-pranjas@gmail.com \
--to=pranjas@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mpa@pengutronix.de \
--cc=nbd-general@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.