All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
To: linux-block@vger.kernel.org
Cc: axboe@kernel.dk, Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Subject: [RFC PATCH 08/20] loop: use uniform function header style
Date: Mon,  1 Feb 2021 21:35:40 -0800	[thread overview]
Message-ID: <20210202053552.4844-9-chaitanya.kulkarni@wdc.com> (raw)
In-Reply-To: <20210202053552.4844-1-chaitanya.kulkarni@wdc.com>

There are two different styles present in the code right now, that
creates a confusion for a new developer on which style to follow. Since
this is a block driver follow common coding style for the function
header than having return type on the separate line and align the
function parameters to the end of the function name.

No functional change in this patch.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
 drivers/block/loop.c | 85 +++++++++++++++++++++-----------------------
 1 file changed, 40 insertions(+), 45 deletions(-)

diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index c4458b3f1dab..b0a8d5b0641f 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -232,8 +232,7 @@ static void __loop_update_dio(struct loop_device *lo, bool dio)
  * loop_validate_block_size() - validates the passed in block size
  * @bsize: size to validate
  */
-static int
-loop_validate_block_size(unsigned short bsize)
+static int loop_validate_block_size(unsigned short bsize)
 {
 	if (bsize < 512 || bsize > PAGE_SIZE || !is_power_of_2(bsize))
 		return -EINVAL;
@@ -255,11 +254,10 @@ static void loop_set_size(struct loop_device *lo, loff_t size)
 		kobject_uevent(&disk_to_dev(lo->lo_disk)->kobj, KOBJ_CHANGE);
 }
 
-static inline int
-lo_do_transfer(struct loop_device *lo, int cmd,
-	       struct page *rpage, unsigned roffs,
-	       struct page *lpage, unsigned loffs,
-	       int size, sector_t rblock)
+static inline int lo_do_transfer(struct loop_device *lo, int cmd,
+				 struct page *rpage, unsigned roffs,
+				 struct page *lpage, unsigned loffs,
+				 int size, sector_t rblock)
 {
 	int ret;
 
@@ -296,7 +294,7 @@ static int lo_write_bvec(struct file *file, struct bio_vec *bvec, loff_t *ppos)
 }
 
 static int lo_write_simple(struct loop_device *lo, struct request *rq,
-		loff_t pos)
+			   loff_t pos)
 {
 	struct bio_vec bvec;
 	struct req_iterator iter;
@@ -318,7 +316,7 @@ static int lo_write_simple(struct loop_device *lo, struct request *rq,
  * access to the destination pages of the backing file.
  */
 static int lo_write_transfer(struct loop_device *lo, struct request *rq,
-		loff_t pos)
+			     loff_t pos)
 {
 	struct bio_vec bvec, b;
 	struct req_iterator iter;
@@ -348,7 +346,7 @@ static int lo_write_transfer(struct loop_device *lo, struct request *rq,
 }
 
 static int lo_read_simple(struct loop_device *lo, struct request *rq,
-		loff_t pos)
+			  loff_t pos)
 {
 	struct bio_vec bvec;
 	struct req_iterator iter;
@@ -377,7 +375,7 @@ static int lo_read_simple(struct loop_device *lo, struct request *rq,
 }
 
 static int lo_read_transfer(struct loop_device *lo, struct request *rq,
-		loff_t pos)
+			    loff_t pos)
 {
 	struct bio_vec bvec, b;
 	struct req_iterator iter;
@@ -964,8 +962,7 @@ static void loop_update_rotational(struct loop_device *lo)
 		blk_queue_flag_clear(QUEUE_FLAG_NONROT, q);
 }
 
-static int
-loop_release_xfer(struct loop_device *lo)
+static int loop_release_xfer(struct loop_device *lo)
 {
 	int err = 0;
 	struct loop_func_table *xfer = lo->lo_encryption;
@@ -980,9 +977,8 @@ loop_release_xfer(struct loop_device *lo)
 	return err;
 }
 
-static int
-loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
-	       const struct loop_info64 *i)
+static int loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
+			  const struct loop_info64 *i)
 {
 	int err = 0;
 
@@ -1009,9 +1005,8 @@ loop_init_xfer(struct loop_device *lo, struct loop_func_table *xfer,
  * Configures the loop device parameters according to the passed
  * in loop_info64 configuration.
  */
-static int
-loop_set_status_from_info(struct loop_device *lo,
-			  const struct loop_info64 *info)
+static int loop_set_status_from_info(struct loop_device *lo,
+				     const struct loop_info64 *info)
 {
 	int err;
 	struct loop_func_table *xfer;
@@ -1336,8 +1331,8 @@ static int loop_clr_fd(struct loop_device *lo)
 	return __loop_clr_fd(lo, false);
 }
 
-static int
-loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
+static int loop_set_status(struct loop_device *lo,
+			   const struct loop_info64 *info)
 {
 	int err;
 	struct block_device *bdev;
@@ -1420,8 +1415,8 @@ loop_set_status(struct loop_device *lo, const struct loop_info64 *info)
 	return err;
 }
 
-static int
-loop_get_status(struct loop_device *lo, struct loop_info64 *info)
+static int loop_get_status(struct loop_device *lo,
+			   struct loop_info64 *info)
 {
 	struct path path;
 	struct kstat stat;
@@ -1464,8 +1459,8 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info)
 	return ret;
 }
 
-static void
-loop_info64_from_old(const struct loop_info *info, struct loop_info64 *info64)
+static void loop_info64_from_old(const struct loop_info *info,
+				 struct loop_info64 *info64)
 {
 	memset(info64, 0, sizeof(*info64));
 	info64->lo_number = info->lo_number;
@@ -1486,8 +1481,8 @@ loop_info64_from_old(const struct loop_info *info, struct loop_info64 *info64)
 	memcpy(info64->lo_encrypt_key, info->lo_encrypt_key, LO_KEY_SIZE);
 }
 
-static int
-loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info)
+static int loop_info64_to_old(const struct loop_info64 *info64,
+			      struct loop_info *info)
 {
 	memset(info, 0, sizeof(*info));
 	info->lo_number = info64->lo_number;
@@ -1516,8 +1511,8 @@ loop_info64_to_old(const struct loop_info64 *info64, struct loop_info *info)
 	return 0;
 }
 
