[PATCH] ext4 crypto: prevent mount when blocksize != pagesize

2015-06-11 Thread Seunghun Lee
Encryption mode is unsupported when blocksize != pagesize.

Signed-off-by: Seunghun Lee 
---
 fs/ext4/super.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 31e85be..032c9e3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1583,6 +1583,15 @@ static int handle_mount_opt(struct super_block *sb, char 
*opt, int token,
IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
} else if (token == Opt_test_dummy_encryption) {
 #ifdef CONFIG_EXT4_FS_ENCRYPTION
+   int blocksize =
+   BLOCK_SIZE << le32_to_cpu(sbi->s_es->s_log_block_size);
+
+   if (blocksize != PAGE_CACHE_SIZE) {
+   ext4_msg(sb, KERN_ERR,
+   "unsupported blocksize for Test dummy 
encryption mode");
+   return -1;
+   }
+
sbi->s_mount_flags |= EXT4_MF_TEST_DUMMY_ENCRYPTION;
ext4_msg(sb, KERN_WARNING,
 "Test dummy encryption mode enabled");
-- 
2.3.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ext4 crypto: prevent mount when blocksize != pagesize

2015-06-11 Thread Seunghun Lee
Encryption mode is unsupported when blocksize != pagesize.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ext4/super.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 31e85be..032c9e3 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1583,6 +1583,15 @@ static int handle_mount_opt(struct super_block *sb, char 
*opt, int token,
IOPRIO_PRIO_VALUE(IOPRIO_CLASS_BE, arg);
} else if (token == Opt_test_dummy_encryption) {
 #ifdef CONFIG_EXT4_FS_ENCRYPTION
+   int blocksize =
+   BLOCK_SIZE  le32_to_cpu(sbi-s_es-s_log_block_size);
+
+   if (blocksize != PAGE_CACHE_SIZE) {
+   ext4_msg(sb, KERN_ERR,
+   unsupported blocksize for Test dummy 
encryption mode);
+   return -1;
+   }
+
sbi-s_mount_flags |= EXT4_MF_TEST_DUMMY_ENCRYPTION;
ext4_msg(sb, KERN_WARNING,
 Test dummy encryption mode enabled);
-- 
2.3.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Fix condition check for workdir

2015-01-09 Thread Seunghun Lee

On 01/09/2015 11:40 AM, hujianyang wrote:
> On 2015/1/8 20:41, Seunghun Lee wrote:
>> When file system is mounted read-only workdir is not needed.
>>
>> Signed-off-by: Seunghun Lee 
>> ---
>>  fs/overlayfs/super.c | 35 +++
>>  1 file changed, 23 insertions(+), 12 deletions(-)
>>
>> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
>> index 84f3144..4e50617 100644
>> --- a/fs/overlayfs/super.c
>> +++ b/fs/overlayfs/super.c
>> @@ -30,6 +30,7 @@ struct ovl_config {
>>  char *lowerdir;
>>  char *upperdir;
>>  char *workdir;
>> +bool is_rw;
>>  };
>>  
>>  /* private information held for overlayfs's superblock */
>> @@ -515,10 +516,11 @@ static int ovl_show_options(struct seq_file *m, struct 
>> dentry *dentry)
>>  struct ovl_fs *ufs = sb->s_fs_info;
>>  
>>  seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir);
>> -if (ufs->config.upperdir) {
>> +if (ufs->config.upperdir)
>>  seq_printf(m, ",upperdir=%s", ufs->config.upperdir);
>> +if (ufs->config.is_rw)
>>  seq_printf(m, ",workdir=%s", ufs->config.workdir);
>> -}
>> +
>>  return 0;
>>  }
>>  
>> @@ -822,16 +824,27 @@ static int ovl_fill_super(struct super_block *sb, void 
>> *data, int silent)
>>  
>>  sb->s_stack_depth = 0;
>>  if (ufs->config.upperdir) {
>> -/* FIXME: workdir is not needed for a R/O mount */
>> +err = ovl_mount_dir(ufs->config.upperdir, );
>> +if (err)
>> +goto out_free_config;
>> +
>> +sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth;
>> +}
>> +
>> +/* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
>> +if (!upperpath.mnt || (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY)) {
>> +ufs->config.is_rw = false;
>> +sb->s_flags |= MS_RDONLY;
>> +} else {
>> +ufs->config.is_rw = true;
>> +}
> Hi Seunghun,
>
> A partition can be mounted with ro flag. I think workdir is not
> needed in this way either.
Hi Hu,

I agree with you, workdir is not needed when filesystem is mounted with ro flag.
After mount,  however, it can be remounted with rw flag.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Fix condition check for workdir

2015-01-09 Thread Seunghun Lee

On 01/09/2015 11:40 AM, hujianyang wrote:
 On 2015/1/8 20:41, Seunghun Lee wrote:
 When file system is mounted read-only workdir is not needed.

 Signed-off-by: Seunghun Lee way...@gmail.com
 ---
  fs/overlayfs/super.c | 35 +++
  1 file changed, 23 insertions(+), 12 deletions(-)

 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
 index 84f3144..4e50617 100644
 --- a/fs/overlayfs/super.c
 +++ b/fs/overlayfs/super.c
 @@ -30,6 +30,7 @@ struct ovl_config {
  char *lowerdir;
  char *upperdir;
  char *workdir;
 +bool is_rw;
  };
  
  /* private information held for overlayfs's superblock */
 @@ -515,10 +516,11 @@ static int ovl_show_options(struct seq_file *m, struct 
 dentry *dentry)
  struct ovl_fs *ufs = sb-s_fs_info;
  
  seq_printf(m, ,lowerdir=%s, ufs-config.lowerdir);
 -if (ufs-config.upperdir) {
 +if (ufs-config.upperdir)
  seq_printf(m, ,upperdir=%s, ufs-config.upperdir);
 +if (ufs-config.is_rw)
  seq_printf(m, ,workdir=%s, ufs-config.workdir);
 -}
 +
  return 0;
  }
  
 @@ -822,16 +824,27 @@ static int ovl_fill_super(struct super_block *sb, void 
 *data, int silent)
  
  sb-s_stack_depth = 0;
  if (ufs-config.upperdir) {
 -/* FIXME: workdir is not needed for a R/O mount */
 +err = ovl_mount_dir(ufs-config.upperdir, upperpath);
 +if (err)
 +goto out_free_config;
 +
 +sb-s_stack_depth = upperpath.mnt-mnt_sb-s_stack_depth;
 +}
 +
 +/* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
 +if (!upperpath.mnt || (upperpath.mnt-mnt_sb-s_flags  MS_RDONLY)) {
 +ufs-config.is_rw = false;
 +sb-s_flags |= MS_RDONLY;
 +} else {
 +ufs-config.is_rw = true;
 +}
 Hi Seunghun,

 A partition can be mounted with ro flag. I think workdir is not
 needed in this way either.
Hi Hu,

I agree with you, workdir is not needed when filesystem is mounted with ro flag.
After mount,  however, it can be remounted with rw flag.

Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Fix condition check for workdir

2015-01-08 Thread Seunghun Lee
When file system is mounted read-only workdir is not needed.

Signed-off-by: Seunghun Lee 
---
 fs/overlayfs/super.c | 35 +++
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..4e50617 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -30,6 +30,7 @@ struct ovl_config {
char *lowerdir;
char *upperdir;
char *workdir;
+   bool is_rw;
 };
 
 /* private information held for overlayfs's superblock */
@@ -515,10 +516,11 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
struct ovl_fs *ufs = sb->s_fs_info;
 
seq_printf(m, ",lowerdir=%s", ufs->config.lowerdir);
-   if (ufs->config.upperdir) {
+   if (ufs->config.upperdir)
seq_printf(m, ",upperdir=%s", ufs->config.upperdir);
+   if (ufs->config.is_rw)
seq_printf(m, ",workdir=%s", ufs->config.workdir);
-   }
+
return 0;
 }
 
@@ -822,16 +824,27 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
 
sb->s_stack_depth = 0;
if (ufs->config.upperdir) {
-   /* FIXME: workdir is not needed for a R/O mount */
+   err = ovl_mount_dir(ufs->config.upperdir, );
+   if (err)
+   goto out_free_config;
+
+   sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth;
+   }
+
+   /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
+   if (!upperpath.mnt || (upperpath.mnt->mnt_sb->s_flags & MS_RDONLY)) {
+   ufs->config.is_rw = false;
+   sb->s_flags |= MS_RDONLY;
+   } else {
+   ufs->config.is_rw = true;
+   }
+
+   if (ufs->config.is_rw) {
if (!ufs->config.workdir) {
pr_err("overlayfs: missing 'workdir'\n");
goto out_free_config;
}
 
-   err = ovl_mount_dir(ufs->config.upperdir, );
-   if (err)
-   goto out_free_config;
-
err = ovl_mount_dir(ufs->config.workdir, );
if (err)
goto out_put_upperpath;
@@ -844,8 +857,8 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
pr_err("overlayfs: workdir and upperdir must be 
separate subtrees\n");
goto out_put_workpath;
}
-   sb->s_stack_depth = upperpath.mnt->mnt_sb->s_stack_depth;
}
+
err = -ENOMEM;
lowertmp = kstrdup(ufs->config.lowerdir, GFP_KERNEL);
if (!lowertmp)
@@ -884,7 +897,9 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
pr_err("overlayfs: failed to clone upperpath\n");
goto out_put_lowerpath;
}
+   }
 
+   if (ufs->config.is_rw) {
ufs->workdir = ovl_workdir_create(ufs->upper_mnt, 
workpath.dentry);
err = PTR_ERR(ufs->workdir);
if (IS_ERR(ufs->workdir)) {
@@ -914,10 +929,6 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
ufs->numlower++;
}
 
-   /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
-   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
-   sb->s_flags |= MS_RDONLY;
-
sb->s_d_op = _dentry_operations;
 
err = -ENOMEM;
-- 
2.2.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Fix condition check for workdir

2015-01-08 Thread Seunghun Lee
When file system is mounted read-only workdir is not needed.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/overlayfs/super.c | 35 +++
 1 file changed, 23 insertions(+), 12 deletions(-)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..4e50617 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -30,6 +30,7 @@ struct ovl_config {
char *lowerdir;
char *upperdir;
char *workdir;
+   bool is_rw;
 };
 
 /* private information held for overlayfs's superblock */
@@ -515,10 +516,11 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
struct ovl_fs *ufs = sb-s_fs_info;
 
seq_printf(m, ,lowerdir=%s, ufs-config.lowerdir);
-   if (ufs-config.upperdir) {
+   if (ufs-config.upperdir)
seq_printf(m, ,upperdir=%s, ufs-config.upperdir);
+   if (ufs-config.is_rw)
seq_printf(m, ,workdir=%s, ufs-config.workdir);
-   }
+
return 0;
 }
 
@@ -822,16 +824,27 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
 
sb-s_stack_depth = 0;
if (ufs-config.upperdir) {
-   /* FIXME: workdir is not needed for a R/O mount */
+   err = ovl_mount_dir(ufs-config.upperdir, upperpath);
+   if (err)
+   goto out_free_config;
+
+   sb-s_stack_depth = upperpath.mnt-mnt_sb-s_stack_depth;
+   }
+
+   /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
+   if (!upperpath.mnt || (upperpath.mnt-mnt_sb-s_flags  MS_RDONLY)) {
+   ufs-config.is_rw = false;
+   sb-s_flags |= MS_RDONLY;
+   } else {
+   ufs-config.is_rw = true;
+   }
+
+   if (ufs-config.is_rw) {
if (!ufs-config.workdir) {
pr_err(overlayfs: missing 'workdir'\n);
goto out_free_config;
}
 
-   err = ovl_mount_dir(ufs-config.upperdir, upperpath);
-   if (err)
-   goto out_free_config;
-
err = ovl_mount_dir(ufs-config.workdir, workpath);
if (err)
goto out_put_upperpath;
@@ -844,8 +857,8 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
pr_err(overlayfs: workdir and upperdir must be 
separate subtrees\n);
goto out_put_workpath;
}
-   sb-s_stack_depth = upperpath.mnt-mnt_sb-s_stack_depth;
}
+
err = -ENOMEM;
lowertmp = kstrdup(ufs-config.lowerdir, GFP_KERNEL);
if (!lowertmp)
@@ -884,7 +897,9 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
pr_err(overlayfs: failed to clone upperpath\n);
goto out_put_lowerpath;
}
+   }
 
+   if (ufs-config.is_rw) {
ufs-workdir = ovl_workdir_create(ufs-upper_mnt, 
workpath.dentry);
err = PTR_ERR(ufs-workdir);
if (IS_ERR(ufs-workdir)) {
@@ -914,10 +929,6 @@ static int ovl_fill_super(struct super_block *sb, void 
*data, int silent)
ufs-numlower++;
}
 
-   /* If the upper fs is r/o or nonexistent, we mark overlayfs r/o too */
-   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  MS_RDONLY))
-   sb-s_flags |= MS_RDONLY;
-
sb-s_d_op = ovl_dentry_operations;
 
err = -ENOMEM;
-- 
2.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-07 Thread Seunghun Lee
Hi Hu,

On 01/07/2015 11:56 AM, hujianyang wrote:
> Hi,
>
> There maybe some misunderstandings here. I think your patch really
> fix an important problem, but not in correct way.
>
> On 2015/1/6 22:02, Seunghun Lee wrote:
>> After patch:
>> root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
>> mount: warning: merged seems to be mounted read-only.
>> root@qemux86:~# mount | grep overlay
>> overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
>> root@qemux86:~# mount -o remount,rw merged
>> mount: warning: /home/root/merged seems to be mounted read-only.
>> root@qemux86:~# mount | grep overlay
>> overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
>> root@qemux86:~# echo hi > merged/hi
>> -sh: merged/hi: Read-only file system
>> root@qemux86:~#
>>
> If users want a rw mount, can we give them a ro mount? I think it's
> wrong, .remount_fs should refuse this request.
>
> So I think your .remount_fs should check both what users in userpace
> want and what kernel can offer, then realize legal requests and
> refuse illegal requests. Not changing the requests from users.
Many file systems just change flags when user requests read-write remount.
(romfs, squashfs, sysv...)
I thought this case is similar above filesystems.
> Further more, can we replace upper/lower/work directories or mount
> point by this .remount_fs?
>
> If you want to export a new function, I think you should considering
> more about these.
>
> Thanks,
> Hu
>
Yes, you are right. However, this patch is a minimal support to
prevent kernel panic when file system is remounted to read-write mode.
And many file systems have remount_fs function of this kind.

I think what you mentioned is can be added later if it is necessary.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-07 Thread Seunghun Lee
Hi Hu,

On 01/07/2015 11:56 AM, hujianyang wrote:
 Hi,

 There maybe some misunderstandings here. I think your patch really
 fix an important problem, but not in correct way.

 On 2015/1/6 22:02, Seunghun Lee wrote:
 After patch:
 root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
 mount: warning: merged seems to be mounted read-only.
 root@qemux86:~# mount | grep overlay
 overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
 root@qemux86:~# mount -o remount,rw merged
 mount: warning: /home/root/merged seems to be mounted read-only.
 root@qemux86:~# mount | grep overlay
 overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
 root@qemux86:~# echo hi  merged/hi
 -sh: merged/hi: Read-only file system
 root@qemux86:~#

 If users want a rw mount, can we give them a ro mount? I think it's
 wrong, .remount_fs should refuse this request.

 So I think your .remount_fs should check both what users in userpace
 want and what kernel can offer, then realize legal requests and
 refuse illegal requests. Not changing the requests from users.
Many file systems just change flags when user requests read-write remount.
(romfs, squashfs, sysv...)
I thought this case is similar above filesystems.
 Further more, can we replace upper/lower/work directories or mount
 point by this .remount_fs?

 If you want to export a new function, I think you should considering
 more about these.

 Thanks,
 Hu

Yes, you are right. However, this patch is a minimal support to
prevent kernel panic when file system is remounted to read-write mode.
And many file systems have remount_fs function of this kind.

I think what you mentioned is can be added later if it is necessary.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-06 Thread Seunghun Lee

On 01/04/2015 11:59 AM, hujianyang wrote:
> I think this exporting of .remount_fs may allow people in userspace have the 
> ability to remount a filesystem with a new set of mounting options. Your new 
> adding function do nothing with the passing in parameters. I'm not sure if it 
> could be competent for remount case. Add Cc linux-unionfs. 
Hi hujianyang,

I think it makes no difference whether .remount_fs is exported or not,
except in the read-write mount case.

And the patch's use case is below:

Before patch:
root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
mount: warning: merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# mount -o remount,rw merged
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (rw,relatime,lowerdir=lower:lower2)
root@qemux86:~# echo hi > merged/hi

[   95.906739] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   95.907172] IP: [] mnt_want_write+0x16/0x50
[   95.907172] PGD 1e34e067 PUD 1e20a067 PMD 0
[   95.907172] Oops:  [#1] SMP
[   95.907172] Modules linked in:
[   95.907172] CPU: 0 PID: 1358 Comm: sh Not tainted 3.19.0-rc2-next-20141231+ 
#5
[   95.907172] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Bochs 01/01/2011
[   95.907172] task: 88001dad2d00 ti: 88001d4dc000 task.ti: 
88001d4dc000
[   95.907172] RIP: 0010:[]  [] 
mnt_want_write+0x16/0x50
[   95.907172] RSP: :88001d4dfbf8  EFLAGS: 0292
[   95.907172] RAX: 88001da4ac80 RBX:  RCX: 
[   95.907172] RDX: 0001 RSI: 0001 RDI: 
[   95.907172] RBP: 88001d4dfc18 R08:  R09: 
[   95.907172] R10:  R11: 8880fb40 R12: 81a4
[   95.907172] R13:  R14:  R15: 
[   95.907172] FS:  (0003) GS:88001fc0(0063) 
knlGS:f7755b40
[   95.907172] CS:  0010 DS: 002b ES: 002b CR0: 8005003b
[   95.907172] CR2: 0008 CR3: 1d4bc000 CR4: 06f0
[   95.907172] DR0:  DR1:  DR2: 
[   95.907172] DR3:  DR6:  DR7: 
[   95.907172] Stack:
[   95.907172]   000381a4 000a 
8880fb40
[   95.907172]  88001d4dfc28 8128ca97 88001d4dfc68 
8128f1e0
[   95.907172]  88001dd55c70 8880fb40  
88001dd55c70
[   95.907172] Call Trace:
[   95.907172]  [] ovl_want_write+0x17/0x20
[   95.907172]  [] ovl_create_object+0x20/0x60
[   95.907172]  [] ovl_create+0x1e/0x20
[   95.907172]  [] vfs_create+0xcd/0x130
[   95.907172]  [] do_last+0x962/0x1110
[   95.907172]  [] ? path_init+0xbc/0x450
[   95.907172]  [] path_openat+0x7f/0x620
[   95.907172]  [] ? handle_mm_fault+0x5e0/0xa30
[   95.907172]  [] do_filp_open+0x35/0x90
[   95.907172]  [] ? getname_flags+0x4a/0x1a0
[   95.907172]  [] ? __alloc_fd+0x7d/0x120
[   95.907172]  [] do_sys_open+0x123/0x220
[   95.907172]  [] compat_SyS_open+0x16/0x20
[   95.907172]  [] ia32_do_call+0x13/0x13
[   95.907172] Code: c3 0f 1f 40 00 48 8b 47 28 65 ff 48 04 b8 e2 ff ff ff 5d 
c3 90 55 ba 01 00 00 00 be 01 00 00 00 48 89 e5 53 48 89 fb 48 83 ec 18 <48> 8b 
7f 08 e8 31 3c fe ff 48 89 df e8 79 ff ff ff 85 c0 74 14
[   95.907172] RIP  [] mnt_want_write+0x16/0x50
[   95.907172]  RSP 
[   95.907172] CR2: 0008
[   95.919596] ---[ end trace 770a329b637fe67d ]---

After patch:
root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
mount: warning: merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# mount -o remount,rw merged
mount: warning: /home/root/merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# echo hi > merged/hi
-sh: merged/hi: Read-only file system
root@qemux86:~#

If what I think is incorrect, please let me know.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-06 Thread Seunghun Lee

On 01/04/2015 11:59 AM, hujianyang wrote:
 I think this exporting of .remount_fs may allow people in userspace have the 
 ability to remount a filesystem with a new set of mounting options. Your new 
 adding function do nothing with the passing in parameters. I'm not sure if it 
 could be competent for remount case. Add Cc linux-unionfs. 
Hi hujianyang,

I think it makes no difference whether .remount_fs is exported or not,
except in the read-write mount case.

And the patch's use case is below:

Before patch:
root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
mount: warning: merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# mount -o remount,rw merged
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (rw,relatime,lowerdir=lower:lower2)
root@qemux86:~# echo hi  merged/hi

[   95.906739] BUG: unable to handle kernel NULL pointer dereference at 
0008
[   95.907172] IP: [8117e0b6] mnt_want_write+0x16/0x50
[   95.907172] PGD 1e34e067 PUD 1e20a067 PMD 0
[   95.907172] Oops:  [#1] SMP
[   95.907172] Modules linked in:
[   95.907172] CPU: 0 PID: 1358 Comm: sh Not tainted 3.19.0-rc2-next-20141231+ 
#5
[   95.907172] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
Bochs 01/01/2011
[   95.907172] task: 88001dad2d00 ti: 88001d4dc000 task.ti: 
88001d4dc000
[   95.907172] RIP: 0010:[8117e0b6]  [8117e0b6] 
mnt_want_write+0x16/0x50
[   95.907172] RSP: :88001d4dfbf8  EFLAGS: 0292
[   95.907172] RAX: 88001da4ac80 RBX:  RCX: 
[   95.907172] RDX: 0001 RSI: 0001 RDI: 
[   95.907172] RBP: 88001d4dfc18 R08:  R09: 
[   95.907172] R10:  R11: 8880fb40 R12: 81a4
[   95.907172] R13:  R14:  R15: 
[   95.907172] FS:  (0003) GS:88001fc0(0063) 
knlGS:f7755b40
[   95.907172] CS:  0010 DS: 002b ES: 002b CR0: 8005003b
[   95.907172] CR2: 0008 CR3: 1d4bc000 CR4: 06f0
[   95.907172] DR0:  DR1:  DR2: 
[   95.907172] DR3:  DR6:  DR7: 
[   95.907172] Stack:
[   95.907172]   000381a4 000a 
8880fb40
[   95.907172]  88001d4dfc28 8128ca97 88001d4dfc68 
8128f1e0
[   95.907172]  88001dd55c70 8880fb40  
88001dd55c70
[   95.907172] Call Trace:
[   95.907172]  [8128ca97] ovl_want_write+0x17/0x20
[   95.907172]  [8128f1e0] ovl_create_object+0x20/0x60
[   95.907172]  [8128f2be] ovl_create+0x1e/0x20
[   95.907172]  [8116aabd] vfs_create+0xcd/0x130
[   95.907172]  [8116d572] do_last+0x962/0x1110
[   95.907172]  [8116b97c] ? path_init+0xbc/0x450
[   95.907172]  [8116dd9f] path_openat+0x7f/0x620
[   95.907172]  [81136aa0] ? handle_mm_fault+0x5e0/0xa30
[   95.907172]  [8116fd05] do_filp_open+0x35/0x90
[   95.907172]  [8116ecda] ? getname_flags+0x4a/0x1a0
[   95.907172]  [8117bcdd] ? __alloc_fd+0x7d/0x120
[   95.907172]  [8115ea23] do_sys_open+0x123/0x220
[   95.907172]  [811aadc6] compat_SyS_open+0x16/0x20
[   95.907172]  [8184ea89] ia32_do_call+0x13/0x13
[   95.907172] Code: c3 0f 1f 40 00 48 8b 47 28 65 ff 48 04 b8 e2 ff ff ff 5d 
c3 90 55 ba 01 00 00 00 be 01 00 00 00 48 89 e5 53 48 89 fb 48 83 ec 18 48 8b 
7f 08 e8 31 3c fe ff 48 89 df e8 79 ff ff ff 85 c0 74 14
[   95.907172] RIP  [8117e0b6] mnt_want_write+0x16/0x50
[   95.907172]  RSP 88001d4dfbf8
[   95.907172] CR2: 0008
[   95.919596] ---[ end trace 770a329b637fe67d ]---

After patch:
root@qemux86:~# mount -t overlay overlay -olowerdir=lower:lower2 merged
mount: warning: merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# mount -o remount,rw merged
mount: warning: /home/root/merged seems to be mounted read-only.
root@qemux86:~# mount | grep overlay
overlay on /home/root/merged type overlay (ro,relatime,lowerdir=lower:lower2)
root@qemux86:~# echo hi  merged/hi
-sh: merged/hi: Read-only file system
root@qemux86:~#

If what I think is incorrect, please let me know.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-02 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper-fs is read-only or nonexistent.
But now it can be remounted read-write and this can cause kernel panic.
So we should prevent read-write remount when the above situation happens.

Signed-off-by: Seunghun Lee 
---
 fs/overlayfs/super.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int ovl_remount(struct super_block *sb, int *flags, char *data)
+{
+   struct ovl_fs *ufs = sb->s_fs_info;
+
+   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
.show_options   = ovl_show_options,
+   .remount_fs = ovl_remount,
 };
 
 enum {
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-02 Thread Seunghun Lee

On 01/02/2015 03:33 AM, Sedat Dilek wrote:
> On Thu, Jan 1, 2015 at 4:38 PM, Seunghun Lee  wrote:
>> Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
>> But now it can be remounted read-write and this can causes kernel panic.
>> So we should prevent read-write remount when the above situation.
>>
> Cannot say much to the code, but you have some typos in your commit-message.
> Here some corrections... wording, style etc.
>
> ...when upper-fs (with a dash) is read-only (if you write read-write
> below) or nonexisten*t*...
> ...this can cause (without s at the end)...
> ...when the above situation *happens* (missing word)...
>
> - Sedat -
>
>> Signed-off-by: Seunghun Lee 
>> ---
>>  fs/overlayfs/super.c | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
>> index 84f3144..8944651 100644
>> --- a/fs/overlayfs/super.c
>> +++ b/fs/overlayfs/super.c
>> @@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
>> dentry *dentry)
>> return 0;
>>  }
>>
>> +static int ovl_remount(struct super_block *sb, int *flags, char *data)
>> +{
>> +   struct ovl_fs *ufs = sb->s_fs_info;
>> +
>> +   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
>> +   *flags |= MS_RDONLY;
>> +
>> +   return 0;
>> +}
>> +
>>  static const struct super_operations ovl_super_operations = {
>> .put_super  = ovl_put_super,
>> .statfs = ovl_statfs,
>> .show_options   = ovl_show_options,
>> +   .remount_fs = ovl_remount,
>>  };
>>
>>  enum {
>> --
>> 2.1.3
>>
Thank you for your correction!

I will fix it.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-02 Thread Seunghun Lee

On 01/02/2015 03:33 AM, Sedat Dilek wrote:
 On Thu, Jan 1, 2015 at 4:38 PM, Seunghun Lee way...@gmail.com wrote:
 Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
 But now it can be remounted read-write and this can causes kernel panic.
 So we should prevent read-write remount when the above situation.

 Cannot say much to the code, but you have some typos in your commit-message.
 Here some corrections... wording, style etc.

 ...when upper-fs (with a dash) is read-only (if you write read-write
 below) or nonexisten*t*...
 ...this can cause (without s at the end)...
 ...when the above situation *happens* (missing word)...

 - Sedat -

 Signed-off-by: Seunghun Lee way...@gmail.com
 ---
  fs/overlayfs/super.c | 11 +++
  1 file changed, 11 insertions(+)

 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
 index 84f3144..8944651 100644
 --- a/fs/overlayfs/super.c
 +++ b/fs/overlayfs/super.c
 @@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
 dentry *dentry)
 return 0;
  }

 +static int ovl_remount(struct super_block *sb, int *flags, char *data)
 +{
 +   struct ovl_fs *ufs = sb-s_fs_info;
 +
 +   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  MS_RDONLY))
 +   *flags |= MS_RDONLY;
 +
 +   return 0;
 +}
 +
  static const struct super_operations ovl_super_operations = {
 .put_super  = ovl_put_super,
 .statfs = ovl_statfs,
 .show_options   = ovl_show_options,
 +   .remount_fs = ovl_remount,
  };

  enum {
 --
 2.1.3

Thank you for your correction!

I will fix it.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-02 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper-fs is read-only or nonexistent.
But now it can be remounted read-write and this can cause kernel panic.
So we should prevent read-write remount when the above situation happens.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/overlayfs/super.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int ovl_remount(struct super_block *sb, int *flags, char *data)
+{
+   struct ovl_fs *ufs = sb-s_fs_info;
+
+   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
.show_options   = ovl_show_options,
+   .remount_fs = ovl_remount,
 };
 
 enum {
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-01 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
But now it can be remounted read-write and this can causes kernel panic.
So we should prevent read-write remount when the above situation.

Signed-off-by: Seunghun Lee 
---
 fs/overlayfs/super.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int ovl_remount(struct super_block *sb, int *flags, char *data)
+{
+   struct ovl_fs *ufs = sb->s_fs_info;
+
+   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
.show_options   = ovl_show_options,
+   .remount_fs = ovl_remount,
 };
 
 enum {
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-01 Thread Seunghun Lee

On 01/02/2015 12:24 AM, Sedat Dilek wrote:
> On Thu, Jan 1, 2015 at 4:13 PM, Richard Weinberger
>  wrote:
>> On Thu, Jan 1, 2015 at 6:07 AM, Seunghun Lee  wrote:
>>> Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
>>> But now it can be remounted read-write and this can causes kernel panic.
>>> So we should prevent read-write remount when the above situation.
>>>
>>> Signed-off-by: Seunghun Lee 
>> This patch makes zero sense, did you use the wrong diff?
>>
> Hmm, was also my 1st thoughts when I saw squashfs_remount() in overlayfs code.
>
> - Sedat -
>
>>> ---
>>>  fs/overlayfs/super.c | 8 
>>>  1 file changed, 8 insertions(+)
>>>
>>> diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
>>> index 84f3144..1faa5e5 100644
>>> --- a/fs/overlayfs/super.c
>>> +++ b/fs/overlayfs/super.c
>>> @@ -522,6 +522,14 @@ static int ovl_show_options(struct seq_file *m, struct 
>>> dentry *dentry)
>>> return 0;
>>>  }
>>>
>>> +static int squashfs_remount(struct super_block *sb, int *flags, char *data)
>>> +{
>>> +   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & 
>>> MS_RDONLY))
>>> +   *flags |= MS_RDONLY;
>>> +
>>> +   return 0;
>>> +}
>>> +
>>>  static const struct super_operations ovl_super_operations = {
>>> .put_super  = ovl_put_super,
>>> .statfs = ovl_statfs,
>>> --
>>> 2.1.3
>>>
>>> --
>>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>>> the body of a message to majord...@vger.kernel.org
>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> Please read the FAQ at  http://www.tux.org/lkml/
>>
>>
>> --
>> Thanks,
>> //richard
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
>> the body of a message to majord...@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sorry, I sent wrong patch.

I will resend it.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-01 Thread Seunghun Lee

On 01/02/2015 12:24 AM, Sedat Dilek wrote:
 On Thu, Jan 1, 2015 at 4:13 PM, Richard Weinberger
 richard.weinber...@gmail.com wrote:
 On Thu, Jan 1, 2015 at 6:07 AM, Seunghun Lee way...@gmail.com wrote:
 Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
 But now it can be remounted read-write and this can causes kernel panic.
 So we should prevent read-write remount when the above situation.

 Signed-off-by: Seunghun Lee way...@gmail.com
 This patch makes zero sense, did you use the wrong diff?

 Hmm, was also my 1st thoughts when I saw squashfs_remount() in overlayfs code.

 - Sedat -

 ---
  fs/overlayfs/super.c | 8 
  1 file changed, 8 insertions(+)

 diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
 index 84f3144..1faa5e5 100644
 --- a/fs/overlayfs/super.c
 +++ b/fs/overlayfs/super.c
 @@ -522,6 +522,14 @@ static int ovl_show_options(struct seq_file *m, struct 
 dentry *dentry)
 return 0;
  }

 +static int squashfs_remount(struct super_block *sb, int *flags, char *data)
 +{
 +   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  
 MS_RDONLY))
 +   *flags |= MS_RDONLY;
 +
 +   return 0;
 +}
 +
  static const struct super_operations ovl_super_operations = {
 .put_super  = ovl_put_super,
 .statfs = ovl_statfs,
 --
 2.1.3

 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/


 --
 Thanks,
 //richard
 --
 To unsubscribe from this list: send the line unsubscribe linux-fsdevel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sorry, I sent wrong patch.

I will resend it.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2015-01-01 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
But now it can be remounted read-write and this can causes kernel panic.
So we should prevent read-write remount when the above situation.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/overlayfs/super.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..8944651 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,10 +522,21 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int ovl_remount(struct super_block *sb, int *flags, char *data)
+{
+   struct ovl_fs *ufs = sb-s_fs_info;
+
+   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
.show_options   = ovl_show_options,
+   .remount_fs = ovl_remount,
 };
 
 enum {
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2014-12-31 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
But now it can be remounted read-write and this can causes kernel panic.
So we should prevent read-write remount when the above situation.

Signed-off-by: Seunghun Lee 
---
 fs/overlayfs/super.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..1faa5e5 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,6 +522,14 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int squashfs_remount(struct super_block *sb, int *flags, char *data)
+{
+   if (!ufs->upper_mnt || (ufs->upper_mnt->mnt_sb->s_flags & MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ovl: Prevent rw remount when it should be ro mount

2014-12-31 Thread Seunghun Lee
Overlayfs should be mounted read-only when upper fs is r/o or nonexistend.
But now it can be remounted read-write and this can causes kernel panic.
So we should prevent read-write remount when the above situation.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/overlayfs/super.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/fs/overlayfs/super.c b/fs/overlayfs/super.c
index 84f3144..1faa5e5 100644
--- a/fs/overlayfs/super.c
+++ b/fs/overlayfs/super.c
@@ -522,6 +522,14 @@ static int ovl_show_options(struct seq_file *m, struct 
dentry *dentry)
return 0;
 }
 
+static int squashfs_remount(struct super_block *sb, int *flags, char *data)
+{
+   if (!ufs-upper_mnt || (ufs-upper_mnt-mnt_sb-s_flags  MS_RDONLY))
+   *flags |= MS_RDONLY;
+
+   return 0;
+}
+
 static const struct super_operations ovl_super_operations = {
.put_super  = ovl_put_super,
.statfs = ovl_statfs,
-- 
2.1.3

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] vfs: move getname() from callers to do_mount()

2014-09-14 Thread Seunghun Lee
On September 15, 2014 2:18:50 PM GMT+09:00, Al Viro  
wrote:
>On Mon, Sep 15, 2014 at 01:39:19PM +0900, Seunghun Lee wrote:
>> 2014. 9. 15. 오전 3:13에 "Al Viro"  wrote:
>> > Applied with one modification: this getname/kern_path/putname is
>
>> Ok, I will resend it after modification.
>
>See above...  It's already in vfs.git#for-next.  The last commit of the
>branch at the moment.  The change was trivial - done it while applying
>the
>patch.

Oh sorry, I misunderstood your email.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] vfs: move getname() from callers to do_mount()

2014-09-14 Thread Seunghun Lee
It would make more sense to pass char __user * instead of
char * in callers of do_mount() and do getname() inside do_mount().

Suggested-by: Al Viro 
Signed-off-by: Seunghun Lee 
---
 arch/alpha/kernel/osf_sys.c | 23 ++-
 fs/compat.c | 20 ++--
 fs/namespace.c  | 29 -
 include/linux/fs.h  |  3 ++-
 4 files changed, 30 insertions(+), 45 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 1402fcc..f9c732e 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -446,7 +446,8 @@ struct procfs_args {
  * unhappy with OSF UFS. [CHECKME]
  */
 static int
-osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
+osf_ufs_mount(const char __user *dirname,
+ struct ufs_args __user *args, int flags)
 {
int retval;
struct cdfs_args tmp;
@@ -466,7 +467,8 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user 
*args, int flags)
 }
 
 static int
-osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
+osf_cdfs_mount(const char __user *dirname,
+  struct cdfs_args __user *args, int flags)
 {
int retval;
struct cdfs_args tmp;
@@ -486,7 +488,8 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user 
*args, int flags)
 }
 
 static int
-osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int 
flags)
+osf_procfs_mount(const char __user *dirname,
+struct procfs_args __user *args, int flags)
 {
struct procfs_args tmp;
 
@@ -500,28 +503,22 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const 
char __user *, path,
int, flag, void __user *, data)
 {
int retval;
-   struct filename *name;
 
-   name = getname(path);
-   retval = PTR_ERR(name);
-   if (IS_ERR(name))
-   goto out;
switch (typenr) {
case 1:
-   retval = osf_ufs_mount(name->name, data, flag);
+   retval = osf_ufs_mount(path, data, flag);
break;
case 6:
-   retval = osf_cdfs_mount(name->name, data, flag);
+   retval = osf_cdfs_mount(path, data, flag);
break;
case 9:
-   retval = osf_procfs_mount(name->name, data, flag);
+   retval = osf_procfs_mount(path, data, flag);
break;
default:
retval = -EINVAL;
printk("osf_mount(%ld, %x)\n", typenr, flag);
}
-   putname(name);
- out:
+
return retval;
 }
 
diff --git a/fs/compat.c b/fs/compat.c
index 6205c24..b13df99 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -794,7 +794,6 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
char *kernel_type;
unsigned long data_page;
char *kernel_dev;
-   struct filename *dir;
int retval;
 
kernel_type = copy_mount_string(type);
@@ -802,19 +801,14 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, 
dev_name,
if (IS_ERR(kernel_type))
goto out;
 
-   dir = getname(dir_name);
-   retval = PTR_ERR(dir);
-   if (IS_ERR(dir))
-   goto out1;
-
kernel_dev = copy_mount_string(dev_name);
retval = PTR_ERR(kernel_dev);
if (IS_ERR(kernel_dev))
-   goto out2;
+   goto out1;
 
retval = copy_mount_options(data, _page);
if (retval < 0)
-   goto out3;
+   goto out2;
 
retval = -EINVAL;
 
@@ -823,19 +817,17 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, 
dev_name,
do_ncp_super_data_conv((void *)data_page);
} else if (!strcmp(kernel_type, NFS4_NAME)) {
if (do_nfs4_super_data_conv((void *) data_page))
-   goto out4;
+   goto out3;
}
}
 
-   retval = do_mount(kernel_dev, dir->name, kernel_type,
+   retval = do_mount(kernel_dev, dir_name, kernel_type,
flags, (void*)data_page);
 
- out4:
-   free_page(data_page);
  out3:
-   kfree(kernel_dev);
+   free_page(data_page);
  out2:
-   putname(dir);
+   kfree(kernel_dev);
  out1:
kfree(kernel_type);
  out:
diff --git a/fs/namespace.c b/fs/namespace.c
index bfd03c6..3e11e9e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2542,9 +2542,10 @@ char *copy_mount_string(const void __user *data)
  * Therefore, if this magic number is present, it carries no information
  * and must be discarded.
  */
-long do_mount(const char *dev_name, const char *dir_name,
+long do_mount(const char *dev_name, const char __user *dir_name,
const char *type_page, unsigned long flags, void *data_page)
 {
+   struct filename *kernel_dir;
struct path path;
in

[PATCH] vfs: move getname() from callers to do_mount()

2014-09-14 Thread Seunghun Lee
It would make more sense to pass char __user * instead of
char * in callers of do_mount() and do getname() inside do_mount().

Suggested-by: Al Viro v...@zeniv.linux.org.uk
Signed-off-by: Seunghun Lee way...@gmail.com
---
 arch/alpha/kernel/osf_sys.c | 23 ++-
 fs/compat.c | 20 ++--
 fs/namespace.c  | 29 -
 include/linux/fs.h  |  3 ++-
 4 files changed, 30 insertions(+), 45 deletions(-)

diff --git a/arch/alpha/kernel/osf_sys.c b/arch/alpha/kernel/osf_sys.c
index 1402fcc..f9c732e 100644
--- a/arch/alpha/kernel/osf_sys.c
+++ b/arch/alpha/kernel/osf_sys.c
@@ -446,7 +446,8 @@ struct procfs_args {
  * unhappy with OSF UFS. [CHECKME]
  */
 static int
-osf_ufs_mount(const char *dirname, struct ufs_args __user *args, int flags)
+osf_ufs_mount(const char __user *dirname,
+ struct ufs_args __user *args, int flags)
 {
int retval;
struct cdfs_args tmp;
@@ -466,7 +467,8 @@ osf_ufs_mount(const char *dirname, struct ufs_args __user 
*args, int flags)
 }
 
 static int
-osf_cdfs_mount(const char *dirname, struct cdfs_args __user *args, int flags)
+osf_cdfs_mount(const char __user *dirname,
+  struct cdfs_args __user *args, int flags)
 {
int retval;
struct cdfs_args tmp;
@@ -486,7 +488,8 @@ osf_cdfs_mount(const char *dirname, struct cdfs_args __user 
*args, int flags)
 }
 
 static int
-osf_procfs_mount(const char *dirname, struct procfs_args __user *args, int 
flags)
+osf_procfs_mount(const char __user *dirname,
+struct procfs_args __user *args, int flags)
 {
struct procfs_args tmp;
 
@@ -500,28 +503,22 @@ SYSCALL_DEFINE4(osf_mount, unsigned long, typenr, const 
char __user *, path,
int, flag, void __user *, data)
 {
int retval;
-   struct filename *name;
 
-   name = getname(path);
-   retval = PTR_ERR(name);
-   if (IS_ERR(name))
-   goto out;
switch (typenr) {
case 1:
-   retval = osf_ufs_mount(name-name, data, flag);
+   retval = osf_ufs_mount(path, data, flag);
break;
case 6:
-   retval = osf_cdfs_mount(name-name, data, flag);
+   retval = osf_cdfs_mount(path, data, flag);
break;
case 9:
-   retval = osf_procfs_mount(name-name, data, flag);
+   retval = osf_procfs_mount(path, data, flag);
break;
default:
retval = -EINVAL;
printk(osf_mount(%ld, %x)\n, typenr, flag);
}
-   putname(name);
- out:
+
return retval;
 }
 
diff --git a/fs/compat.c b/fs/compat.c
index 6205c24..b13df99 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -794,7 +794,6 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, dev_name,
char *kernel_type;
unsigned long data_page;
char *kernel_dev;
-   struct filename *dir;
int retval;
 
kernel_type = copy_mount_string(type);
@@ -802,19 +801,14 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, 
dev_name,
if (IS_ERR(kernel_type))
goto out;
 
-   dir = getname(dir_name);
-   retval = PTR_ERR(dir);
-   if (IS_ERR(dir))
-   goto out1;
-
kernel_dev = copy_mount_string(dev_name);
retval = PTR_ERR(kernel_dev);
if (IS_ERR(kernel_dev))
-   goto out2;
+   goto out1;
 
retval = copy_mount_options(data, data_page);
if (retval  0)
-   goto out3;
+   goto out2;
 
retval = -EINVAL;
 
@@ -823,19 +817,17 @@ COMPAT_SYSCALL_DEFINE5(mount, const char __user *, 
dev_name,
do_ncp_super_data_conv((void *)data_page);
} else if (!strcmp(kernel_type, NFS4_NAME)) {
if (do_nfs4_super_data_conv((void *) data_page))
-   goto out4;
+   goto out3;
}
}
 
-   retval = do_mount(kernel_dev, dir-name, kernel_type,
+   retval = do_mount(kernel_dev, dir_name, kernel_type,
flags, (void*)data_page);
 
- out4:
-   free_page(data_page);
  out3:
-   kfree(kernel_dev);
+   free_page(data_page);
  out2:
-   putname(dir);
+   kfree(kernel_dev);
  out1:
kfree(kernel_type);
  out:
diff --git a/fs/namespace.c b/fs/namespace.c
index bfd03c6..3e11e9e 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2542,9 +2542,10 @@ char *copy_mount_string(const void __user *data)
  * Therefore, if this magic number is present, it carries no information
  * and must be discarded.
  */
-long do_mount(const char *dev_name, const char *dir_name,
+long do_mount(const char *dev_name, const char __user *dir_name,
const char *type_page, unsigned long flags, void *data_page)
 {
+   struct filename *kernel_dir;
struct path path

Re: [PATCH] vfs: move getname() from callers to do_mount()

2014-09-14 Thread Seunghun Lee
On September 15, 2014 2:18:50 PM GMT+09:00, Al Viro v...@zeniv.linux.org.uk 
wrote:
On Mon, Sep 15, 2014 at 01:39:19PM +0900, Seunghun Lee wrote:
 2014. 9. 15. 오전 3:13에 Al Viro v...@zeniv.linux.org.uk wrote:
  Applied with one modification: this getname/kern_path/putname is

 Ok, I will resend it after modification.

See above...  It's already in vfs.git#for-next.  The last commit of the
branch at the moment.  The change was trivial - done it while applying
the
patch.

Oh sorry, I misunderstood your email.

Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] vfs: remove redundant sanity check in do_mount

2014-09-12 Thread Seunghun Lee

On 09/13/2014 01:28 AM, Al Viro wrote:
> On Sat, Sep 13, 2014 at 12:53:32AM +0900, Seunghun Lee wrote:
>> In sys_mount, getname() checks dir_name.
>> So do_mount needn't check dir_name again.
> ... and simple grep shows four more call sites.  At the very least, the
> commit message needs to cover those as well, *if* the check is, indeed,
> redundant.  From the look through those guys it looks like it is, but...
> I wonder if it would make more sense to pass char __user * instead of
> char * here.  And do getname() inside do_mount().  As it is, we do
> getname() in all callers *and* never look into the result of said getname()
> until passing it to do_mount().  So how about just passing userland pointer
> all the way down to do_mount() (grep for callers and watch out for ones
> in arch/alpha/kernel/osf_sys.c) and doing getname() in do_mount() itself?
Ok, I will rework the patch.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] vfs: remove redundant sanity check in do_mount

2014-09-12 Thread Seunghun Lee
In sys_mount, getname() checks dir_name.
So do_mount needn't check dir_name again.

Signed-off-by: Seunghun Lee 
---
 fs/namespace.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index bfd03c6..bf8a9af 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2553,11 +2553,6 @@ long do_mount(const char *dev_name, const char *dir_name,
if ((flags & MS_MGC_MSK) == MS_MGC_VAL)
flags &= ~MS_MGC_MSK;
 
-   /* Basic sanity checks */
-
-   if (!dir_name || !*dir_name || !memchr(dir_name, 0, PAGE_SIZE))
-   return -EINVAL;
-
if (data_page)
((char *)data_page)[PAGE_SIZE - 1] = 0;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] vfs: remove redundant sanity check in do_mount

2014-09-12 Thread Seunghun Lee
In sys_mount, getname() checks dir_name.
So do_mount needn't check dir_name again.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/namespace.c |5 -
 1 file changed, 5 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index bfd03c6..bf8a9af 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2553,11 +2553,6 @@ long do_mount(const char *dev_name, const char *dir_name,
if ((flags  MS_MGC_MSK) == MS_MGC_VAL)
flags = ~MS_MGC_MSK;
 
-   /* Basic sanity checks */
-
-   if (!dir_name || !*dir_name || !memchr(dir_name, 0, PAGE_SIZE))
-   return -EINVAL;
-
if (data_page)
((char *)data_page)[PAGE_SIZE - 1] = 0;
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] vfs: remove redundant sanity check in do_mount

2014-09-12 Thread Seunghun Lee

On 09/13/2014 01:28 AM, Al Viro wrote:
 On Sat, Sep 13, 2014 at 12:53:32AM +0900, Seunghun Lee wrote:
 In sys_mount, getname() checks dir_name.
 So do_mount needn't check dir_name again.
 ... and simple grep shows four more call sites.  At the very least, the
 commit message needs to cover those as well, *if* the check is, indeed,
 redundant.  From the look through those guys it looks like it is, but...
 I wonder if it would make more sense to pass char __user * instead of
 char * here.  And do getname() inside do_mount().  As it is, we do
 getname() in all callers *and* never look into the result of said getname()
 until passing it to do_mount().  So how about just passing userland pointer
 all the way down to do_mount() (grep for callers and watch out for ones
 in arch/alpha/kernel/osf_sys.c) and doing getname() in do_mount() itself?
Ok, I will rework the patch.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fat: Simplify calc_fat_clusters code

2014-09-02 Thread Seunghun Lee

On 09/03/2014 12:37 AM, OGAWA Hirofumi wrote:
> Seunghun Lee  writes:
>
>> diff --git a/fs/fat/inode.c b/fs/fat/inode.c
>> index 756aead..6992dea 100644
>> --- a/fs/fat/inode.c
>> +++ b/fs/fat/inode.c
>> @@ -1307,12 +1307,9 @@ static unsigned long calc_fat_clusters(struct 
>> super_block *sb)
>>  struct msdos_sb_info *sbi = MSDOS_SB(sb);
>>  
>>  /* Divide first to avoid overflow */
>> -if (sbi->fat_bits != 12) {
>> -unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
>> -return ent_per_sec * sbi->fat_length;
>> -}
>> +unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
>>  
>> -return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits;
>> +return ent_per_sec * sbi->fat_length;
>>  }
> When sbi->fat_bits == 12, it doesn't work, right? (there is the remainder)
>
> Thanks.
Yes, you are right.

I didn't think about the remainder.

Thanks.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fat: Simplify calc_fat_clusters code

2014-09-02 Thread Seunghun Lee
Code for fat12 and fat16/32 can be merged to one.

Signed-off-by: Seunghun Lee 
---
 fs/fat/inode.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 756aead..6992dea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1307,12 +1307,9 @@ static unsigned long calc_fat_clusters(struct 
super_block *sb)
struct msdos_sb_info *sbi = MSDOS_SB(sb);
 
/* Divide first to avoid overflow */
-   if (sbi->fat_bits != 12) {
-   unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
-   return ent_per_sec * sbi->fat_length;
-   }
+   unsigned long ent_per_sec = sb->s_blocksize * 8 / sbi->fat_bits;
 
-   return sbi->fat_length * sb->s_blocksize * 8 / sbi->fat_bits;
+   return ent_per_sec * sbi->fat_length;
 }
 
 static bool fat_bpb_is_zero(struct fat_boot_sector *b)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] fat: Simplify calc_fat_clusters code

2014-09-02 Thread Seunghun Lee
Code for fat12 and fat16/32 can be merged to one.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/fat/inode.c |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/fs/fat/inode.c b/fs/fat/inode.c
index 756aead..6992dea 100644
--- a/fs/fat/inode.c
+++ b/fs/fat/inode.c
@@ -1307,12 +1307,9 @@ static unsigned long calc_fat_clusters(struct 
super_block *sb)
struct msdos_sb_info *sbi = MSDOS_SB(sb);
 
/* Divide first to avoid overflow */
-   if (sbi-fat_bits != 12) {
-   unsigned long ent_per_sec = sb-s_blocksize * 8 / sbi-fat_bits;
-   return ent_per_sec * sbi-fat_length;
-   }
+   unsigned long ent_per_sec = sb-s_blocksize * 8 / sbi-fat_bits;
 
-   return sbi-fat_length * sb-s_blocksize * 8 / sbi-fat_bits;
+   return ent_per_sec * sbi-fat_length;
 }
 
 static bool fat_bpb_is_zero(struct fat_boot_sector *b)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] fat: Simplify calc_fat_clusters code

2014-09-02 Thread Seunghun Lee

On 09/03/2014 12:37 AM, OGAWA Hirofumi wrote:
 Seunghun Lee way...@gmail.com writes:

 diff --git a/fs/fat/inode.c b/fs/fat/inode.c
 index 756aead..6992dea 100644
 --- a/fs/fat/inode.c
 +++ b/fs/fat/inode.c
 @@ -1307,12 +1307,9 @@ static unsigned long calc_fat_clusters(struct 
 super_block *sb)
  struct msdos_sb_info *sbi = MSDOS_SB(sb);
  
  /* Divide first to avoid overflow */
 -if (sbi-fat_bits != 12) {
 -unsigned long ent_per_sec = sb-s_blocksize * 8 / sbi-fat_bits;
 -return ent_per_sec * sbi-fat_length;
 -}
 +unsigned long ent_per_sec = sb-s_blocksize * 8 / sbi-fat_bits;
  
 -return sbi-fat_length * sb-s_blocksize * 8 / sbi-fat_bits;
 +return ent_per_sec * sbi-fat_length;
  }
 When sbi-fat_bits == 12, it doesn't work, right? (there is the remainder)

 Thanks.
Yes, you are right.

I didn't think about the remainder.

Thanks.

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: split two assignments into the two assignments on two lines.

2014-09-01 Thread Seunghun Lee
split two assignments into the two assignments on two lines.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/TODO  |2 --
 drivers/staging/dgnc/dgnc_cls.c|   15 ++-
 drivers/staging/dgnc/dgnc_driver.c |   10 ++
 drivers/staging/dgnc/dgnc_neo.c|   16 +++-
 drivers/staging/dgnc/dgnc_tty.c|9 ++---
 5 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index d2828c7..22adff1 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,6 +1,4 @@
 * checkpatch fixes
-* split two assignments into the two assignments on two lines;
-  don't use two equals signs
 * remove unecessary comments
 * remove unecessary error messages. Example kzalloc() has its 
   own error message. Adding an extra one is useless.
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 84b1377..0393d6d 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -493,9 +493,12 @@ static void cls_param(struct tty_struct *tty)
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
if ((ch->ch_c_cflag & (CBAUD)) == 0) {
-   ch->ch_r_head = ch->ch_r_tail = 0;
-   ch->ch_e_head = ch->ch_e_tail = 0;
-   ch->ch_w_head = ch->ch_w_tail = 0;
+   ch->ch_r_head = 0;
+   ch->ch_r_tail = 0;
+   ch->ch_e_head = 0;
+   ch->ch_e_tail = 0;
+   ch->ch_w_head = 0;
+   ch->ch_w_tail = 0;
 
cls_flush_uart_write(ch);
cls_flush_uart_read(ch);
@@ -627,7 +630,8 @@ static void cls_param(struct tty_struct *tty)
break;
}
 
-   ier = uart_ier = readb(>ch_cls_uart->ier);
+   uart_ier = readb(>ch_cls_uart->ier);
+   ier =  uart_ier;
uart_lcr = readb(>ch_cls_uart->lcr);
 
if (baud == 0)
@@ -915,7 +919,8 @@ static void cls_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * I hope thats okay with everyone? Yes? Good.
 */
while (qleft < 1) {
-   ch->ch_r_tail = tail = (tail + 1) & RQUEUEMASK;
+   tail = (tail + 1) & RQUEUEMASK;
+   ch->ch_r_tail = tail;
ch->ch_err_overrun++;
qleft++;
}
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 11bed56..2cc02c9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -410,14 +410,16 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
unsigned long flags;
 
/* get the board structure and prep it */
-   brd = dgnc_Board[dgnc_NumBoards] =
-   kzalloc(sizeof(*brd), GFP_KERNEL);
+   dgnc_Board[dgnc_NumBoards] = kzalloc(sizeof(*brd), GFP_KERNEL);
+   brd = dgnc_Board[dgnc_NumBoards];
+
if (!brd)
return -ENOMEM;
 
/* make a temporary message buffer for the boot messages */
-   brd->msgbuf = brd->msgbuf_head =
-   kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+   brd->msgbuf_head = kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+   brd->msgbuf = brd->msgbuf_head;
+
if (!brd->msgbuf) {
kfree(brd);
return -ENOMEM;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 920ce2d..d6f4a80 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -626,9 +626,12 @@ static void neo_param(struct tty_struct *tty)
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
if ((ch->ch_c_cflag & (CBAUD)) == 0) {
-   ch->ch_r_head = ch->ch_r_tail = 0;
-   ch->ch_e_head = ch->ch_e_tail = 0;
-   ch->ch_w_head = ch->ch_w_tail = 0;
+   ch->ch_r_head = 0;
+   ch->ch_r_tail = 0;
+   ch->ch_e_head = 0;
+   ch->ch_e_tail = 0;
+   ch->ch_w_head = 0;
+   ch->ch_w_tail = 0;
 
neo_flush_uart_write(ch);
neo_flush_uart_read(ch);
@@ -754,7 +757,9 @@ static void neo_param(struct tty_struct *tty)
break;
}
 
-   ier = uart_ier = readb(>ch_neo_uart->ier);
+   uart_ier = readb(>ch_neo_uart->ier);
+   ier = uart_ier;
+
uart_lcr = readb(>ch_neo_uart->lcr);
 
if (baud == 0)
@@ -1285,7 +1290,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * I hope thats okay with everyone? Yes? Good.
 */
while (qleft < 1) {
-

[PATCH] ext4: fix comments about get_blocks

2014-09-01 Thread Seunghun Lee
get_blocks is renamed to get_block.

Signed-off-by: Seunghun Lee 
---
 fs/ext4/inode.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3aa26e9..6c91fb3 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -590,7 +590,7 @@ found:
/*
 * New blocks allocate and/or writing to unwritten extent
 * will possibly result in updating i_data, so we take
-* the write lock of i_data_sem, and call get_blocks()
+* the write lock of i_data_sem, and call get_block()
 * with create == 1 flag.
 */
down_write(_I(inode)->i_data_sem);
@@ -1536,7 +1536,7 @@ out_unlock:
 }
 
 /*
- * This is a special get_blocks_t callback which is used by
+ * This is a special get_block_t callback which is used by
  * ext4_da_write_begin().  It will either return mapped block or
  * reserve space for a single block.
  *
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ext4: fix comments about get_blocks

2014-09-01 Thread Seunghun Lee
get_blocks is renamed to get_block.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ext4/inode.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 3aa26e9..6c91fb3 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -590,7 +590,7 @@ found:
/*
 * New blocks allocate and/or writing to unwritten extent
 * will possibly result in updating i_data, so we take
-* the write lock of i_data_sem, and call get_blocks()
+* the write lock of i_data_sem, and call get_block()
 * with create == 1 flag.
 */
down_write(EXT4_I(inode)-i_data_sem);
@@ -1536,7 +1536,7 @@ out_unlock:
 }
 
 /*
- * This is a special get_blocks_t callback which is used by
+ * This is a special get_block_t callback which is used by
  * ext4_da_write_begin().  It will either return mapped block or
  * reserve space for a single block.
  *
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: split two assignments into the two assignments on two lines.

2014-09-01 Thread Seunghun Lee
split two assignments into the two assignments on two lines.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/TODO  |2 --
 drivers/staging/dgnc/dgnc_cls.c|   15 ++-
 drivers/staging/dgnc/dgnc_driver.c |   10 ++
 drivers/staging/dgnc/dgnc_neo.c|   16 +++-
 drivers/staging/dgnc/dgnc_tty.c|9 ++---
 5 files changed, 33 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO
index d2828c7..22adff1 100644
--- a/drivers/staging/dgnc/TODO
+++ b/drivers/staging/dgnc/TODO
@@ -1,6 +1,4 @@
 * checkpatch fixes
-* split two assignments into the two assignments on two lines;
-  don't use two equals signs
 * remove unecessary comments
 * remove unecessary error messages. Example kzalloc() has its 
   own error message. Adding an extra one is useless.
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 84b1377..0393d6d 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -493,9 +493,12 @@ static void cls_param(struct tty_struct *tty)
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
if ((ch-ch_c_cflag  (CBAUD)) == 0) {
-   ch-ch_r_head = ch-ch_r_tail = 0;
-   ch-ch_e_head = ch-ch_e_tail = 0;
-   ch-ch_w_head = ch-ch_w_tail = 0;
+   ch-ch_r_head = 0;
+   ch-ch_r_tail = 0;
+   ch-ch_e_head = 0;
+   ch-ch_e_tail = 0;
+   ch-ch_w_head = 0;
+   ch-ch_w_tail = 0;
 
cls_flush_uart_write(ch);
cls_flush_uart_read(ch);
@@ -627,7 +630,8 @@ static void cls_param(struct tty_struct *tty)
break;
}
 
-   ier = uart_ier = readb(ch-ch_cls_uart-ier);
+   uart_ier = readb(ch-ch_cls_uart-ier);
+   ier =  uart_ier;
uart_lcr = readb(ch-ch_cls_uart-lcr);
 
if (baud == 0)
@@ -915,7 +919,8 @@ static void cls_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * I hope thats okay with everyone? Yes? Good.
 */
while (qleft  1) {
-   ch-ch_r_tail = tail = (tail + 1)  RQUEUEMASK;
+   tail = (tail + 1)  RQUEUEMASK;
+   ch-ch_r_tail = tail;
ch-ch_err_overrun++;
qleft++;
}
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 11bed56..2cc02c9 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -410,14 +410,16 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
unsigned long flags;
 
/* get the board structure and prep it */
-   brd = dgnc_Board[dgnc_NumBoards] =
-   kzalloc(sizeof(*brd), GFP_KERNEL);
+   dgnc_Board[dgnc_NumBoards] = kzalloc(sizeof(*brd), GFP_KERNEL);
+   brd = dgnc_Board[dgnc_NumBoards];
+
if (!brd)
return -ENOMEM;
 
/* make a temporary message buffer for the boot messages */
-   brd-msgbuf = brd-msgbuf_head =
-   kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+   brd-msgbuf_head = kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+   brd-msgbuf = brd-msgbuf_head;
+
if (!brd-msgbuf) {
kfree(brd);
return -ENOMEM;
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 920ce2d..d6f4a80 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -626,9 +626,12 @@ static void neo_param(struct tty_struct *tty)
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
if ((ch-ch_c_cflag  (CBAUD)) == 0) {
-   ch-ch_r_head = ch-ch_r_tail = 0;
-   ch-ch_e_head = ch-ch_e_tail = 0;
-   ch-ch_w_head = ch-ch_w_tail = 0;
+   ch-ch_r_head = 0;
+   ch-ch_r_tail = 0;
+   ch-ch_e_head = 0;
+   ch-ch_e_tail = 0;
+   ch-ch_w_head = 0;
+   ch-ch_w_tail = 0;
 
neo_flush_uart_write(ch);
neo_flush_uart_read(ch);
@@ -754,7 +757,9 @@ static void neo_param(struct tty_struct *tty)
break;
}
 
-   ier = uart_ier = readb(ch-ch_neo_uart-ier);
+   uart_ier = readb(ch-ch_neo_uart-ier);
+   ier = uart_ier;
+
uart_lcr = readb(ch-ch_neo_uart-lcr);
 
if (baud == 0)
@@ -1285,7 +1290,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * I hope thats okay with everyone? Yes? Good.
 */
while (qleft  1) {
-   ch-ch_r_tail = tail = (tail + 1)  RQUEUEMASK;
+   tail = (tail + 1)  RQUEUEMASK;
+   ch-ch_r_tail

[PATCH] staging: dgnc: remove some unused macros

2014-08-31 Thread Seunghun Lee
These macros do nothing, so remove it.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.h |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 020..7776874 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -54,9 +54,9 @@
 #defineDEVSTR  "/dev/dg/dgnc"  /* /dev entries 
 */
 #defineDRVSTR  "dgnc"  /* Driver name string
 * displayed by APR  */
-#defineAPR(args)   do { PRINTF_TO_KMEM(args); printk(DRVSTR": "); 
printk args; \
+#defineAPR(args)   do { printk(DRVSTR": "); printk args; \
   } while (0)
-#defineRAPR(args)  do { PRINTF_TO_KMEM(args); printk args; } while 
(0)
+#defineRAPR(args)  do { printk args; } while (0)
 
 #define TRC_TO_CONSOLE 1
 
@@ -89,9 +89,6 @@
 
 #defineDBG_CARR(dgnc_debug & 0x1)
 
-#define PRINTF_TO_KMEM(args)
-# define TRC(ARGS)
-
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
 #defineMAXPORTS8
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: remove some unused macros

2014-08-31 Thread Seunghun Lee
These macros do nothing, so remove it.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_driver.h |7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 020..7776874 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -54,9 +54,9 @@
 #defineDEVSTR  /dev/dg/dgnc  /* /dev entries 
 */
 #defineDRVSTR  dgnc  /* Driver name string
 * displayed by APR  */
-#defineAPR(args)   do { PRINTF_TO_KMEM(args); printk(DRVSTR: ); 
printk args; \
+#defineAPR(args)   do { printk(DRVSTR: ); printk args; \
   } while (0)
-#defineRAPR(args)  do { PRINTF_TO_KMEM(args); printk args; } while 
(0)
+#defineRAPR(args)  do { printk args; } while (0)
 
 #define TRC_TO_CONSOLE 1
 
@@ -89,9 +89,6 @@
 
 #defineDBG_CARR(dgnc_debug  0x1)
 
-#define PRINTF_TO_KMEM(args)
-# define TRC(ARGS)
-
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
 #defineMAXPORTS8
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-19 Thread Seunghun Lee
In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.

So remove them and related codes.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_cls.c|   51 
 drivers/staging/dgnc/dgnc_driver.c |   19 +--
 drivers/staging/dgnc/dgnc_driver.h |   21 ---
 drivers/staging/dgnc/dgnc_mgmt.c   |   23 
 drivers/staging/dgnc/dgnc_neo.c|  104 ++-
 drivers/staging/dgnc/dgnc_tty.c|  249 +++-
 6 files changed, 29 insertions(+), 438 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index fe099c6..84b1377 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -99,7 +99,6 @@ static inline void cls_set_cts_flow_control(struct channel_t 
*ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting CTSFLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -144,7 +143,6 @@ static inline void cls_set_ixon_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting IXON FLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -193,7 +191,6 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Unsetting Output FLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -240,7 +237,6 @@ static inline void cls_set_rts_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting RTSFLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -283,7 +279,6 @@ static inline void cls_set_ixoff_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting IXOFF FLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -328,7 +323,6 @@ static inline void cls_set_no_input_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Unsetting Input FLOW\n"));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -394,8 +388,6 @@ static inline void cls_clear_break(struct channel_t *ch, 
int force)
writeb((temp & ~UART_LCR_SBC), >ch_cls_uart->lcr);
ch->ch_flags &= ~(CH_BREAK_SENDING);
ch->ch_stop_sending_break = 0;
-   DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n",
-   jiffies));
}
}
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -430,9 +422,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
if (isr & UART_IIR_NO_INT)
break;
 
-   DPR_INTR(("%s:%d port: %x isr: %x\n", __FILE__, __LINE__,
-port, isr));
-
/* Receive Interrupt pending */
if (isr & (UART_IIR_RDI | UART_IIR_RDI_TIMEOUT)) {
/* Read data from uart -> queue */
@@ -464,7 +453,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
}
 
/* Parse any modem signal changes */
-   DPR_INTR(("MOD_STAT: sending to parse_modem_sigs\n"));
cls_parse_modem(ch, readb(>ch_cls_uart->msr));
}
 }
@@ -501,10 +489,6 @@ static void cls_param(struct tty_struct *tty)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n",
-   ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag,
-ch->ch_c_iflag));
-
/*
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
@@ -588,8 +572,6 @@ static void cls_param(struct tty_struct *tty)
(jindex < 16)) {
baud = bauds[iindex][jindex];
} else {
-   DPR_IOCTL(("baud indices were out of range (%d)(%d)",
-   iindex, jindex));
baud = 0;
}
 
@@ -840,14 +822,10 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
 
/* If 0, no interrupts pending */
if (!poll_reg) {
- 

[PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-19 Thread Seunghun Lee
In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.

So remove them and related codes.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_cls.c|   51 
 drivers/staging/dgnc/dgnc_driver.c |   19 +--
 drivers/staging/dgnc/dgnc_driver.h |   21 ---
 drivers/staging/dgnc/dgnc_mgmt.c   |   23 
 drivers/staging/dgnc/dgnc_neo.c|  104 ++-
 drivers/staging/dgnc/dgnc_tty.c|  249 +++-
 6 files changed, 29 insertions(+), 438 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index fe099c6..84b1377 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -99,7 +99,6 @@ static inline void cls_set_cts_flow_control(struct channel_t 
*ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting CTSFLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -144,7 +143,6 @@ static inline void cls_set_ixon_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting IXON FLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -193,7 +191,6 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Unsetting Output FLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -240,7 +237,6 @@ static inline void cls_set_rts_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting RTSFLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -283,7 +279,6 @@ static inline void cls_set_ixoff_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting IXOFF FLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -328,7 +323,6 @@ static inline void cls_set_no_input_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Unsetting Input FLOW\n));
 
/*
 * The Enhanced Register Set may only be accessed when
@@ -394,8 +388,6 @@ static inline void cls_clear_break(struct channel_t *ch, 
int force)
writeb((temp  ~UART_LCR_SBC), ch-ch_cls_uart-lcr);
ch-ch_flags = ~(CH_BREAK_SENDING);
ch-ch_stop_sending_break = 0;
-   DPR_IOCTL((Finishing UART_LCR_SBC! finished: %lx\n,
-   jiffies));
}
}
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -430,9 +422,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
if (isr  UART_IIR_NO_INT)
break;
 
-   DPR_INTR((%s:%d port: %x isr: %x\n, __FILE__, __LINE__,
-port, isr));
-
/* Receive Interrupt pending */
if (isr  (UART_IIR_RDI | UART_IIR_RDI_TIMEOUT)) {
/* Read data from uart - queue */
@@ -464,7 +453,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
}
 
/* Parse any modem signal changes */
-   DPR_INTR((MOD_STAT: sending to parse_modem_sigs\n));
cls_parse_modem(ch, readb(ch-ch_cls_uart-msr));
}
 }
@@ -501,10 +489,6 @@ static void cls_param(struct tty_struct *tty)
if (!bd || bd-magic != DGNC_BOARD_MAGIC)
return;
 
-   DPR_PARAM((param start: tdev: %x cflags: %x oflags: %x iflags: %x\n,
-   ch-ch_tun.un_dev, ch-ch_c_cflag, ch-ch_c_oflag,
-ch-ch_c_iflag));
-
/*
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
@@ -588,8 +572,6 @@ static void cls_param(struct tty_struct *tty)
(jindex  16)) {
baud = bauds[iindex][jindex];
} else {
-   DPR_IOCTL((baud indices were out of range (%d)(%d),
-   iindex, jindex));
baud = 0;
}
 
@@ -840,14 +822,10 @@ static irqreturn_t cls_intr(int irq, void *voidbrd)
 
/* If 0, no interrupts pending */
if (!poll_reg) {
-   DPR_INTR((
-Kernel interrupted to me, but no pending 
interrupts...\n));
DGNC_UNLOCK(brd-bd_intr_lock, lock_flags

Re: [PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-15 Thread Seunghun Lee

On 08/15/2014 03:08 PM, Greg KH wrote:
> On Tue, Aug 12, 2014 at 10:30:14PM +0900, Seunghun Lee wrote:
>> In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.
>>
>> So remove them and related codes.
>>
>> CC: Lidza Louina 
>> CC: Mark Hounschell 
>> Signed-off-by: Seunghun Lee 
>> ---
>>  drivers/staging/dgnc/dgnc_cls.c|   63 +
>>  drivers/staging/dgnc/dgnc_driver.c |   20 +--
>>  drivers/staging/dgnc/dgnc_driver.h |   21 ---
>>  drivers/staging/dgnc/dgnc_mgmt.c   |   23 
>>  drivers/staging/dgnc/dgnc_neo.c|  104 ++-
>>  drivers/staging/dgnc/dgnc_tty.c|  249 
>> +++-
>>  6 files changed, 36 insertions(+), 444 deletions(-)
> This conflicts with patches others have sent, can you refresh it after
> next Tuesday or so when I catch up with the pending patches and can push
> them out?
>
> thanks,
>
> greg k-h
Ok, I will refresh it after next Tuesday.

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-15 Thread Seunghun Lee

On 08/15/2014 03:08 PM, Greg KH wrote:
 On Tue, Aug 12, 2014 at 10:30:14PM +0900, Seunghun Lee wrote:
 In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.

 So remove them and related codes.

 CC: Lidza Louina lidza.lou...@gmail.com
 CC: Mark Hounschell ma...@compro.net
 Signed-off-by: Seunghun Lee way...@gmail.com
 ---
  drivers/staging/dgnc/dgnc_cls.c|   63 +
  drivers/staging/dgnc/dgnc_driver.c |   20 +--
  drivers/staging/dgnc/dgnc_driver.h |   21 ---
  drivers/staging/dgnc/dgnc_mgmt.c   |   23 
  drivers/staging/dgnc/dgnc_neo.c|  104 ++-
  drivers/staging/dgnc/dgnc_tty.c|  249 
 +++-
  6 files changed, 36 insertions(+), 444 deletions(-)
 This conflicts with patches others have sent, can you refresh it after
 next Tuesday or so when I catch up with the pending patches and can push
 them out?

 thanks,

 greg k-h
Ok, I will refresh it after next Tuesday.

Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: android: fix a possible memory leak

2014-08-13 Thread Seunghun Lee
Memory allocated by kstrdup should be freed.

CC: Brian Swetland 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/android/logger.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 9b47e66..0bf0d24 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -790,7 +790,7 @@ static int __init create_log(char *log_name, int size)
if (unlikely(ret)) {
pr_err("failed to register misc device for log '%s'!\n",
log->misc.name);
-   goto out_free_log;
+   goto out_free_misc_name;
}
 
pr_info("created %luK log '%s'\n",
@@ -798,6 +798,9 @@ static int __init create_log(char *log_name, int size)
 
return 0;
 
+out_free_misc_name:
+   kfree(log->misc.name);
+
 out_free_log:
kfree(log);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: android: fix a possible memory leak

2014-08-13 Thread Seunghun Lee
Memory allocated by kstrdup should be freed.

CC: Brian Swetland swetl...@google.com
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/android/logger.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/logger.c b/drivers/staging/android/logger.c
index 9b47e66..0bf0d24 100644
--- a/drivers/staging/android/logger.c
+++ b/drivers/staging/android/logger.c
@@ -790,7 +790,7 @@ static int __init create_log(char *log_name, int size)
if (unlikely(ret)) {
pr_err(failed to register misc device for log '%s'!\n,
log-misc.name);
-   goto out_free_log;
+   goto out_free_misc_name;
}
 
pr_info(created %luK log '%s'\n,
@@ -798,6 +798,9 @@ static int __init create_log(char *log_name, int size)
 
return 0;
 
+out_free_misc_name:
+   kfree(log-misc.name);
+
 out_free_log:
kfree(log);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-12 Thread Seunghun Lee
In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.

So remove them and related codes.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_cls.c|   63 +
 drivers/staging/dgnc/dgnc_driver.c |   20 +--
 drivers/staging/dgnc/dgnc_driver.h |   21 ---
 drivers/staging/dgnc/dgnc_mgmt.c   |   23 
 drivers/staging/dgnc/dgnc_neo.c|  104 ++-
 drivers/staging/dgnc/dgnc_tty.c|  249 +++-
 6 files changed, 36 insertions(+), 444 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index cfa8384..8ff39e6 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -99,8 +99,7 @@ static inline void cls_set_cts_flow_control(struct channel_t 
*ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting CTSFLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -144,8 +143,7 @@ static inline void cls_set_ixon_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting IXON FLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -193,8 +191,7 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Unsetting Output FLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -240,8 +237,7 @@ static inline void cls_set_rts_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting RTSFLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -283,8 +279,7 @@ static inline void cls_set_ixoff_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Setting IXOFF FLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -328,8 +323,7 @@ static inline void cls_set_no_input_flow_control(struct 
channel_t *ch)
uchar ier = readb(>ch_cls_uart->ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM(("Unsetting Input FLOW\n"));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -393,8 +387,6 @@ static inline void cls_clear_break(struct channel_t *ch, 
int force)
writeb((temp & ~UART_LCR_SBC), >ch_cls_uart->lcr);
ch->ch_flags &= ~(CH_BREAK_SENDING);
ch->ch_stop_sending_break = 0;
-   DPR_IOCTL(("Finishing UART_LCR_SBC! finished: %lx\n",
-   jiffies));
}
}
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -429,9 +421,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
if (isr & UART_IIR_NO_INT)
break;
 
-   DPR_INTR(("%s:%d port: %x isr: %x\n", __FILE__, __LINE__,
-port, isr));
-
/* Receive Interrupt pending */
if (isr & (UART_IIR_RDI | UART_IIR_RDI_TIMEOUT)) {
/* Read data from uart -> queue */
@@ -463,7 +452,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
}
 
/* Parse any modem signal changes */
-   DPR_INTR(("MOD_STAT: sending to parse_modem_sigs\n"));
cls_parse_modem(ch, readb(>ch_cls_uart->msr));
}
 }
@@ -500,10 +488,6 @@ static void cls_param(struct tty_struct *tty)
if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
-   DPR_PARAM(("param start: tdev: %x cflags: %x oflags: %x iflags: %x\n",
-   ch->ch_tun.un_dev, ch->ch_c_cflag, ch->ch_c_oflag,
-ch->ch_c_iflag));
-
/*
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
@@ -587,8 +571,6 @@ static void cls_param(struct tty_struct *tty)
(jindex < 16)) {
baud = bauds[iindex][jindex];
} else {
- 

[PATCH] staging: dgnc: remove DPR Macros and related codes.

2014-08-12 Thread Seunghun Lee
In dgnc_drivers.h, DPR macro and DPR_* macros are defined but do nothing.

So remove them and related codes.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_cls.c|   63 +
 drivers/staging/dgnc/dgnc_driver.c |   20 +--
 drivers/staging/dgnc/dgnc_driver.h |   21 ---
 drivers/staging/dgnc/dgnc_mgmt.c   |   23 
 drivers/staging/dgnc/dgnc_neo.c|  104 ++-
 drivers/staging/dgnc/dgnc_tty.c|  249 +++-
 6 files changed, 36 insertions(+), 444 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index cfa8384..8ff39e6 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -99,8 +99,7 @@ static inline void cls_set_cts_flow_control(struct channel_t 
*ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting CTSFLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -144,8 +143,7 @@ static inline void cls_set_ixon_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting IXON FLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -193,8 +191,7 @@ static inline void cls_set_no_output_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Unsetting Output FLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -240,8 +237,7 @@ static inline void cls_set_rts_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting RTSFLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -283,8 +279,7 @@ static inline void cls_set_ixoff_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Setting IXOFF FLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -328,8 +323,7 @@ static inline void cls_set_no_input_flow_control(struct 
channel_t *ch)
uchar ier = readb(ch-ch_cls_uart-ier);
uchar isr_fcr = 0;
 
-   DPR_PARAM((Unsetting Input FLOW\n));
-
+
/*
 * The Enhanced Register Set may only be accessed when
 * the Line Control Register is set to 0xBFh.
@@ -393,8 +387,6 @@ static inline void cls_clear_break(struct channel_t *ch, 
int force)
writeb((temp  ~UART_LCR_SBC), ch-ch_cls_uart-lcr);
ch-ch_flags = ~(CH_BREAK_SENDING);
ch-ch_stop_sending_break = 0;
-   DPR_IOCTL((Finishing UART_LCR_SBC! finished: %lx\n,
-   jiffies));
}
}
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -429,9 +421,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
if (isr  UART_IIR_NO_INT)
break;
 
-   DPR_INTR((%s:%d port: %x isr: %x\n, __FILE__, __LINE__,
-port, isr));
-
/* Receive Interrupt pending */
if (isr  (UART_IIR_RDI | UART_IIR_RDI_TIMEOUT)) {
/* Read data from uart - queue */
@@ -463,7 +452,6 @@ static inline void cls_parse_isr(struct dgnc_board *brd, 
uint port)
}
 
/* Parse any modem signal changes */
-   DPR_INTR((MOD_STAT: sending to parse_modem_sigs\n));
cls_parse_modem(ch, readb(ch-ch_cls_uart-msr));
}
 }
@@ -500,10 +488,6 @@ static void cls_param(struct tty_struct *tty)
if (!bd || bd-magic != DGNC_BOARD_MAGIC)
return;
 
-   DPR_PARAM((param start: tdev: %x cflags: %x oflags: %x iflags: %x\n,
-   ch-ch_tun.un_dev, ch-ch_c_cflag, ch-ch_c_oflag,
-ch-ch_c_iflag));
-
/*
 * If baud rate is zero, flush queues, and set mval to drop DTR.
 */
@@ -587,8 +571,6 @@ static void cls_param(struct tty_struct *tty)
(jindex  16)) {
baud = bauds[iindex][jindex];
} else {
-   DPR_IOCTL((baud indices were out of range (%d)(%d),
-   iindex, jindex));
baud = 0

[PATCH 2/2] staging: dgnc: Remove unneeded dgnc_trace.c and dgnc_trace.h

2014-07-31 Thread Seunghun Lee
Removes unneeded dgnc_trace.c and dgnc_trace.h

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/Makefile  |2 +-
 drivers/staging/dgnc/dgnc_cls.c|1 -
 drivers/staging/dgnc/dgnc_driver.c |1 -
 drivers/staging/dgnc/dgnc_neo.c|1 -
 drivers/staging/dgnc/dgnc_trace.c  |   54 
 drivers/staging/dgnc/dgnc_trace.h  |   34 ---
 drivers/staging/dgnc/dgnc_tty.c|1 -
 7 files changed, 1 insertion(+), 93 deletions(-)
 delete mode 100644 drivers/staging/dgnc/dgnc_trace.c
 delete mode 100644 drivers/staging/dgnc/dgnc_trace.h

diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
index 888c433..733434f 100644
--- a/drivers/staging/dgnc/Makefile
+++ b/drivers/staging/dgnc/Makefile
@@ -4,4 +4,4 @@ obj-$(CONFIG_DGNC) += dgnc.o
 
 dgnc-objs :=   dgnc_cls.o dgnc_driver.o\
dgnc_mgmt.o dgnc_neo.o\
-   dgnc_trace.o dgnc_tty.o dgnc_sysfs.o
+   dgnc_tty.o dgnc_sysfs.o
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 5a76a8e..cfa8384 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -41,7 +41,6 @@
 #include "dgnc_driver.h"   /* Driver main header file */
 #include "dgnc_cls.h"
 #include "dgnc_tty.h"
-#include "dgnc_trace.h"
 
 static inline void cls_parse_isr(struct dgnc_board *brd, uint port);
 static inline void cls_clear_break(struct channel_t *ch, int force);
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index a5be911..764613b 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -40,7 +40,6 @@
 #include "dpacompat.h"
 #include "dgnc_mgmt.h"
 #include "dgnc_tty.h"
-#include "dgnc_trace.h"
 #include "dgnc_cls.h"
 #include "dgnc_neo.h"
 #include "dgnc_sysfs.h"
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 9de988c..68ff116 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -41,7 +41,6 @@
 #include "dgnc_driver.h"   /* Driver main header file */
 #include "dgnc_neo.h"  /* Our header file */
 #include "dgnc_tty.h"
-#include "dgnc_trace.h"
 
 static inline void neo_parse_lsr(struct dgnc_board *brd, uint port);
 static inline void neo_parse_isr(struct dgnc_board *brd, uint port);
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
deleted file mode 100644
index 3bb2259..000
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003 Digi International (www.digi.com)
- * Scott H Kilau 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * NOTE TO LINUX KERNEL HACKERS:  DO NOT REFORMAT THIS CODE!
- *
- * This is shared code between Digi's CVS archive and the
- * Linux Kernel sources.
- * Changing the source just for reformatting needlessly breaks
- * our CVS diff history.
- *
- * Send any bug fixes/changes to:  Eng.Linux at digi dot com.
- * Thank you.
- *
- */
-
-#include 
-#include/* For jiffies, task states */
-#include/* For tasklet and interrupt structs/defines */
-#include 
-
-#include "dgnc_driver.h"
-#include "dgnc_trace.h"
-
-#define TRC_TO_CONSOLE 1
-
-/* file level globals */
-static char *dgnc_trcbuf;  /* the ringbuffer */
-
-/*
- * dgnc_tracer_free()
- *
- *
- */
-void dgnc_tracer_free(void)
-{
-   if (dgnc_trcbuf)
-   vfree(dgnc_trcbuf);
-}
diff --git a/drivers/staging/dgnc/dgnc_trace.h 
b/drivers/staging/dgnc/dgnc_trace.h
deleted file mode 100644
index 4f4e2b9..000
--- a/drivers/staging/dgnc/dgnc_trace.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2003 Digi International (www.digi.com)
- * Scott H Kilau 
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will b

[PATCH 1/2] staging: dgnc: rephrase comment

2014-07-31 Thread Seunghun Lee
Rephrase comment to explain original intention of function.

CC: Lidza Louina 
CC: Mark Hounschell 
Suggested-by: Tobias Klauser 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_cls.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 4b65306..5a76a8e 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1040,11 +1040,11 @@ static void cls_flush_uart_read(struct channel_t *ch)
 * For complete POSIX compatibility, we should be purging the
 * read FIFO in the UART here.
 *
-* However, doing the statement below also incorrectly flushes
-* write data as well as just basically trashing the FIFO.
+* However, clearing the read FIFO (UART_FCR_CLEAR_RCVR) also
+* incorrectly flushes write data as well as just basically trashing the
+* FIFO.
 *
-* I believe this is a BUG in this UART.
-* So for now, we will leave the code #ifdef'ed out...
+* Presumably, this is a bug in this UART.
 */
 
udelay(10);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] staging: dgnc: rephrase comment

2014-07-31 Thread Seunghun Lee
Rephrase comment to explain original intention of function.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Suggested-by: Tobias Klauser tklau...@distanz.ch
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_cls.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 4b65306..5a76a8e 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1040,11 +1040,11 @@ static void cls_flush_uart_read(struct channel_t *ch)
 * For complete POSIX compatibility, we should be purging the
 * read FIFO in the UART here.
 *
-* However, doing the statement below also incorrectly flushes
-* write data as well as just basically trashing the FIFO.
+* However, clearing the read FIFO (UART_FCR_CLEAR_RCVR) also
+* incorrectly flushes write data as well as just basically trashing the
+* FIFO.
 *
-* I believe this is a BUG in this UART.
-* So for now, we will leave the code #ifdef'ed out...
+* Presumably, this is a bug in this UART.
 */
 
udelay(10);
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] staging: dgnc: Remove unneeded dgnc_trace.c and dgnc_trace.h

2014-07-31 Thread Seunghun Lee
Removes unneeded dgnc_trace.c and dgnc_trace.h

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/Makefile  |2 +-
 drivers/staging/dgnc/dgnc_cls.c|1 -
 drivers/staging/dgnc/dgnc_driver.c |1 -
 drivers/staging/dgnc/dgnc_neo.c|1 -
 drivers/staging/dgnc/dgnc_trace.c  |   54 
 drivers/staging/dgnc/dgnc_trace.h  |   34 ---
 drivers/staging/dgnc/dgnc_tty.c|1 -
 7 files changed, 1 insertion(+), 93 deletions(-)
 delete mode 100644 drivers/staging/dgnc/dgnc_trace.c
 delete mode 100644 drivers/staging/dgnc/dgnc_trace.h

diff --git a/drivers/staging/dgnc/Makefile b/drivers/staging/dgnc/Makefile
index 888c433..733434f 100644
--- a/drivers/staging/dgnc/Makefile
+++ b/drivers/staging/dgnc/Makefile
@@ -4,4 +4,4 @@ obj-$(CONFIG_DGNC) += dgnc.o
 
 dgnc-objs :=   dgnc_cls.o dgnc_driver.o\
dgnc_mgmt.o dgnc_neo.o\
-   dgnc_trace.o dgnc_tty.o dgnc_sysfs.o
+   dgnc_tty.o dgnc_sysfs.o
diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 5a76a8e..cfa8384 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -41,7 +41,6 @@
 #include dgnc_driver.h   /* Driver main header file */
 #include dgnc_cls.h
 #include dgnc_tty.h
-#include dgnc_trace.h
 
 static inline void cls_parse_isr(struct dgnc_board *brd, uint port);
 static inline void cls_clear_break(struct channel_t *ch, int force);
diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index a5be911..764613b 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -40,7 +40,6 @@
 #include dpacompat.h
 #include dgnc_mgmt.h
 #include dgnc_tty.h
-#include dgnc_trace.h
 #include dgnc_cls.h
 #include dgnc_neo.h
 #include dgnc_sysfs.h
diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 9de988c..68ff116 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -41,7 +41,6 @@
 #include dgnc_driver.h   /* Driver main header file */
 #include dgnc_neo.h  /* Our header file */
 #include dgnc_tty.h
-#include dgnc_trace.h
 
 static inline void neo_parse_lsr(struct dgnc_board *brd, uint port);
 static inline void neo_parse_isr(struct dgnc_board *brd, uint port);
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
deleted file mode 100644
index 3bb2259..000
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright 2003 Digi International (www.digi.com)
- * Scott H Kilau Scott_Kilau at digi dot com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- * PURPOSE.  See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- *
- * NOTE TO LINUX KERNEL HACKERS:  DO NOT REFORMAT THIS CODE!
- *
- * This is shared code between Digi's CVS archive and the
- * Linux Kernel sources.
- * Changing the source just for reformatting needlessly breaks
- * our CVS diff history.
- *
- * Send any bug fixes/changes to:  Eng.Linux at digi dot com.
- * Thank you.
- *
- */
-
-#include linux/kernel.h
-#include linux/sched.h   /* For jiffies, task states */
-#include linux/interrupt.h   /* For tasklet and interrupt structs/defines */
-#include linux/vmalloc.h
-
-#include dgnc_driver.h
-#include dgnc_trace.h
-
-#define TRC_TO_CONSOLE 1
-
-/* file level globals */
-static char *dgnc_trcbuf;  /* the ringbuffer */
-
-/*
- * dgnc_tracer_free()
- *
- *
- */
-void dgnc_tracer_free(void)
-{
-   if (dgnc_trcbuf)
-   vfree(dgnc_trcbuf);
-}
diff --git a/drivers/staging/dgnc/dgnc_trace.h 
b/drivers/staging/dgnc/dgnc_trace.h
deleted file mode 100644
index 4f4e2b9..000
--- a/drivers/staging/dgnc/dgnc_trace.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2003 Digi International (www.digi.com)
- * Scott H Kilau Scott_Kilau at digi dot com
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY

[PATCH] staging: dgnc: removes unused if defined code

2014-07-28 Thread Seunghun Lee
DGNC_TRACER and TRC_TO_KMEM are never defined.

This patch removes if defined DGNC_TRACER and TRC_TO_KMEM code.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.c |4 ---
 drivers/staging/dgnc/dgnc_driver.h |   53 
 drivers/staging/dgnc/dgnc_trace.c  |8 --
 3 files changed, 65 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 68460af..a5be911 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -388,10 +388,6 @@ void dgnc_cleanup_module(void)
 
dgnc_tty_post_uninit();
 
-#if defined(DGNC_TRACER)
-   /* last thing, make sure we release the tracebuffer */
-   dgnc_tracer_free();
-#endif
if (dgnc_NumBoards)
pci_unregister_driver(_driver);
 }
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index b40ee2c..58b5aa7 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -91,57 +91,6 @@
 
 #defineDBG_CARR(dgnc_debug & 0x1)
 
-
-#if defined(DGNC_TRACER)
-
-# if defined(TRC_TO_KMEM)
-/* Choose one: */
-#  define TRC_ON_OVERFLOW_WRAP_AROUND
-#  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
-# endif /* TRC_TO_KMEM */
-
-# define TRC_MAXMSG1024
-# define TRC_OVERFLOW  "(OVERFLOW)"
-# define TRC_DTRC  "/usr/bin/dtrc"
-
-#if defined TRC_TO_CONSOLE
-#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
-#else /* !defined TRACE_TO_CONSOLE */
-#define PRINTF_TO_CONSOLE(args)
-#endif
-
-#if defined TRC_TO_KMEM
-#define PRINTF_TO_KMEM(args) dgnc_tracef args
-#else /* !defined TRC_TO_KMEM */
-#define PRINTF_TO_KMEM(args)
-#endif
-
-#defineTRC(args)   { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) 
}
-
-# define DPR_INIT(ARGS)if (DBG_INIT) TRC(ARGS)
-# define DPR_BASIC(ARGS)   if (DBG_BASIC) TRC(ARGS)
-# define DPR_CORE(ARGS)if (DBG_CORE) TRC(ARGS)
-# define DPR_OPEN(ARGS)if (DBG_OPEN)  TRC(ARGS)
-# define DPR_CLOSE(ARGS)   if (DBG_CLOSE)  TRC(ARGS)
-# define DPR_READ(ARGS)if (DBG_READ)  TRC(ARGS)
-# define DPR_WRITE(ARGS)   if (DBG_WRITE) TRC(ARGS)
-# define DPR_IOCTL(ARGS)   if (DBG_IOCTL) TRC(ARGS)
-# define DPR_PROC(ARGS)if (DBG_PROC)  TRC(ARGS)
-# define DPR_PARAM(ARGS)   if (DBG_PARAM)  TRC(ARGS)
-# define DPR_PSCAN(ARGS)   if (DBG_PSCAN)  TRC(ARGS)
-# define DPR_EVENT(ARGS)   if (DBG_EVENT)  TRC(ARGS)
-# define DPR_DRAIN(ARGS)   if (DBG_DRAIN)  TRC(ARGS)
-# define DPR_CARR(ARGS)if (DBG_CARR)  TRC(ARGS)
-# define DPR_MGMT(ARGS)if (DBG_MGMT)  TRC(ARGS)
-# define DPR_INTR(ARGS)if (DBG_INTR)  TRC(ARGS)
-# define DPR_MSIGS(ARGS)   if (DBG_MSIGS)  TRC(ARGS)
-
-# define DPR(ARGS) if (dgnc_debug) TRC(ARGS)
-# define P(X)  dgnc_tracef(#X "=%p\n", X)
-# define X(X)  dgnc_tracef(#X "=%x\n", X)
-
-#else/* !defined DGNC_TRACER */
-
 #define PRINTF_TO_KMEM(args)
 # define TRC(ARGS)
 # define DPR_INIT(ARGS)
@@ -164,8 +113,6 @@
 
 # define DPR(args)
 
-#endif/* DGNC_TRACER */
-
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
 #defineMAXPORTS8
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index d764154..3bb2259 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -42,14 +42,6 @@
 /* file level globals */
 static char *dgnc_trcbuf;  /* the ringbuffer */
 
-#if defined(TRC_TO_KMEM)
-static int dgnc_trcbufi = 0;   /* index of the tilde at the end of */
-#endif
-
-#if defined(TRC_TO_KMEM)
-static DEFINE_SPINLOCK(dgnc_tracef_lock);
-#endif
-
 /*
  * dgnc_tracer_free()
  *
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: removes unused if defined code

2014-07-28 Thread Seunghun Lee
DGNC_TRACER and TRC_TO_KMEM are never defined.

This patch removes if defined DGNC_TRACER and TRC_TO_KMEM code.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_driver.c |4 ---
 drivers/staging/dgnc/dgnc_driver.h |   53 
 drivers/staging/dgnc/dgnc_trace.c  |8 --
 3 files changed, 65 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 68460af..a5be911 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -388,10 +388,6 @@ void dgnc_cleanup_module(void)
 
dgnc_tty_post_uninit();
 
-#if defined(DGNC_TRACER)
-   /* last thing, make sure we release the tracebuffer */
-   dgnc_tracer_free();
-#endif
if (dgnc_NumBoards)
pci_unregister_driver(dgnc_driver);
 }
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index b40ee2c..58b5aa7 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -91,57 +91,6 @@
 
 #defineDBG_CARR(dgnc_debug  0x1)
 
-
-#if defined(DGNC_TRACER)
-
-# if defined(TRC_TO_KMEM)
-/* Choose one: */
-#  define TRC_ON_OVERFLOW_WRAP_AROUND
-#  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
-# endif /* TRC_TO_KMEM */
-
-# define TRC_MAXMSG1024
-# define TRC_OVERFLOW  (OVERFLOW)
-# define TRC_DTRC  /usr/bin/dtrc
-
-#if defined TRC_TO_CONSOLE
-#define PRINTF_TO_CONSOLE(args) { printk(DRVSTR: ); printk args; }
-#else /* !defined TRACE_TO_CONSOLE */
-#define PRINTF_TO_CONSOLE(args)
-#endif
-
-#if defined TRC_TO_KMEM
-#define PRINTF_TO_KMEM(args) dgnc_tracef args
-#else /* !defined TRC_TO_KMEM */
-#define PRINTF_TO_KMEM(args)
-#endif
-
-#defineTRC(args)   { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) 
}
-
-# define DPR_INIT(ARGS)if (DBG_INIT) TRC(ARGS)
-# define DPR_BASIC(ARGS)   if (DBG_BASIC) TRC(ARGS)
-# define DPR_CORE(ARGS)if (DBG_CORE) TRC(ARGS)
-# define DPR_OPEN(ARGS)if (DBG_OPEN)  TRC(ARGS)
-# define DPR_CLOSE(ARGS)   if (DBG_CLOSE)  TRC(ARGS)
-# define DPR_READ(ARGS)if (DBG_READ)  TRC(ARGS)
-# define DPR_WRITE(ARGS)   if (DBG_WRITE) TRC(ARGS)
-# define DPR_IOCTL(ARGS)   if (DBG_IOCTL) TRC(ARGS)
-# define DPR_PROC(ARGS)if (DBG_PROC)  TRC(ARGS)
-# define DPR_PARAM(ARGS)   if (DBG_PARAM)  TRC(ARGS)
-# define DPR_PSCAN(ARGS)   if (DBG_PSCAN)  TRC(ARGS)
-# define DPR_EVENT(ARGS)   if (DBG_EVENT)  TRC(ARGS)
-# define DPR_DRAIN(ARGS)   if (DBG_DRAIN)  TRC(ARGS)
-# define DPR_CARR(ARGS)if (DBG_CARR)  TRC(ARGS)
-# define DPR_MGMT(ARGS)if (DBG_MGMT)  TRC(ARGS)
-# define DPR_INTR(ARGS)if (DBG_INTR)  TRC(ARGS)
-# define DPR_MSIGS(ARGS)   if (DBG_MSIGS)  TRC(ARGS)
-
-# define DPR(ARGS) if (dgnc_debug) TRC(ARGS)
-# define P(X)  dgnc_tracef(#X =%p\n, X)
-# define X(X)  dgnc_tracef(#X =%x\n, X)
-
-#else/* !defined DGNC_TRACER */
-
 #define PRINTF_TO_KMEM(args)
 # define TRC(ARGS)
 # define DPR_INIT(ARGS)
@@ -164,8 +113,6 @@
 
 # define DPR(args)
 
-#endif/* DGNC_TRACER */
-
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
 #defineMAXPORTS8
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index d764154..3bb2259 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -42,14 +42,6 @@
 /* file level globals */
 static char *dgnc_trcbuf;  /* the ringbuffer */
 
-#if defined(TRC_TO_KMEM)
-static int dgnc_trcbufi = 0;   /* index of the tilde at the end of */
-#endif
-
-#if defined(TRC_TO_KMEM)
-static DEFINE_SPINLOCK(dgnc_tracef_lock);
-#endif
-
 /*
  * dgnc_tracer_free()
  *
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: remove commented code

2014-07-25 Thread Seunghun Lee
This patch removes commented code in dgnc driver.

CC: Lidza Louina 
CC: Mark Hounschell 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_cls.c   |5 +-
 drivers/staging/dgnc/dgnc_trace.c |  123 -
 drivers/staging/dgnc/dgnc_trace.h |   10 ---
 drivers/staging/dgnc/dgnc_tty.c   |   18 --
 drivers/staging/dgnc/digi.h   |1 -
 5 files changed, 1 insertion(+), 156 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 8e265c2..4b65306 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1046,10 +1046,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
 * I believe this is a BUG in this UART.
 * So for now, we will leave the code #ifdef'ed out...
 */
-#if 0
-   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR),
->ch_cls_uart->isr_fcr);
-#endif
+
udelay(10);
 }
 
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index 2f62f2a..d764154 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -50,129 +50,6 @@ static int dgnc_trcbufi = 0;/* index of the 
tilde at the end of */
 static DEFINE_SPINLOCK(dgnc_tracef_lock);
 #endif
 
