2012-06-07 20:20:33

by Sam Hansen

[permalink] [raw]
Subject: [PATCH 0/3] 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(-)

--
1.7.5.4


2012-06-07 20:20:31

by Sam Hansen

[permalink] [raw]
Subject: [PATCH 1/3] staging: zram: conventions pr_warning -> pr_warn()

Porting zram to use the pr_warn() function instead of the deprecated
pr_warning().

Signed-off-by: Sam Hansen <[email protected]>
---
drivers/staging/zram/zram_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 685d612..55775ce 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -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;
}
--
1.7.5.4

2012-06-07 20:20:58

by Sam Hansen

[permalink] [raw]
Subject: [PATCH 3/3] staging: zram: conventions, line splitting

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 | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 55775ce..8791a09 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -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;
}
--
1.7.5.4

2012-06-07 20:21:16

by Sam Hansen

[permalink] [raw]
Subject: [PATCH 2/3] staging: zram: conventions, __aligned() attribute

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

diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
index fbe8ac9..cda89ec 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/staging/zram/zram_drv.h
@@ -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 */
--
1.7.5.4

2012-06-07 20:28:35

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH 3/3] staging: zram: conventions, line splitting

On Thu, 2012-06-07 at 13:20 -0700, Sam Hansen wrote:
> Opting to violate the 80-char limit in favor of not splitting strings onto
> multiple lines (via pr_info()). This mostly to help readability.
[]
> diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
[]
> @@ -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);

2012-06-07 20:30:56

by Sam Hansen

[permalink] [raw]
Subject: Re: [PATCH 3/3] staging: zram: conventions, line splitting

> 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.

2012-06-07 23:04:32

by Sam Hansen

[permalink] [raw]
Subject: [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().

Signed-off-by: Sam Hansen <[email protected]>
---
drivers/staging/zram/zram_drv.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 685d612..55775ce 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -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;
}
--
1.7.5.4

2012-06-07 23:04:30

by Sam Hansen

[permalink] [raw]
Subject: [PATCH V2 0/3] 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 | 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.
--
1.7.5.4

2012-06-07 23:04:51

by Sam Hansen

[permalink] [raw]
Subject: [PATCH V2 3/3] staging: zram: conventions, line splitting

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

diff --git a/drivers/staging/zram/zram_drv.c b/drivers/staging/zram/zram_drv.c
index 55775ce..6292045 100644
--- a/drivers/staging/zram/zram_drv.c
+++ b/drivers/staging/zram/zram_drv.c
@@ -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;
}
--
1.7.5.4

2012-06-07 23:05:16

by Sam Hansen

[permalink] [raw]
Subject: [PATCH V2 2/3] staging: zram: conventions, __aligned() attribute

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

diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
index fbe8ac9..cda89ec 100644
--- a/drivers/staging/zram/zram_drv.h
+++ b/drivers/staging/zram/zram_drv.h
@@ -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 */
--
1.7.5.4

2012-06-08 07:34:32

by Nitin Gupta

[permalink] [raw]
Subject: Re: [PATCH 1/3] staging: zram: conventions pr_warning -> pr_warn()

On 06/07/2012 01:20 PM, Sam Hansen wrote:

> Porting zram to use the pr_warn() function instead of the deprecated
> pr_warning().
>
> Signed-off-by: Sam Hansen <[email protected]>
> ---
> drivers/staging/zram/zram_drv.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>


Acked-by: Nitin Gupta <[email protected]>

Thanks,
Nitin

2012-06-08 07:37:22

by Nitin Gupta

[permalink] [raw]
Subject: Re: [PATCH 2/3] staging: zram: conventions, __aligned() attribute

On 06/07/2012 01:20 PM, Sam Hansen wrote:

> 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(-)
>
> diff --git a/drivers/staging/zram/zram_drv.h b/drivers/staging/zram/zram_drv.h
> index fbe8ac9..cda89ec 100644
> --- a/drivers/staging/zram/zram_drv.h
> +++ b/drivers/staging/zram/zram_drv.h
> @@ -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

2012-06-08 07:42:29

by Nitin Gupta

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] staging: zram: conventions, line splitting

On 06/07/2012 04:03 PM, Sam Hansen wrote:

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


Acked-by: Nitin Gupta <[email protected]>

Thanks,
Nitin

2012-06-11 18:26:43

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] staging: zram: conventions, line splitting

On Thu, Jun 07, 2012 at 04:03:49PM -0700, Sam Hansen wrote:
> 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 :(

2012-06-11 22:08:15

by Sam Hansen

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] staging: zram: conventions, line splitting

> ?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]>

2012-06-11 22:26:41

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] staging: zram: conventions, line splitting

On Mon, Jun 11, 2012 at 03:08:13PM -0700, Sam Hansen wrote:
> > ?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

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

2012-06-11 22:29:59

by Sam Hansen

[permalink] [raw]
Subject: Re: [PATCH V2 3/3] staging: zram: conventions, line splitting

> 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