-static int
-loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg)
+static int loop_set_status_old(struct loop_device *lo,
+			       const struct loop_info __user *arg)
 {
 	struct loop_info info;
 	struct loop_info64 info64;
@@ -1528,8 +1523,8 @@ loop_set_status_old(struct loop_device *lo, const struct loop_info __user *arg)
 	return loop_set_status(lo, &info64);
 }
 
-static int
-loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg)
+static int loop_set_status64(struct loop_device *lo,
+			     const struct loop_info64 __user *arg)
 {
 	struct loop_info64 info64;
 
@@ -1538,8 +1533,9 @@ loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg)
 	return loop_set_status(lo, &info64);
 }
 
-static int
-loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) {
+static int loop_get_status_old(struct loop_device *lo,
+			       struct loop_info __user *arg)
+{
 	struct loop_info info;
 	struct loop_info64 info64;
 	int err;
@@ -1555,8 +1551,9 @@ loop_get_status_old(struct loop_device *lo, struct loop_info __user *arg) {
 	return err;
 }
 
-static int
-loop_get_status64(struct loop_device *lo, struct loop_info64 __user *arg) {
+static int loop_get_status64(struct loop_device *lo,
+			     struct loop_info64 __user *arg)
+{
 	struct loop_info64 info64;
 	int err;
 
@@ -1660,8 +1657,8 @@ static int lo_simple_ioctl(struct loop_device *lo, unsigned int cmd,
 	return err;
 }
 
-static int lo_ioctl(struct block_device *bdev, fmode_t mode,
-	unsigned int cmd, unsigned long arg)
+static int lo_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd,
+		    unsigned long arg)
 {
 	struct loop_device *lo = bdev->bd_disk->private_data;
 	void __user *argp = (void __user *) arg;
@@ -1813,9 +1810,8 @@ loop_info64_to_compat(const struct loop_info64 *info64,
 	return 0;
 }
 
-static int
-loop_set_status_compat(struct loop_device *lo,
-		       const struct compat_loop_info __user *arg)
+static int loop_set_status_compat(struct loop_device *lo,
+				 const struct compat_loop_info __user *arg)
 {
 	struct loop_info64 info64;
 	int ret;
@@ -1826,9 +1822,8 @@ loop_set_status_compat(struct loop_device *lo,
 	return loop_set_status(lo, &info64);
 }
 
-static int
-loop_get_status_compat(struct loop_device *lo,
-		       struct compat_loop_info __user *arg)
+static int loop_get_status_compat(struct loop_device *lo,
+				  struct compat_loop_info __user *arg)
 {
 	struct loop_info64 info64;
 	int err;
@@ -1999,7 +1994,7 @@ EXPORT_SYMBOL(loop_register_transfer);
 EXPORT_SYMBOL(loop_unregister_transfer);
 
 static blk_status_t loop_queue_rq(struct blk_mq_hw_ctx *hctx,
-		const struct blk_mq_queue_data *bd)
+				  const struct blk_mq_queue_data *bd)
 {
 	struct request *rq = bd->rq;
 	struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq);
@@ -2068,7 +2063,7 @@ static void loop_queue_work(struct kthread_work *work)
 }
 
 static int loop_init_request(struct blk_mq_tag_set *set, struct request *rq,
-		unsigned int hctx_idx, unsigned int numa_node)
+			     unsigned int hctx_idx, unsigned int numa_node)
 {
 	struct loop_cmd *cmd = blk_mq_rq_to_pdu(rq);
 
-- 
2.22.1


  parent reply	other threads:[~2021-02-02  5:38 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02  5:35 [RFC PATCH 00/20] loop: cleanup and small improvement Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 01/20] loop: use uniform alignment for struct members Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 02/20] loop: add lockdep assert in loop_add() Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 03/20] loop: add lockdep assert in loop_lookup() Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 04/20] loop: allow user to set the queue depth Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 05/20] loop: use snprintf for XXX_show() Chaitanya Kulkarni