-
-#if 0
-
-#if !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE)
-
-void dgnc_tracef(const char *fmt, ...)
-{
-   return;
-}
-
-#else /* !defined(TRC_TO_KMEM) && !defined(TRC_TO_CONSOLE) */
-
-void dgnc_tracef(const char *fmt, ...)
-{
-   va_list ap;
-   charbuf[TRC_MAXMSG+1];
-   size_t  lenbuf;
-   int i;
-   static int  failed = FALSE;
-# if defined(TRC_TO_KMEM)
-   unsigned longflags;
-#endif
-
-   if (failed)
-   return;
-# if defined(TRC_TO_KMEM)
-   DGNC_LOCK(dgnc_tracef_lock, flags);
-#endif
-
-   /* Format buf using fmt and arguments contained in ap. */
-   va_start(ap, fmt);
-   i = vsprintf(buf, fmt,  ap);
-   va_end(ap);
-   lenbuf = strlen(buf);
-
-# if defined(TRC_TO_KMEM)
-   {
-   static int   initd = 0;
-
-   /*
-* Now, in addition to (or instead of) printing this stuff out
-* (which is a buffered operation), also tuck it away into a
-* corner of memory which can be examined post-crash in kdb.
-*/
-   if (!initd) {
-   dgnc_trcbuf = (char *) vmalloc(dgnc_trcbuf_size);
-   if (!dgnc_trcbuf) {
-   failed = TRUE;
-   printk("dgnc: tracing init failed!\n");
-   return;
-   }
-
-   memset(dgnc_trcbuf, '\0',  dgnc_trcbuf_size);
-   dgnc_trcbufi = 0;
-   initd++;
-
-   printk("dgnc: tracing enabled - " TRC_DTRC
-   " 0x%lx 0x%x\n",
-   (unsigned long)dgnc_trcbuf,
-   dgnc_trcbuf_size);
-   }
-
-#  if defined(TRC_ON_OVERFLOW_WRAP_AROUND)
-   /*
-* This is the less CPU-intensive way to do things.  We simply
-* wrap around before we fall off the end of the buffer.  A
-* tilde (~) demarcates the current end of the trace.
-*
-* This method should be used if you are concerned about race
-* conditions as it is less likely to affect the timing of
-* things.
-*/
-
-   if (dgnc_trcbufi + lenbuf >= dgnc_trcbuf_size) {
-   /* We are wrapping, so wipe out the last tilde. */
-   dgnc_trcbuf[dgnc_trcbufi] = '\0';
-   /* put the new string at the beginning of the buffer */
-   dgnc_trcbufi = 0;
-   }
-
-   strcpy(_trcbuf[dgnc_trcbufi], buf);
-   dgnc_trcbufi += lenbuf;
-   dgnc_trcbuf[dgnc_trcbufi] = '~';
-
-#  elif defined(TRC_ON_OVERFLOW_SHIFT_BUFFER)
-   /*
-* This is the more CPU-intensive way to do things.  If we
-* venture into the last 1/8 of the buffer, we shift the
-* last 7/8 of the buffer forward, wiping out the first 1/8.
-* Advantage: No wrap-around, only truncation from the
-* beginning.
-*
-* This method should not be used if you are concerned about
-* timing changes affecting the behaviour of the driver (ie,
-* race conditions).
-*/
-   strcpy(_trcbuf[dgnc_trcbufi], buf);
-   dgnc_trcbufi += lenbuf;
-   dgnc_

[PATCH] staging: dgnc: remove commented code

2014-07-25 Thread Seunghun Lee
This patch removes commented code in dgnc driver.

CC: Lidza Louina lidza.lou...@gmail.com
CC: Mark Hounschell ma...@compro.net
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_cls.c   |5 +-
 drivers/staging/dgnc/dgnc_trace.c |  123 -
 drivers/staging/dgnc/dgnc_trace.h |   10 ---
 drivers/staging/dgnc/dgnc_tty.c   |   18 --
 drivers/staging/dgnc/digi.h   |1 -
 5 files changed, 1 insertion(+), 156 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_cls.c b/drivers/staging/dgnc/dgnc_cls.c
index 8e265c2..4b65306 100644
--- a/drivers/staging/dgnc/dgnc_cls.c
+++ b/drivers/staging/dgnc/dgnc_cls.c
@@ -1046,10 +1046,7 @@ static void cls_flush_uart_read(struct channel_t *ch)
 * I believe this is a BUG in this UART.
 * So for now, we will leave the code #ifdef'ed out...
 */
-#if 0
-   writeb((UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR),
-ch-ch_cls_uart-isr_fcr);
-#endif
+
udelay(10);
 }
 
diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index 2f62f2a..d764154 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -50,129 +50,6 @@ static int dgnc_trcbufi = 0;/* index of the 
tilde at the end of */
 static DEFINE_SPINLOCK(dgnc_tracef_lock);
 #endif
 
-
-#if 0
-
-#if !defined(TRC_TO_KMEM)  !defined(TRC_TO_CONSOLE)
-
-void dgnc_tracef(const char *fmt, ...)
-{
-   return;
-}
-
-#else /* !defined(TRC_TO_KMEM)  !defined(TRC_TO_CONSOLE) */
-
-void dgnc_tracef(const char *fmt, ...)
-{
-   va_list ap;
-   charbuf[TRC_MAXMSG+1];
-   size_t  lenbuf;
-   int i;
-   static int  failed = FALSE;
-# if defined(TRC_TO_KMEM)
-   unsigned longflags;
-#endif
-
-   if (failed)
-   return;
-# if defined(TRC_TO_KMEM)
-   DGNC_LOCK(dgnc_tracef_lock, flags);
-#endif
-
-   /* Format buf using fmt and arguments contained in ap. */
-   va_start(ap, fmt);
-   i = vsprintf(buf, fmt,  ap);
-   va_end(ap);
-   lenbuf = strlen(buf);
-
-# if defined(TRC_TO_KMEM)
-   {
-   static int   initd = 0;
-
-   /*
-* Now, in addition to (or instead of) printing this stuff out
-* (which is a buffered operation), also tuck it away into a
-* corner of memory which can be examined post-crash in kdb.
-*/
-   if (!initd) {
-   dgnc_trcbuf = (char *) vmalloc(dgnc_trcbuf_size);
-   if (!dgnc_trcbuf) {
-   failed = TRUE;
-   printk(dgnc: tracing init failed!\n);
-   return;
-   }
-
-   memset(dgnc_trcbuf, '\0',  dgnc_trcbuf_size);
-   dgnc_trcbufi = 0;
-   initd++;
-
-   printk(dgnc: tracing enabled -  TRC_DTRC
-0x%lx 0x%x\n,
-   (unsigned long)dgnc_trcbuf,
-   dgnc_trcbuf_size);
-   }
-
-#  if defined(TRC_ON_OVERFLOW_WRAP_AROUND)
-   /*
-* This is the less CPU-intensive way to do things.  We simply
-* wrap around before we fall off the end of the buffer.  A
-* tilde (~) demarcates the current end of the trace.
-*
-* This method should be used if you are concerned about race
-* conditions as it is less likely to affect the timing of
-* things.
-*/
-
-   if (dgnc_trcbufi + lenbuf = dgnc_trcbuf_size) {
-   /* We are wrapping, so wipe out the last tilde. */
-   dgnc_trcbuf[dgnc_trcbufi] = '\0';
-   /* put the new string at the beginning of the buffer */
-   dgnc_trcbufi = 0;
-   }
-
-   strcpy(dgnc_trcbuf[dgnc_trcbufi], buf);
-   dgnc_trcbufi += lenbuf;
-   dgnc_trcbuf[dgnc_trcbufi] = '~';
-
-#  elif defined(TRC_ON_OVERFLOW_SHIFT_BUFFER)
-   /*
-* This is the more CPU-intensive way to do things.  If we
-* venture into the last 1/8 of the buffer, we shift the
-* last 7/8 of the buffer forward, wiping out the first 1/8.
-* Advantage: No wrap-around, only truncation from the
-* beginning.
-*
-* This method should not be used if you are concerned about
-* timing changes affecting the behaviour of the driver (ie,
-* race conditions).
-*/
-   strcpy(dgnc_trcbuf[dgnc_trcbufi], buf);
-   dgnc_trcbufi += lenbuf

[PATCH 2/3] staging: dgnc: Fix do not initialise statics to 0 or NULL

2014-07-24 Thread Seunghun Lee
This patch fixes checkpatch errors
"do not initialise statics to 0 or NULL"

Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_trace.c |2 +-
 drivers/staging/dgnc/dgnc_tty.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index 2f62f2a..9be4715 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -43,7 +43,7 @@
 static char *dgnc_trcbuf;  /* the ringbuffer */
 
 #if defined(TRC_TO_KMEM)
-static int dgnc_trcbufi = 0;   /* index of the tilde at the end of */
+static int dgnc_trcbufi;   /* index of the tilde at the end of */
 #endif
 
 #if defined(TRC_TO_KMEM)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 714a069..919abda 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -67,7 +67,7 @@
  * internal variables
  */
 static struct dgnc_board   *dgnc_BoardsByMajor[256];
-static uchar   *dgnc_TmpWriteBuf = NULL;
+static uchar   *dgnc_TmpWriteBuf;
 static DECLARE_MUTEX(dgnc_TmpWriteSem);
 
 /*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: dgng: Fix Macros with complex values should be enclosed in parenthesis

2014-07-24 Thread Seunghun Lee
This patch fixes a checkpatch errors
"Macros with complex values should be enclosed in parenthesis"

Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.h |   40 
 drivers/staging/dgnc/digi.h|   60 ++--
 drivers/staging/dgnc/dpacompat.h   |   12 
 3 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index fe5ea90..f7730a1 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -111,32 +111,32 @@
 #endif
 
 #if defined TRC_TO_KMEM
-#define PRINTF_TO_KMEM(args) dgnc_tracef args
+#define PRINTF_TO_KMEM(args) do { dgnc_tracef args } while (0)
 #else /* !defined TRC_TO_KMEM */
 #define PRINTF_TO_KMEM(args)
 #endif
 
 #defineTRC(args)   { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) 
}
 
-# define DPR_INIT(ARGS)if (DBG_INIT) TRC(ARGS)
-# define DPR_BASIC(ARGS)   if (DBG_BASIC) TRC(ARGS)
-# define DPR_CORE(ARGS)if (DBG_CORE) TRC(ARGS)
-# define DPR_OPEN(ARGS)if (DBG_OPEN)  TRC(ARGS)
-# define DPR_CLOSE(ARGS)   if (DBG_CLOSE)  TRC(ARGS)
-# define DPR_READ(ARGS)if (DBG_READ)  TRC(ARGS)
-# define DPR_WRITE(ARGS)   if (DBG_WRITE) TRC(ARGS)
-# define DPR_IOCTL(ARGS)   if (DBG_IOCTL) TRC(ARGS)
-# define DPR_PROC(ARGS)if (DBG_PROC)  TRC(ARGS)
-# define DPR_PARAM(ARGS)   if (DBG_PARAM)  TRC(ARGS)
-# define DPR_PSCAN(ARGS)   if (DBG_PSCAN)  TRC(ARGS)
-# define DPR_EVENT(ARGS)   if (DBG_EVENT)  TRC(ARGS)
-# define DPR_DRAIN(ARGS)   if (DBG_DRAIN)  TRC(ARGS)
-# define DPR_CARR(ARGS)if (DBG_CARR)  TRC(ARGS)
-# define DPR_MGMT(ARGS)if (DBG_MGMT)  TRC(ARGS)
-# define DPR_INTR(ARGS)if (DBG_INTR)  TRC(ARGS)
-# define DPR_MSIGS(ARGS)   if (DBG_MSIGS)  TRC(ARGS)
-
-# define DPR(ARGS) if (dgnc_debug) TRC(ARGS)
+# define DPR_INIT(ARGS)do { if (DBG_INIT) TRC(ARGS) } while (0)
+# define DPR_BASIC(ARGS)   do { if (DBG_BASIC) TRC(ARGS) } while (0)
+# define DPR_CORE(ARGS)do { if (DBG_CORE) TRC(ARGS) } while (0)
+# define DPR_OPEN(ARGS)do { if (DBG_OPEN)  TRC(ARGS) } while 
(0)
+# define DPR_CLOSE(ARGS)   do { if (DBG_CLOSE)  TRC(ARGS) } while (0)
+# define DPR_READ(ARGS)do { if (DBG_READ)  TRC(ARGS) } while 
(0)
+# define DPR_WRITE(ARGS)   do { if (DBG_WRITE) TRC(ARGS) } while (0)
+# define DPR_IOCTL(ARGS)   do { if (DBG_IOCTL) TRC(ARGS) } while (0)
+# define DPR_PROC(ARGS)do { if (DBG_PROC)  TRC(ARGS) } while 
(0)
+# define DPR_PARAM(ARGS)   do { if (DBG_PARAM)  TRC(ARGS) } while (0)
+# define DPR_PSCAN(ARGS)   do { if (DBG_PSCAN)  TRC(ARGS) } while (0)
+# define DPR_EVENT(ARGS)   do { if (DBG_EVENT)  TRC(ARGS) } while (0)
+# define DPR_DRAIN(ARGS)   do { if (DBG_DRAIN)  TRC(ARGS) } while (0)
+# define DPR_CARR(ARGS)do { if (DBG_CARR)  TRC(ARGS) } while 
(0)
+# define DPR_MGMT(ARGS)do { if (DBG_MGMT)  TRC(ARGS) } while 
(0)
+# define DPR_INTR(ARGS)do { if (DBG_INTR)  TRC(ARGS) } while 
(0)
+# define DPR_MSIGS(ARGS)   do { if (DBG_MSIGS)  TRC(ARGS) } while (0)
+
+# define DPR(ARGS) do { if (dgnc_debug) TRC(ARGS) } while (0)
 # define P(X)  dgnc_tracef(#X "=%p\n", X)
 # define X(X)  dgnc_tracef(#X "=%x\n", X)
 
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 282908f..086cd9a 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -38,8 +38,8 @@
 
 #if !defined(TIOCMODG)
 
-#defineTIOCMODG('d'<<8) | 250  /* get modem ctrl state 
*/
-#defineTIOCMODS('d'<<8) | 251  /* set modem ctrl state 
*/
+#defineTIOCMODG(('d'<<8) | 250)/* get modem ctrl state 
*/
+#defineTIOCMODS(('d'<<8) | 251)/* set modem ctrl state 
*/
 
 #ifndef TIOCM_LE
 #defineTIOCM_LE0x01/* line enable  
*/
@@ -58,44 +58,44 @@
 #endif
 
 #if !defined(TIOCMSET)
-#defineTIOCMSET('d'<<8) | 252  /* set modem ctrl state 
*/
-#defineTIOCMGET('d'<<8) | 253  /* set modem ctrl state 
*/
+#defineTIOCMSET(('d'<<8) | 252)/* set modem ctrl state 
*/
+#defineTIOCMGET(('d'<<8) | 253)/* set modem ctrl state 
*/
 #endif
 
 #if !defined(TIOCMBIC)
-#defineTIOCMBIC('d'<<8) | 254  /* set modem ctrl state 
*/
-#defineTIOCMBIS('d'<<8) | 255  /* set modem ctrl state 
*/
+#defineTIOCMBIC(('d'<<8) | 254)/* set modem ctrl state 
*/
+#defineTIOCMBIS

[PATCH 3/3] staging: dgnc: Fix space required after that ','

2014-07-24 Thread Seunghun Lee
This patch fixes checkpatch errors:
"space required after that ','"

Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index f7730a1..b68246a 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -219,8 +219,8 @@
  * Makes spotting lock/unlock locations easier.
  */
 # define DGNC_SPINLOCK_INIT(x) spin_lock_init(&(x))
-# define DGNC_LOCK(x,y)spin_lock_irqsave(&(x), y)
-# define DGNC_UNLOCK(x,y)  spin_unlock_irqrestore(&(x), y)
+# define DGNC_LOCK(x, y)   spin_lock_irqsave(&(x), y)
+# define DGNC_UNLOCK(x, y) spin_unlock_irqrestore(&(x), y)
 
 /*
  * All the possible states the driver can be while being loaded.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/3] staging: dgnc: Fix space required after that ','

2014-07-24 Thread Seunghun Lee
This patch fixes checkpatch errors:
space required after that ','

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_driver.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index f7730a1..b68246a 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -219,8 +219,8 @@
  * Makes spotting lock/unlock locations easier.
  */
 # define DGNC_SPINLOCK_INIT(x) spin_lock_init((x))
-# define DGNC_LOCK(x,y)spin_lock_irqsave((x), y)
-# define DGNC_UNLOCK(x,y)  spin_unlock_irqrestore((x), y)
+# define DGNC_LOCK(x, y)   spin_lock_irqsave((x), y)
+# define DGNC_UNLOCK(x, y) spin_unlock_irqrestore((x), y)
 
 /*
  * All the possible states the driver can be while being loaded.
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/3] staging: dgng: Fix Macros with complex values should be enclosed in parenthesis

2014-07-24 Thread Seunghun Lee
This patch fixes a checkpatch errors
Macros with complex values should be enclosed in parenthesis

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_driver.h |   40 
 drivers/staging/dgnc/digi.h|   60 ++--
 drivers/staging/dgnc/dpacompat.h   |   12 
 3 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index fe5ea90..f7730a1 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -111,32 +111,32 @@
 #endif
 
 #if defined TRC_TO_KMEM
-#define PRINTF_TO_KMEM(args) dgnc_tracef args
+#define PRINTF_TO_KMEM(args) do { dgnc_tracef args } while (0)
 #else /* !defined TRC_TO_KMEM */
 #define PRINTF_TO_KMEM(args)
 #endif
 
 #defineTRC(args)   { PRINTF_TO_KMEM(args); PRINTF_TO_CONSOLE(args) 
}
 
-# define DPR_INIT(ARGS)if (DBG_INIT) TRC(ARGS)
-# define DPR_BASIC(ARGS)   if (DBG_BASIC) TRC(ARGS)
-# define DPR_CORE(ARGS)if (DBG_CORE) TRC(ARGS)
-# define DPR_OPEN(ARGS)if (DBG_OPEN)  TRC(ARGS)
-# define DPR_CLOSE(ARGS)   if (DBG_CLOSE)  TRC(ARGS)
-# define DPR_READ(ARGS)if (DBG_READ)  TRC(ARGS)
-# define DPR_WRITE(ARGS)   if (DBG_WRITE) TRC(ARGS)
-# define DPR_IOCTL(ARGS)   if (DBG_IOCTL) TRC(ARGS)
-# define DPR_PROC(ARGS)if (DBG_PROC)  TRC(ARGS)
-# define DPR_PARAM(ARGS)   if (DBG_PARAM)  TRC(ARGS)
-# define DPR_PSCAN(ARGS)   if (DBG_PSCAN)  TRC(ARGS)
-# define DPR_EVENT(ARGS)   if (DBG_EVENT)  TRC(ARGS)
-# define DPR_DRAIN(ARGS)   if (DBG_DRAIN)  TRC(ARGS)
-# define DPR_CARR(ARGS)if (DBG_CARR)  TRC(ARGS)
-# define DPR_MGMT(ARGS)if (DBG_MGMT)  TRC(ARGS)
-# define DPR_INTR(ARGS)if (DBG_INTR)  TRC(ARGS)
-# define DPR_MSIGS(ARGS)   if (DBG_MSIGS)  TRC(ARGS)
-
-# define DPR(ARGS) if (dgnc_debug) TRC(ARGS)
+# define DPR_INIT(ARGS)do { if (DBG_INIT) TRC(ARGS) } while (0)
+# define DPR_BASIC(ARGS)   do { if (DBG_BASIC) TRC(ARGS) } while (0)
+# define DPR_CORE(ARGS)do { if (DBG_CORE) TRC(ARGS) } while (0)
+# define DPR_OPEN(ARGS)do { if (DBG_OPEN)  TRC(ARGS) } while 
(0)
+# define DPR_CLOSE(ARGS)   do { if (DBG_CLOSE)  TRC(ARGS) } while (0)
+# define DPR_READ(ARGS)do { if (DBG_READ)  TRC(ARGS) } while 
(0)
+# define DPR_WRITE(ARGS)   do { if (DBG_WRITE) TRC(ARGS) } while (0)
+# define DPR_IOCTL(ARGS)   do { if (DBG_IOCTL) TRC(ARGS) } while (0)
+# define DPR_PROC(ARGS)do { if (DBG_PROC)  TRC(ARGS) } while 
(0)
+# define DPR_PARAM(ARGS)   do { if (DBG_PARAM)  TRC(ARGS) } while (0)
+# define DPR_PSCAN(ARGS)   do { if (DBG_PSCAN)  TRC(ARGS) } while (0)
+# define DPR_EVENT(ARGS)   do { if (DBG_EVENT)  TRC(ARGS) } while (0)
+# define DPR_DRAIN(ARGS)   do { if (DBG_DRAIN)  TRC(ARGS) } while (0)
+# define DPR_CARR(ARGS)do { if (DBG_CARR)  TRC(ARGS) } while 
(0)
+# define DPR_MGMT(ARGS)do { if (DBG_MGMT)  TRC(ARGS) } while 
(0)
+# define DPR_INTR(ARGS)do { if (DBG_INTR)  TRC(ARGS) } while 
(0)
+# define DPR_MSIGS(ARGS)   do { if (DBG_MSIGS)  TRC(ARGS) } while (0)
+
+# define DPR(ARGS) do { if (dgnc_debug) TRC(ARGS) } while (0)
 # define P(X)  dgnc_tracef(#X =%p\n, X)
 # define X(X)  dgnc_tracef(#X =%x\n, X)
 
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 282908f..086cd9a 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -38,8 +38,8 @@
 
 #if !defined(TIOCMODG)
 
-#defineTIOCMODG('d'8) | 250  /* get modem ctrl state 
*/
-#defineTIOCMODS('d'8) | 251  /* set modem ctrl state 
*/
+#defineTIOCMODG(('d'8) | 250)/* get modem ctrl state 
*/
+#defineTIOCMODS(('d'8) | 251)/* set modem ctrl state 
*/
 
 #ifndef TIOCM_LE
 #defineTIOCM_LE0x01/* line enable  
*/
@@ -58,44 +58,44 @@
 #endif
 
 #if !defined(TIOCMSET)
-#defineTIOCMSET('d'8) | 252  /* set modem ctrl state 
*/
-#defineTIOCMGET('d'8) | 253  /* set modem ctrl state 
*/
+#defineTIOCMSET(('d'8) | 252)/* set modem ctrl state 
*/
+#defineTIOCMGET(('d'8) | 253)/* set modem ctrl state 
*/
 #endif
 
 #if !defined(TIOCMBIC)
-#defineTIOCMBIC('d'8) | 254  /* set modem ctrl state 
*/
-#defineTIOCMBIS('d'8) | 255  /* set modem ctrl state 
*/
+#defineTIOCMBIC(('d'8) | 254)/* set modem ctrl state 
*/
+#defineTIOCMBIS(('d'8) | 255)/* set modem ctrl state 
*/
 #endif
 
 
 #if !defined(TIOCSDTR)
-#define

[PATCH 2/3] staging: dgnc: Fix do not initialise statics to 0 or NULL

2014-07-24 Thread Seunghun Lee
This patch fixes checkpatch errors
do not initialise statics to 0 or NULL

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_trace.c |2 +-
 drivers/staging/dgnc/dgnc_tty.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_trace.c 
b/drivers/staging/dgnc/dgnc_trace.c
index 2f62f2a..9be4715 100644
--- a/drivers/staging/dgnc/dgnc_trace.c
+++ b/drivers/staging/dgnc/dgnc_trace.c
@@ -43,7 +43,7 @@
 static char *dgnc_trcbuf;  /* the ringbuffer */
 
 #if defined(TRC_TO_KMEM)
-static int dgnc_trcbufi = 0;   /* index of the tilde at the end of */
+static int dgnc_trcbufi;   /* index of the tilde at the end of */
 #endif
 
 #if defined(TRC_TO_KMEM)
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index 714a069..919abda 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -67,7 +67,7 @@
  * internal variables
  */
 static struct dgnc_board   *dgnc_BoardsByMajor[256];
-static uchar   *dgnc_TmpWriteBuf = NULL;
+static uchar   *dgnc_TmpWriteBuf;
 static DECLARE_MUTEX(dgnc_TmpWriteSem);
 
 /*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: Remove all C99 comments

2014-07-22 Thread Seunghun Lee
This patch fixes the following checkpatch error:

ERROR: do not use C99 // comments

CC: Lidza Louina 
Signed-off-by: Seunghun Lee 
---
 drivers/staging/dgnc/dgnc_driver.h |   10 +-
 drivers/staging/dgnc/digi.h|   36 ++--
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 3519b80..fe5ea90 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -98,7 +98,7 @@
 /* Choose one: */
 #  define TRC_ON_OVERFLOW_WRAP_AROUND
 #  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
-# endif //TRC_TO_KMEM
+# endif /* TRC_TO_KMEM */
 
 # define TRC_MAXMSG1024
 # define TRC_OVERFLOW  "(OVERFLOW)"
@@ -106,13 +106,13 @@
 
 #if defined TRC_TO_CONSOLE
 #define PRINTF_TO_CONSOLE(args) { printk(DRVSTR": "); printk args; }
-#else //!defined TRACE_TO_CONSOLE
+#else /* !defined TRACE_TO_CONSOLE */
 #define PRINTF_TO_CONSOLE(args)
 #endif
 
 #if defined TRC_TO_KMEM
 #define PRINTF_TO_KMEM(args) dgnc_tracef args
-#else //!defined TRC_TO_KMEM
+#else /* !defined TRC_TO_KMEM */
 #define PRINTF_TO_KMEM(args)
 #endif
 
@@ -140,7 +140,7 @@
 # define P(X)  dgnc_tracef(#X "=%p\n", X)
 # define X(X)  dgnc_tracef(#X "=%x\n", X)
 
-#else//!defined DGNC_TRACER
+#else/* !defined DGNC_TRACER */
 
 #define PRINTF_TO_KMEM(args)
 # define TRC(ARGS)
@@ -164,7 +164,7 @@
 
 # define DPR(args)
 
-#endif//DGNC_TRACER
+#endif/* DGNC_TRACER */
 
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 6a9adf6..282908f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -394,23 +394,23 @@ struct digi_getcounter {
 #define DIGI_REALPORT_GETCOUNTERS ('e'<<8 ) | 110
 #define DIGI_REALPORT_GETEVENTS ('e'<<8 ) | 111
 
-#define EV_OPU 0x0001  //!http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: dgnc: Remove all C99 comments

2014-07-22 Thread Seunghun Lee
This patch fixes the following checkpatch error:

ERROR: do not use C99 // comments

CC: Lidza Louina lidza.lou...@gmail.com
Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/dgnc/dgnc_driver.h |   10 +-
 drivers/staging/dgnc/digi.h|   36 ++--
 2 files changed, 23 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 3519b80..fe5ea90 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -98,7 +98,7 @@
 /* Choose one: */
 #  define TRC_ON_OVERFLOW_WRAP_AROUND
 #  undef  TRC_ON_OVERFLOW_SHIFT_BUFFER
-# endif //TRC_TO_KMEM
+# endif /* TRC_TO_KMEM */
 
 # define TRC_MAXMSG1024
 # define TRC_OVERFLOW  (OVERFLOW)
@@ -106,13 +106,13 @@
 
 #if defined TRC_TO_CONSOLE
 #define PRINTF_TO_CONSOLE(args) { printk(DRVSTR: ); printk args; }
-#else //!defined TRACE_TO_CONSOLE
+#else /* !defined TRACE_TO_CONSOLE */
 #define PRINTF_TO_CONSOLE(args)
 #endif
 
 #if defined TRC_TO_KMEM
 #define PRINTF_TO_KMEM(args) dgnc_tracef args
-#else //!defined TRC_TO_KMEM
+#else /* !defined TRC_TO_KMEM */
 #define PRINTF_TO_KMEM(args)
 #endif
 
@@ -140,7 +140,7 @@
 # define P(X)  dgnc_tracef(#X =%p\n, X)
 # define X(X)  dgnc_tracef(#X =%x\n, X)
 
-#else//!defined DGNC_TRACER
+#else/* !defined DGNC_TRACER */
 
 #define PRINTF_TO_KMEM(args)
 # define TRC(ARGS)
@@ -164,7 +164,7 @@
 
 # define DPR(args)
 
-#endif//DGNC_TRACER
+#endif/* DGNC_TRACER */
 
 /* Number of boards we support at once. */
 #defineMAXBOARDS   20
diff --git a/drivers/staging/dgnc/digi.h b/drivers/staging/dgnc/digi.h
index 6a9adf6..282908f 100644
--- a/drivers/staging/dgnc/digi.h
+++ b/drivers/staging/dgnc/digi.h
@@ -394,23 +394,23 @@ struct digi_getcounter {
 #define DIGI_REALPORT_GETCOUNTERS ('e'8 ) | 110
 #define DIGI_REALPORT_GETEVENTS ('e'8 ) | 111
 
-#define EV_OPU 0x0001  //!Output paused by client
-#define EV_OPS 0x0002  //!Output paused by reqular sw flowctrl
-#define EV_OPX 0x0004  //!Output paused by extra sw flowctrl
-#define EV_OPH 0x0008  //!Output paused by hw flowctrl
-#define EV_OPT 0x0800  //!Output paused for RTS Toggle 
predelay
-
-#define EV_IPU 0x0010  //!Input paused unconditionally by user
-#define EV_IPS 0x0020  //!Input paused by high/low water marks
-//#define EV_IPH   0x0040  //!Input paused w/ hardware
-#define EV_IPA 0x0400  //!Input paused by pattern alarm module
-
-#define EV_TXB 0x0040  //!Transmit break pending
-#define EV_TXI 0x0080  //!Transmit immediate pending
-#define EV_TXF 0x0100  //!Transmit flowctrl char pending
-#define EV_RXB 0x0200  //!Break received
-
-#define EV_OPALL   0x080f  //!Output pause flags
-#define EV_IPALL   0x0430  //!Input pause flags
+#define EV_OPU 0x0001  /* !Output paused by client */
+#define EV_OPS 0x0002  /* !Output paused by reqular sw 
flowctrl */
+#define EV_OPX 0x0004  /* !Output paused by extra sw flowctrl 
*/
+#define EV_OPH 0x0008  /* !Output paused by hw flowctrl */
+#define EV_OPT 0x0800  /* !Output paused for RTS Toggle 
predelay */
+
+#define EV_IPU 0x0010  /* !Input paused unconditionally by 
user */
+#define EV_IPS 0x0020  /* !Input paused by high/low water 
marks */
+/* #define EV_IPH  0x0040  //!Input paused w/ hardware */
+#define EV_IPA 0x0400  /* !Input paused by pattern alarm 
module */
+
+#define EV_TXB 0x0040  /* !Transmit break pending */
+#define EV_TXI 0x0080  /* !Transmit immediate pending */
+#define EV_TXF 0x0100  /* !Transmit flowctrl char pending */
+#define EV_RXB 0x0200  /* !Break received */
+
+#define EV_OPALL   0x080f  /* !Output pause flags */
+#define EV_IPALL   0x0430  /* !Input pause flags */
 
 #endif /* DIGI_H */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] UBIFS: fix some comments

2014-07-01 Thread Seunghun Lee
This patch fixes some comments about return type.

Signed-off-by: Seunghun Lee 
---
 fs/ubifs/recovery.c |4 ++--
 fs/ubifs/scan.c |5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index c14adb2..933dda5 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -629,8 +629,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int 
*offs)
  *
  * This function does a scan of a LEB, but caters for errors that might have
  * been caused by the unclean unmount from which we are attempting to recover.
- * Returns %0 in case of success, %-EUCLEAN if an unrecoverable corruption is
- * found, and a negative error code in case of failure.
+ * Returns the scaned information on success and a negative error code on
+ * failure.
  */
 struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
 int offs, void *sbuf, int jhead)
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 58aa05d..327d84a 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -131,7 +131,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void 
*buf, int len, int lnum,
  * @offs: offset to start at (usually zero)
  * @sbuf: scan buffer (must be c->leb_size)
  *
- * This function returns %0 on success and a negative error code on failure.
+ * This function returns the scaned information on success and a negative error
+ * code on failure.
  */
 struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
int offs, void *sbuf)
@@ -169,8 +170,6 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct 
ubifs_info *c, int lnum,
  * @sleb: scanning information
  * @lnum: logical eraseblock number
  * @offs: offset to start at (usually zero)
- *
- * This function returns %0 on success and a negative error code on failure.
  */
 void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
int lnum, int offs)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] UBIFS: fix some comments

2014-07-01 Thread Seunghun Lee
This patch fixes some comments about return type.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ubifs/recovery.c |4 ++--
 fs/ubifs/scan.c |5 ++---
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index c14adb2..933dda5 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -629,8 +629,8 @@ static void drop_last_node(struct ubifs_scan_leb *sleb, int 
*offs)
  *
  * This function does a scan of a LEB, but caters for errors that might have
  * been caused by the unclean unmount from which we are attempting to recover.
- * Returns %0 in case of success, %-EUCLEAN if an unrecoverable corruption is
- * found, and a negative error code in case of failure.
+ * Returns the scaned information on success and a negative error code on
+ * failure.
  */
 struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum,
 int offs, void *sbuf, int jhead)
