* [PATCH] Staging: dream: pmem: fix some code style issues
@ 2010-04-10 19:14 Chihau Chau
2010-04-10 20:47 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Chihau Chau @ 2010-04-10 19:14 UTC (permalink / raw)
To: gregkh; +Cc: pavel, jochen.maes, devel, linux-kernel, Chihau Chau
From: Chihau Chau <chihau@gmail.com>
This fixes some code style issues like prohibited spaces after that open
parenthesis '(' and before that close parenthesis ')', and lines over 80
characters.
Signed-off-by: Chihau Chau <chihau@gmail.com>
---
drivers/staging/dream/pmem.c | 22 +++++++++++-----------
1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/dream/pmem.c b/drivers/staging/dream/pmem.c
index 503ba21..3e4dd21 100644
--- a/drivers/staging/dream/pmem.c
+++ b/drivers/staging/dream/pmem.c
@@ -37,17 +37,17 @@
* the file should not be released until put_pmem_file is called */
#define PMEM_FLAGS_BUSY 0x1
/* indicates that this is a suballocation of a larger master range */
-#define PMEM_FLAGS_CONNECTED ( 0x1 << 1 )
+#define PMEM_FLAGS_CONNECTED (0x1 << 1)
/* indicates this is a master and not a sub allocation and that it is mmaped */
-#define PMEM_FLAGS_MASTERMAP ( 0x1 << 2 )
+#define PMEM_FLAGS_MASTERMAP (0x1 << 2)
/* submap and unsubmap flags indicate:
* 00: subregion has never been mmaped
* 10: subregion has been mmaped, reference to the mm was taken
* 11: subretion has ben released, refernece to the mm still held
* 01: subretion has been released, reference to the mm has been released
*/
-#define PMEM_FLAGS_SUBMAP ( 0x1 << 3 )
-#define PMEM_FLAGS_UNSUBMAP ( 0x1 << 4 )
+#define PMEM_FLAGS_SUBMAP (0x1 << 3)
+#define PMEM_FLAGS_UNSUBMAP (0x1 << 4)
struct pmem_data {
@@ -152,7 +152,7 @@ struct pmem_info {
static struct pmem_info pmem[PMEM_MAX_DEVICES];
static int id_count;
-#define PMEM_IS_FREE(id, index) ( !(pmem[id].bitmap[index].allocated) )
+#define PMEM_IS_FREE(id, index) (!(pmem[id].bitmap[index].allocated))
#define PMEM_ORDER(id, index) pmem[id].bitmap[index].order
#define PMEM_BUDDY_INDEX(id, index) (index ^ (1 << PMEM_ORDER(id, index)))
#define PMEM_NEXT_INDEX(id, index) (index + (1 << PMEM_ORDER(id, index)))
@@ -844,8 +844,8 @@ static int pmem_connect(unsigned long connect, struct file *file)
src_data = (struct pmem_data *)src_file->private_data;
if (has_allocation(file) && (data->index != src_data->index)) {
- printk(KERN_INFO "pmem: file is already mapped but doesn't match this"
- " src_file!\n");
+ printk(KERN_INFO "pmem: file is already mapped but doesn't "
+ "match this src_file!\n");
ret = -EINVAL;
goto err_bad_file;
}
@@ -934,8 +934,8 @@ int pmem_remap(struct pmem_region *region, struct file *file,
if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) ||
!PMEM_IS_PAGE_ALIGNED(region->len))) {
#if PMEM_DEBUG
- printk(KERN_DEBUG "pmem: request for unaligned pmem suballocation "
- "%lx %lx\n", region->offset, region->len);
+ printk(KERN_DEBUG "pmem: request for unaligned pmem "
+ "suballocation %lx %lx\n", region->offset, region->len);
#endif
return -EINVAL;
}
@@ -1085,8 +1085,8 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
region.offset = pmem_start_addr(id, data);
region.len = pmem_len(id, data);
}
- printk(KERN_INFO "pmem: request for physical address of pmem region "
- "from process %d.\n", current->pid);
+ printk(KERN_INFO "pmem: request for physical address "
+ "of pmem region from process %d.\n", current->pid);
if (copy_to_user((void __user *)arg, ®ion,
sizeof(struct pmem_region)))
return -EFAULT;
--
1.5.6.3
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Staging: dream: pmem: fix some code style issues
2010-04-10 19:14 [PATCH] Staging: dream: pmem: fix some code style issues Chihau Chau
@ 2010-04-10 20:47 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2010-04-10 20:47 UTC (permalink / raw)
To: Chihau Chau; +Cc: gregkh, jochen.maes, devel, linux-kernel
On Sat 2010-04-10 15:14:38, Chihau Chau wrote:
> From: Chihau Chau <chihau@gmail.com>
>
> This fixes some code style issues like prohibited spaces after that open
> parenthesis '(' and before that close parenthesis ')', and lines over 80
> characters.
>
> Signed-off-by: Chihau Chau <chihau@gmail.com>
ACK.
> ---
> drivers/staging/dream/pmem.c | 22 +++++++++++-----------
> 1 files changed, 11 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/staging/dream/pmem.c b/drivers/staging/dream/pmem.c
> index 503ba21..3e4dd21 100644
> --- a/drivers/staging/dream/pmem.c
> +++ b/drivers/staging/dream/pmem.c
> @@ -37,17 +37,17 @@
> * the file should not be released until put_pmem_file is called */
> #define PMEM_FLAGS_BUSY 0x1
> /* indicates that this is a suballocation of a larger master range */
> -#define PMEM_FLAGS_CONNECTED ( 0x1 << 1 )
> +#define PMEM_FLAGS_CONNECTED (0x1 << 1)
> /* indicates this is a master and not a sub allocation and that it is mmaped */
> -#define PMEM_FLAGS_MASTERMAP ( 0x1 << 2 )
> +#define PMEM_FLAGS_MASTERMAP (0x1 << 2)
> /* submap and unsubmap flags indicate:
> * 00: subregion has never been mmaped
> * 10: subregion has been mmaped, reference to the mm was taken
> * 11: subretion has ben released, refernece to the mm still held
> * 01: subretion has been released, reference to the mm has been released
> */
> -#define PMEM_FLAGS_SUBMAP ( 0x1 << 3 )
> -#define PMEM_FLAGS_UNSUBMAP ( 0x1 << 4 )
> +#define PMEM_FLAGS_SUBMAP (0x1 << 3)
> +#define PMEM_FLAGS_UNSUBMAP (0x1 << 4)
>
>
> struct pmem_data {
> @@ -152,7 +152,7 @@ struct pmem_info {
> static struct pmem_info pmem[PMEM_MAX_DEVICES];
> static int id_count;
>
> -#define PMEM_IS_FREE(id, index) ( !(pmem[id].bitmap[index].allocated) )
> +#define PMEM_IS_FREE(id, index) (!(pmem[id].bitmap[index].allocated))
> #define PMEM_ORDER(id, index) pmem[id].bitmap[index].order
> #define PMEM_BUDDY_INDEX(id, index) (index ^ (1 << PMEM_ORDER(id, index)))
> #define PMEM_NEXT_INDEX(id, index) (index + (1 << PMEM_ORDER(id, index)))
> @@ -844,8 +844,8 @@ static int pmem_connect(unsigned long connect, struct file *file)
> src_data = (struct pmem_data *)src_file->private_data;
>
> if (has_allocation(file) && (data->index != src_data->index)) {
> - printk(KERN_INFO "pmem: file is already mapped but doesn't match this"
> - " src_file!\n");
> + printk(KERN_INFO "pmem: file is already mapped but doesn't "
> + "match this src_file!\n");
> ret = -EINVAL;
> goto err_bad_file;
> }
> @@ -934,8 +934,8 @@ int pmem_remap(struct pmem_region *region, struct file *file,
> if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) ||
> !PMEM_IS_PAGE_ALIGNED(region->len))) {
> #if PMEM_DEBUG
> - printk(KERN_DEBUG "pmem: request for unaligned pmem suballocation "
> - "%lx %lx\n", region->offset, region->len);
> + printk(KERN_DEBUG "pmem: request for unaligned pmem "
> + "suballocation %lx %lx\n", region->offset, region->len);
> #endif
> return -EINVAL;
> }
> @@ -1085,8 +1085,8 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> region.offset = pmem_start_addr(id, data);
> region.len = pmem_len(id, data);
> }
> - printk(KERN_INFO "pmem: request for physical address of pmem region "
> - "from process %d.\n", current->pid);
> + printk(KERN_INFO "pmem: request for physical address "
> + "of pmem region from process %d.\n", current->pid);
> if (copy_to_user((void __user *)arg, ®ion,
> sizeof(struct pmem_region)))
> return -EFAULT;
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Staging: dream: pmem: fix some code style issues
@ 2010-03-01 23:50 Chihau Chau
2010-03-02 5:22 ` Pavel Machek
0 siblings, 1 reply; 4+ messages in thread
From: Chihau Chau @ 2010-03-01 23:50 UTC (permalink / raw)
To: gregkh; +Cc: pavel, devel, linux-kernel, Chihau Chau
From: Chihau Chau <chihau@gmail.com>
This fixes some code style issues like some braces {} deleted becouse
are not necessary for a single statement blocks and to include KERN_
facility level in the printk() functions.
Signed-off-by: Chihau Chau <chihau@gmail.com>
---
drivers/staging/dream/pmem.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/dream/pmem.c b/drivers/staging/dream/pmem.c
index def6468..d8b5cb0 100644
--- a/drivers/staging/dream/pmem.c
+++ b/drivers/staging/dream/pmem.c
@@ -708,9 +708,8 @@ int get_pmem_addr(struct file *file, unsigned long *start,
struct pmem_data *data;
int id;
- if (!is_pmem_file(file) || !has_allocation(file)) {
+ if (!is_pmem_file(file) || !has_allocation(file))
return -1;
- }
data = (struct pmem_data *)file->private_data;
if (data->index == -1) {
@@ -789,9 +788,8 @@ void flush_pmem_file(struct file *file, unsigned long offset, unsigned long len)
struct list_head *elt;
void *flush_start, *flush_end;
- if (!is_pmem_file(file) || !has_allocation(file)) {
+ if (!is_pmem_file(file) || !has_allocation(file))
return;
- }
id = get_id(file);
data = (struct pmem_data *)file->private_data;
@@ -833,7 +831,7 @@ static int pmem_connect(unsigned long connect, struct file *file)
src_file = fget_light(connect, &put_needed);
DLOG("connect %p to %p\n", file, src_file);
if (!src_file) {
- printk("pmem: src file not found!\n");
+ printk(KERN_ERR "pmem: src file not found!\n");
ret = -EINVAL;
goto err_no_file;
}
@@ -936,8 +934,8 @@ int pmem_remap(struct pmem_region *region, struct file *file,
if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) ||
!PMEM_IS_PAGE_ALIGNED(region->len))) {
#if PMEM_DEBUG
- printk("pmem: request for unaligned pmem suballocation "
- "%lx %lx\n", region->offset, region->len);
+ printk(KERN_ERR "pmem: request for unaligned pmem "
+ "suballocation %lx %lx\n", region->offset, region->len);
#endif
return -EINVAL;
}
@@ -1087,8 +1085,10 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
region.offset = pmem_start_addr(id, data);
region.len = pmem_len(id, data);
}
- printk(KERN_INFO "pmem: request for physical address of pmem region "
- "from process %d.\n", current->pid);
+ printk(KERN_INFO "pmem: request for physical address "
+ "of pmem region from process %d.\n",
+ current->pid);
+
if (copy_to_user((void __user *)arg, ®ion,
sizeof(struct pmem_region)))
return -EFAULT;
--
1.5.6.3
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Staging: dream: pmem: fix some code style issues
2010-03-01 23:50 Chihau Chau
@ 2010-03-02 5:22 ` Pavel Machek
0 siblings, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2010-03-02 5:22 UTC (permalink / raw)
To: Chihau Chau; +Cc: gregkh, devel, linux-kernel
On Mon 2010-03-01 20:50:15, Chihau Chau wrote:
> From: Chihau Chau <chihau@gmail.com>
>
> This fixes some code style issues like some braces {} deleted becouse
> are not necessary for a single statement blocks and to include KERN_
> facility level in the printk() functions.
Most of patch is good, but...
> @@ -936,8 +934,8 @@ int pmem_remap(struct pmem_region *region, struct file *file,
> if (unlikely(!PMEM_IS_PAGE_ALIGNED(region->offset) ||
> !PMEM_IS_PAGE_ALIGNED(region->len))) {
> #if PMEM_DEBUG
> - printk("pmem: request for unaligned pmem suballocation "
> - "%lx %lx\n", region->offset, region->len);
> + printk(KERN_ERR "pmem: request for unaligned pmem "
> + "suballocation %lx %lx\n", region->offset, region->len);
> #endif
> return -EINVAL;
> }
This is strange. If it is debuging print, should it be KERN_DEBUG? And
we have nice dev_dbg macros for just that, so that ifdef is not
neccessarry.
> @@ -1087,8 +1085,10 @@ static long pmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> region.offset = pmem_start_addr(id, data);
> region.len = pmem_len(id, data);
> }
> - printk(KERN_INFO "pmem: request for physical address of pmem region "
> - "from process %d.\n", current->pid);
> + printk(KERN_INFO "pmem: request for physical address "
> + "of pmem region from process %d.\n",
> + current->pid);
> +
And this gets code worse, not better.
(Feel free to send all the other hunks with my ACK.)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-04-10 20:47 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-04-10 19:14 [PATCH] Staging: dream: pmem: fix some code style issues Chihau Chau
2010-04-10 20:47 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2010-03-01 23:50 Chihau Chau
2010-03-02 5:22 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome