Hi Lauri,
This cleanup series is based on the top of v11 that adds kernel coding
style fixes in the various places without changing the functionality.
Instead of sending a one big patch I've made small patches which are
easier to review, integrate, blame and revert in case of any error.
I've got the reviewed-by tag from the driver owner offline which
is added to the series.
-ck
Chaitanya Kulkarni (9):
n64: use pr_fmt to avoid duplicate string
n64: move module info at the end
n64: move module param at the top
n64: use enums for reg
n64: use sector SECTOR_SHIFT instead 512
n64: remove curly brackets
n64: cosmetics changes
n64: cleanup n64cart_probe()
n64: store dev instance into disk private data
drivers/block/n64cart.c | 87 ++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 49 deletions(-)
--
2.22.1
Move module parameters at the top of the file after macro definition &
global variables below macro definitions just like we have for other
modules.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
@@ -31,6 +27,17 @@ static struct device *dev;#define MIN_ALIGNMENT 8+staticu32__iomem*reg_base;+staticstructdevice*dev;++staticunsignedintstart;+module_param(start,uint,0);+MODULE_PARM_DESC(start,"Start address of the cart block data");++staticunsignedintsize;+module_param(size,uint,0);+MODULE_PARM_DESC(size,"Size of the cart block data, in bytes");+staticvoidn64cart_write_reg(constu8reg,constu32value){writel(value,reg_base+reg);
@@ -177,12 +184,6 @@ static int __init n64cart_init(void)returnplatform_driver_probe(&n64cart_driver,n64cart_probe);}-module_param(start,uint,0);-MODULE_PARM_DESC(start,"Start address of the cart block data");--module_param(size,uint,0);-MODULE_PARM_DESC(size,"Size of the cart block data, in bytes");-module_init(n64cart_init);MODULE_AUTHOR("Lauri Kasanen <cand@gmx.com>");
Make the variable declaration ascending order and initialize the
variables at the time of declaration when possible.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Remove extra braces for the if which has only single statement.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Instead of repeating the n64cart string all over the module use pr_fmt
macro and remove the duplicate string. Also, replace and with or in the
one of the error message.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
@@ -117,12 +118,12 @@ static int __init n64cart_probe(struct platform_device *pdev)structgendisk*disk;if(!start||!size){-pr_err("n64cart: start and size not specified\n");+pr_err("start or size not specified\n");return-ENODEV;}if(size&4095){-pr_err("n64cart: size must be a multiple of 4K\n");+pr_err("size must be a multiple of 4K\n");return-ENODEV;}
Move the module auth, description, and license at the end of the file
just like what we have for the other modules.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
@@ -13,10 +13,6 @@#include<linux/module.h>#include<linux/platform_device.h>-MODULE_AUTHOR("Lauri Kasanen <cand@gmx.com>");-MODULE_DESCRIPTION("Driver for the N64 cart");-MODULE_LICENSE("GPL");-staticunsignedintstart,size;staticu32__iomem*reg_base;staticstructdevice*dev;
@@ -188,3 +184,7 @@ module_param(size, uint, 0);MODULE_PARM_DESC(size,"Size of the cart block data, in bytes");module_init(n64cart_init);++MODULE_AUTHOR("Lauri Kasanen <cand@gmx.com>");+MODULE_DESCRIPTION("Driver for the N64 cart");+MODULE_LICENSE("GPL");
The goto label fail_queue is needed to cleanup the queue allocation
when devm_platform_ioremap_resource() or alloc_disk() fails, either of
these two functions are not dependent on the queue variable which is
allocated prior to these calls.
Allocate the queue variable after successful alloc_disk(). Return
error directly when devm_platform_ioremap_resource() or alloc_disk()
fail. Remove fail_queue label and a call to the blk_cleanup_queue().
Direct return from these two functions allows us to remove the local
variable err and allocating queue after alloc_disk() allows us to
remove the local variable queue so we use disk->queue directly.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 33 +++++++++++----------------------
1 file changed, 11 insertions(+), 22 deletions(-)
The device instance is declared globally. Remove global variable & use
the disk->private_data to store the device instance in the
n64cart_probe() and get the same instance from bio->bi_disk->private
data in n64cart_submit_bio.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Instead of using magic numbers use SECTOR_SHIFT to get the number of
sectors from the size.
Signed-off-by: Chaitanya Kulkarni <redacted>
Reviewed-by: Lauri Kasanen <redacted>
---
drivers/block/n64cart.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Date: 2021-02-21 22:59:19
On Mon, Jan 25, 2021 at 03:32:34PM -0800, Chaitanya Kulkarni wrote:
Hi Lauri,
This cleanup series is based on the top of v11 that adds kernel coding
style fixes in the various places without changing the functionality.
Instead of sending a one big patch I've made small patches which are
easier to review, integrate, blame and revert in case of any error.
I've got the reviewed-by tag from the driver owner offline which
is added to the series.
-ck
Chaitanya Kulkarni (9):
n64: use pr_fmt to avoid duplicate string
n64: move module info at the end
n64: move module param at the top
n64: use enums for reg
n64: use sector SECTOR_SHIFT instead 512
n64: remove curly brackets
n64: cosmetics changes
n64: cleanup n64cart_probe()
n64: store dev instance into disk private data
drivers/block/n64cart.c | 87 ++++++++++++++++++-----------------------
1 file changed, 38 insertions(+), 49 deletions(-)
series applied to mips-next.
Thomas.
--
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea. [ RFC1925, 2.3 ]