diff --git a/fs/ubifs/scan.c b/fs/ubifs/scan.c
index 58aa05d..327d84a 100644
--- a/fs/ubifs/scan.c
+++ b/fs/ubifs/scan.c
@@ -131,7 +131,8 @@ int ubifs_scan_a_node(const struct ubifs_info *c, void 
*buf, int len, int lnum,
  * @offs: offset to start at (usually zero)
  * @sbuf: scan buffer (must be c-leb_size)
  *
- * This function returns %0 on success and a negative error code on failure.
+ * This function returns the scaned information on success and a negative error
+ * code on failure.
  */
 struct ubifs_scan_leb *ubifs_start_scan(const struct ubifs_info *c, int lnum,
int offs, void *sbuf)
@@ -169,8 +170,6 @@ struct ubifs_scan_leb *ubifs_start_scan(const struct 
ubifs_info *c, int lnum,
  * @sleb: scanning information
  * @lnum: logical eraseblock number
  * @offs: offset to start at (usually zero)
- *
- * This function returns %0 on success and a negative error code on failure.
  */
 void ubifs_end_scan(const struct ubifs_info *c, struct ubifs_scan_leb *sleb,
int lnum, int offs)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: ced1401: fix sparse warning for ced1401

2014-06-22 Thread Seunghun Lee
This patch fixes below warning.

drivers/staging/ced1401/ced_ioc.c:703:30: warning: incorrect type in assignment 
(different address spaces)
drivers/staging/ced1401/ced_ioc.c:703:30:expected void *[usertype] lpvBuff
drivers/staging/ced1401/ced_ioc.c:703:30:got char [noderef] *puBuf

Signed-off-by: Seunghun Lee 
---
 drivers/staging/ced1401/usb1401.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index ea0fe63..8327e9c 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -101,7 +101,7 @@ typedef struct circBlk {
 /*  A structure holding all of the information about a transfer area - an area 
of */
 /*   memory set up for use either as a source or destination in DMA transfers. 
*/
 typedef struct transarea {
-   void*lpvBuff;/*  User address of xfer area saved 
for completeness */
+   void __user *lpvBuff;/*  User address of xfer area 
saved for completeness */
UINTdwBaseOffset;   /*  offset to start of xfer area in 
first page */
UINTdwLength;   /*  Length of xfer area, in bytes */
struct page **pPages;   /*  Points at array of locked down 
pages */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: ced1401: fix sparse warning for ced1401

2014-06-22 Thread Seunghun Lee
This patch fixes below warning.

drivers/staging/ced1401/ced_ioc.c:703:30: warning: incorrect type in assignment 
(different address spaces)
drivers/staging/ced1401/ced_ioc.c:703:30:expected void *[usertype] lpvBuff
drivers/staging/ced1401/ced_ioc.c:703:30:got char [noderef] asn:1*puBuf

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/ced1401/usb1401.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/usb1401.h 
b/drivers/staging/ced1401/usb1401.h
index ea0fe63..8327e9c 100644
--- a/drivers/staging/ced1401/usb1401.h
+++ b/drivers/staging/ced1401/usb1401.h
@@ -101,7 +101,7 @@ typedef struct circBlk {
 /*  A structure holding all of the information about a transfer area - an area 
of */
 /*   memory set up for use either as a source or destination in DMA transfers. 
*/
 typedef struct transarea {
-   void*lpvBuff;/*  User address of xfer area saved 
for completeness */
+   void __user *lpvBuff;/*  User address of xfer area 
saved for completeness */
UINTdwBaseOffset;   /*  offset to start of xfer area in 
first page */
UINTdwLength;   /*  Length of xfer area, in bytes */
struct page **pPages;   /*  Points at array of locked down 
pages */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: ced1401: fix sparse warning for ced1401

2014-06-13 Thread Seunghun Lee
This patch fixes below warning.

drivers/staging/ced1401/ced_ioc.c:703:30: warning: incorrect type in assignment 
(different address spaces)
drivers/staging/ced1401/ced_ioc.c:703:30:expected void *[usertype] 
lpvBuff
drivers/staging/ced1401/ced_ioc.c:703:30:got char [noderef] 
*puBuf

Signed-off-by: Seunghun Lee 
---
 drivers/staging/ced1401/ced_ioc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index ebbc509..963b941 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -700,7 +700,7 @@ static int SetArea(DEVICE_EXTENSION *pdx, int nArea, char 
__user *puBuf,
/*  kmap() or kmap_atomic() to get a virtual address. 
page_address will give you */
/*  (null) or at least it does in this context with an x86 
machine. */
spin_lock_irq(>stagedLock);
-   pTA->lpvBuff = puBuf;   /*  keep start of region (user address) 
*/
+   pTA->lpvBuff = (__force void *)puBuf;   /*  keep start of 
region (user address) */
pTA->dwBaseOffset = ulOffset;   /*  save offset in first page 
to start of xfer */
pTA->dwLength = dwLength;   /*  Size if the region in bytes 
*/
pTA->pPages = pPages;   /*  list of pages that are used by 
buffer */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: ced1401: fix sparse warning for ced1401

2014-06-13 Thread Seunghun Lee
This patch fixes below warning.

drivers/staging/ced1401/ced_ioc.c:703:30: warning: incorrect type in assignment 
(different address spaces)
drivers/staging/ced1401/ced_ioc.c:703:30:expected void *[usertype] 
lpvBuff
drivers/staging/ced1401/ced_ioc.c:703:30:got char [noderef] 
asn:1*puBuf

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/ced1401/ced_ioc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/ced1401/ced_ioc.c 
b/drivers/staging/ced1401/ced_ioc.c
index ebbc509..963b941 100644
--- a/drivers/staging/ced1401/ced_ioc.c
+++ b/drivers/staging/ced1401/ced_ioc.c
@@ -700,7 +700,7 @@ static int SetArea(DEVICE_EXTENSION *pdx, int nArea, char 
__user *puBuf,
/*  kmap() or kmap_atomic() to get a virtual address. 
page_address will give you */
/*  (null) or at least it does in this context with an x86 
machine. */
spin_lock_irq(pdx-stagedLock);
-   pTA-lpvBuff = puBuf;   /*  keep start of region (user address) 
*/
+   pTA-lpvBuff = (__force void *)puBuf;   /*  keep start of 
region (user address) */
pTA-dwBaseOffset = ulOffset;   /*  save offset in first page 
to start of xfer */
pTA-dwLength = dwLength;   /*  Size if the region in bytes 
*/
pTA-pPages = pPages;   /*  list of pages that are used by 
buffer */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] ext2: fix error handling in ext2_fill_super()

2014-05-15 Thread Seunghun Lee
ext2_fill_super is using err variable, but it is not applied to return value.

This patch fixes it.

Signed-off-by: Seunghun Lee 
---
 fs/ext2/super.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index e3fc51e..7e36536 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
unsigned long logic_sb_block;
unsigned long offset = 0;
unsigned long def_mount_opts;
-   int ret = -EINVAL;
+   int ret = -ENOMEM;
int blocksize = BLOCK_SIZE;
int db_count;
int i, j;
__le32 features;
-   int err;
+   int err = 0;
 
-   err = -ENOMEM;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto failed;
@@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
 
spin_lock_init(>s_lock);
 
+   /* -EINVAL is default */
+   ret = -EINVAL;
+
/*
 * See what the current blocksize for the device is, and
 * use that as the blocksize.  Otherwise (or if the blocksize
@@ -1140,7 +1142,7 @@ failed_sbi:
kfree(sbi->s_blockgroup_lock);
kfree(sbi);
 failed:
-   return ret;
+   return err ? err : ret;
 }
 
 static void ext2_clear_super_error(struct super_block *sb)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] ext2: fix type of return value ext2_fill_super()

2014-05-15 Thread Seunghun Lee
This patch fixes type of return value ext2_fill_super().

Signed-off-by: Seunghun Lee 
---
 fs/ext2/super.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3750031..e3fc51e 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -770,7 +770,7 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
unsigned long logic_sb_block;
unsigned long offset = 0;
unsigned long def_mount_opts;
-   long ret = -EINVAL;
+   int ret = -EINVAL;
int blocksize = BLOCK_SIZE;
int db_count;
int i, j;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] ext2: fix type of return value ext2_fill_super()

2014-05-15 Thread Seunghun Lee
This patch fixes type of return value ext2_fill_super().

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ext2/super.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3750031..e3fc51e 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -770,7 +770,7 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
unsigned long logic_sb_block;
unsigned long offset = 0;
unsigned long def_mount_opts;
-   long ret = -EINVAL;
+   int ret = -EINVAL;
int blocksize = BLOCK_SIZE;
int db_count;
int i, j;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] ext2: fix error handling in ext2_fill_super()

2014-05-15 Thread Seunghun Lee
ext2_fill_super is using err variable, but it is not applied to return value.

This patch fixes it.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ext2/super.c |   10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index e3fc51e..7e36536 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -770,14 +770,13 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
unsigned long logic_sb_block;
unsigned long offset = 0;
unsigned long def_mount_opts;
-   int ret = -EINVAL;
+   int ret = -ENOMEM;
int blocksize = BLOCK_SIZE;
int db_count;
int i, j;
__le32 features;
-   int err;
+   int err = 0;
 
-   err = -ENOMEM;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
goto failed;
@@ -793,6 +792,9 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
 
spin_lock_init(sbi-s_lock);
 
+   /* -EINVAL is default */
+   ret = -EINVAL;
+
/*
 * See what the current blocksize for the device is, and
 * use that as the blocksize.  Otherwise (or if the blocksize
@@ -1140,7 +1142,7 @@ failed_sbi:
kfree(sbi-s_blockgroup_lock);
kfree(sbi);
 failed:
-   return ret;
+   return err ? err : ret;
 }
 
 static void ext2_clear_super_error(struct super_block *sb)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ext2: super: remove unnecessary goto statement

2014-05-07 Thread Seunghun Lee
This patch removes unnecessary goto failed,
and moves kfree to failed.

Signed-off-by: Seunghun Lee 
---
 fs/ext2/super.c |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3750031..7d20a50 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -777,17 +777,15 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
__le32 features;
int err;
 
-   err = -ENOMEM;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
-   goto failed;
+   return -ENOMEM;
 
sbi->s_blockgroup_lock =
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
-   if (!sbi->s_blockgroup_lock) {
-   kfree(sbi);
+   if (!sbi->s_blockgroup_lock)
goto failed;
-   }
+
sb->s_fs_info = sbi;
sbi->s_sb_block = sb_block;
 
@@ -1138,8 +1136,8 @@ failed_mount:
 failed_sbi:
sb->s_fs_info = NULL;
kfree(sbi->s_blockgroup_lock);
-   kfree(sbi);
 failed:
+   kfree(sbi);
return ret;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ext2: super: remove unnecessary goto statement

2014-05-07 Thread Seunghun Lee
This patch removes unnecessary goto failed,
and moves kfree to failed.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 fs/ext2/super.c |   10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 3750031..7d20a50 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -777,17 +777,15 @@ static int ext2_fill_super(struct super_block *sb, void 
*data, int silent)
__le32 features;
int err;
 
-   err = -ENOMEM;
sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
if (!sbi)
-   goto failed;
+   return -ENOMEM;
 
sbi-s_blockgroup_lock =
kzalloc(sizeof(struct blockgroup_lock), GFP_KERNEL);
-   if (!sbi-s_blockgroup_lock) {
-   kfree(sbi);
+   if (!sbi-s_blockgroup_lock)
goto failed;
-   }
+
sb-s_fs_info = sbi;
sbi-s_sb_block = sb_block;
 
@@ -1138,8 +1136,8 @@ failed_mount:
 failed_sbi:
sb-s_fs_info = NULL;
kfree(sbi-s_blockgroup_lock);
-   kfree(sbi);
 failed:
+   kfree(sbi);
return ret;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[RESEND] [PATCH] staging: android: fix missing a blank line after declarations

2014-04-30 Thread Seunghun Lee
This patch fixes "Missing a blank line after declarations" warnings.

Signed-off-by: Seunghun Lee 
---
 drivers/staging/android/alarm-dev.c   |1 +
 drivers/staging/android/binder.c  |   34 +
 drivers/staging/android/ion/ion.c |   10 
 drivers/staging/android/ion/ion_heap.c|2 ++
 drivers/staging/android/ion/ion_priv.h|1 +
 drivers/staging/android/ion/ion_system_heap.c |5 
 drivers/staging/android/logger.c  |3 +++
 drivers/staging/android/sw_sync.c |2 ++
 drivers/staging/android/sync.c|8 ++
 drivers/staging/android/timed_gpio.c  |1 +
 10 files changed, 67 insertions(+)

diff --git a/drivers/staging/android/alarm-dev.c 
b/drivers/staging/android/alarm-dev.c
index 2fc7cdd..f200e8a 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -329,6 +329,7 @@ static int alarm_release(struct inode *inode, struct file 
*file)
if (file->private_data) {
for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) {
uint32_t alarm_type_mask = 1U << i;
+
if (alarm_enabled & alarm_type_mask) {
alarm_dbg(INFO,
  "%s: clear alarm, pending %d\n",
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index fc59281..3a4394f 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -118,6 +118,7 @@ static int binder_set_stop_on_user_error(const char *val,
 struct kernel_param *kp)
 {
int ret;
+
ret = param_set_int(val, kp);
if (binder_stop_on_user_error < 2)
wake_up(_user_error_wait);
@@ -194,6 +195,7 @@ static struct binder_transaction_log_entry 
*binder_transaction_log_add(
struct binder_transaction_log *log)
 {
struct binder_transaction_log_entry *e;
+
e = >entry[log->next];
memset(e, 0, sizeof(*e));
log->next++;
@@ -432,6 +434,7 @@ static inline void binder_unlock(const char *tag)
 static void binder_set_nice(long nice)
 {
long min_nice;
+
if (can_nice(current, nice)) {
set_user_nice(current, nice);
return;
@@ -584,6 +587,7 @@ static int binder_update_page_range(struct binder_proc 
*proc, int allocate,
for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) {
int ret;
struct page **page_array_ptr;
+
page = >pages[(page_addr - proc->buffer) / PAGE_SIZE];
 
BUG_ON(*page);
@@ -726,6 +730,7 @@ static struct binder_buffer *binder_alloc_buf(struct 
binder_proc *proc,
binder_insert_allocated_buffer(proc, buffer);
if (buffer_size != size) {
struct binder_buffer *new_buffer = (void *)buffer->data + size;
+
list_add(_buffer->entry, >entry);
new_buffer->free = 1;
binder_insert_free_buffer(proc, new_buffer);
@@ -838,6 +843,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (!list_is_last(>entry, >buffers)) {
struct binder_buffer *next = list_entry(buffer->entry.next,
struct binder_buffer, entry);
+
if (next->free) {
rb_erase(>rb_node, >free_buffers);
binder_delete_free_buffer(proc, next);
@@ -846,6 +852,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (proc->buffers.next != >entry) {
struct binder_buffer *prev = list_entry(buffer->entry.prev,
struct binder_buffer, entry);
+
if (prev->free) {
binder_delete_free_buffer(proc, buffer);
rb_erase(>rb_node, >free_buffers);
@@ -1107,6 +1114,7 @@ static int binder_inc_ref(struct binder_ref *ref, int 
strong,
  struct list_head *target_list)
 {
int ret;
+
if (strong) {
if (ref->strong == 0) {
ret = binder_inc_node(ref->node, 1, 1, target_list);
@@ -1138,6 +1146,7 @@ static int binder_dec_ref(struct binder_ref *ref, int 
strong)
ref->strong--;
if (ref->strong == 0) {
int ret;
+
ret = binder_dec_node(ref->node, strong, 1);
if (ret)
return ret;
@@ -1177,6 +1186,7 @@ static void binder_send_failed_reply(struct 
binder_transaction *t,
 uint32_t error_code)
 {
struct binder_thread *target_thread;
+
BUG_O

[RESEND] [PATCH] staging: android: fix missing a blank line after declarations

2014-04-30 Thread Seunghun Lee
This patch fixes Missing a blank line after declarations warnings.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/android/alarm-dev.c   |1 +
 drivers/staging/android/binder.c  |   34 +
 drivers/staging/android/ion/ion.c |   10 
 drivers/staging/android/ion/ion_heap.c|2 ++
 drivers/staging/android/ion/ion_priv.h|1 +
 drivers/staging/android/ion/ion_system_heap.c |5 
 drivers/staging/android/logger.c  |3 +++
 drivers/staging/android/sw_sync.c |2 ++
 drivers/staging/android/sync.c|8 ++
 drivers/staging/android/timed_gpio.c  |1 +
 10 files changed, 67 insertions(+)

diff --git a/drivers/staging/android/alarm-dev.c 
b/drivers/staging/android/alarm-dev.c
index 2fc7cdd..f200e8a 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -329,6 +329,7 @@ static int alarm_release(struct inode *inode, struct file 
*file)
if (file-private_data) {
for (i = 0; i  ANDROID_ALARM_TYPE_COUNT; i++) {
uint32_t alarm_type_mask = 1U  i;
+
if (alarm_enabled  alarm_type_mask) {
alarm_dbg(INFO,
  %s: clear alarm, pending %d\n,
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index fc59281..3a4394f 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -118,6 +118,7 @@ static int binder_set_stop_on_user_error(const char *val,
 struct kernel_param *kp)
 {
int ret;
+
ret = param_set_int(val, kp);
if (binder_stop_on_user_error  2)
wake_up(binder_user_error_wait);
@@ -194,6 +195,7 @@ static struct binder_transaction_log_entry 
*binder_transaction_log_add(
struct binder_transaction_log *log)
 {
struct binder_transaction_log_entry *e;
+
e = log-entry[log-next];
memset(e, 0, sizeof(*e));
log-next++;
@@ -432,6 +434,7 @@ static inline void binder_unlock(const char *tag)
 static void binder_set_nice(long nice)
 {
long min_nice;
+
if (can_nice(current, nice)) {
set_user_nice(current, nice);
return;
@@ -584,6 +587,7 @@ static int binder_update_page_range(struct binder_proc 
*proc, int allocate,
for (page_addr = start; page_addr  end; page_addr += PAGE_SIZE) {
int ret;
struct page **page_array_ptr;
+
page = proc-pages[(page_addr - proc-buffer) / PAGE_SIZE];
 
BUG_ON(*page);
@@ -726,6 +730,7 @@ static struct binder_buffer *binder_alloc_buf(struct 
binder_proc *proc,
binder_insert_allocated_buffer(proc, buffer);
if (buffer_size != size) {
struct binder_buffer *new_buffer = (void *)buffer-data + size;
+
list_add(new_buffer-entry, buffer-entry);
new_buffer-free = 1;
binder_insert_free_buffer(proc, new_buffer);
@@ -838,6 +843,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (!list_is_last(buffer-entry, proc-buffers)) {
struct binder_buffer *next = list_entry(buffer-entry.next,
struct binder_buffer, entry);
+
if (next-free) {
rb_erase(next-rb_node, proc-free_buffers);
binder_delete_free_buffer(proc, next);
@@ -846,6 +852,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (proc-buffers.next != buffer-entry) {
struct binder_buffer *prev = list_entry(buffer-entry.prev,
struct binder_buffer, entry);
+
if (prev-free) {
binder_delete_free_buffer(proc, buffer);
rb_erase(prev-rb_node, proc-free_buffers);
@@ -1107,6 +1114,7 @@ static int binder_inc_ref(struct binder_ref *ref, int 
strong,
  struct list_head *target_list)
 {
int ret;
+
if (strong) {
if (ref-strong == 0) {
ret = binder_inc_node(ref-node, 1, 1, target_list);
@@ -1138,6 +1146,7 @@ static int binder_dec_ref(struct binder_ref *ref, int 
strong)
ref-strong--;
if (ref-strong == 0) {
int ret;
+
ret = binder_dec_node(ref-node, strong, 1);
if (ret)
return ret;
@@ -1177,6 +1186,7 @@ static void binder_send_failed_reply(struct 
binder_transaction *t,
 uint32_t error_code)
 {
struct binder_thread *target_thread;
+
BUG_ON(t-flags  TF_ONE_WAY);
while (1) {
target_thread = t-from;
@@ -1247,6

[PATCH] staging: android: fix missing a blank line after declarations

2014-04-29 Thread Seunghun Lee
This patch fixes "Missing a blank line after declarations" warnings.

Signed-off-by: Seunghun Lee 
---
 drivers/staging/android/alarm-dev.c   |1 +
 drivers/staging/android/binder.c  |   37 +
 drivers/staging/android/ion/ion.c |   10 +++
 drivers/staging/android/ion/ion_heap.c|2 ++
 drivers/staging/android/ion/ion_priv.h|1 +
 drivers/staging/android/ion/ion_system_heap.c |5 
 drivers/staging/android/logger.c  |3 ++
 drivers/staging/android/sw_sync.c |2 ++
 drivers/staging/android/sync.c|8 ++
 drivers/staging/android/timed_gpio.c  |1 +
 10 files changed, 70 insertions(+)

diff --git a/drivers/staging/android/alarm-dev.c 
b/drivers/staging/android/alarm-dev.c
index 2fc7cdd..f200e8a 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -329,6 +329,7 @@ static int alarm_release(struct inode *inode, struct file 
*file)
if (file->private_data) {
for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++) {
uint32_t alarm_type_mask = 1U << i;
+
if (alarm_enabled & alarm_type_mask) {
alarm_dbg(INFO,
  "%s: clear alarm, pending %d\n",
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index fc59281..8220304 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -118,6 +118,7 @@ static int binder_set_stop_on_user_error(const char *val,
 struct kernel_param *kp)
 {
int ret;
+
ret = param_set_int(val, kp);
if (binder_stop_on_user_error < 2)
wake_up(_user_error_wait);
@@ -194,6 +195,7 @@ static struct binder_transaction_log_entry 
*binder_transaction_log_add(
struct binder_transaction_log *log)
 {
struct binder_transaction_log_entry *e;
+
e = >entry[log->next];
memset(e, 0, sizeof(*e));
log->next++;
@@ -228,8 +230,10 @@ struct binder_node {
int internal_strong_refs;
int local_weak_refs;
int local_strong_refs;
+
binder_uintptr_t ptr;
binder_uintptr_t cookie;
+
unsigned has_strong_ref:1;
unsigned pending_strong_ref:1;
unsigned has_weak_ref:1;
@@ -432,6 +436,7 @@ static inline void binder_unlock(const char *tag)
 static void binder_set_nice(long nice)
 {
long min_nice;
+
if (can_nice(current, nice)) {
set_user_nice(current, nice);
return;
@@ -584,6 +589,7 @@ static int binder_update_page_range(struct binder_proc 
*proc, int allocate,
for (page_addr = start; page_addr < end; page_addr += PAGE_SIZE) {
int ret;
struct page **page_array_ptr;
+
page = >pages[(page_addr - proc->buffer) / PAGE_SIZE];
 
BUG_ON(*page);
@@ -726,6 +732,7 @@ static struct binder_buffer *binder_alloc_buf(struct 
binder_proc *proc,
binder_insert_allocated_buffer(proc, buffer);
if (buffer_size != size) {
struct binder_buffer *new_buffer = (void *)buffer->data + size;
+
list_add(_buffer->entry, >entry);
new_buffer->free = 1;
binder_insert_free_buffer(proc, new_buffer);
@@ -778,6 +785,7 @@ static void binder_delete_free_buffer(struct binder_proc 
*proc,
if (!list_is_last(>entry, >buffers)) {
next = list_entry(buffer->entry.next,
  struct binder_buffer, entry);
+
if (buffer_start_page(next) == buffer_end_page(buffer)) {
free_page_end = 0;
if (buffer_start_page(next) ==
@@ -838,6 +846,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (!list_is_last(>entry, >buffers)) {
struct binder_buffer *next = list_entry(buffer->entry.next,
struct binder_buffer, entry);
+
if (next->free) {
rb_erase(>rb_node, >free_buffers);
binder_delete_free_buffer(proc, next);
@@ -846,6 +855,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (proc->buffers.next != >entry) {
struct binder_buffer *prev = list_entry(buffer->entry.prev,
struct binder_buffer, entry);
+
if (prev->free) {
binder_delete_free_buffer(proc, buffer);
rb_erase(>rb_node, >free_buffers);
@@ -1107,6 +1117,7 @@ static int binder_inc_ref(struct binder_ref *ref, int 
strong,
  struct list_head *target_lis

[PATCH] staging: android: fix missing a blank line after declarations

2014-04-29 Thread Seunghun Lee
This patch fixes Missing a blank line after declarations warnings.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/android/alarm-dev.c   |1 +
 drivers/staging/android/binder.c  |   37 +
 drivers/staging/android/ion/ion.c |   10 +++
 drivers/staging/android/ion/ion_heap.c|2 ++
 drivers/staging/android/ion/ion_priv.h|1 +
 drivers/staging/android/ion/ion_system_heap.c |5 
 drivers/staging/android/logger.c  |3 ++
 drivers/staging/android/sw_sync.c |2 ++
 drivers/staging/android/sync.c|8 ++
 drivers/staging/android/timed_gpio.c  |1 +
 10 files changed, 70 insertions(+)

diff --git a/drivers/staging/android/alarm-dev.c 
b/drivers/staging/android/alarm-dev.c
index 2fc7cdd..f200e8a 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -329,6 +329,7 @@ static int alarm_release(struct inode *inode, struct file 
*file)
if (file-private_data) {
for (i = 0; i  ANDROID_ALARM_TYPE_COUNT; i++) {
uint32_t alarm_type_mask = 1U  i;
+
if (alarm_enabled  alarm_type_mask) {
alarm_dbg(INFO,
  %s: clear alarm, pending %d\n,
diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c
index fc59281..8220304 100644
--- a/drivers/staging/android/binder.c
+++ b/drivers/staging/android/binder.c
@@ -118,6 +118,7 @@ static int binder_set_stop_on_user_error(const char *val,
 struct kernel_param *kp)
 {
int ret;
+
ret = param_set_int(val, kp);
if (binder_stop_on_user_error  2)
wake_up(binder_user_error_wait);
@@ -194,6 +195,7 @@ static struct binder_transaction_log_entry 
*binder_transaction_log_add(
struct binder_transaction_log *log)
 {
struct binder_transaction_log_entry *e;
+
e = log-entry[log-next];
memset(e, 0, sizeof(*e));
log-next++;
@@ -228,8 +230,10 @@ struct binder_node {
int internal_strong_refs;
int local_weak_refs;
int local_strong_refs;
+
binder_uintptr_t ptr;
binder_uintptr_t cookie;
+
unsigned has_strong_ref:1;
unsigned pending_strong_ref:1;
unsigned has_weak_ref:1;
@@ -432,6 +436,7 @@ static inline void binder_unlock(const char *tag)
 static void binder_set_nice(long nice)
 {
long min_nice;
+
if (can_nice(current, nice)) {
set_user_nice(current, nice);
return;
@@ -584,6 +589,7 @@ static int binder_update_page_range(struct binder_proc 
*proc, int allocate,
for (page_addr = start; page_addr  end; page_addr += PAGE_SIZE) {
int ret;
struct page **page_array_ptr;
+
page = proc-pages[(page_addr - proc-buffer) / PAGE_SIZE];
 
BUG_ON(*page);
@@ -726,6 +732,7 @@ static struct binder_buffer *binder_alloc_buf(struct 
binder_proc *proc,
binder_insert_allocated_buffer(proc, buffer);
if (buffer_size != size) {
struct binder_buffer *new_buffer = (void *)buffer-data + size;
+
list_add(new_buffer-entry, buffer-entry);
new_buffer-free = 1;
binder_insert_free_buffer(proc, new_buffer);
@@ -778,6 +785,7 @@ static void binder_delete_free_buffer(struct binder_proc 
*proc,
if (!list_is_last(buffer-entry, proc-buffers)) {
next = list_entry(buffer-entry.next,
  struct binder_buffer, entry);
+
if (buffer_start_page(next) == buffer_end_page(buffer)) {
free_page_end = 0;
if (buffer_start_page(next) ==
@@ -838,6 +846,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (!list_is_last(buffer-entry, proc-buffers)) {
struct binder_buffer *next = list_entry(buffer-entry.next,
struct binder_buffer, entry);
+
if (next-free) {
rb_erase(next-rb_node, proc-free_buffers);
binder_delete_free_buffer(proc, next);
@@ -846,6 +855,7 @@ static void binder_free_buf(struct binder_proc *proc,
if (proc-buffers.next != buffer-entry) {
struct binder_buffer *prev = list_entry(buffer-entry.prev,
struct binder_buffer, entry);
+
if (prev-free) {
binder_delete_free_buffer(proc, buffer);
rb_erase(prev-rb_node, proc-free_buffers);
@@ -1107,6 +1117,7 @@ static int binder_inc_ref(struct binder_ref *ref, int 
strong,
  struct list_head *target_list)
 {
int ret;
+
if (strong

[PATCH] staging: android: uapi: fix coding style

2014-04-16 Thread Seunghun Lee
This patch fix checkpatch.pl warning and errors.

Signed-off-by: Seunghun Lee 
---
 drivers/staging/android/uapi/ion.h |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index f09e7c1..6aa4956 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -27,12 +27,12 @@ typedef int ion_user_handle_t;
  * @ION_HEAP_TYPE_SYSTEM:   memory allocated via vmalloc
  * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
  * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
- *  carveout heap, allocations are physically
- *  contiguous
+ *  carveout heap, allocations are physically
+ *  contiguous
  * @ION_HEAP_TYPE_DMA:  memory allocated via DMA API
  * @ION_NUM_HEAPS:  helper for iterating over heaps, a bit mask
- *  is used to identify the heaps, so only 32
- *  total heap types are supported
+ *  is used to identify the heaps, so only 32
+ *  total heap types are supported
  */
 enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
@@ -50,7 +50,7 @@ enum ion_heap_type {
 #define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
 #define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
 
-#define ION_NUM_HEAP_IDS   sizeof(unsigned int) * 8
+#define ION_NUM_HEAP_IDS   (sizeof(unsigned int) * 8)
 
 /**
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
@@ -78,7 +78,7 @@ enum ion_heap_type {
  * @align: required alignment of the allocation
  * @heap_id_mask:  mask of heap ids to allocate from
  * @flags: flags passed to heap
- * @handle:pointer that will be populated with a cookie to use to 
+ * @handle:pointer that will be populated with a cookie to use to
  * refer to this allocation
  *
  * Provided by userspace as an argument to the ioctl
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging : android : uapi : fix coding style

2014-04-16 Thread Seunghun Lee
This patch fix checkpatch.pl warnings and errors.

Signed-off-by: Seunghun Lee 
---
 drivers/staging/android/uapi/binder.h |2 +-
 drivers/staging/android/uapi/ion.h|   20 +---
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/android/uapi/binder.h 
b/drivers/staging/android/uapi/binder.h
index 904adb7..dba4cef 100644
--- a/drivers/staging/android/uapi/binder.h
+++ b/drivers/staging/android/uapi/binder.h
@@ -169,7 +169,7 @@ struct binder_ptr_cookie {
 struct binder_handle_cookie {
__u32 handle;
binder_uintptr_t cookie;
-} __attribute__((packed));
+} __packed;
 
 struct binder_pri_desc {
__s32 priority;
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index f09e7c1..36332dc 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -20,19 +20,17 @@
 #include 
 #include 
 
-typedef int ion_user_handle_t;
-
 /**
  * enum ion_heap_types - list of all possible types of heaps
  * @ION_HEAP_TYPE_SYSTEM:   memory allocated via vmalloc
  * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
  * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
- *  carveout heap, allocations are physically
- *  contiguous
+ *  carveout heap, allocations are physically
+ *  contiguous
  * @ION_HEAP_TYPE_DMA:  memory allocated via DMA API
  * @ION_NUM_HEAPS:  helper for iterating over heaps, a bit mask
- *  is used to identify the heaps, so only 32
- *  total heap types are supported
+ *  is used to identify the heaps, so only 32
+ *  total heap types are supported
  */
 enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
@@ -50,7 +48,7 @@ enum ion_heap_type {
 #define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
 #define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
 
-#define ION_NUM_HEAP_IDS   sizeof(unsigned int) * 8
+#define ION_NUM_HEAP_IDS   (sizeof(unsigned int) * 8)
 
 /**
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
@@ -78,7 +76,7 @@ enum ion_heap_type {
  * @align: required alignment of the allocation
  * @heap_id_mask:  mask of heap ids to allocate from
  * @flags: flags passed to heap
- * @handle:pointer that will be populated with a cookie to use to 
+ * @handle:pointer that will be populated with a cookie to use to
  * refer to this allocation
  *
  * Provided by userspace as an argument to the ioctl
@@ -88,7 +86,7 @@ struct ion_allocation_data {
size_t align;
unsigned int heap_id_mask;
unsigned int flags;
-   ion_user_handle_t handle;
+   int handle;
 };
 
 /**
@@ -102,7 +100,7 @@ struct ion_allocation_data {
  * provides the file descriptor and the kernel returns the handle.
  */
 struct ion_fd_data {
-   ion_user_handle_t handle;
+   int handle;
int fd;
 };
 
@@ -111,7 +109,7 @@ struct ion_fd_data {
  * @handle:a handle
  */
 struct ion_handle_data {
-   ion_user_handle_t handle;
+   int handle;
 };
 
 /**
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging : android : uapi : fix coding style

2014-04-16 Thread Seunghun Lee
This patch fix checkpatch.pl warnings and errors.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/android/uapi/binder.h |2 +-
 drivers/staging/android/uapi/ion.h|   20 +---
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/android/uapi/binder.h 
b/drivers/staging/android/uapi/binder.h
index 904adb7..dba4cef 100644
--- a/drivers/staging/android/uapi/binder.h
+++ b/drivers/staging/android/uapi/binder.h
@@ -169,7 +169,7 @@ struct binder_ptr_cookie {
 struct binder_handle_cookie {
__u32 handle;
binder_uintptr_t cookie;
-} __attribute__((packed));
+} __packed;
 
 struct binder_pri_desc {
__s32 priority;
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index f09e7c1..36332dc 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -20,19 +20,17 @@
 #include linux/ioctl.h
 #include linux/types.h
 
-typedef int ion_user_handle_t;
-
 /**
  * enum ion_heap_types - list of all possible types of heaps
  * @ION_HEAP_TYPE_SYSTEM:   memory allocated via vmalloc
  * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
  * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
- *  carveout heap, allocations are physically
- *  contiguous
+ *  carveout heap, allocations are physically
+ *  contiguous
  * @ION_HEAP_TYPE_DMA:  memory allocated via DMA API
  * @ION_NUM_HEAPS:  helper for iterating over heaps, a bit mask
- *  is used to identify the heaps, so only 32
- *  total heap types are supported
+ *  is used to identify the heaps, so only 32
+ *  total heap types are supported
  */
 enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
@@ -50,7 +48,7 @@ enum ion_heap_type {
 #define ION_HEAP_CARVEOUT_MASK (1  ION_HEAP_TYPE_CARVEOUT)
 #define ION_HEAP_TYPE_DMA_MASK (1  ION_HEAP_TYPE_DMA)
 
-#define ION_NUM_HEAP_IDS   sizeof(unsigned int) * 8
+#define ION_NUM_HEAP_IDS   (sizeof(unsigned int) * 8)
 
 /**
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
@@ -78,7 +76,7 @@ enum ion_heap_type {
  * @align: required alignment of the allocation
  * @heap_id_mask:  mask of heap ids to allocate from
  * @flags: flags passed to heap
- * @handle:pointer that will be populated with a cookie to use to 
+ * @handle:pointer that will be populated with a cookie to use to
  * refer to this allocation
  *
  * Provided by userspace as an argument to the ioctl
@@ -88,7 +86,7 @@ struct ion_allocation_data {
size_t align;
unsigned int heap_id_mask;
unsigned int flags;
-   ion_user_handle_t handle;
+   int handle;
 };
 
 /**
@@ -102,7 +100,7 @@ struct ion_allocation_data {
  * provides the file descriptor and the kernel returns the handle.
  */
 struct ion_fd_data {
-   ion_user_handle_t handle;
+   int handle;
int fd;
 };
 
@@ -111,7 +109,7 @@ struct ion_fd_data {
  * @handle:a handle
  */
 struct ion_handle_data {
-   ion_user_handle_t handle;
+   int handle;
 };
 
 /**
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] staging: android: uapi: fix coding style

2014-04-16 Thread Seunghun Lee
This patch fix checkpatch.pl warning and errors.

Signed-off-by: Seunghun Lee way...@gmail.com
---
 drivers/staging/android/uapi/ion.h |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index f09e7c1..6aa4956 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -27,12 +27,12 @@ typedef int ion_user_handle_t;
  * @ION_HEAP_TYPE_SYSTEM:   memory allocated via vmalloc
  * @ION_HEAP_TYPE_SYSTEM_CONTIG: memory allocated via kmalloc
  * @ION_HEAP_TYPE_CARVEOUT: memory allocated from a prereserved
- *  carveout heap, allocations are physically
- *  contiguous
+ *  carveout heap, allocations are physically
+ *  contiguous
  * @ION_HEAP_TYPE_DMA:  memory allocated via DMA API
  * @ION_NUM_HEAPS:  helper for iterating over heaps, a bit mask
- *  is used to identify the heaps, so only 32
- *  total heap types are supported
+ *  is used to identify the heaps, so only 32
+ *  total heap types are supported
  */
 enum ion_heap_type {
ION_HEAP_TYPE_SYSTEM,
@@ -50,7 +50,7 @@ enum ion_heap_type {
 #define ION_HEAP_CARVEOUT_MASK (1  ION_HEAP_TYPE_CARVEOUT)
 #define ION_HEAP_TYPE_DMA_MASK (1  ION_HEAP_TYPE_DMA)
 
-#define ION_NUM_HEAP_IDS   sizeof(unsigned int) * 8
+#define ION_NUM_HEAP_IDS   (sizeof(unsigned int) * 8)
 
 /**
  * allocation flags - the lower 16 bits are used by core ion, the upper 16
@@ -78,7 +78,7 @@ enum ion_heap_type {
  * @align: required alignment of the allocation
  * @heap_id_mask:  mask of heap ids to allocate from
  * @flags: flags passed to heap
- * @handle:pointer that will be populated with a cookie to use to 
+ * @handle:pointer that will be populated with a cookie to use to
  * refer to this allocation
  *
  * Provided by userspace as an argument to the ioctl
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] module: fix coding style

2013-12-18 Thread Seunghun Lee
Fix coding style of module.h

Signed-off-by: Seunghun Lee 
---
 include/linux/module.h |   62 
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 46e548f..eaf60ff 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -29,8 +29,7 @@
 
 #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
 
-struct modversion_info
-{
+struct modversion_info {
unsigned long crc;
char name[MODULE_NAME_LEN];
 };
@@ -84,12 +83,12 @@ void sort_main_extable(void);
 void trim_init_extable(struct module *m);
 
 #ifdef MODULE
-#define MODULE_GENERIC_TABLE(gtype,name)   \
+#define MODULE_GENERIC_TABLE(gtype, name)  \
 extern const struct gtype##_id __mod_##gtype##_table   \
   __attribute__ ((unused, alias(__stringify(name
 
 #else  /* !MODULE */
-#define MODULE_GENERIC_TABLE(gtype,name)
+#define MODULE_GENERIC_TABLE(gtype, name)
 #endif
 
 /* Generic info of form tag = "info" */
@@ -126,7 +125,7 @@ extern const struct gtype##_id __mod_##gtype##_table
\
  * is a GPL combined work.
  *
  * This exists for several reasons
- * 1.  So modinfo can show license info for users wanting to vet their setup 
+ * 1.  So modinfo can show license info for users wanting to vet their setup
  * is free
  * 2.  So the community can ignore bug reports including proprietary modules
  * 3.  So vendors can do likewise based on their own policies
@@ -138,27 +137,29 @@ extern const struct gtype##_id __mod_##gtype##_table  
\
  * authors use multiple MODULE_AUTHOR() statements/lines.
  */
 #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
-  
+
 /* What your module does. */
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 
-#define MODULE_DEVICE_TABLE(type,name) \
-  MODULE_GENERIC_TABLE(type##_device,name)
+#define MODULE_DEVICE_TABLE(type, name)\
+  MODULE_GENERIC_TABLE(type##_device, name)
 
 /* Version of form [:][-].
-   Or for CVS/RCS ID version, everything but the number is stripped.
-  : A (small) unsigned integer which allows you to start versions
-   anew. If not mentioned, it's zero.  eg. "2:1.0" is after
-  "1:2.0".
-  : The  may contain only alphanumerics and the
-   character `.'.  Ordered by numeric sort for numeric parts,
-  ascii sort for ascii parts (as per RPM or DEB algorithm).
-  : Like , but inserted for local
-   customizations, eg "rh3" or "rusty1".
-
-  Using this automatically adds a checksum of the .c files and the
-  local headers in "srcversion".
-*/
+ * Or for CVS/RCS ID version, everything but the number is stripped.
+ * : A (small) unsigned integer which allows you to start versions
+ * anew. If not mentioned, it's zero.  eg. "2:1.0" is after
+ * "1:2.0".
+
+ * : The  may contain only alphanumerics and the
+ * character `.'.  Ordered by numeric sort for numeric parts,
+ * ascii sort for ascii parts (as per RPM or DEB algorithm).
+
+ * : Like , but inserted for local
+ * customizations, eg "rh3" or "rusty1".
+
+ * Using this automatically adds a checksum of the .c files and the
+ * local headers in "srcversion".
+ */
 
 #if defined(MODULE) || !defined(CONFIG_SYSFS)
 #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
@@ -226,8 +227,7 @@ struct module_ref {
unsigned long decs;
 } __attribute((aligned(2 * sizeof(unsigned long;
 
-struct module
-{
+struct module {
enum module_state state;
 
/* Member of list of modules */
@@ -480,8 +480,8 @@ static inline void module_put(struct module *module)
 static inline void __module_get(struct module *module)
 {
 }
-#define symbol_put(x) do { } while(0)
-#define symbol_put_addr(p) do { } while(0)
+#define symbol_put(x) do { } while (0)
+#define symbol_put_addr(p) do { } while (0)
 
 #endif /* CONFIG_MODULE_UNLOAD */
 int ref_module(struct module *a, struct module *b);
@@ -507,8 +507,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned 
long *size, unsigned
 /* For extable.c to search modules' exception tables. */
 const struct exception_table_entry *search_module_extables(unsigned long addr);
 
-int register_module_notifier(struct notifier_block * nb);
-int unregister_module_notifier(struct notifier_block * nb);
+int register_module_notifier(struct notifier_block *nb);
+int unregister_module_notifier(struct notifier_block *nb);
 
 extern void print_modules(void);
 
@@ -548,8 +548,8 @@ static inline bool is_module_text_address(unsigned long 
addr)
 
 /* Get/put a kernel symbol (calls should be symmetric) */
 #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
-#define symbol_put(x) do { } while(0)
-#define symbol_put_addr(x) do { } while(0)
+#define symbol_put(x) do { } while (0)
+#

[PATCH] module: fix coding style

2013-12-18 Thread Seunghun Lee
Fix coding style of module.h

Signed-off-by: Seunghun Lee way...@gmail.com
---
 include/linux/module.h |   62 
 1 file changed, 31 insertions(+), 31 deletions(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index 46e548f..eaf60ff 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -29,8 +29,7 @@
 
 #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
 
-struct modversion_info
-{
+struct modversion_info {
unsigned long crc;
char name[MODULE_NAME_LEN];
 };
@@ -84,12 +83,12 @@ void sort_main_extable(void);
 void trim_init_extable(struct module *m);
 
 #ifdef MODULE
-#define MODULE_GENERIC_TABLE(gtype,name)   \
+#define MODULE_GENERIC_TABLE(gtype, name)  \
 extern const struct gtype##_id __mod_##gtype##_table   \
   __attribute__ ((unused, alias(__stringify(name
 
 #else  /* !MODULE */
-#define MODULE_GENERIC_TABLE(gtype,name)
+#define MODULE_GENERIC_TABLE(gtype, name)
 #endif
 
 /* Generic info of form tag = info */
@@ -126,7 +125,7 @@ extern const struct gtype##_id __mod_##gtype##_table
\
  * is a GPL combined work.
  *
  * This exists for several reasons
- * 1.  So modinfo can show license info for users wanting to vet their setup 
+ * 1.  So modinfo can show license info for users wanting to vet their setup
  * is free
  * 2.  So the community can ignore bug reports including proprietary modules
  * 3.  So vendors can do likewise based on their own policies
@@ -138,27 +137,29 @@ extern const struct gtype##_id __mod_##gtype##_table  
\
  * authors use multiple MODULE_AUTHOR() statements/lines.
  */
 #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
-  
+
 /* What your module does. */
 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
 
-#define MODULE_DEVICE_TABLE(type,name) \
-  MODULE_GENERIC_TABLE(type##_device,name)
+#define MODULE_DEVICE_TABLE(type, name)\
+  MODULE_GENERIC_TABLE(type##_device, name)
 
 /* Version of form [epoch:]version[-extra-version].
-   Or for CVS/RCS ID version, everything but the number is stripped.
-  epoch: A (small) unsigned integer which allows you to start versions
-   anew. If not mentioned, it's zero.  eg. 2:1.0 is after
-  1:2.0.
-  version: The version may contain only alphanumerics and the
-   character `.'.  Ordered by numeric sort for numeric parts,
-  ascii sort for ascii parts (as per RPM or DEB algorithm).
-  extraversion: Like version, but inserted for local
-   customizations, eg rh3 or rusty1.
-
-  Using this automatically adds a checksum of the .c files and the
-  local headers in srcversion.
-*/
+ * Or for CVS/RCS ID version, everything but the number is stripped.
+ * epoch: A (small) unsigned integer which allows you to start versions
+ * anew. If not mentioned, it's zero.  eg. 2:1.0 is after
+ * 1:2.0.
+
+ * version: The version may contain only alphanumerics and the
+ * character `.'.  Ordered by numeric sort for numeric parts,
+ * ascii sort for ascii parts (as per RPM or DEB algorithm).
+
+ * extraversion: Like version, but inserted for local
+ * customizations, eg rh3 or rusty1.
+
+ * Using this automatically adds a checksum of the .c files and the
+ * local headers in srcversion.
+ */
 
 #if defined(MODULE) || !defined(CONFIG_SYSFS)
 #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
@@ -226,8 +227,7 @@ struct module_ref {
unsigned long decs;
 } __attribute((aligned(2 * sizeof(unsigned long;
 
-struct module
-{
+struct module {
enum module_state state;
 
/* Member of list of modules */
@@ -480,8 +480,8 @@ static inline void module_put(struct module *module)
 static inline void __module_get(struct module *module)
 {
 }
-#define symbol_put(x) do { } while(0)
-#define symbol_put_addr(p) do { } while(0)
+#define symbol_put(x) do { } while (0)
+#define symbol_put_addr(p) do { } while (0)
 
 #endif /* CONFIG_MODULE_UNLOAD */
 int ref_module(struct module *a, struct module *b);
@@ -507,8 +507,8 @@ int lookup_module_symbol_attrs(unsigned long addr, unsigned 
long *size, unsigned
 /* For extable.c to search modules' exception tables. */
 const struct exception_table_entry *search_module_extables(unsigned long addr);
 
-int register_module_notifier(struct notifier_block * nb);
-int unregister_module_notifier(struct notifier_block * nb);
+int register_module_notifier(struct notifier_block *nb);
+int unregister_module_notifier(struct notifier_block *nb);
 
 extern void print_modules(void);
 
@@ -548,8 +548,8 @@ static inline bool is_module_text_address(unsigned long 
addr)
 
 /* Get/put a kernel symbol (calls should be symmetric) */
 #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); (x); })
-#define symbol_put(x) do { } while(0)
-#define symbol_put_addr(x) do { } while(0)
+#define symbol_put(x) do { } while (0)
+#define