@@ -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);
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(-)