Styleguide conformity
cover Styleguide conformity
From: Sam Hansen <[email protected]>
This patch set addresses basic checkpatch.pl issues.
Sam Hansen (3):
staging: zram: conventions pr_warning -> pr_warn()
staging: zram: conventions, __aligned() attribute
staging: zram: conventions, line splitting
drivers/staging/zram/zram_drv.c | 14 ++++++-------- drivers/staging/zram/zram_drv.h | 2 +- 2 files changed, 7 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 staging: zram: conventions pr_warning -> pr_warn()
Porting zram to use the pr_warn() function instead of the deprecated pr_warning().
--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/zram/zram_drv.c +4 -4
@@ -724,7 +724,7 @@ static int create_device(struct zram *zram, int device_id) zram->disk =alloc_disk (1 );if (!zram->disk) {blk_cleanup_queue (zram->queue); -pr_warning ("Error allocating disk structure for device %d\n" , +pr_warn ("Error allocating disk structure for device %d\n" , device_id); ret = -ENOMEM ; goto out;
@@ -755,7 +755,7 @@ static int create_device(struct zram *zram, int device_id) ret =sysfs_create_group (&disk_to_dev (zram->disk)->kobj, &zram_disk_attr_group);if (ret <0 ) { -pr_warning ("Error creating sysfs group" ); +pr_warn ("Error creating sysfs group" ); goto out; }
@@ -789,7 +789,7 @@ static int __init zram_init(void)int ret, dev_id;if (num_devices > max_num_devices) { -pr_warning ("Invalid value for num_devices: %u\n" , +pr_warn ("Invalid value for num_devices: %u\n" , num_devices); ret = -EINVAL ; goto out;
@@ -797,7 +797,7 @@ static int __init zram_init(void) zram_major =register_blkdev (0 ,"zram" );if (zram_major <=0 ) { -pr_warning ("Unable to get major number\n" ); +pr_warn ("Unable to get major number\n" ); ret = -EBUSY ; goto out; }
Signature · 1 line
1.7.5.4
Re: [PATCH 1/3] staging: zram: conventions pr_warning -> pr_warn()
Quoted 8 lines · Sam Hansen
Porting zram to use the
pr_warn()function instead of the deprecatedpr_warning().Signed-off-by Sam Hansen <[email protected]>--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
Thanks,
Nitin
PATCH 2/3 staging: zram: conventions, __aligned() attribute
In reply to Sam HansenUsing the __aligned() attribute in favor of __attribute__((aligned(size)))
--- drivers/staging/zram/zram_drv.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/zram/zram_drv.h +1 -1
@@ -85,7 +85,7 @@ struct table {u16 size;/* object size (excluding header) */ u8 count;/* object ref count (not yet used) */ u8 flags; -} __attribute__((aligned(4))); +}__aligned(4) ;struct zram_stats {u64 compr_size;/* compressed size of pages stored */
Signature · 1 line
1.7.5.4
Re: [PATCH 2/3] staging: zram: conventions, __aligned() attribute
Quoted 12 lines · Sam Hansen
Using the
__aligned()attribute in favor of __attribute__((aligned(size)))Signed-off-by Sam Hansen <[email protected]>--- drivers/staging/zram/zram_drv.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/staging/zram/zram_drv.h +0
-0
drivers/staging/zram/zram_drv.h struct table { · line 91
Quoted 8 lines
drivers/staging/zram/zram_drv.h +1
-1@@ -85,7 +85,7 @@ struct table {u16 size;/* object size (excluding header) */ u8 count;/* object ref count (not yet used) */ u8 flags; -} __attribute__((aligned(4))); +}__aligned(4) ;struct zram_stats {u64 compr_size;/* compressed size of pages stored */
I plan to get rid of this table soon (as part of zsmalloc compaction work). So, we can skip any changes to this part of the code.
Thanks,
Nitin
PATCH 3/3 staging: zram: conventions, line splitting
In reply to Sam HansenOpting to violate the 80-char limit in favor of not splitting strings onto multiple lines (via pr_info()). This mostly to help readability.
--- drivers/staging/zram/zram_drv.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/staging/zram/zram_drv.c +2 -4
@@ -390,8 +390,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, clen =PAGE_SIZE ; page_store =alloc_page (GFP_NOIO | __GFP_HIGHMEM);if (unlikely (!page_store)) { -pr_info ("Error allocating memory for " -"incompressible page: %u\n" , index); +pr_info ("Error allocating memory for incompressible page: %u\n" , index); ret = -ENOMEM ; goto out; }
@@ -407,8 +406,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, handle =zs_malloc (zram->mem_pool, clen +sizeof (*zheader));if (!handle) { -pr_info ("Error allocating memory for compressed " -"page: %u, size=%zu\n" , index, clen); +pr_info ("Error allocating memory for compressed page: %u, size=%zu\n" , index, clen); ret = -ENOMEM ; goto out; }
Signature · 1 line
1.7.5.4
Re: [PATCH 3/3] staging: zram: conventions, line splitting
Quoted 2 lines · Sam Hansen
Opting to violate the 80-char limit in favor of not splitting strings onto multiple lines (via
pr_info()). This mostly to help readability.
[]
drivers/staging/zram/zram_drv.c
Quoted 1 line
drivers/staging/zram/zram_drv.c +0
-0
[]
drivers/staging/zram/zram_drv.c static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, · line 393
Quoted 7 lines
drivers/staging/zram/zram_drv.c +1
-2@@ -390,8 +390,7 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, clen =PAGE_SIZE ; page_store =alloc_page (GFP_NOIO | __GFP_HIGHMEM);if (unlikely (!page_store)) { -pr_info ("Error allocating memory for " -"incompressible page: %u\n" , index); +pr_info ("Error allocating memory for incompressible page: %u\n" , index);
Hi Sam.
The general use has been to allow the format string to exceed 80 columns, but not any additional arguments on the same line.
i.e. it's more conformant to use:
pr_info("Error allocating memory for incompressible page: %u\n",
index);Re: [PATCH 3/3] staging: zram: conventions, line splitting
Quoted 2 lines
The general use has been to allow the format string to exceed 80 columns, but not any additional arguments on the same line.
Oh cool. Expect a follow up patch set later on.
v2 cover Styleguide conformity
In reply to Sam HansenFrom: Sam Hansen <[email protected]>
This patch set addresses basic checkpatch.pl issues.
Sam Hansen (3):
staging: zram: conventions pr_warning -> pr_warn()
staging: zram: conventions, __aligned() attribute
staging: zram: conventions, line splitting
drivers/staging/zram/zram_drv.c | 16 ++++++++-------- drivers/staging/zram/zram_drv.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-)
V2 - Moving arguments for pr_info() to the next line.
Signature · 1 line
1.7.5.4
PATCH v2 1/3 staging: zram: conventions pr_warning -> pr_warn()
Porting zram to use the pr_warn() function instead of the deprecated pr_warning().
--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/zram/zram_drv.c +4 -4
@@ -724,7 +724,7 @@ static int create_device(struct zram *zram, int device_id) zram->disk =alloc_disk (1 );if (!zram->disk) {blk_cleanup_queue (zram->queue); -pr_warning ("Error allocating disk structure for device %d\n" , +pr_warn ("Error allocating disk structure for device %d\n" , device_id); ret = -ENOMEM ; goto out;
@@ -755,7 +755,7 @@ static int create_device(struct zram *zram, int device_id) ret =sysfs_create_group (&disk_to_dev (zram->disk)->kobj, &zram_disk_attr_group);if (ret <0 ) { -pr_warning ("Error creating sysfs group" ); +pr_warn ("Error creating sysfs group" ); goto out; }
@@ -789,7 +789,7 @@ static int __init zram_init(void)int ret, dev_id;if (num_devices > max_num_devices) { -pr_warning ("Invalid value for num_devices: %u\n" , +pr_warn ("Invalid value for num_devices: %u\n" , num_devices); ret = -EINVAL ; goto out;
@@ -797,7 +797,7 @@ static int __init zram_init(void) zram_major =register_blkdev (0 ,"zram" );if (zram_major <=0 ) { -pr_warning ("Unable to get major number\n" ); +pr_warn ("Unable to get major number\n" ); ret = -EBUSY ; goto out; }
Signature · 1 line
1.7.5.4
PATCH v2 2/3 staging: zram: conventions, __aligned() attribute
In reply to Sam HansenUsing the __aligned() attribute in favor of __attribute__((aligned(size)))
--- drivers/staging/zram/zram_drv.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/staging/zram/zram_drv.h +1 -1
@@ -85,7 +85,7 @@ struct table {u16 size;/* object size (excluding header) */ u8 count;/* object ref count (not yet used) */ u8 flags; -} __attribute__((aligned(4))); +}__aligned(4) ;struct zram_stats {u64 compr_size;/* compressed size of pages stored */
Signature · 1 line
1.7.5.4
PATCH v2 3/3 staging: zram: conventions, line splitting
In reply to Sam HansenOpting to violate the 80-char limit in favor of not splitting strings onto multiple lines (via pr_info()). This mostly to help readability.
--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/zram/zram_drv.c +4 -4
@@ -390,8 +390,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, clen =PAGE_SIZE ; page_store =alloc_page (GFP_NOIO | __GFP_HIGHMEM);if (unlikely (!page_store)) { -pr_info ("Error allocating memory for " -"incompressible page: %u\n" , index); +pr_info ("Error allocating memory for incompressible page: %u\n" , + index); ret = -ENOMEM ; goto out; }
@@ -407,8 +407,8 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index, handle =zs_malloc (zram->mem_pool, clen +sizeof (*zheader));if (!handle) { -pr_info ("Error allocating memory for compressed " -"page: %u, size=%zu\n" , index, clen); +pr_info ("Error allocating memory for compressed page: %u, size=%zu\n" , + index, clen); ret = -ENOMEM ; goto out; }
Signature · 1 line
1.7.5.4
Re: [PATCH V2 3/3] staging: zram: conventions, line splitting
Quoted 8 lines · Sam Hansen
Opting to violate the 80-char limit in favor of not splitting strings onto multiple lines (via
pr_info()). This mostly to help readability.Signed-off-by Sam Hansen <[email protected]>--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
Thanks,
Nitin
Greg Kroah-Hartman
maintainerRe: [PATCH V2 3/3] staging: zram: conventions, line splitting
In reply to Sam HansenQuoted 8 lines · Sam Hansen
Opting to violate the 80-char limit in favor of not splitting strings onto multiple lines (via
pr_info()). This mostly to help readability.Signed-off-by Sam Hansen <[email protected]>Acked-by Nitin Gupta <[email protected]>--- drivers/staging/zram/zram_drv.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
This patch no longer applies to the tree :(
Re: [PATCH V2 3/3] staging: zram: conventions, line splitting
Quoted 4 lines
drivers/staging/zram/zram_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)This patch no longer applies to the tree :(
Hi Greg,
I wrote the patch against Linus' tree
<http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git>.
Is it more appropriate to write code against your staging tree
<http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git>?
Have I been writing code against the wrong tree? If so, I'm a huge tool and sorry for the confusion :p
I'm also doing a huge cleanup of the wan-pmc drivers (cxt1e1) and will port over to your repo if necessary.
Thanks!
-sam
<[email protected]>
Greg Kroah-Hartman
maintainerRe: [PATCH V2 3/3] staging: zram: conventions, line splitting
Quoted 5 lines · Sam Hansen
Quoted 4 lines
drivers/staging/zram/zram_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)This patch no longer applies to the tree :(
Quoted 8 lines
Hi Greg,
I wrote the patch against Linus' tree
<http://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git>.
Is it more appropriate to write code against your staging tree
<http://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git>?Have I been writing code against the wrong tree? If so, I'm a huge tool and sorry for the confusion :p
Problem is, other zram changes just went into my tree, so they probably conflicted with your changes as well.
So yes, it's best to work against my staging-next branch for coding style cleanups, or the linux-next tree, either should be fine.
thanks,
greg k-h
Re: [PATCH V2 3/3] staging: zram: conventions, line splitting
Quoted 2 lines
Problem is, other zram changes just went into my tree, so they probably conflicted with your changes as well.
Ok cool. I was assuming me and someone else simply clobbered each others work. I try and keep an eye on the mailing lists to avoid duplicating work and causing a merge conflict. Thanks for the feedback, it's appreciated!
-sam