2021-02-02 11:05   ` Johannes Thumshirn
2021-02-02 19:56     ` Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 06/20] loop: add newline after variable declaration Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 07/20] loop: use uniform variable declaration style Chaitanya Kulkarni
2021-02-02  5:35 ` Chaitanya Kulkarni [this message]
2021-02-02  5:35 ` [RFC PATCH 09/20] loop: remove extra variable in lo_fallocate() Chaitanya Kulkarni
2021-02-02 11:50   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 10/20] loop: remove extra variable in lo_req_flush Chaitanya Kulkarni
2021-02-02 11:50   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 11/20] loop: remove local variable in lo_compat_ioctl Chaitanya Kulkarni
2021-02-02 11:52   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 12/20] loop: cleanup lo_ioctl() Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 13/20] loop: remove memset in info64 to compat Chaitanya Kulkarni
2021-02-02 11:55   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 14/20] loop: remove memset in info64 from compat Chaitanya Kulkarni
2021-02-02 11:55   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 15/20] loop: remove memset in loop_info64_from_old() Chaitanya Kulkarni
2021-02-02 11:58   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 16/20] loop: remove memset in loop_info64_to_old() Chaitanya Kulkarni
2021-02-02 11:59   ` Johannes Thumshirn
2021-02-02  5:35 ` [RFC PATCH 17/20] loop: change fd set err at actual error condition Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 18/20] loop: configure " Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 19/20] loop: set error value in case of actual error Chaitanya Kulkarni
2021-02-02  5:35 ` [RFC PATCH 20/20] loop: remove the extra line in declaration Chaitanya Kulkarni
2021-02-02 12:07   ` Johannes Thumshirn

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=20210202053552.4844-9-chaitanya.kulkarni@wdc.com \
    --to=chaitanya.kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=linux-block@vger.kernel.org \
    /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.