[PATCH 0/3] gpu: drm: Fix memory leak in vmwgfx_shader.c

2014-06-24 Thread Masaru Nomura
This patch fixes memory leak detected by Kernel memory leak detector, 
and cleans up functions which call drm_ht_remove_item() and 
vmw_compat_shader_free() so that an unused parameter is not passed.

Part of logs from /sys/kernel/debug/kmemleak is as follows:

unreferenced object 0xc900086ed000 (size 32768):
  comm "plymouthd", pid 287, jiffies 4294682116 (age 5911.149s)
  hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[] kmemleak_alloc+0x4e/0xb0
[] __vmalloc_node_range+0x1b2/0x2a0
[] vzalloc+0x4b/0x50
[] drm_ht_create+0x65/0xa0 [drm]
[] vmw_compat_shader_man_create+0x78/0xb0 [vmwgfx]
[] vmw_driver_open+0x62/0xa0 [vmwgfx]
[] drm_open+0x1b7/0x4c0 [drm]
[] drm_stub_open+0xa5/0x100 [drm]
[] chrdev_open+0xb9/0x1a0
[] do_dentry_open+0x1ff/0x340
[] finish_open+0x31/0x40
[] do_last+0xa64/0x1190
[] path_openat+0xcd/0x670
[] do_filp_open+0x4d/0xb0
[] do_sys_open+0x13d/0x230
[] SyS_open+0x1e/0x20
unreferenced object 0xc900086e4000 (size 32768):
  comm "Xorg", pid 751, jiffies 4294687683 (age 5917.505s)
  hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[] kmemleak_alloc+0x4e/0xb0
[] __vmalloc_node_range+0x1b2/0x2a0
[] vzalloc+0x4b/0x50
[] drm_ht_create+0x65/0xa0 [drm]
[] vmw_compat_shader_man_create+0x78/0xb0 [vmwgfx]
[] vmw_driver_open+0x62/0xa0 [vmwgfx]
[] drm_open+0x1b7/0x4c0 [drm]
[] drm_stub_open+0xa5/0x100 [drm]
[] chrdev_open+0xb9/0x1a0
[] do_dentry_open+0x1ff/0x340
[] finish_open+0x31/0x40
[] do_last+0xa64/0x1190
[] path_openat+0xcd/0x670
[] do_filp_open+0x4d/0xb0
[] do_sys_open+0x13d/0x230
[] SyS_open+0x1e/0x20

Masaru Nomura (3):
  gpu: drm: vmwgfx: Fix memory leak by adding drm_ht_remove()
  gpu: drm: Remove unnecessary parameter from drm_ht_remove_item()
  gpu: drm: vmwgfx: Remove unnecessary parameter from
vmw_compat_shader_free()

 drivers/gpu/drm/drm_auth.c  |  2 +-
 drivers/gpu/drm/drm_hashtab.c   |  2 +-
 drivers/gpu/drm/drm_stub.c  |  2 +-
 drivers/gpu/drm/ttm/ttm_object.c|  8 +++-
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |  4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 16 
 include/drm/drm_hashtab.h   |  2 +-
 7 files changed, 17 insertions(+), 19 deletions(-)

-- 
1.9.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 3/3] gpu: drm: vmwgfx: Remove unnecessary parameter from vmw_compat_shader_free()

2014-06-24 Thread Masaru Nomura
vm_compat_shader_manager is only used for drm_ht_remove_item() within the 
function.
As drm_ht_remove_item() does not need a paremeter drm_open_hash(> shaders),
vm_compat_shader_manager(*man) does not have to be passed to this function.

Signed-off-by: Masaru Nomura 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index bbb30c3..2fdbf8e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -532,14 +532,12 @@ int vmw_compat_shader_lookup(struct 
vmw_compat_shader_manager *man,
 /**
  * vmw_compat_shader_free - Free a compat shader.
  *
- * @man: Pointer to the compat shader manager.
  * @entry: Pointer to a struct vmw_compat_shader.
  *
  * Frees a struct vmw_compat_shder entry and drops its reference to the
  * guest backed shader.
  */
-static void vmw_compat_shader_free(struct vmw_compat_shader_manager *man,
-  struct vmw_compat_shader *entry)
+static void vmw_compat_shader_free(struct vmw_compat_shader *entry)
 {
list_del(>head);
WARN_ON(drm_ht_remove_item(>hash));
@@ -602,7 +600,7 @@ void vmw_compat_shaders_revert(struct 
vmw_compat_shader_manager *man,
list_for_each_entry_safe(entry, next, list, head) {
switch (entry->state) {
case VMW_COMPAT_ADD:
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
break;
case VMW_COMPAT_DEL:
ret = drm_ht_insert_item(>shaders, >hash);
@@ -649,7 +647,7 @@ int vmw_compat_shader_remove(struct 
vmw_compat_shader_manager *man,
 
switch (entry->state) {
case VMW_COMPAT_ADD:
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
break;
case VMW_COMPAT_COMMITED:
drm_ht_remove_item(>hash);
@@ -804,7 +802,7 @@ void vmw_compat_shader_man_destroy(struct 
vmw_compat_shader_manager *man)
 
mutex_lock(>dev_priv->cmdbuf_mutex);
list_for_each_entry_safe(entry, next, >list, head)
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
 
drm_ht_remove(>shaders);
 
-- 
1.9.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 2/3] gpu: drm: Remove unnecessary parameter from drm_ht_remove_item()

2014-06-24 Thread Masaru Nomura
removed drm_open_hash from drm_ht_remove_item() as the parameter is
not used within the function.

Signed-off-by: Masaru Nomura 
---
Please review this patch carefully. The reason the parameter is passed
might be some historical one or clarity of which drm_open_hash
we remove an item from.

 drivers/gpu/drm/drm_auth.c  | 2 +-
 drivers/gpu/drm/drm_hashtab.c   | 2 +-
 drivers/gpu/drm/drm_stub.c  | 2 +-
 drivers/gpu/drm/ttm/ttm_object.c| 8 +++-
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 4 ++--
 include/drm/drm_hashtab.h   | 2 +-
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 3cedae1..f7ceea0 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -115,7 +115,7 @@ int drm_remove_magic(struct drm_master *master, drm_magic_t 
magic)
return -EINVAL;
}
pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
-   drm_ht_remove_item(>magiclist, hash);
+   drm_ht_remove_item(hash);
list_del(>head);
mutex_unlock(>struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index c3b80fd..a66447f 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -188,7 +188,7 @@ int drm_ht_remove_key(struct drm_open_hash *ht, unsigned 
long key)
return -EINVAL;
 }
 
-int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
+int drm_ht_remove_item(struct drm_hash_item *item)
 {
hlist_del_init_rcu(>head);
return 0;
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 14d1646..6ffed45 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -166,7 +166,7 @@ static void drm_master_destroy(struct kref *kref)
 
list_for_each_entry_safe(pt, next, >magicfree, head) {
list_del(>head);
-   drm_ht_remove_item(>magiclist, >hash_item);
+   drm_ht_remove_item(>hash_item);
kfree(pt);
}
 
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
index d2a0533..42f73a8 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/ttm/ttm_object.c
@@ -188,7 +188,7 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
return 0;
 out_err1:
spin_lock(>object_lock);
-   (void)drm_ht_remove_item_rcu(>object_hash, >hash);
+   drm_ht_remove_item_rcu(>hash);
spin_unlock(>object_lock);
 out_err0:
return ret;
@@ -202,7 +202,7 @@ static void ttm_release_base(struct kref *kref)
struct ttm_object_device *tdev = base->tfile->tdev;
 
spin_lock(>object_lock);
-   (void)drm_ht_remove_item_rcu(>object_hash, >hash);
+   drm_ht_remove_item_rcu(>hash);
spin_unlock(>object_lock);
 
/*
@@ -390,11 +390,9 @@ static void ttm_ref_object_release(struct kref *kref)
container_of(kref, struct ttm_ref_object, kref);
struct ttm_base_object *base = ref->obj;
struct ttm_object_file *tfile = ref->tfile;
-   struct drm_open_hash *ht;
struct ttm_mem_global *mem_glob = tfile->tdev->mem_glob;
 
-   ht = >ref_hash[ref->ref_type];
-   (void)drm_ht_remove_item_rcu(ht, >hash);
+   drm_ht_remove_item_rcu(>hash);
list_del(>head);
spin_unlock(>lock);
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 87df0b3..1780f5e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2185,13 +2185,13 @@ static void vmw_clear_validations(struct vmw_sw_context 
*sw_context)
 base.head) {
list_del(>base.head);
ttm_bo_unref(>base.bo);
-   (void) drm_ht_remove_item(_context->res_ht, >hash);
+   drm_ht_remove_item(>hash);
sw_context->cur_val_buf--;
}
BUG_ON(sw_context->cur_val_buf != 0);
 
list_for_each_entry(val, _context->resource_list, head)
-   (void) drm_ht_remove_item(_context->res_ht, >hash);
+   drm_ht_remove_item(>hash);
 }
 
 static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 01cc8ea..bbb30c3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -542,7 +542,7 @@ static void vmw_compat_shader_free(struct 
vmw_compat_shader_manager *man,
   struct vmw_compat_shader *entry)
 {
list_del(>head);
-   WARN_ON(drm_ht_remove_item(>

[PATCH 1/3] gpu: drm: vmwgfx: Fix memory leak by adding drm_ht_remove()

2014-06-24 Thread Masaru Nomura
drm_ht_remove() should be called in vmw_compat_shader_man_destroy()
This is because memory was allocated for (>shaders)->table by
vmw_compat_shader_man_create() -> drm_ht_create()
but this memory is not freed when vmw_compat_shader_mager is destroied.

Signed-off-by: Masaru Nomura 
---
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index c1559eea..01cc8ea 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -806,6 +806,8 @@ void vmw_compat_shader_man_destroy(struct 
vmw_compat_shader_manager *man)
list_for_each_entry_safe(entry, next, >list, head)
vmw_compat_shader_free(man, entry);
 
+   drm_ht_remove(>shaders);
+
mutex_unlock(>dev_priv->cmdbuf_mutex);
kfree(man);
 }
-- 
1.9.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 2/3] gpu: drm: Remove unnecessary parameter from drm_ht_remove_item()

2014-06-24 Thread Masaru Nomura
removed drm_open_hash from drm_ht_remove_item() as the parameter is
not used within the function.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
Please review this patch carefully. The reason the parameter is passed
might be some historical one or clarity of which drm_open_hash
we remove an item from.

 drivers/gpu/drm/drm_auth.c  | 2 +-
 drivers/gpu/drm/drm_hashtab.c   | 2 +-
 drivers/gpu/drm/drm_stub.c  | 2 +-
 drivers/gpu/drm/ttm/ttm_object.c| 8 +++-
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 4 ++--
 include/drm/drm_hashtab.h   | 2 +-
 7 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 3cedae1..f7ceea0 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -115,7 +115,7 @@ int drm_remove_magic(struct drm_master *master, drm_magic_t 
magic)
return -EINVAL;
}
pt = drm_hash_entry(hash, struct drm_magic_entry, hash_item);
-   drm_ht_remove_item(master-magiclist, hash);
+   drm_ht_remove_item(hash);
list_del(pt-head);
mutex_unlock(dev-struct_mutex);
 
diff --git a/drivers/gpu/drm/drm_hashtab.c b/drivers/gpu/drm/drm_hashtab.c
index c3b80fd..a66447f 100644
--- a/drivers/gpu/drm/drm_hashtab.c
+++ b/drivers/gpu/drm/drm_hashtab.c
@@ -188,7 +188,7 @@ int drm_ht_remove_key(struct drm_open_hash *ht, unsigned 
long key)
return -EINVAL;
 }
 
-int drm_ht_remove_item(struct drm_open_hash *ht, struct drm_hash_item *item)
+int drm_ht_remove_item(struct drm_hash_item *item)
 {
hlist_del_init_rcu(item-head);
return 0;
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 14d1646..6ffed45 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -166,7 +166,7 @@ static void drm_master_destroy(struct kref *kref)
 
list_for_each_entry_safe(pt, next, master-magicfree, head) {
list_del(pt-head);
-   drm_ht_remove_item(master-magiclist, pt-hash_item);
+   drm_ht_remove_item(pt-hash_item);
kfree(pt);
}
 
diff --git a/drivers/gpu/drm/ttm/ttm_object.c b/drivers/gpu/drm/ttm/ttm_object.c
index d2a0533..42f73a8 100644
--- a/drivers/gpu/drm/ttm/ttm_object.c
+++ b/drivers/gpu/drm/ttm/ttm_object.c
@@ -188,7 +188,7 @@ int ttm_base_object_init(struct ttm_object_file *tfile,
return 0;
 out_err1:
spin_lock(tdev-object_lock);
-   (void)drm_ht_remove_item_rcu(tdev-object_hash, base-hash);
+   drm_ht_remove_item_rcu(base-hash);
spin_unlock(tdev-object_lock);
 out_err0:
return ret;
@@ -202,7 +202,7 @@ static void ttm_release_base(struct kref *kref)
struct ttm_object_device *tdev = base-tfile-tdev;
 
spin_lock(tdev-object_lock);
-   (void)drm_ht_remove_item_rcu(tdev-object_hash, base-hash);
+   drm_ht_remove_item_rcu(base-hash);
spin_unlock(tdev-object_lock);
 
/*
@@ -390,11 +390,9 @@ static void ttm_ref_object_release(struct kref *kref)
container_of(kref, struct ttm_ref_object, kref);
struct ttm_base_object *base = ref-obj;
struct ttm_object_file *tfile = ref-tfile;
-   struct drm_open_hash *ht;
struct ttm_mem_global *mem_glob = tfile-tdev-mem_glob;
 
-   ht = tfile-ref_hash[ref-ref_type];
-   (void)drm_ht_remove_item_rcu(ht, ref-hash);
+   drm_ht_remove_item_rcu(ref-hash);
list_del(ref-head);
spin_unlock(tfile-lock);
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
index 87df0b3..1780f5e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c
@@ -2185,13 +2185,13 @@ static void vmw_clear_validations(struct vmw_sw_context 
*sw_context)
 base.head) {
list_del(entry-base.head);
ttm_bo_unref(entry-base.bo);
-   (void) drm_ht_remove_item(sw_context-res_ht, entry-hash);
+   drm_ht_remove_item(entry-hash);
sw_context-cur_val_buf--;
}
BUG_ON(sw_context-cur_val_buf != 0);
 
list_for_each_entry(val, sw_context-resource_list, head)
-   (void) drm_ht_remove_item(sw_context-res_ht, val-hash);
+   drm_ht_remove_item(val-hash);
 }
 
 static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index 01cc8ea..bbb30c3 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -542,7 +542,7 @@ static void vmw_compat_shader_free(struct 
vmw_compat_shader_manager *man,
   struct vmw_compat_shader *entry)
 {
list_del(entry-head);
-   WARN_ON(drm_ht_remove_item(man-shaders, entry-hash));
+   WARN_ON

[PATCH 1/3] gpu: drm: vmwgfx: Fix memory leak by adding drm_ht_remove()

2014-06-24 Thread Masaru Nomura
drm_ht_remove() should be called in vmw_compat_shader_man_destroy()
This is because memory was allocated for (man-shaders)-table by
vmw_compat_shader_man_create() - drm_ht_create()
but this memory is not freed when vmw_compat_shader_mager is destroied.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index c1559eea..01cc8ea 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -806,6 +806,8 @@ void vmw_compat_shader_man_destroy(struct 
vmw_compat_shader_manager *man)
list_for_each_entry_safe(entry, next, man-list, head)
vmw_compat_shader_free(man, entry);
 
+   drm_ht_remove(man-shaders);
+
mutex_unlock(man-dev_priv-cmdbuf_mutex);
kfree(man);
 }
-- 
1.9.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 0/3] gpu: drm: Fix memory leak in vmwgfx_shader.c

2014-06-24 Thread Masaru Nomura
This patch fixes memory leak detected by Kernel memory leak detector, 
and cleans up functions which call drm_ht_remove_item() and 
vmw_compat_shader_free() so that an unused parameter is not passed.

Part of logs from /sys/kernel/debug/kmemleak is as follows:

unreferenced object 0xc900086ed000 (size 32768):
  comm plymouthd, pid 287, jiffies 4294682116 (age 5911.149s)
  hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[816f7b6e] kmemleak_alloc+0x4e/0xb0
[811b9382] __vmalloc_node_range+0x1b2/0x2a0
[811b950b] vzalloc+0x4b/0x50
[a009c7e5] drm_ht_create+0x65/0xa0 [drm]
[a011a068] vmw_compat_shader_man_create+0x78/0xb0 [vmwgfx]
[a0109ac2] vmw_driver_open+0x62/0xa0 [vmwgfx]
[a0093307] drm_open+0x1b7/0x4c0 [drm]
[a00936b5] drm_stub_open+0xa5/0x100 [drm]
[811f6c29] chrdev_open+0xb9/0x1a0
[811ef58f] do_dentry_open+0x1ff/0x340
[811ef8a1] finish_open+0x31/0x40
[812017e4] do_last+0xa64/0x1190
[81201fdd] path_openat+0xcd/0x670
[81202ddd] do_filp_open+0x4d/0xb0
[811f12fd] do_sys_open+0x13d/0x230
[811f140e] SyS_open+0x1e/0x20
unreferenced object 0xc900086e4000 (size 32768):
  comm Xorg, pid 751, jiffies 4294687683 (age 5917.505s)
  hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
  backtrace:
[816f7b6e] kmemleak_alloc+0x4e/0xb0
[811b9382] __vmalloc_node_range+0x1b2/0x2a0
[811b950b] vzalloc+0x4b/0x50
[a009c7e5] drm_ht_create+0x65/0xa0 [drm]
[a011a068] vmw_compat_shader_man_create+0x78/0xb0 [vmwgfx]
[a0109ac2] vmw_driver_open+0x62/0xa0 [vmwgfx]
[a0093307] drm_open+0x1b7/0x4c0 [drm]
[a00936b5] drm_stub_open+0xa5/0x100 [drm]
[811f6c29] chrdev_open+0xb9/0x1a0
[811ef58f] do_dentry_open+0x1ff/0x340
[811ef8a1] finish_open+0x31/0x40
[812017e4] do_last+0xa64/0x1190
[81201fdd] path_openat+0xcd/0x670
[81202ddd] do_filp_open+0x4d/0xb0
[811f12fd] do_sys_open+0x13d/0x230
[811f140e] SyS_open+0x1e/0x20

Masaru Nomura (3):
  gpu: drm: vmwgfx: Fix memory leak by adding drm_ht_remove()
  gpu: drm: Remove unnecessary parameter from drm_ht_remove_item()
  gpu: drm: vmwgfx: Remove unnecessary parameter from
vmw_compat_shader_free()

 drivers/gpu/drm/drm_auth.c  |  2 +-
 drivers/gpu/drm/drm_hashtab.c   |  2 +-
 drivers/gpu/drm/drm_stub.c  |  2 +-
 drivers/gpu/drm/ttm/ttm_object.c|  8 +++-
 drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c |  4 ++--
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c  | 16 
 include/drm/drm_hashtab.h   |  2 +-
 7 files changed, 17 insertions(+), 19 deletions(-)

-- 
1.9.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 3/3] gpu: drm: vmwgfx: Remove unnecessary parameter from vmw_compat_shader_free()

2014-06-24 Thread Masaru Nomura
vm_compat_shader_manager is only used for drm_ht_remove_item() within the 
function.
As drm_ht_remove_item() does not need a paremeter drm_open_hash(man- shaders),
vm_compat_shader_manager(*man) does not have to be passed to this function.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/gpu/drm/vmwgfx/vmwgfx_shader.c | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
index bbb30c3..2fdbf8e 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_shader.c
@@ -532,14 +532,12 @@ int vmw_compat_shader_lookup(struct 
vmw_compat_shader_manager *man,
 /**
  * vmw_compat_shader_free - Free a compat shader.
  *
- * @man: Pointer to the compat shader manager.
  * @entry: Pointer to a struct vmw_compat_shader.
  *
  * Frees a struct vmw_compat_shder entry and drops its reference to the
  * guest backed shader.
  */
-static void vmw_compat_shader_free(struct vmw_compat_shader_manager *man,
-  struct vmw_compat_shader *entry)
+static void vmw_compat_shader_free(struct vmw_compat_shader *entry)
 {
list_del(entry-head);
WARN_ON(drm_ht_remove_item(entry-hash));
@@ -602,7 +600,7 @@ void vmw_compat_shaders_revert(struct 
vmw_compat_shader_manager *man,
list_for_each_entry_safe(entry, next, list, head) {
switch (entry-state) {
case VMW_COMPAT_ADD:
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
break;
case VMW_COMPAT_DEL:
ret = drm_ht_insert_item(man-shaders, entry-hash);
@@ -649,7 +647,7 @@ int vmw_compat_shader_remove(struct 
vmw_compat_shader_manager *man,
 
switch (entry-state) {
case VMW_COMPAT_ADD:
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
break;
case VMW_COMPAT_COMMITED:
drm_ht_remove_item(entry-hash);
@@ -804,7 +802,7 @@ void vmw_compat_shader_man_destroy(struct 
vmw_compat_shader_manager *man)
 
mutex_lock(man-dev_priv-cmdbuf_mutex);
list_for_each_entry_safe(entry, next, man-list, head)
-   vmw_compat_shader_free(man, entry);
+   vmw_compat_shader_free(entry);
 
drm_ht_remove(man-shaders);
 
-- 
1.9.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 v3] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-25 Thread Masaru Nomura
> What _branch_ of that git tree did you make it against?
>

I did my work against

commit 4b660a7f5c8099d88d1a43d8ae138965112592c7

Thank you,
Masaru
--
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 v3] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-25 Thread Masaru Nomura
Remove prohibited space between function name and
open parenthesis to meet kernel coding style.
Also fix indenting due to changes to keep readability.

-since v2:
None. This is the resend of v2 as v2 failed to apply

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  242 ++--
 1 file changed, 120 insertions(+), 122 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..39b607f 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (>ksnr_refcount, 1);
+   atomic_set(>ksnr_refcount, 1);
route->ksnr_peer = NULL;
route->ksnr_retry_interval = 0;  /* OK to connect at any time */
route->ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(>ksnr_refcount) == 0);
+   LASSERT(atomic_read(>ksnr_refcount) == 0);
 
if (route->ksnr_peer != NULL)
ksocknal_peer_decref(route->ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni->ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer->ksnp_ni = ni;
peer->ksnp_id = id;
-   atomic_set (>ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(>ksnp_refcount, 1);   /* 1 ref for caller */
peer->ksnp_closing = 0;
peer->ksnp_accepting = 0;
peer->ksnp_proto = NULL;
peer->ksnp_last_alive = 0;
peer->ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (>ksnp_conns);
-   INIT_LIST_HEAD (>ksnp_routes);
-   INIT_LIST_HEAD (>ksnp_tx_queue);
-   INIT_LIST_HEAD (>ksnp_zc_req_list);
+   INIT_LIST_HEAD(>ksnp_conns);
+   INIT_LIST_HEAD(>ksnp_routes);
+   INIT_LIST_HEAD(>ksnp_tx_queue);
+   INIT_LIST_HEAD(>ksnp_zc_req_list);
spin_lock_init(>ksnp_lock);
 
spin_lock_bh(>ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer->ksnp_ni->ni_data;
 
-   CDEBUG (D_NET, "peer %s %p deleted\n",
-   libcfs_id2str(peer->ksnp_id), peer);
+   CDEBUG(D_NET, "peer %s %p deleted\n",
+  libcfs_id2str(peer->ksnp_id), peer);
 
-   LASSERT (atomic_read (>ksnp_refcount) == 0);
-   LASSERT (peer->ksnp_accepting == 0);
-   LASSERT (list_empty (>ksnp_conns));
-   LASSERT (list_empty (>ksnp_routes));
-   LASSERT (list_empty (>ksnp_tx_queue));
-   LASSERT (list_empty (>ksnp_zc_req_list));
+   LASSERT(atomic_read(>ksnp_refcount) == 0);
+   LASSERT(peer->ksnp_accepting == 0);
+   LASSERT(list_empty(>ksnp_conns));
+   LASSERT(list_empty(>ksnp_routes));
+   LASSERT(list_empty(>ksnp_tx_queue));
+   LASSERT(list_empty(>ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)
 {
struct list_head   *peer_list = ksocknal_nid2peerlist(id.nid);
struct list_head   *tmp;
ksock_peer_t 

[PATCH v3] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-25 Thread Masaru Nomura
Remove prohibited space between function name and
open parenthesis to meet kernel coding style.
Also fix indenting due to changes to keep readability.

-since v2:
None. This is the resend of v2 as v2 failed to apply

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  242 ++--
 1 file changed, 120 insertions(+), 122 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..39b607f 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (route-ksnr_refcount, 1);
+   atomic_set(route-ksnr_refcount, 1);
route-ksnr_peer = NULL;
route-ksnr_retry_interval = 0;  /* OK to connect at any time */
route-ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(route-ksnr_refcount) == 0);
+   LASSERT(atomic_read(route-ksnr_refcount) == 0);
 
if (route-ksnr_peer != NULL)
ksocknal_peer_decref(route-ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni-ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer-ksnp_ni = ni;
peer-ksnp_id = id;
-   atomic_set (peer-ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(peer-ksnp_refcount, 1);   /* 1 ref for caller */
peer-ksnp_closing = 0;
peer-ksnp_accepting = 0;
peer-ksnp_proto = NULL;
peer-ksnp_last_alive = 0;
peer-ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (peer-ksnp_conns);
-   INIT_LIST_HEAD (peer-ksnp_routes);
-   INIT_LIST_HEAD (peer-ksnp_tx_queue);
-   INIT_LIST_HEAD (peer-ksnp_zc_req_list);
+   INIT_LIST_HEAD(peer-ksnp_conns);
+   INIT_LIST_HEAD(peer-ksnp_routes);
+   INIT_LIST_HEAD(peer-ksnp_tx_queue);
+   INIT_LIST_HEAD(peer-ksnp_zc_req_list);
spin_lock_init(peer-ksnp_lock);
 
spin_lock_bh(net-ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer-ksnp_ni-ni_data;
 
-   CDEBUG (D_NET, peer %s %p deleted\n,
-   libcfs_id2str(peer-ksnp_id), peer);
+   CDEBUG(D_NET, peer %s %p deleted\n,
+  libcfs_id2str(peer-ksnp_id), peer);
 
-   LASSERT (atomic_read (peer-ksnp_refcount) == 0);
-   LASSERT (peer-ksnp_accepting == 0);
-   LASSERT (list_empty (peer-ksnp_conns));
-   LASSERT (list_empty (peer-ksnp_routes));
-   LASSERT (list_empty (peer-ksnp_tx_queue));
-   LASSERT (list_empty (peer-ksnp_zc_req_list));
+   LASSERT(atomic_read(peer-ksnp_refcount) == 0);
+   LASSERT(peer-ksnp_accepting == 0);
+   LASSERT(list_empty(peer-ksnp_conns));
+   LASSERT(list_empty(peer-ksnp_routes));
+   LASSERT(list_empty(peer-ksnp_tx_queue));
+   LASSERT(list_empty(peer-ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)
 {
struct list_head   *peer_list = ksocknal_nid2peerlist(id.nid);
struct list_head   *tmp;
ksock_peer_t *peer;
 
-   list_for_each (tmp, peer_list

Re: [PATCH v3] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-25 Thread Masaru Nomura
 What _branch_ of that git tree did you make it against?


I did my work against

commit 4b660a7f5c8099d88d1a43d8ae138965112592c7

Thank you,
Masaru
--
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: lustre: lnet: klnds: Remove prohibited space in socklnd.c

2014-05-21 Thread Masaru Nomura
Remove prohibited space between function name and open parenthesis
to meet kernel coding style. Also, fix indenting due to changes.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  230 ++--
 1 file changed, 116 insertions(+), 114 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..6354491 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1351,8 +1351,8 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
 
  failed_2:
if (!peer->ksnp_closing &&
-   list_empty (>ksnp_conns) &&
-   list_empty (>ksnp_routes)) {
+   list_empty(>ksnp_conns) &&
+   list_empty(>ksnp_routes)) {
list_add(, >ksnp_tx_queue);
list_del_init(>ksnp_tx_queue);
ksocknal_unlink_peer_locked(peer);
@@ -1391,7 +1391,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
kshm_ips[LNET_MAX_INTERFACES]));
 
-   LIBCFS_FREE (conn, sizeof(*conn));
+   LIBCFS_FREE(conn, sizeof(*conn));
 
  failed_0:
libcfs_sock_release(sock);
@@ -1399,7 +1399,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
 }
 
 void
-ksocknal_close_conn_locked (ksock_conn_t *conn, int error)
+ksocknal_close_conn_locked(ksock_conn_t *conn, int error)
 {
/* This just does the immmediate housekeeping, and queues the
 * connection for the reaper to terminate.
@@ -1409,18 +1409,18 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
ksock_conn_t  *conn2;
struct list_head*tmp;
 
-   LASSERT (peer->ksnp_error == 0);
-   LASSERT (!conn->ksnc_closing);
+   LASSERT(peer->ksnp_error == 0);
+   LASSERT(!conn->ksnc_closing);
conn->ksnc_closing = 1;
 
/* ksnd_deathrow_conns takes over peer's ref */
-   list_del (>ksnc_list);
+   list_del(>ksnc_list);
 
route = conn->ksnc_route;
if (route != NULL) {
/* dissociate conn from route... */
-   LASSERT (!route->ksnr_deleted);
-   LASSERT ((route->ksnr_connected & (1 << conn->ksnc_type)) != 0);
+   LASSERT(!route->ksnr_deleted);
+   LASSERT((route->ksnr_connected & (1 << conn->ksnc_type)) != 0);
 
conn2 = NULL;
list_for_each(tmp, >ksnp_conns) {
@@ -1439,19 +1439,19 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
 
 #if 0 /* irrelevant with only eager routes */
/* make route least favourite */
-   list_del (>ksnr_list);
-   list_add_tail (>ksnr_list, >ksnp_routes);
+   list_del(>ksnr_list);
+   list_add_tail(>ksnr_list, >ksnp_routes);
 #endif
ksocknal_route_decref(route); /* drop conn's ref on route */
}
 
-   if (list_empty (>ksnp_conns)) {
+   if (list_empty(>ksnp_conns)) {
/* No more connections to this peer */
 
if (!list_empty(>ksnp_tx_queue)) {
ksock_tx_t *tx;
 
-   LASSERT (conn->ksnc_proto == _protocol_v3x);
+   LASSERT(conn->ksnc_proto == _protocol_v3x);
 
/* throw them to the last connection...,
 * these TXs will be send to /dev/null by scheduler */
@@ -1468,10 +1468,10 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
peer->ksnp_proto = NULL;/* renegotiate protocol version 
*/
peer->ksnp_error = error;   /* stash last conn close reason 
*/
 
-   if (list_empty (>ksnp_routes)) {
+   if (list_empty(>ksnp_routes)) {
/* I've just closed last conn belonging to a
 * peer with no routes to it */
-   ksocknal_unlink_peer_locked (peer);
+   ksocknal_unlink_peer_locked(peer);
}
}
 
@@ -1485,7 +1485,7 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error)
 }
 
 void
-ksocknal_peer_failed (ksock_peer_t *peer)
+ksocknal_peer_failed(ksock_peer_t *peer)
 {
int notify = 0;
cfs_time_t last_alive = 0;
@@ -1507,8 +1507,8 @@ ksocknal_peer_failed (ksock_peer_t *peer)
read_unlock(_data.ksnd_global_lock);
 
if (notify)
-   lnet_notify (peer->ksnp_ni, peer->ksnp_id.nid, 0,
-last_alive);
+   lnet_notify(peer->ksnp_ni, peer->ksnp_id.nid, 0,
+   last_alive);
 }
 
 void
@

[PATCH] staging: lustre: lnet: klnds: Remove prohibited space in socklnd.c

2014-05-21 Thread Masaru Nomura
Remove prohibited space between function name and open parenthesis
to meet kernel coding style. Also, fix indenting due to changes.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  230 ++--
 1 file changed, 116 insertions(+), 114 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..6354491 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1351,8 +1351,8 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
 
  failed_2:
if (!peer-ksnp_closing 
-   list_empty (peer-ksnp_conns) 
-   list_empty (peer-ksnp_routes)) {
+   list_empty(peer-ksnp_conns) 
+   list_empty(peer-ksnp_routes)) {
list_add(zombies, peer-ksnp_tx_queue);
list_del_init(peer-ksnp_tx_queue);
ksocknal_unlink_peer_locked(peer);
@@ -1391,7 +1391,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
LIBCFS_FREE(hello, offsetof(ksock_hello_msg_t,
kshm_ips[LNET_MAX_INTERFACES]));
 
-   LIBCFS_FREE (conn, sizeof(*conn));
+   LIBCFS_FREE(conn, sizeof(*conn));
 
  failed_0:
libcfs_sock_release(sock);
@@ -1399,7 +1399,7 @@ ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
 }
 
 void
-ksocknal_close_conn_locked (ksock_conn_t *conn, int error)
+ksocknal_close_conn_locked(ksock_conn_t *conn, int error)
 {
/* This just does the immmediate housekeeping, and queues the
 * connection for the reaper to terminate.
@@ -1409,18 +1409,18 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
ksock_conn_t  *conn2;
struct list_head*tmp;
 
-   LASSERT (peer-ksnp_error == 0);
-   LASSERT (!conn-ksnc_closing);
+   LASSERT(peer-ksnp_error == 0);
+   LASSERT(!conn-ksnc_closing);
conn-ksnc_closing = 1;
 
/* ksnd_deathrow_conns takes over peer's ref */
-   list_del (conn-ksnc_list);
+   list_del(conn-ksnc_list);
 
route = conn-ksnc_route;
if (route != NULL) {
/* dissociate conn from route... */
-   LASSERT (!route-ksnr_deleted);
-   LASSERT ((route-ksnr_connected  (1  conn-ksnc_type)) != 0);
+   LASSERT(!route-ksnr_deleted);
+   LASSERT((route-ksnr_connected  (1  conn-ksnc_type)) != 0);
 
conn2 = NULL;
list_for_each(tmp, peer-ksnp_conns) {
@@ -1439,19 +1439,19 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
 
 #if 0 /* irrelevant with only eager routes */
/* make route least favourite */
-   list_del (route-ksnr_list);
-   list_add_tail (route-ksnr_list, peer-ksnp_routes);
+   list_del(route-ksnr_list);
+   list_add_tail(route-ksnr_list, peer-ksnp_routes);
 #endif
ksocknal_route_decref(route); /* drop conn's ref on route */
}
 
-   if (list_empty (peer-ksnp_conns)) {
+   if (list_empty(peer-ksnp_conns)) {
/* No more connections to this peer */
 
if (!list_empty(peer-ksnp_tx_queue)) {
ksock_tx_t *tx;
 
-   LASSERT (conn-ksnc_proto == ksocknal_protocol_v3x);
+   LASSERT(conn-ksnc_proto == ksocknal_protocol_v3x);
 
/* throw them to the last connection...,
 * these TXs will be send to /dev/null by scheduler */
@@ -1468,10 +1468,10 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int 
error)
peer-ksnp_proto = NULL;/* renegotiate protocol version 
*/
peer-ksnp_error = error;   /* stash last conn close reason 
*/
 
-   if (list_empty (peer-ksnp_routes)) {
+   if (list_empty(peer-ksnp_routes)) {
/* I've just closed last conn belonging to a
 * peer with no routes to it */
-   ksocknal_unlink_peer_locked (peer);
+   ksocknal_unlink_peer_locked(peer);
}
}
 
@@ -1485,7 +1485,7 @@ ksocknal_close_conn_locked (ksock_conn_t *conn, int error)
 }
 
 void
-ksocknal_peer_failed (ksock_peer_t *peer)
+ksocknal_peer_failed(ksock_peer_t *peer)
 {
int notify = 0;
cfs_time_t last_alive = 0;
@@ -1507,8 +1507,8 @@ ksocknal_peer_failed (ksock_peer_t *peer)
read_unlock(ksocknal_data.ksnd_global_lock);
 
if (notify)
-   lnet_notify (peer-ksnp_ni, peer-ksnp_id.nid, 0,
-last_alive);
+   lnet_notify(peer-ksnp_ni, peer-ksnp_id.nid, 0,
+   last_alive);
 }
 
 void
@@ -1521,7 +1521,7 @@ ksocknal_finalize_zcreq(ksock_conn_t *conn

[PATCH v2] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-19 Thread Masaru Nomura
Remove prohibited space between function name and
open parenthesis to meet kernel coding style.
Also fix indenting due to changes to keep readability.

I undid modifications to memset(...) which I made in
previous patches as it could be removed based on
the fact LIBCFS_ALLOC is executed before memset.
With this, others can notice warnings against memset
caused by checkpatch.pl and modify it easily.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  238 ++--
 1 file changed, 119 insertions(+), 119 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..415bb81 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (>ksnr_refcount, 1);
+   atomic_set(>ksnr_refcount, 1);
route->ksnr_peer = NULL;
route->ksnr_retry_interval = 0;  /* OK to connect at any time */
route->ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(>ksnr_refcount) == 0);
+   LASSERT(atomic_read(>ksnr_refcount) == 0);
 
if (route->ksnr_peer != NULL)
ksocknal_peer_decref(route->ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni->ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer->ksnp_ni = ni;
peer->ksnp_id = id;
-   atomic_set (>ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(>ksnp_refcount, 1);   /* 1 ref for caller */
peer->ksnp_closing = 0;
peer->ksnp_accepting = 0;
peer->ksnp_proto = NULL;
peer->ksnp_last_alive = 0;
peer->ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (>ksnp_conns);
-   INIT_LIST_HEAD (>ksnp_routes);
-   INIT_LIST_HEAD (>ksnp_tx_queue);
-   INIT_LIST_HEAD (>ksnp_zc_req_list);
+   INIT_LIST_HEAD(>ksnp_conns);
+   INIT_LIST_HEAD(>ksnp_routes);
+   INIT_LIST_HEAD(>ksnp_tx_queue);
+   INIT_LIST_HEAD(>ksnp_zc_req_list);
spin_lock_init(>ksnp_lock);
 
spin_lock_bh(>ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer->ksnp_ni->ni_data;
 
-   CDEBUG (D_NET, "peer %s %p deleted\n",
-   libcfs_id2str(peer->ksnp_id), peer);
+   CDEBUG(D_NET, "peer %s %p deleted\n",
+  libcfs_id2str(peer->ksnp_id), peer);
 
-   LASSERT (atomic_read (>ksnp_refcount) == 0);
-   LASSERT (peer->ksnp_accepting == 0);
-   LASSERT (list_empty (>ksnp_conns));
-   LASSERT (list_empty (>ksnp_routes));
-   LASSERT (list_empty (>ksnp_tx_queue));
-   LASSERT (list_empty (>ksnp_zc_req_list));
+   LASSERT(atomic_read(>ksnp_refcount) == 0);
+   LASSERT(peer->ksnp_accepting == 0);
+   LASSERT(list_empty(>ksnp_conns));
+   LASSERT(list_empty(>ksnp_routes));
+   LASSERT(list_empty(>ksnp_tx_queue));
+   LASSERT(list_empty(>ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_f

[PATCH v2] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-19 Thread Masaru Nomura
Remove prohibited space between function name and
open parenthesis to meet kernel coding style.
Also fix indenting due to changes to keep readability.

I undid modifications to memset(...) which I made in
previous patches as it could be removed based on
the fact LIBCFS_ALLOC is executed before memset.
With this, others can notice warnings against memset
caused by checkpatch.pl and modify it easily.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  238 ++--
 1 file changed, 119 insertions(+), 119 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..415bb81 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (route-ksnr_refcount, 1);
+   atomic_set(route-ksnr_refcount, 1);
route-ksnr_peer = NULL;
route-ksnr_retry_interval = 0;  /* OK to connect at any time */
route-ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(route-ksnr_refcount) == 0);
+   LASSERT(atomic_read(route-ksnr_refcount) == 0);
 
if (route-ksnr_peer != NULL)
ksocknal_peer_decref(route-ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni-ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer-ksnp_ni = ni;
peer-ksnp_id = id;
-   atomic_set (peer-ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(peer-ksnp_refcount, 1);   /* 1 ref for caller */
peer-ksnp_closing = 0;
peer-ksnp_accepting = 0;
peer-ksnp_proto = NULL;
peer-ksnp_last_alive = 0;
peer-ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (peer-ksnp_conns);
-   INIT_LIST_HEAD (peer-ksnp_routes);
-   INIT_LIST_HEAD (peer-ksnp_tx_queue);
-   INIT_LIST_HEAD (peer-ksnp_zc_req_list);
+   INIT_LIST_HEAD(peer-ksnp_conns);
+   INIT_LIST_HEAD(peer-ksnp_routes);
+   INIT_LIST_HEAD(peer-ksnp_tx_queue);
+   INIT_LIST_HEAD(peer-ksnp_zc_req_list);
spin_lock_init(peer-ksnp_lock);
 
spin_lock_bh(net-ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer-ksnp_ni-ni_data;
 
-   CDEBUG (D_NET, peer %s %p deleted\n,
-   libcfs_id2str(peer-ksnp_id), peer);
+   CDEBUG(D_NET, peer %s %p deleted\n,
+  libcfs_id2str(peer-ksnp_id), peer);
 
-   LASSERT (atomic_read (peer-ksnp_refcount) == 0);
-   LASSERT (peer-ksnp_accepting == 0);
-   LASSERT (list_empty (peer-ksnp_conns));
-   LASSERT (list_empty (peer-ksnp_routes));
-   LASSERT (list_empty (peer-ksnp_tx_queue));
-   LASSERT (list_empty (peer-ksnp_zc_req_list));
+   LASSERT(atomic_read(peer-ksnp_refcount) == 0);
+   LASSERT(peer-ksnp_accepting == 0);
+   LASSERT(list_empty(peer-ksnp_conns));
+   LASSERT(list_empty(peer-ksnp_routes));
+   LASSERT(list_empty(peer-ksnp_tx_queue));
+   LASSERT(list_empty(peer-ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id

Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
>> - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
>> etc */
>> + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
>
> It looks like this memset is unnecessary
> as it's already zeroed by LIBCFS_ALLOC->
> LIBCFS_ALLOC_GFP->LIBCFS_ALLOC_POST->memset.
>
> It seems as if all these ALLOC macros could
> use quite a bit of cleaning/sorting out.

Thank you for pointing it out. I didn't know that nor check the macros.
I'll care about similar problems next time.

I checked the macros and kind of understand what you mean,
but honestly I'm not sure whether or not it's perfectly correct to
remove memset.

If this is the right way, I think we can remove the following memset
which I modified as well.
The reason is the same as you mentioned. conn is zeroed by
LIBCFS_ALLOC before memset.

[PATCH 1/5]
@@ -1041,26 +1041,26 @@ ksocknal_create_conn (lnet_ni_t *ni,
ksock_route_t *route,
goto failed_0;
}

-   memset (conn, 0, sizeof (*conn));
+   memset(conn, 0, sizeof(*conn));


Thank you,
Masaru
--
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/5] staging: lustre: lnet: socklnd: Remove prohibited space

2014-05-18 Thread Masaru Nomura
Remove prohibited space between open parenthesis and
function name to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  226 ++--
 1 file changed, 113 insertions(+), 113 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..66af02e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (>ksnr_refcount, 1);
+   atomic_set(>ksnr_refcount, 1);
route->ksnr_peer = NULL;
route->ksnr_retry_interval = 0;  /* OK to connect at any time */
route->ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(>ksnr_refcount) == 0);
+   LASSERT(atomic_read(>ksnr_refcount) == 0);
 
if (route->ksnr_peer != NULL)
ksocknal_peer_decref(route->ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni->ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer->ksnp_ni = ni;
peer->ksnp_id = id;
-   atomic_set (>ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(>ksnp_refcount, 1);   /* 1 ref for caller */
peer->ksnp_closing = 0;
peer->ksnp_accepting = 0;
peer->ksnp_proto = NULL;
peer->ksnp_last_alive = 0;
peer->ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (>ksnp_conns);
-   INIT_LIST_HEAD (>ksnp_routes);
-   INIT_LIST_HEAD (>ksnp_tx_queue);
-   INIT_LIST_HEAD (>ksnp_zc_req_list);
+   INIT_LIST_HEAD(>ksnp_conns);
+   INIT_LIST_HEAD(>ksnp_routes);
+   INIT_LIST_HEAD(>ksnp_tx_queue);
+   INIT_LIST_HEAD(>ksnp_zc_req_list);
spin_lock_init(>ksnp_lock);
 
spin_lock_bh(>ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer->ksnp_ni->ni_data;
 
CDEBUG (D_NET, "peer %s %p deleted\n",
libcfs_id2str(peer->ksnp_id), peer);
 
-   LASSERT (atomic_read (>ksnp_refcount) == 0);
-   LASSERT (peer->ksnp_accepting == 0);
-   LASSERT (list_empty (>ksnp_conns));
-   LASSERT (list_empty (>ksnp_routes));
-   LASSERT (list_empty (>ksnp_tx_queue));
-   LASSERT (list_empty (>ksnp_zc_req_list));
+   LASSERT(atomic_read(>ksnp_refcount) == 0);
+   LASSERT(peer->ksnp_accepting == 0);
+   LASSERT(list_empty(>ksnp_conns));
+   LASSERT(list_empty(>ksnp_routes));
+   LASSERT(list_empty(>ksnp_tx_queue));
+   LASSERT(list_empty(>ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)
 {
struct list_head   *peer_list = ksocknal_nid2peerlist(id.nid);
struct list_head   *tmp;
ksock_peer_t *peer;
 
-   list_for_each (tmp, peer_list) {
+   list_for_each(tmp, peer_list) {
 
-   peer = list_entry (tmp, ksock_peer_t, ksnp_list);
+   peer = list_entry(tmp, ksock_peer_t, ksnp_l

[PATCH 5/5] staging: lustre: lnet: socklnd: Clean up ksocknal_create_conn(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameters
of ksocknal_create_conn(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index fd4cdc3..c63d69a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1010,8 +1010,8 @@ ksocknal_connecting(ksock_peer_t *peer, __u32 ipaddr)
 }
 
 int
-ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
- socket_t *sock, int type)
+ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
+socket_t *sock, int type)
 {
rwlock_t*global_lock = _data.ksnd_global_lock;
LIST_HEAD (zombies);
-- 
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/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix line over 80 characters of
memset(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 66af02e..2d6414a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, 
lnet_process_id_t id)
if (peer == NULL)
return -ENOMEM;
 
-   memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
etc */
+   memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
 
peer->ksnp_ni = ni;
peer->ksnp_id = id;
-- 
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 0/5] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-18 Thread Masaru Nomura
These patches fix warnings below in socklnd.c to meet coding style.
Also fix some indenting due to changes to keep readability.

WARNING: space prohibited between function name and open parenthesis '('
WARNING: line over 80 characters

Masaru Nomura (5):
  staging: lustre: lnet: socklnd: Remove prohibited space
  staging: lustre: lnet: socklnd: Clean up memset(...)
  staging: lustre: lnet: socklnd: Clean up CDEBUG(...)
  staging: lustre: lnet: socklnd: Clean up ksocknal_get_peer_info(...)
  staging: lustre: lnet: socklnd: Clean up ksocknal_create_conn(...)

 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  242 ++--
 1 file changed, 121 insertions(+), 121 deletions(-)

-- 
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/5] staging: lustre: lnet: socklnd: Clean up CDEBUG(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameters
of CDEBUG(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 2d6414a..26cb8ce 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -153,8 +153,8 @@ ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer->ksnp_ni->ni_data;
 
-   CDEBUG (D_NET, "peer %s %p deleted\n",
-   libcfs_id2str(peer->ksnp_id), peer);
+   CDEBUG(D_NET, "peer %s %p deleted\n",
+  libcfs_id2str(peer->ksnp_id), peer);
 
LASSERT(atomic_read(>ksnp_refcount) == 0);
LASSERT(peer->ksnp_accepting == 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 4/5] staging: lustre: lnet: socklnd: Clean up ksocknal_get_peer_info(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameter
of ksocknal_get_peer_info(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 26cb8ce..fd4cdc3 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -247,9 +247,9 @@ ksocknal_unlink_peer_locked(ksock_peer_t *peer)
 }
 
 int
-ksocknal_get_peer_info (lnet_ni_t *ni, int index,
-   lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip,
-   int *port, int *conn_count, int *share_count)
+ksocknal_get_peer_info(lnet_ni_t *ni, int index,
+  lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip,
+  int *port, int *conn_count, int *share_count)
 {
ksock_peer_t  *peer;
struct list_head*ptmp;
-- 
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/5] staging: lustre: lnet: socklnd: Clean up CDEBUG(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameters
of CDEBUG(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 2d6414a..26cb8ce 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -153,8 +153,8 @@ ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer-ksnp_ni-ni_data;
 
-   CDEBUG (D_NET, peer %s %p deleted\n,
-   libcfs_id2str(peer-ksnp_id), peer);
+   CDEBUG(D_NET, peer %s %p deleted\n,
+  libcfs_id2str(peer-ksnp_id), peer);
 
LASSERT(atomic_read(peer-ksnp_refcount) == 0);
LASSERT(peer-ksnp_accepting == 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 4/5] staging: lustre: lnet: socklnd: Clean up ksocknal_get_peer_info(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameter
of ksocknal_get_peer_info(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 26cb8ce..fd4cdc3 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -247,9 +247,9 @@ ksocknal_unlink_peer_locked(ksock_peer_t *peer)
 }
 
 int
-ksocknal_get_peer_info (lnet_ni_t *ni, int index,
-   lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip,
-   int *port, int *conn_count, int *share_count)
+ksocknal_get_peer_info(lnet_ni_t *ni, int index,
+  lnet_process_id_t *id, __u32 *myip, __u32 *peer_ip,
+  int *port, int *conn_count, int *share_count)
 {
ksock_peer_t  *peer;
struct list_head*ptmp;
-- 
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 5/5] staging: lustre: lnet: socklnd: Clean up ksocknal_create_conn(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix indenting of following parameters
of ksocknal_create_conn(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index fd4cdc3..c63d69a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1010,8 +1010,8 @@ ksocknal_connecting(ksock_peer_t *peer, __u32 ipaddr)
 }
 
 int
-ksocknal_create_conn (lnet_ni_t *ni, ksock_route_t *route,
- socket_t *sock, int type)
+ksocknal_create_conn(lnet_ni_t *ni, ksock_route_t *route,
+socket_t *sock, int type)
 {
rwlock_t*global_lock = ksocknal_data.ksnd_global_lock;
LIST_HEAD (zombies);
-- 
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/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
Remove prohibited space and fix line over 80 characters of
memset(...) to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 66af02e..2d6414a 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -113,7 +113,7 @@ ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, 
lnet_process_id_t id)
if (peer == NULL)
return -ENOMEM;
 
-   memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
etc */
+   memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */
 
peer-ksnp_ni = ni;
peer-ksnp_id = id;
-- 
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 0/5] staging: lustre: lnet: klnds: Fix coding style in socklnd.c

2014-05-18 Thread Masaru Nomura
These patches fix warnings below in socklnd.c to meet coding style.
Also fix some indenting due to changes to keep readability.

WARNING: space prohibited between function name and open parenthesis '('
WARNING: line over 80 characters

Masaru Nomura (5):
  staging: lustre: lnet: socklnd: Remove prohibited space
  staging: lustre: lnet: socklnd: Clean up memset(...)
  staging: lustre: lnet: socklnd: Clean up CDEBUG(...)
  staging: lustre: lnet: socklnd: Clean up ksocknal_get_peer_info(...)
  staging: lustre: lnet: socklnd: Clean up ksocknal_create_conn(...)

 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  242 ++--
 1 file changed, 121 insertions(+), 121 deletions(-)

-- 
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/5] staging: lustre: lnet: socklnd: Remove prohibited space

2014-05-18 Thread Masaru Nomura
Remove prohibited space between open parenthesis and
function name to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|  226 ++--
 1 file changed, 113 insertions(+), 113 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..66af02e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -65,15 +65,15 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
 }
 
 ksock_route_t *
-ksocknal_create_route (__u32 ipaddr, int port)
+ksocknal_create_route(__u32 ipaddr, int port)
 {
ksock_route_t *route;
 
-   LIBCFS_ALLOC (route, sizeof (*route));
+   LIBCFS_ALLOC(route, sizeof(*route));
if (route == NULL)
return (NULL);
 
-   atomic_set (route-ksnr_refcount, 1);
+   atomic_set(route-ksnr_refcount, 1);
route-ksnr_peer = NULL;
route-ksnr_retry_interval = 0;  /* OK to connect at any time */
route-ksnr_ipaddr = ipaddr;
@@ -89,27 +89,27 @@ ksocknal_create_route (__u32 ipaddr, int port)
 }
 
 void
-ksocknal_destroy_route (ksock_route_t *route)
+ksocknal_destroy_route(ksock_route_t *route)
 {
-   LASSERT (atomic_read(route-ksnr_refcount) == 0);
+   LASSERT(atomic_read(route-ksnr_refcount) == 0);
 
if (route-ksnr_peer != NULL)
ksocknal_peer_decref(route-ksnr_peer);
 
-   LIBCFS_FREE (route, sizeof (*route));
+   LIBCFS_FREE(route, sizeof(*route));
 }
 
 int
-ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t 
id)
+ksocknal_create_peer(ksock_peer_t **peerp, lnet_ni_t *ni, lnet_process_id_t id)
 {
ksock_net_t   *net = ni-ni_data;
ksock_peer_t  *peer;
 
-   LASSERT (id.nid != LNET_NID_ANY);
-   LASSERT (id.pid != LNET_PID_ANY);
-   LASSERT (!in_interrupt());
+   LASSERT(id.nid != LNET_NID_ANY);
+   LASSERT(id.pid != LNET_PID_ANY);
+   LASSERT(!in_interrupt());
 
-   LIBCFS_ALLOC (peer, sizeof (*peer));
+   LIBCFS_ALLOC(peer, sizeof(*peer));
if (peer == NULL)
return -ENOMEM;
 
@@ -117,17 +117,17 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 
peer-ksnp_ni = ni;
peer-ksnp_id = id;
-   atomic_set (peer-ksnp_refcount, 1);   /* 1 ref for caller */
+   atomic_set(peer-ksnp_refcount, 1);   /* 1 ref for caller */
peer-ksnp_closing = 0;
peer-ksnp_accepting = 0;
peer-ksnp_proto = NULL;
peer-ksnp_last_alive = 0;
peer-ksnp_zc_next_cookie = SOCKNAL_KEEPALIVE_PING + 1;
 
-   INIT_LIST_HEAD (peer-ksnp_conns);
-   INIT_LIST_HEAD (peer-ksnp_routes);
-   INIT_LIST_HEAD (peer-ksnp_tx_queue);
-   INIT_LIST_HEAD (peer-ksnp_zc_req_list);
+   INIT_LIST_HEAD(peer-ksnp_conns);
+   INIT_LIST_HEAD(peer-ksnp_routes);
+   INIT_LIST_HEAD(peer-ksnp_tx_queue);
+   INIT_LIST_HEAD(peer-ksnp_zc_req_list);
spin_lock_init(peer-ksnp_lock);
 
spin_lock_bh(net-ksnn_lock);
@@ -149,21 +149,21 @@ ksocknal_create_peer (ksock_peer_t **peerp, lnet_ni_t 
*ni, lnet_process_id_t id)
 }
 
 void
-ksocknal_destroy_peer (ksock_peer_t *peer)
+ksocknal_destroy_peer(ksock_peer_t *peer)
 {
ksock_net_t*net = peer-ksnp_ni-ni_data;
 
CDEBUG (D_NET, peer %s %p deleted\n,
libcfs_id2str(peer-ksnp_id), peer);
 
-   LASSERT (atomic_read (peer-ksnp_refcount) == 0);
-   LASSERT (peer-ksnp_accepting == 0);
-   LASSERT (list_empty (peer-ksnp_conns));
-   LASSERT (list_empty (peer-ksnp_routes));
-   LASSERT (list_empty (peer-ksnp_tx_queue));
-   LASSERT (list_empty (peer-ksnp_zc_req_list));
+   LASSERT(atomic_read(peer-ksnp_refcount) == 0);
+   LASSERT(peer-ksnp_accepting == 0);
+   LASSERT(list_empty(peer-ksnp_conns));
+   LASSERT(list_empty(peer-ksnp_routes));
+   LASSERT(list_empty(peer-ksnp_tx_queue));
+   LASSERT(list_empty(peer-ksnp_zc_req_list));
 
-   LIBCFS_FREE (peer, sizeof (*peer));
+   LIBCFS_FREE(peer, sizeof(*peer));
 
/* NB a peer's connections and routes keep a reference on their peer
 * until they are destroyed, so we can be assured that _all_ state to
@@ -175,17 +175,17 @@ ksocknal_destroy_peer (ksock_peer_t *peer)
 }
 
 ksock_peer_t *
-ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t id)
+ksocknal_find_peer_locked(lnet_ni_t *ni, lnet_process_id_t id)
 {
struct list_head   *peer_list = ksocknal_nid2peerlist(id.nid);
struct list_head   *tmp;
ksock_peer_t *peer;
 
-   list_for_each (tmp, peer_list) {
+   list_for_each(tmp, peer_list) {
 
-   peer = list_entry (tmp, ksock_peer_t, ksnp_list);
+   peer = list_entry(tmp, ksock_peer_t, ksnp_list);
 
-   LASSERT (!peer

Re: [PATCH 2/5] staging: lustre: lnet: socklnd: Clean up memset(...)

2014-05-18 Thread Masaru Nomura
 - memset (peer, 0, sizeof (*peer));   /* NULL pointers/clear flags 
 etc */
 + memset(peer, 0, sizeof(*peer)); /* NULL pointers/clear flags etc */

 It looks like this memset is unnecessary
 as it's already zeroed by LIBCFS_ALLOC-
 LIBCFS_ALLOC_GFP-LIBCFS_ALLOC_POST-memset.

 It seems as if all these ALLOC macros could
 use quite a bit of cleaning/sorting out.

Thank you for pointing it out. I didn't know that nor check the macros.
I'll care about similar problems next time.

I checked the macros and kind of understand what you mean,
but honestly I'm not sure whether or not it's perfectly correct to
remove memset.

If this is the right way, I think we can remove the following memset
which I modified as well.
The reason is the same as you mentioned. conn is zeroed by
LIBCFS_ALLOC before memset.

[PATCH 1/5]
@@ -1041,26 +1041,26 @@ ksocknal_create_conn (lnet_ni_t *ni,
ksock_route_t *route,
goto failed_0;
}

-   memset (conn, 0, sizeof (*conn));
+   memset(conn, 0, sizeof(*conn));


Thank you,
Masaru
--
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 v2 1/3] staging: dgnc: Put else statements on the right line

2014-05-17 Thread Masaru Nomura
Fix indenting of if-else statement in dgnc_neo.c and dgnc_tty.c
so that following else-if or else statement meets coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |   48 +--
 drivers/staging/dgnc/dgnc_tty.c |   36 ++---
 2 files changed, 28 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index cf22c7b..e87cf49 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -485,8 +485,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
}
DPR_INTR(("Port %d. XON detected in incoming 
data\n", port));
-   }
-   else if (cause == UART_17158_XOFF_DETECT) {
+   } else if (cause == UART_17158_XOFF_DETECT) {
if (!(brd->channels[port]->ch_flags & CH_STOP)) 
{
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_flags |= CH_STOP;
@@ -511,8 +510,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat |= UART_MCR_RTS;
DGNC_UNLOCK(ch->ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat &= ~(UART_MCR_RTS);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -522,8 +520,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat |= UART_MCR_DTR;
DGNC_UNLOCK(ch->ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat &= ~(UART_MCR_DTR);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -624,8 +621,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, 
uint port)
 
/* Transfer data (if any) from Write Queue -> UART. */
neo_copy_data_from_queue_to_uart(ch);
-   }
-   else if (linestatus & UART_17158_TX_AND_FIFO_CLR) {
+   } else if (linestatus & UART_17158_TX_AND_FIFO_CLR) {
brd->intr_tx++;
ch->ch_intr_tx++;
DGNC_LOCK(ch->ch_lock, lock_flags);
@@ -834,8 +830,7 @@ static void neo_param(struct tty_struct *tty)
 
if (ch->ch_c_cflag & CREAD) {
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   }
-   else {
+   } else {
ier &= ~(UART_IER_RDI | UART_IER_RLSI);
}
 
@@ -848,8 +843,7 @@ static void neo_param(struct tty_struct *tty)
!(ch->ch_c_cflag & CLOCAL))
{
ier |= UART_IER_MSI;
-   }
-   else {
+   } else {
ier &= ~UART_IER_MSI;
}
 
@@ -863,29 +857,25 @@ static void neo_param(struct tty_struct *tty)
 
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_cts_flow_control(ch);
-   }
-   else if (ch->ch_c_iflag & IXON) {
+   } else if (ch->ch_c_iflag & IXON) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_output_flow_control(ch);
else
neo_set_ixon_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_output_flow_control(ch);
}
 
if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_rts_flow_control(ch);
-   }
-   else if (ch->ch_c_iflag & IXOFF) {
+   } else if (ch->ch_c_iflag & IXOFF) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_input_flow_control(ch);
else
neo_set_ixoff_flow_control(ch);
-   }

[PATCH v2 0/3] Fix coding style of if statement

2014-05-17 Thread Masaru Nomura
This is the modified patches of
[PATCH x/4] Fix coding style of if statment

The following pateches fix the errors and warnings below in 
dgnc_neo.c and dgnc_tty.c to meet kernel coding style.

ERROR: else should follow close brace '}'
ERROR: that open brace { should be on the previous line
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks

Masaru Nomura (3):
  staging: dgnc: Put else statements on the right line
  staging: dgnc: dgnc_neo: Clean up if statement
  staging: dgnc: Remove extra curly braces

 drivers/staging/dgnc/dgnc_neo.c |  112 +++
 drivers/staging/dgnc/dgnc_tty.c |  140 ++-
 2 files changed, 88 insertions(+), 164 deletions(-)

-- 
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 v2 3/3] staging: dgnc: Remove extra curly braces

2014-05-17 Thread Masaru Nomura
Remove unnecessary curly braces of if statements in dgnc_neo.c and
dgnc_tty.c to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |   60 -
 drivers/staging/dgnc/dgnc_tty.c |  110 ++-
 2 files changed, 61 insertions(+), 109 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 10b6016..2d472e6 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -434,9 +434,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
isr = readb(>ch_neo_uart->isr_fcr);
 
/* Bail if no pending interrupt */
-   if (isr & UART_IIR_NO_INT)  {
+   if (isr & UART_IIR_NO_INT)
break;
-   }
 
/*
 * Yank off the upper 2 bits, which just show that the FIFO's 
are enabled.
@@ -650,24 +649,20 @@ static void neo_param(struct tty_struct *tty)
struct channel_t *ch;
struct un_t   *un;
 
-   if (!tty || tty->magic != TTY_MAGIC) {
+   if (!tty || tty->magic != TTY_MAGIC)
return;
-   }
 
un = (struct un_t *) tty->driver_data;
-   if (!un || un->magic != DGNC_UNIT_MAGIC) {
+   if (!un || un->magic != DGNC_UNIT_MAGIC)
return;
-   }
 
ch = un->un_ch;
-   if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
+   if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return;
-   }
 
bd = ch->ch_bd;
-   if (!bd || bd->magic != DGNC_BOARD_MAGIC) {
+   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));
@@ -773,13 +768,11 @@ static void neo_param(struct tty_struct *tty)
}
}
 
-   if (ch->ch_c_cflag & PARENB) {
+   if (ch->ch_c_cflag & PARENB)
lcr |= UART_LCR_PARITY;
-   }
 
-   if (!(ch->ch_c_cflag & PARODD)) {
+   if (!(ch->ch_c_cflag & PARODD))
lcr |= UART_LCR_EPAR;
-   }
 
/*
 * Not all platforms support mark/space parity,
@@ -828,11 +821,10 @@ static void neo_param(struct tty_struct *tty)
if (uart_lcr != lcr)
writeb(lcr, >ch_neo_uart->lcr);
 
-   if (ch->ch_c_cflag & CREAD) {
+   if (ch->ch_c_cflag & CREAD)
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   } else {
+   else
ier &= ~(UART_IER_RDI | UART_IER_RLSI);
-   }
 
/*
 * Have the UART interrupt on modem signal changes ONLY when
@@ -1215,11 +1207,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * The count can be any where from 0-3 bytes "off".
 * Bizarre, but true.
 */
-   if ((ch->ch_bd->dvid & 0xf0) >= UART_XR17E158_DVID) {
+   if ((ch->ch_bd->dvid & 0xf0) >= UART_XR17E158_DVID)
total -= 1;
-   } else {
+   else
total -= 3;
-   }
}
 
 
@@ -1263,9 +1254,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * will reset some bits after our read, we need to ensure
 * we don't miss our TX FIFO emptys.
 */
-   if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
+   if (linestatus & (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR))
ch->ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
-   }
 
linestatus = 0;
 
@@ -1393,19 +1383,16 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
struct un_t *un;
int rc = 0;
 
-   if (!tty || tty->magic != TTY_MAGIC) {
+   if (!tty || tty->magic != TTY_MAGIC)
return -ENXIO;
-   }
 
un = (struct un_t *) tty->driver_data;
-   if (!un || un->magic != DGNC_UNIT_MAGIC) {
+   if (!un || un->magic != DGNC_UNIT_MAGIC)
return -ENXIO;
-   }
 
ch = un->un_ch;
-   if (!ch || ch->magic != DGNC_CHANNEL_MAGIC) {
+   if (!ch || ch->magic != DGNC_CHANNEL_MAGIC)
return -ENXIO;
-   }
 
DPR_IOCTL(("%d Drain wait started.\n", __LINE__));
 
@@ -1422,11 +1409,10 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & 
UN_EMPTY) == 0));
 
/* If ret is non-zero, user ctrl-c'ed us */
-   if (rc) {
+   if (rc)
DP

[PATCH v2 2/3] staging: dgnc: dgnc_neo: Clean up if statement

2014-05-17 Thread Masaru Nomura
Fix line over 80 characters and indenting of condition part.
Also, remove unnecessary braces to meet coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index e87cf49..10b6016 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -838,14 +838,14 @@ static void neo_param(struct tty_struct *tty)
 * Have the UART interrupt on modem signal changes ONLY when
 * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
 */
-   if ((ch->ch_digi.digi_flags & CTSPACE) || (ch->ch_digi.digi_flags & 
RTSPACE) ||
-   (ch->ch_c_cflag & CRTSCTS) || !(ch->ch_digi.digi_flags & 
DIGI_FORCEDCD) ||
-   !(ch->ch_c_cflag & CLOCAL))
-   {
+   if ((ch->ch_digi.digi_flags & CTSPACE) ||
+   (ch->ch_digi.digi_flags & RTSPACE) ||
+   (ch->ch_c_cflag & CRTSCTS) ||
+   !(ch->ch_digi.digi_flags & DIGI_FORCEDCD) ||
+   !(ch->ch_c_cflag & CLOCAL))
ier |= UART_IER_MSI;
-   } else {
+   else
ier &= ~UART_IER_MSI;
-   }
 
ier |= UART_IER_THRI;
 
-- 
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 3/4] staging: dgnc: dgnc_neo: Fix conditional part of if statement

2014-05-17 Thread Masaru Nomura
Hi Dan,

Thank you for your detailed explanation!

> This isn't the right way.  Write it like this:
>
> if ((ch->ch_digi.digi_flags & CTSPACE) ||
> (ch->ch_digi.digi_flags & RTSPACE) ||
> (ch->ch_c_cflag & CRTSCTS) ||
> !(ch->ch_digi.digi_flags & DIGI_FORCEDCD) ||
> !(ch->ch_c_cflag & CLOCAL)) {
> ier |= UART_IER_MSI;
> else
> ier &= ~UART_IER_MSI;
>
> 1) The "||" operation goes at the end of the line.
> 2) The conditions are all in a line.  The indenting is
>
> [tab][space][space][space][space](ch->ch_digi.digi_f...

Sure, I'll modify this.

> Also just fold this patch and [patch 2/4] together into one patch.  We
> don't need two patches to fix one if statement.
>
> The one thing per patch rule is a bit tricky.  It means that you have to
> say which one thing you are fixing.  Don't say "I am fixing three
> things."  Say "I am fixing one if statement".

So in this case, do you think I could fold all four patches into one?
As I just worked on the 'same' if statements and divided them into
four patches, this could be the case. (but I'm not sure yet...)

Also, should I put v[number] for the modified patches?
Say [PATCH v2] staging: ...

Thank you,
Masaru
--
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: unisys: visorutil: Add a blank line

2014-05-17 Thread Masaru Nomura
Add a blank line after declarations to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/unisys/visorutil/charqueue.c  |2 ++
 drivers/staging/unisys/visorutil/easyproc.c   |6 ++
 drivers/staging/unisys/visorutil/periodic_work.c  |1 +
 drivers/staging/unisys/visorutil/procobjecttree.c |6 ++
 4 files changed, 15 insertions(+)

diff --git a/drivers/staging/unisys/visorutil/charqueue.c 
b/drivers/staging/unisys/visorutil/charqueue.c
index 61600e1..22241c7 100644
--- a/drivers/staging/unisys/visorutil/charqueue.c
+++ b/drivers/staging/unisys/visorutil/charqueue.c
@@ -41,6 +41,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots)
 {
int alloc_size = sizeof(CHARQUEUE) + nslots + 1;
CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY);
+
if (cq == NULL) {
ERRDRV("visor_charqueue_create allocation failed 
(alloc_size=%d)",
   alloc_size);
@@ -75,6 +76,7 @@ EXPORT_SYMBOL_GPL(visor_charqueue_enqueue);
 BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue)
 {
BOOL b;
+
spin_lock(>lock);
b = IS_EMPTY(charqueue);
spin_unlock(>lock);
diff --git a/drivers/staging/unisys/visorutil/easyproc.c 
b/drivers/staging/unisys/visorutil/easyproc.c
index 43df598..3b38849 100644
--- a/drivers/staging/unisys/visorutil/easyproc.c
+++ b/drivers/staging/unisys/visorutil/easyproc.c
@@ -61,6 +61,7 @@ static struct proc_dir_entry *
createProcDir(char *name, struct proc_dir_entry *parent)
 {
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
+
if (p == NULL)
ERRDRV("failed to create /proc directory %s", name);
return p;
@@ -196,6 +197,7 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info 
*pdriver,
 {
if ((pdriver->ProcDeviceDir != NULL) && (p->procDevicexDir == NULL)) {
char s[29];
+
sprintf(s, "%d", devno);
p->procDevicexDir = createProcDir(s, pdriver->ProcDeviceDir);
p->devno = devno;
@@ -267,6 +269,7 @@ void visor_easyproc_DeInitDevice(struct 
easyproc_driver_info *pdriver,
 struct easyproc_device_info *p, int devno)
 {
size_t i;
+
for (i = 0; i < ARRAY_SIZE(p->device_property_info); i++) {
if (p->device_property_info[i].procEntry != NULL) {
struct easyproc_device_property_info *px =
@@ -281,6 +284,7 @@ void visor_easyproc_DeInitDevice(struct 
easyproc_driver_info *pdriver,
}
if (p->procDevicexDir != NULL) {
char s[29];
+
sprintf(s, "%d", devno);
remove_proc_entry(s, pdriver->ProcDeviceDir);
p->procDevicexDir = NULL;
@@ -334,6 +338,7 @@ static ssize_t proc_write_driver(struct file *file, const 
char __user *buffer,
struct seq_file *seq = (struct seq_file *)file->private_data;
struct easyproc_driver_info *p = NULL;
char local_buf[256];
+
if (seq == NULL)
return 0;
p = (struct easyproc_driver_info *)(seq->private);
@@ -356,6 +361,7 @@ static ssize_t proc_write_device(struct file *file, const 
char __user *buffer,
struct seq_file *seq = (struct seq_file *)file->private_data;
struct easyproc_device_info *p = NULL;
char local_buf[256];
+
if (seq == NULL)
return 0;
p = (struct easyproc_device_info *)(seq->private);
diff --git a/drivers/staging/unisys/visorutil/periodic_work.c 
b/drivers/staging/unisys/visorutil/periodic_work.c
index 0251b83..38a60ce 100644
--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_destroy);
 BOOL visor_periodic_work_nextperiod(PERIODIC_WORK *periodic_work)
 {
BOOL rc = FALSE;
+
write_lock(_work->lock);
if (periodic_work->want_to_stop) {
periodic_work->is_scheduled = FALSE;
diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c 
b/drivers/staging/unisys/visorutil/procobjecttree.c
index 2f874e0..5c8c95c 100644
--- a/drivers/staging/unisys/visorutil/procobjecttree.c
+++ b/drivers/staging/unisys/visorutil/procobjecttree.c
@@ -95,6 +95,7 @@ static struct proc_dir_entry *
 createProcDir(const char *name, struct proc_dir_entry *parent)
 {
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
+
if (p == NULL)
ERRDRV("failed to create /proc directory %s", name);
return p;
@@ -197,9 +198,11 @@ void visor_proc_DestroyType(MYPROCTYPE *type)
return;
if (type->procDirs != NULL) {
int i = type->nNames-1;
+
while (i >= 0) {
if (type->procDir

[PATCH 4/4] staging: dgnc: Remove unnecessary braces

2014-05-17 Thread Masaru Nomura
Remove unnecessary braces of if-else statements in dgnc_neo.c and
dgnc_tty.c to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |   20 
 drivers/staging/dgnc/dgnc_tty.c |   10 --
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index c211f9f..c4ab17b 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -828,11 +828,10 @@ static void neo_param(struct tty_struct *tty)
if (uart_lcr != lcr)
writeb(lcr, >ch_neo_uart->lcr);
 
-   if (ch->ch_c_cflag & CREAD) {
+   if (ch->ch_c_cflag & CREAD)
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   } else {
+   else
ier &= ~(UART_IER_RDI | UART_IER_RLSI);
-   }
 
/*
 * Have the UART interrupt on modem signal changes ONLY when
@@ -842,11 +841,10 @@ static void neo_param(struct tty_struct *tty)
|| (ch->ch_digi.digi_flags & RTSPACE)
|| (ch->ch_c_cflag & CRTSCTS)
|| !(ch->ch_digi.digi_flags & DIGI_FORCEDCD)
-   || !(ch->ch_c_cflag & CLOCAL)) {
+   || !(ch->ch_c_cflag & CLOCAL))
ier |= UART_IER_MSI;
-   } else {
+   else
ier &= ~UART_IER_MSI;
-   }
 
ier |= UART_IER_THRI;
 
@@ -1216,11 +1214,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * The count can be any where from 0-3 bytes "off".
 * Bizarre, but true.
 */
-   if ((ch->ch_bd->dvid & 0xf0) >= UART_XR17E158_DVID) {
+   if ((ch->ch_bd->dvid & 0xf0) >= UART_XR17E158_DVID)
total -= 1;
-   } else {
+   else
total -= 3;
-   }
}
 
 
@@ -1423,11 +1420,10 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
rc = wait_event_interruptible(un->un_flags_wait, ((un->un_flags & 
UN_EMPTY) == 0));
 
/* If ret is non-zero, user ctrl-c'ed us */
-   if (rc) {
+   if (rc)
DPR_IOCTL(("%d Drain - User ctrl c'ed\n", __LINE__));
-   } else {
+   else
DPR_IOCTL(("%d Drain wait finished.\n", __LINE__));
-   }
 
return rc;
 }
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index e432c04..cda2254 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -2549,17 +2549,15 @@ static int dgnc_set_modem_info(struct tty_struct *tty, 
unsigned int command, uns
 
case TIOCMSET:
 
-   if (arg & TIOCM_RTS) {
+   if (arg & TIOCM_RTS)
ch->ch_mostat |= UART_MCR_RTS;
-   } else {
+   else
ch->ch_mostat &= ~(UART_MCR_RTS);
-   }
 
-   if (arg & TIOCM_DTR) {
+   if (arg & TIOCM_DTR)
ch->ch_mostat |= UART_MCR_DTR;
-   } else {
+   else
ch->ch_mostat &= ~(UART_MCR_DTR);
-   }
 
break;
 
-- 
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/4] staging: dgnc: dgnc_neo: Fix conditional part of if statement

2014-05-17 Thread Masaru Nomura
Fix line over 80 characters of if-condition part and also
indent the lines to tell the difference between the condition and
body of the if statement.

Then I think we can keep the readability and meet coding style
with this change.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8988346..c211f9f 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -838,9 +838,11 @@ static void neo_param(struct tty_struct *tty)
 * Have the UART interrupt on modem signal changes ONLY when
 * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
 */
-   if ((ch->ch_digi.digi_flags & CTSPACE) || (ch->ch_digi.digi_flags & 
RTSPACE) ||
-   (ch->ch_c_cflag & CRTSCTS) || !(ch->ch_digi.digi_flags & 
DIGI_FORCEDCD) ||
-   !(ch->ch_c_cflag & CLOCAL)) {
+   if ((ch->ch_digi.digi_flags & CTSPACE)
+   || (ch->ch_digi.digi_flags & RTSPACE)
+   || (ch->ch_c_cflag & CRTSCTS)
+   || !(ch->ch_digi.digi_flags & DIGI_FORCEDCD)
+   || !(ch->ch_c_cflag & CLOCAL)) {
ier |= UART_IER_MSI;
} else {
ier &= ~UART_IER_MSI;
-- 
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/4] staging: dgnc: dgnc_neo: Fix indenting of if statement

2014-05-17 Thread Masaru Nomura
Fix indenting of if statement in dgnc_neo.c so that an open brace
follows if-condition part to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index e87cf49..8988346 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -840,8 +840,7 @@ static void neo_param(struct tty_struct *tty)
 */
if ((ch->ch_digi.digi_flags & CTSPACE) || (ch->ch_digi.digi_flags & 
RTSPACE) ||
(ch->ch_c_cflag & CRTSCTS) || !(ch->ch_digi.digi_flags & 
DIGI_FORCEDCD) ||
-   !(ch->ch_c_cflag & CLOCAL))
-   {
+   !(ch->ch_c_cflag & CLOCAL)) {
ier |= UART_IER_MSI;
} else {
ier &= ~UART_IER_MSI;
-- 
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/4] staging: dgnc: Fix indenting of if-else statement

2014-05-17 Thread Masaru Nomura
Fix indenting of if-else statement in dgnc_neo.c and dgnc_tty.c
so that following else-if or else statement meets coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_neo.c |   48 +--
 drivers/staging/dgnc/dgnc_tty.c |   36 ++---
 2 files changed, 28 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index cf22c7b..e87cf49 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -485,8 +485,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_UNLOCK(ch->ch_lock, lock_flags);
}
DPR_INTR(("Port %d. XON detected in incoming 
data\n", port));
-   }
-   else if (cause == UART_17158_XOFF_DETECT) {
+   } else if (cause == UART_17158_XOFF_DETECT) {
if (!(brd->channels[port]->ch_flags & CH_STOP)) 
{
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_flags |= CH_STOP;
@@ -511,8 +510,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat |= UART_MCR_RTS;
DGNC_UNLOCK(ch->ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat &= ~(UART_MCR_RTS);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -522,8 +520,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat |= UART_MCR_DTR;
DGNC_UNLOCK(ch->ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch->ch_lock, lock_flags);
ch->ch_mostat &= ~(UART_MCR_DTR);
DGNC_UNLOCK(ch->ch_lock, lock_flags);
@@ -624,8 +621,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, 
uint port)
 
/* Transfer data (if any) from Write Queue -> UART. */
neo_copy_data_from_queue_to_uart(ch);
-   }
-   else if (linestatus & UART_17158_TX_AND_FIFO_CLR) {
+   } else if (linestatus & UART_17158_TX_AND_FIFO_CLR) {
brd->intr_tx++;
ch->ch_intr_tx++;
DGNC_LOCK(ch->ch_lock, lock_flags);
@@ -834,8 +830,7 @@ static void neo_param(struct tty_struct *tty)
 
if (ch->ch_c_cflag & CREAD) {
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   }
-   else {
+   } else {
ier &= ~(UART_IER_RDI | UART_IER_RLSI);
}
 
@@ -848,8 +843,7 @@ static void neo_param(struct tty_struct *tty)
!(ch->ch_c_cflag & CLOCAL))
{
ier |= UART_IER_MSI;
-   }
-   else {
+   } else {
ier &= ~UART_IER_MSI;
}
 
@@ -863,29 +857,25 @@ static void neo_param(struct tty_struct *tty)
 
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_cts_flow_control(ch);
-   }
-   else if (ch->ch_c_iflag & IXON) {
+   } else if (ch->ch_c_iflag & IXON) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_output_flow_control(ch);
else
neo_set_ixon_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_output_flow_control(ch);
}
 
if (ch->ch_digi.digi_flags & RTSPACE || ch->ch_c_cflag & CRTSCTS) {
neo_set_rts_flow_control(ch);
-   }
-   else if (ch->ch_c_iflag & IXOFF) {
+   } else if (ch->ch_c_iflag & IXOFF) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch->ch_startc == _POSIX_VDISABLE) || (ch->ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_input_flow_control(ch);
else
neo_set_ixoff_flow_control(ch);
-   }

[PATCH 0/4] Fix coding style of if statement

2014-05-17 Thread Masaru Nomura
The following pateches fix the errors and warnings in 
dgnc_neo.c and dgnc_tty.c to meet kernel coding style.

ERROR: else should follow close brace '}'
ERROR: that open brace { should be on the previous line
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks

Masaru Nomura (4):
  staging: dgnc: Fix indenting of if-else statement
  staging: dgnc: dgnc_neo: Fix indenting of if statement
  staging: dgnc: dgnc_neo: Fix conditional part of if statement
  staging: dgnc: Remove unnecessary braces

 drivers/staging/dgnc/dgnc_neo.c |   67 ++-
 drivers/staging/dgnc/dgnc_tty.c |   42 
 2 files changed, 38 insertions(+), 71 deletions(-)

-- 
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 0/4] Fix coding style of if statement

2014-05-17 Thread Masaru Nomura
The following pateches fix the errors and warnings in 
dgnc_neo.c and dgnc_tty.c to meet kernel coding style.

ERROR: else should follow close brace '}'
ERROR: that open brace { should be on the previous line
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks

Masaru Nomura (4):
  staging: dgnc: Fix indenting of if-else statement
  staging: dgnc: dgnc_neo: Fix indenting of if statement
  staging: dgnc: dgnc_neo: Fix conditional part of if statement
  staging: dgnc: Remove unnecessary braces

 drivers/staging/dgnc/dgnc_neo.c |   67 ++-
 drivers/staging/dgnc/dgnc_tty.c |   42 
 2 files changed, 38 insertions(+), 71 deletions(-)

-- 
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/4] staging: dgnc: Fix indenting of if-else statement

2014-05-17 Thread Masaru Nomura
Fix indenting of if-else statement in dgnc_neo.c and dgnc_tty.c
so that following else-if or else statement meets coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |   48 +--
 drivers/staging/dgnc/dgnc_tty.c |   36 ++---
 2 files changed, 28 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index cf22c7b..e87cf49 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -485,8 +485,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_UNLOCK(ch-ch_lock, lock_flags);
}
DPR_INTR((Port %d. XON detected in incoming 
data\n, port));
-   }
-   else if (cause == UART_17158_XOFF_DETECT) {
+   } else if (cause == UART_17158_XOFF_DETECT) {
if (!(brd-channels[port]-ch_flags  CH_STOP)) 
{
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_flags |= CH_STOP;
@@ -511,8 +510,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat |= UART_MCR_RTS;
DGNC_UNLOCK(ch-ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat = ~(UART_MCR_RTS);
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -522,8 +520,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat |= UART_MCR_DTR;
DGNC_UNLOCK(ch-ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat = ~(UART_MCR_DTR);
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -624,8 +621,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, 
uint port)
 
/* Transfer data (if any) from Write Queue - UART. */
neo_copy_data_from_queue_to_uart(ch);
-   }
-   else if (linestatus  UART_17158_TX_AND_FIFO_CLR) {
+   } else if (linestatus  UART_17158_TX_AND_FIFO_CLR) {
brd-intr_tx++;
ch-ch_intr_tx++;
DGNC_LOCK(ch-ch_lock, lock_flags);
@@ -834,8 +830,7 @@ static void neo_param(struct tty_struct *tty)
 
if (ch-ch_c_cflag  CREAD) {
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   }
-   else {
+   } else {
ier = ~(UART_IER_RDI | UART_IER_RLSI);
}
 
@@ -848,8 +843,7 @@ static void neo_param(struct tty_struct *tty)
!(ch-ch_c_cflag  CLOCAL))
{
ier |= UART_IER_MSI;
-   }
-   else {
+   } else {
ier = ~UART_IER_MSI;
}
 
@@ -863,29 +857,25 @@ static void neo_param(struct tty_struct *tty)
 
if (ch-ch_digi.digi_flags  CTSPACE || ch-ch_c_cflag  CRTSCTS) {
neo_set_cts_flow_control(ch);
-   }
-   else if (ch-ch_c_iflag  IXON) {
+   } else if (ch-ch_c_iflag  IXON) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch-ch_startc == _POSIX_VDISABLE) || (ch-ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_output_flow_control(ch);
else
neo_set_ixon_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_output_flow_control(ch);
}
 
if (ch-ch_digi.digi_flags  RTSPACE || ch-ch_c_cflag  CRTSCTS) {
neo_set_rts_flow_control(ch);
-   }
-   else if (ch-ch_c_iflag  IXOFF) {
+   } else if (ch-ch_c_iflag  IXOFF) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch-ch_startc == _POSIX_VDISABLE) || (ch-ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_input_flow_control(ch);
else
neo_set_ixoff_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_input_flow_control(ch);
}
 
@@ -1227,8 +1217,7 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 */
if ((ch

[PATCH 2/4] staging: dgnc: dgnc_neo: Fix indenting of if statement

2014-05-17 Thread Masaru Nomura
Fix indenting of if statement in dgnc_neo.c so that an open brace
follows if-condition part to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index e87cf49..8988346 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -840,8 +840,7 @@ static void neo_param(struct tty_struct *tty)
 */
if ((ch-ch_digi.digi_flags  CTSPACE) || (ch-ch_digi.digi_flags  
RTSPACE) ||
(ch-ch_c_cflag  CRTSCTS) || !(ch-ch_digi.digi_flags  
DIGI_FORCEDCD) ||
-   !(ch-ch_c_cflag  CLOCAL))
-   {
+   !(ch-ch_c_cflag  CLOCAL)) {
ier |= UART_IER_MSI;
} else {
ier = ~UART_IER_MSI;
-- 
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 4/4] staging: dgnc: Remove unnecessary braces

2014-05-17 Thread Masaru Nomura
Remove unnecessary braces of if-else statements in dgnc_neo.c and
dgnc_tty.c to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |   20 
 drivers/staging/dgnc/dgnc_tty.c |   10 --
 2 files changed, 12 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index c211f9f..c4ab17b 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -828,11 +828,10 @@ static void neo_param(struct tty_struct *tty)
if (uart_lcr != lcr)
writeb(lcr, ch-ch_neo_uart-lcr);
 
-   if (ch-ch_c_cflag  CREAD) {
+   if (ch-ch_c_cflag  CREAD)
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   } else {
+   else
ier = ~(UART_IER_RDI | UART_IER_RLSI);
-   }
 
/*
 * Have the UART interrupt on modem signal changes ONLY when
@@ -842,11 +841,10 @@ static void neo_param(struct tty_struct *tty)
|| (ch-ch_digi.digi_flags  RTSPACE)
|| (ch-ch_c_cflag  CRTSCTS)
|| !(ch-ch_digi.digi_flags  DIGI_FORCEDCD)
-   || !(ch-ch_c_cflag  CLOCAL)) {
+   || !(ch-ch_c_cflag  CLOCAL))
ier |= UART_IER_MSI;
-   } else {
+   else
ier = ~UART_IER_MSI;
-   }
 
ier |= UART_IER_THRI;
 
@@ -1216,11 +1214,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * The count can be any where from 0-3 bytes off.
 * Bizarre, but true.
 */
-   if ((ch-ch_bd-dvid  0xf0) = UART_XR17E158_DVID) {
+   if ((ch-ch_bd-dvid  0xf0) = UART_XR17E158_DVID)
total -= 1;
-   } else {
+   else
total -= 3;
-   }
}
 
 
@@ -1423,11 +1420,10 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
rc = wait_event_interruptible(un-un_flags_wait, ((un-un_flags  
UN_EMPTY) == 0));
 
/* If ret is non-zero, user ctrl-c'ed us */
-   if (rc) {
+   if (rc)
DPR_IOCTL((%d Drain - User ctrl c'ed\n, __LINE__));
-   } else {
+   else
DPR_IOCTL((%d Drain wait finished.\n, __LINE__));
-   }
 
return rc;
 }
diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index e432c04..cda2254 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -2549,17 +2549,15 @@ static int dgnc_set_modem_info(struct tty_struct *tty, 
unsigned int command, uns
 
case TIOCMSET:
 
-   if (arg  TIOCM_RTS) {
+   if (arg  TIOCM_RTS)
ch-ch_mostat |= UART_MCR_RTS;
-   } else {
+   else
ch-ch_mostat = ~(UART_MCR_RTS);
-   }
 
-   if (arg  TIOCM_DTR) {
+   if (arg  TIOCM_DTR)
ch-ch_mostat |= UART_MCR_DTR;
-   } else {
+   else
ch-ch_mostat = ~(UART_MCR_DTR);
-   }
 
break;
 
-- 
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/4] staging: dgnc: dgnc_neo: Fix conditional part of if statement

2014-05-17 Thread Masaru Nomura
Fix line over 80 characters of if-condition part and also
indent the lines to tell the difference between the condition and
body of the if statement.

Then I think we can keep the readability and meet coding style
with this change.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 8988346..c211f9f 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -838,9 +838,11 @@ static void neo_param(struct tty_struct *tty)
 * Have the UART interrupt on modem signal changes ONLY when
 * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
 */
-   if ((ch-ch_digi.digi_flags  CTSPACE) || (ch-ch_digi.digi_flags  
RTSPACE) ||
-   (ch-ch_c_cflag  CRTSCTS) || !(ch-ch_digi.digi_flags  
DIGI_FORCEDCD) ||
-   !(ch-ch_c_cflag  CLOCAL)) {
+   if ((ch-ch_digi.digi_flags  CTSPACE)
+   || (ch-ch_digi.digi_flags  RTSPACE)
+   || (ch-ch_c_cflag  CRTSCTS)
+   || !(ch-ch_digi.digi_flags  DIGI_FORCEDCD)
+   || !(ch-ch_c_cflag  CLOCAL)) {
ier |= UART_IER_MSI;
} else {
ier = ~UART_IER_MSI;
-- 
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: unisys: visorutil: Add a blank line

2014-05-17 Thread Masaru Nomura
Add a blank line after declarations to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/unisys/visorutil/charqueue.c  |2 ++
 drivers/staging/unisys/visorutil/easyproc.c   |6 ++
 drivers/staging/unisys/visorutil/periodic_work.c  |1 +
 drivers/staging/unisys/visorutil/procobjecttree.c |6 ++
 4 files changed, 15 insertions(+)

diff --git a/drivers/staging/unisys/visorutil/charqueue.c 
b/drivers/staging/unisys/visorutil/charqueue.c
index 61600e1..22241c7 100644
--- a/drivers/staging/unisys/visorutil/charqueue.c
+++ b/drivers/staging/unisys/visorutil/charqueue.c
@@ -41,6 +41,7 @@ CHARQUEUE *visor_charqueue_create(ulong nslots)
 {
int alloc_size = sizeof(CHARQUEUE) + nslots + 1;
CHARQUEUE *cq = kmalloc(alloc_size, GFP_KERNEL|__GFP_NORETRY);
+
if (cq == NULL) {
ERRDRV(visor_charqueue_create allocation failed 
(alloc_size=%d),
   alloc_size);
@@ -75,6 +76,7 @@ EXPORT_SYMBOL_GPL(visor_charqueue_enqueue);
 BOOL visor_charqueue_is_empty(CHARQUEUE *charqueue)
 {
BOOL b;
+
spin_lock(charqueue-lock);
b = IS_EMPTY(charqueue);
spin_unlock(charqueue-lock);
diff --git a/drivers/staging/unisys/visorutil/easyproc.c 
b/drivers/staging/unisys/visorutil/easyproc.c
index 43df598..3b38849 100644
--- a/drivers/staging/unisys/visorutil/easyproc.c
+++ b/drivers/staging/unisys/visorutil/easyproc.c
@@ -61,6 +61,7 @@ static struct proc_dir_entry *
createProcDir(char *name, struct proc_dir_entry *parent)
 {
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
+
if (p == NULL)
ERRDRV(failed to create /proc directory %s, name);
return p;
@@ -196,6 +197,7 @@ void visor_easyproc_InitDevice(struct easyproc_driver_info 
*pdriver,
 {
if ((pdriver-ProcDeviceDir != NULL)  (p-procDevicexDir == NULL)) {
char s[29];
+
sprintf(s, %d, devno);
p-procDevicexDir = createProcDir(s, pdriver-ProcDeviceDir);
p-devno = devno;
@@ -267,6 +269,7 @@ void visor_easyproc_DeInitDevice(struct 
easyproc_driver_info *pdriver,
 struct easyproc_device_info *p, int devno)
 {
size_t i;
+
for (i = 0; i  ARRAY_SIZE(p-device_property_info); i++) {
if (p-device_property_info[i].procEntry != NULL) {
struct easyproc_device_property_info *px =
@@ -281,6 +284,7 @@ void visor_easyproc_DeInitDevice(struct 
easyproc_driver_info *pdriver,
}
if (p-procDevicexDir != NULL) {
char s[29];
+
sprintf(s, %d, devno);
remove_proc_entry(s, pdriver-ProcDeviceDir);
p-procDevicexDir = NULL;
@@ -334,6 +338,7 @@ static ssize_t proc_write_driver(struct file *file, const 
char __user *buffer,
struct seq_file *seq = (struct seq_file *)file-private_data;
struct easyproc_driver_info *p = NULL;
char local_buf[256];
+
if (seq == NULL)
return 0;
p = (struct easyproc_driver_info *)(seq-private);
@@ -356,6 +361,7 @@ static ssize_t proc_write_device(struct file *file, const 
char __user *buffer,
struct seq_file *seq = (struct seq_file *)file-private_data;
struct easyproc_device_info *p = NULL;
char local_buf[256];
+
if (seq == NULL)
return 0;
p = (struct easyproc_device_info *)(seq-private);
diff --git a/drivers/staging/unisys/visorutil/periodic_work.c 
b/drivers/staging/unisys/visorutil/periodic_work.c
index 0251b83..38a60ce 100644
--- a/drivers/staging/unisys/visorutil/periodic_work.c
+++ b/drivers/staging/unisys/visorutil/periodic_work.c
@@ -92,6 +92,7 @@ EXPORT_SYMBOL_GPL(visor_periodic_work_destroy);
 BOOL visor_periodic_work_nextperiod(PERIODIC_WORK *periodic_work)
 {
BOOL rc = FALSE;
+
write_lock(periodic_work-lock);
if (periodic_work-want_to_stop) {
periodic_work-is_scheduled = FALSE;
diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c 
b/drivers/staging/unisys/visorutil/procobjecttree.c
index 2f874e0..5c8c95c 100644
--- a/drivers/staging/unisys/visorutil/procobjecttree.c
+++ b/drivers/staging/unisys/visorutil/procobjecttree.c
@@ -95,6 +95,7 @@ static struct proc_dir_entry *
 createProcDir(const char *name, struct proc_dir_entry *parent)
 {
struct proc_dir_entry *p = proc_mkdir_mode(name, S_IFDIR, parent);
+
if (p == NULL)
ERRDRV(failed to create /proc directory %s, name);
return p;
@@ -197,9 +198,11 @@ void visor_proc_DestroyType(MYPROCTYPE *type)
return;
if (type-procDirs != NULL) {
int i = type-nNames-1;
+
while (i = 0) {
if (type-procDirs[i] != NULL) {
struct proc_dir_entry *parent = NULL

Re: [PATCH 3/4] staging: dgnc: dgnc_neo: Fix conditional part of if statement

2014-05-17 Thread Masaru Nomura
Hi Dan,

Thank you for your detailed explanation!

 This isn't the right way.  Write it like this:

 if ((ch-ch_digi.digi_flags  CTSPACE) ||
 (ch-ch_digi.digi_flags  RTSPACE) ||
 (ch-ch_c_cflag  CRTSCTS) ||
 !(ch-ch_digi.digi_flags  DIGI_FORCEDCD) ||
 !(ch-ch_c_cflag  CLOCAL)) {
 ier |= UART_IER_MSI;
 else
 ier = ~UART_IER_MSI;

 1) The || operation goes at the end of the line.
 2) The conditions are all in a line.  The indenting is

 [tab][space][space][space][space](ch-ch_digi.digi_f...

Sure, I'll modify this.

 Also just fold this patch and [patch 2/4] together into one patch.  We
 don't need two patches to fix one if statement.

 The one thing per patch rule is a bit tricky.  It means that you have to
 say which one thing you are fixing.  Don't say I am fixing three
 things.  Say I am fixing one if statement.

So in this case, do you think I could fold all four patches into one?
As I just worked on the 'same' if statements and divided them into
four patches, this could be the case. (but I'm not sure yet...)

Also, should I put v[number] for the modified patches?
Say [PATCH v2] staging: ...

Thank you,
Masaru
--
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 v2 0/3] Fix coding style of if statement

2014-05-17 Thread Masaru Nomura
This is the modified patches of
[PATCH x/4] Fix coding style of if statment

The following pateches fix the errors and warnings below in 
dgnc_neo.c and dgnc_tty.c to meet kernel coding style.

ERROR: else should follow close brace '}'
ERROR: that open brace { should be on the previous line
WARNING: line over 80 characters
WARNING: braces {} are not necessary for single statement blocks

Masaru Nomura (3):
  staging: dgnc: Put else statements on the right line
  staging: dgnc: dgnc_neo: Clean up if statement
  staging: dgnc: Remove extra curly braces

 drivers/staging/dgnc/dgnc_neo.c |  112 +++
 drivers/staging/dgnc/dgnc_tty.c |  140 ++-
 2 files changed, 88 insertions(+), 164 deletions(-)

-- 
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 v2 3/3] staging: dgnc: Remove extra curly braces

2014-05-17 Thread Masaru Nomura
Remove unnecessary curly braces of if statements in dgnc_neo.c and
dgnc_tty.c to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |   60 -
 drivers/staging/dgnc/dgnc_tty.c |  110 ++-
 2 files changed, 61 insertions(+), 109 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index 10b6016..2d472e6 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -434,9 +434,8 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
isr = readb(ch-ch_neo_uart-isr_fcr);
 
/* Bail if no pending interrupt */
-   if (isr  UART_IIR_NO_INT)  {
+   if (isr  UART_IIR_NO_INT)
break;
-   }
 
/*
 * Yank off the upper 2 bits, which just show that the FIFO's 
are enabled.
@@ -650,24 +649,20 @@ static void neo_param(struct tty_struct *tty)
struct channel_t *ch;
struct un_t   *un;
 
-   if (!tty || tty-magic != TTY_MAGIC) {
+   if (!tty || tty-magic != TTY_MAGIC)
return;
-   }
 
un = (struct un_t *) tty-driver_data;
-   if (!un || un-magic != DGNC_UNIT_MAGIC) {
+   if (!un || un-magic != DGNC_UNIT_MAGIC)
return;
-   }
 
ch = un-un_ch;
-   if (!ch || ch-magic != DGNC_CHANNEL_MAGIC) {
+   if (!ch || ch-magic != DGNC_CHANNEL_MAGIC)
return;
-   }
 
bd = ch-ch_bd;
-   if (!bd || bd-magic != DGNC_BOARD_MAGIC) {
+   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));
@@ -773,13 +768,11 @@ static void neo_param(struct tty_struct *tty)
}
}
 
-   if (ch-ch_c_cflag  PARENB) {
+   if (ch-ch_c_cflag  PARENB)
lcr |= UART_LCR_PARITY;
-   }
 
-   if (!(ch-ch_c_cflag  PARODD)) {
+   if (!(ch-ch_c_cflag  PARODD))
lcr |= UART_LCR_EPAR;
-   }
 
/*
 * Not all platforms support mark/space parity,
@@ -828,11 +821,10 @@ static void neo_param(struct tty_struct *tty)
if (uart_lcr != lcr)
writeb(lcr, ch-ch_neo_uart-lcr);
 
-   if (ch-ch_c_cflag  CREAD) {
+   if (ch-ch_c_cflag  CREAD)
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   } else {
+   else
ier = ~(UART_IER_RDI | UART_IER_RLSI);
-   }
 
/*
 * Have the UART interrupt on modem signal changes ONLY when
@@ -1215,11 +1207,10 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * The count can be any where from 0-3 bytes off.
 * Bizarre, but true.
 */
-   if ((ch-ch_bd-dvid  0xf0) = UART_XR17E158_DVID) {
+   if ((ch-ch_bd-dvid  0xf0) = UART_XR17E158_DVID)
total -= 1;
-   } else {
+   else
total -= 3;
-   }
}
 
 
@@ -1263,9 +1254,8 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 * will reset some bits after our read, we need to ensure
 * we don't miss our TX FIFO emptys.
 */
-   if (linestatus  (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR)) {
+   if (linestatus  (UART_LSR_THRE | UART_17158_TX_AND_FIFO_CLR))
ch-ch_flags |= (CH_TX_FIFO_EMPTY | CH_TX_FIFO_LWM);
-   }
 
linestatus = 0;
 
@@ -1393,19 +1383,16 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
struct un_t *un;
int rc = 0;
 
-   if (!tty || tty-magic != TTY_MAGIC) {
+   if (!tty || tty-magic != TTY_MAGIC)
return -ENXIO;
-   }
 
un = (struct un_t *) tty-driver_data;
-   if (!un || un-magic != DGNC_UNIT_MAGIC) {
+   if (!un || un-magic != DGNC_UNIT_MAGIC)
return -ENXIO;
-   }
 
ch = un-un_ch;
-   if (!ch || ch-magic != DGNC_CHANNEL_MAGIC) {
+   if (!ch || ch-magic != DGNC_CHANNEL_MAGIC)
return -ENXIO;
-   }
 
DPR_IOCTL((%d Drain wait started.\n, __LINE__));
 
@@ -1422,11 +1409,10 @@ static int neo_drain(struct tty_struct *tty, uint 
seconds)
rc = wait_event_interruptible(un-un_flags_wait, ((un-un_flags  
UN_EMPTY) == 0));
 
/* If ret is non-zero, user ctrl-c'ed us */
-   if (rc) {
+   if (rc)
DPR_IOCTL((%d Drain - User ctrl c'ed\n, __LINE__));
-   } else {
+   else
DPR_IOCTL((%d Drain wait finished.\n, __LINE__));
-   }
 
return rc;
 }
@@ -1442,9 +1428,8 @@ static void neo_flush_uart_write(struct

[PATCH v2 2/3] staging: dgnc: dgnc_neo: Clean up if statement

2014-05-17 Thread Masaru Nomura
Fix line over 80 characters and indenting of condition part.
Also, remove unnecessary braces to meet coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |   12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index e87cf49..10b6016 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -838,14 +838,14 @@ static void neo_param(struct tty_struct *tty)
 * Have the UART interrupt on modem signal changes ONLY when
 * we are in hardware flow control mode, or CLOCAL/FORCEDCD is not set.
 */
-   if ((ch-ch_digi.digi_flags  CTSPACE) || (ch-ch_digi.digi_flags  
RTSPACE) ||
-   (ch-ch_c_cflag  CRTSCTS) || !(ch-ch_digi.digi_flags  
DIGI_FORCEDCD) ||
-   !(ch-ch_c_cflag  CLOCAL))
-   {
+   if ((ch-ch_digi.digi_flags  CTSPACE) ||
+   (ch-ch_digi.digi_flags  RTSPACE) ||
+   (ch-ch_c_cflag  CRTSCTS) ||
+   !(ch-ch_digi.digi_flags  DIGI_FORCEDCD) ||
+   !(ch-ch_c_cflag  CLOCAL))
ier |= UART_IER_MSI;
-   } else {
+   else
ier = ~UART_IER_MSI;
-   }
 
ier |= UART_IER_THRI;
 
-- 
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 v2 1/3] staging: dgnc: Put else statements on the right line

2014-05-17 Thread Masaru Nomura
Fix indenting of if-else statement in dgnc_neo.c and dgnc_tty.c
so that following else-if or else statement meets coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_neo.c |   48 +--
 drivers/staging/dgnc/dgnc_tty.c |   36 ++---
 2 files changed, 28 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_neo.c b/drivers/staging/dgnc/dgnc_neo.c
index cf22c7b..e87cf49 100644
--- a/drivers/staging/dgnc/dgnc_neo.c
+++ b/drivers/staging/dgnc/dgnc_neo.c
@@ -485,8 +485,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_UNLOCK(ch-ch_lock, lock_flags);
}
DPR_INTR((Port %d. XON detected in incoming 
data\n, port));
-   }
-   else if (cause == UART_17158_XOFF_DETECT) {
+   } else if (cause == UART_17158_XOFF_DETECT) {
if (!(brd-channels[port]-ch_flags  CH_STOP)) 
{
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_flags |= CH_STOP;
@@ -511,8 +510,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat |= UART_MCR_RTS;
DGNC_UNLOCK(ch-ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat = ~(UART_MCR_RTS);
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -522,8 +520,7 @@ static inline void neo_parse_isr(struct dgnc_board *brd, 
uint port)
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat |= UART_MCR_DTR;
DGNC_UNLOCK(ch-ch_lock, lock_flags);
-   }
-   else {
+   } else {
DGNC_LOCK(ch-ch_lock, lock_flags);
ch-ch_mostat = ~(UART_MCR_DTR);
DGNC_UNLOCK(ch-ch_lock, lock_flags);
@@ -624,8 +621,7 @@ static inline void neo_parse_lsr(struct dgnc_board *brd, 
uint port)
 
/* Transfer data (if any) from Write Queue - UART. */
neo_copy_data_from_queue_to_uart(ch);
-   }
-   else if (linestatus  UART_17158_TX_AND_FIFO_CLR) {
+   } else if (linestatus  UART_17158_TX_AND_FIFO_CLR) {
brd-intr_tx++;
ch-ch_intr_tx++;
DGNC_LOCK(ch-ch_lock, lock_flags);
@@ -834,8 +830,7 @@ static void neo_param(struct tty_struct *tty)
 
if (ch-ch_c_cflag  CREAD) {
ier |= (UART_IER_RDI | UART_IER_RLSI);
-   }
-   else {
+   } else {
ier = ~(UART_IER_RDI | UART_IER_RLSI);
}
 
@@ -848,8 +843,7 @@ static void neo_param(struct tty_struct *tty)
!(ch-ch_c_cflag  CLOCAL))
{
ier |= UART_IER_MSI;
-   }
-   else {
+   } else {
ier = ~UART_IER_MSI;
}
 
@@ -863,29 +857,25 @@ static void neo_param(struct tty_struct *tty)
 
if (ch-ch_digi.digi_flags  CTSPACE || ch-ch_c_cflag  CRTSCTS) {
neo_set_cts_flow_control(ch);
-   }
-   else if (ch-ch_c_iflag  IXON) {
+   } else if (ch-ch_c_iflag  IXON) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch-ch_startc == _POSIX_VDISABLE) || (ch-ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_output_flow_control(ch);
else
neo_set_ixon_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_output_flow_control(ch);
}
 
if (ch-ch_digi.digi_flags  RTSPACE || ch-ch_c_cflag  CRTSCTS) {
neo_set_rts_flow_control(ch);
-   }
-   else if (ch-ch_c_iflag  IXOFF) {
+   } else if (ch-ch_c_iflag  IXOFF) {
/* If start/stop is set to disable, then we should disable flow 
control */
if ((ch-ch_startc == _POSIX_VDISABLE) || (ch-ch_stopc == 
_POSIX_VDISABLE))
neo_set_no_input_flow_control(ch);
else
neo_set_ixoff_flow_control(ch);
-   }
-   else {
+   } else {
neo_set_no_input_flow_control(ch);
}
 
@@ -1227,8 +1217,7 @@ static void neo_copy_data_from_uart_to_queue(struct 
channel_t *ch)
 */
if ((ch

[PATCH] staging: dgnc: dgnc_tty: Remove a prohibited space

2014-05-16 Thread Masaru Nomura
Remove a prohibited space before a closed parenthesis of if statement
to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_tty.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index f0b17c3..13d7a14 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -1693,7 +1693,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
/*
 * turn off print device when closing print device.
 */
-   if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON) ) {
+   if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON)) {
dgnc_wmove(ch, ch->ch_digi.digi_offstr,
(int) ch->ch_digi.digi_offlen);
ch->ch_flags &= ~CH_PRON;
@@ -1753,7 +1753,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
/*
 * turn off print device when closing print device.
 */
-   if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON) ) {
+   if ((un->un_type == DGNC_PRINT) && (ch->ch_flags & CH_PRON)) {
dgnc_wmove(ch, ch->ch_digi.digi_offstr,
(int) ch->ch_digi.digi_offlen);
ch->ch_flags &= ~CH_PRON;
@@ -1857,7 +1857,7 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int 
bytes_available)
if (un->un_type != DGNC_PRINT)
return bytes_available;
 
-   if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0 ) {
+   if (ch->ch_digi.digi_maxcps > 0 && ch->ch_digi.digi_bufsize > 0) {
int cps_limit = 0;
unsigned long current_time = jiffies;
unsigned long buffer_time = current_time +
-- 
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: dgnc_tty: Add a required space

2014-05-16 Thread Masaru Nomura
Add a required space before an open parenthesis of if statement
to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 drivers/staging/dgnc/dgnc_tty.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index f0b17c3..c63c355 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -661,7 +661,7 @@ void dgnc_input(struct channel_t *ch)
tp = ch->ch_tun.un_tty;
 
bd = ch->ch_bd;
-   if(!bd || bd->magic != DGNC_BOARD_MAGIC)
+   if (!bd || bd->magic != DGNC_BOARD_MAGIC)
return;
 
DGNC_LOCK(ch->ch_lock, lock_flags);
@@ -1044,7 +1044,7 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
if (qleft < 256) {
/* HWFLOW */
if (ch->ch_digi.digi_flags & CTSPACE || ch->ch_c_cflag & 
CRTSCTS) {
-   if(!(ch->ch_flags & CH_RECEIVER_OFF)) {
+   if (!(ch->ch_flags & CH_RECEIVER_OFF)) {
ch->ch_bd->bd_ops->disable_receiver(ch);
ch->ch_flags |= (CH_RECEIVER_OFF);
DPR_READ(("Internal queue hit hilevel mark 
(%d)! Turning off interrupts.\n",
@@ -3061,7 +3061,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
 
DGNC_LOCK(ch->ch_lock, lock_flags);
 
-   if(((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
+   if (((cmd == TCSBRK) && (!arg)) || (cmd == TCSBRKP)) {
ch->ch_bd->bd_ops->send_break(ch, 250);
}
 
-- 
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: dgnc_tty: Add a required space

2014-05-16 Thread Masaru Nomura
Add a required space before an open parenthesis of if statement
to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_tty.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index f0b17c3..c63c355 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -661,7 +661,7 @@ void dgnc_input(struct channel_t *ch)
tp = ch-ch_tun.un_tty;
 
bd = ch-ch_bd;
-   if(!bd || bd-magic != DGNC_BOARD_MAGIC)
+   if (!bd || bd-magic != DGNC_BOARD_MAGIC)
return;
 
DGNC_LOCK(ch-ch_lock, lock_flags);
@@ -1044,7 +1044,7 @@ void dgnc_check_queue_flow_control(struct channel_t *ch)
if (qleft  256) {
/* HWFLOW */
if (ch-ch_digi.digi_flags  CTSPACE || ch-ch_c_cflag  
CRTSCTS) {
-   if(!(ch-ch_flags  CH_RECEIVER_OFF)) {
+   if (!(ch-ch_flags  CH_RECEIVER_OFF)) {
ch-ch_bd-bd_ops-disable_receiver(ch);
ch-ch_flags |= (CH_RECEIVER_OFF);
DPR_READ((Internal queue hit hilevel mark 
(%d)! Turning off interrupts.\n,
@@ -3061,7 +3061,7 @@ static int dgnc_tty_ioctl(struct tty_struct *tty, 
unsigned int cmd,
 
DGNC_LOCK(ch-ch_lock, lock_flags);
 
-   if(((cmd == TCSBRK)  (!arg)) || (cmd == TCSBRKP)) {
+   if (((cmd == TCSBRK)  (!arg)) || (cmd == TCSBRKP)) {
ch-ch_bd-bd_ops-send_break(ch, 250);
}
 
-- 
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: dgnc_tty: Remove a prohibited space

2014-05-16 Thread Masaru Nomura
Remove a prohibited space before a closed parenthesis of if statement
to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 drivers/staging/dgnc/dgnc_tty.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c
index f0b17c3..13d7a14 100644
--- a/drivers/staging/dgnc/dgnc_tty.c
+++ b/drivers/staging/dgnc/dgnc_tty.c
@@ -1693,7 +1693,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
/*
 * turn off print device when closing print device.
 */
-   if ((un-un_type == DGNC_PRINT)  (ch-ch_flags  CH_PRON) ) {
+   if ((un-un_type == DGNC_PRINT)  (ch-ch_flags  CH_PRON)) {
dgnc_wmove(ch, ch-ch_digi.digi_offstr,
(int) ch-ch_digi.digi_offlen);
ch-ch_flags = ~CH_PRON;
@@ -1753,7 +1753,7 @@ static void dgnc_tty_close(struct tty_struct *tty, struct 
file *file)
/*
 * turn off print device when closing print device.
 */
-   if ((un-un_type == DGNC_PRINT)  (ch-ch_flags  CH_PRON) ) {
+   if ((un-un_type == DGNC_PRINT)  (ch-ch_flags  CH_PRON)) {
dgnc_wmove(ch, ch-ch_digi.digi_offstr,
(int) ch-ch_digi.digi_offlen);
ch-ch_flags = ~CH_PRON;
@@ -1857,7 +1857,7 @@ static int dgnc_maxcps_room(struct tty_struct *tty, int 
bytes_available)
if (un-un_type != DGNC_PRINT)
return bytes_available;
 
-   if (ch-ch_digi.digi_maxcps  0  ch-ch_digi.digi_bufsize  0 ) {
+   if (ch-ch_digi.digi_maxcps  0  ch-ch_digi.digi_bufsize  0) {
int cps_limit = 0;
unsigned long current_time = jiffies;
unsigned long buffer_time = current_time +
-- 
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: lustre: socklnd: Remove unnecessary return brackets

2014-05-15 Thread Masaru Nomura
Remove unnecessary brackets from return statements in socklnd.c,
socklnd.h, socklnd_cb.c and socklnd_lib-linux.c to meet
kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|6 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h|4 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |   82 ++--
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   26 +++
 4 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..1fb1f8e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -459,7 +459,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
 
if (id.nid == LNET_NID_ANY ||
id.pid == LNET_PID_ANY)
-   return (-EINVAL);
+   return -EINVAL;
 
/* Have a brand new peer ready... */
rc = ksocknal_create_peer(, ni, id);
@@ -469,7 +469,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
route = ksocknal_create_route (ipaddr, port);
if (route == NULL) {
ksocknal_peer_decref(peer);
-   return (-ENOMEM);
+   return -ENOMEM;
}
 
write_lock_bh(_data.ksnd_global_lock);
@@ -1951,7 +1951,7 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, 
__u32 netmask)
 
if (ipaddress == 0 ||
netmask == 0)
-   return (-EINVAL);
+   return -EINVAL;
 
write_lock_bh(_data.ksnd_global_lock);
 
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index df2be7a..109a239 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -418,7 +418,7 @@ ksocknal_nid2peerlist (lnet_nid_t nid)
 {
unsigned int hash = ((unsigned int)nid) % 
ksocknal_data.ksnd_peer_hash_size;
 
-   return (_data.ksnd_peers [hash]);
+   return _data.ksnd_peers[hash];
 }
 
 static inline void
@@ -452,7 +452,7 @@ ksocknal_connsock_addref (ksock_conn_t *conn)
}
read_unlock(_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 static inline void
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index bdf95ea..75bd658 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -120,7 +120,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_lib_send_iov(conn, tx);
 
if (rc <= 0)/* sent nothing? */
-   return (rc);
+   return rc;
 
nob = rc;
LASSERT (nob <= tx->tx_resid);
@@ -133,7 +133,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
if (nob < (int) iov->iov_len) {
iov->iov_base = (void *)((char *)iov->iov_base + nob);
iov->iov_len -= nob;
-   return (rc);
+   return rc;
}
 
nob -= iov->iov_len;
@@ -141,7 +141,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
tx->tx_niov--;
} while (nob != 0);
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -158,7 +158,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_lib_send_kiov(conn, tx);
 
if (rc <= 0)/* sent nothing? */
-   return (rc);
+   return rc;
 
nob = rc;
LASSERT (nob <= tx->tx_resid);
@@ -179,7 +179,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
tx->tx_nkiov--;
} while (nob != 0);
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -198,7 +198,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_connsock_addref(conn);
if (rc != 0) {
LASSERT (conn->ksnc_closing);
-   return (-ESHUTDOWN);
+   return -ESHUTDOWN;
}
 
do {
@@ -245,7 +245,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
} while (tx->tx_resid != 0);
 
ksocknal_connsock_decref(conn);
-   return (rc);
+   return rc;
 }
 
 int
@@ -262,7 +262,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
rc = ksocknal_lib_recv_iov(conn);
 
if (rc <= 0)
-   return (rc);
+   return rc;
 
/* received something... */
nob = rc;
@@ -282,7 +282,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
if (nob < (int)iov->iov_len) {
iov->iov_len -=

[PATCH] staging: lustre: socklnd: Remove unnecessary line continuation

2014-05-15 Thread Masaru Nomura
Remove unnecessary line continuation '\' in socklnd.c to meet
kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..a82ac03 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -650,8 +650,7 @@ ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index)
conn = list_entry (ctmp, ksock_conn_t,
   ksnc_list);
ksocknal_conn_addref(conn);
-   read_unlock(_data. \
-ksnd_global_lock);
+   read_unlock(_data.ksnd_global_lock);
return (conn);
}
}
@@ -2299,12 +2298,12 @@ ksocknal_base_shutdown(void)
for (j = 0; j < info->ksi_nthreads_max; j++) {
 
sched = >ksi_scheds[j];
-   LASSERT(list_empty(>\
-  kss_tx_conns));
-   LASSERT(list_empty(>\
-  kss_rx_conns));
-   LASSERT(list_empty(> \
- kss_zombie_noop_txs));
+   LASSERT(list_empty(
+   >kss_tx_conns));
+   LASSERT(list_empty(
+   >kss_rx_conns));
+   LASSERT(list_empty(
+   >kss_zombie_noop_txs));
LASSERT(sched->kss_nconns == 0);
}
}
@@ -2683,8 +2682,8 @@ ksocknal_search_new_ipif(ksock_net_t *net)
list_for_each_entry(tmp, _data.ksnd_nets,
ksnn_list) {
for (j = 0; !found && j < tmp->ksnn_ninterfaces; j++) {
-   char *ifnam2 = >ksnn_interfaces[j].\
-ksni_name[0];
+   char *ifnam2 =
+   >ksnn_interfaces[j].ksni_name[0];
char *colon2 = strchr(ifnam2, ':');
 
if (colon2 != NULL)
-- 
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: lustre: socklnd: Remove unnecessary line continuation

2014-05-15 Thread Masaru Nomura
Remove unnecessary line continuation '\' in socklnd.c to meet
kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|   19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..a82ac03 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -650,8 +650,7 @@ ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index)
conn = list_entry (ctmp, ksock_conn_t,
   ksnc_list);
ksocknal_conn_addref(conn);
-   read_unlock(ksocknal_data. \
-ksnd_global_lock);
+   read_unlock(ksocknal_data.ksnd_global_lock);
return (conn);
}
}
@@ -2299,12 +2298,12 @@ ksocknal_base_shutdown(void)
for (j = 0; j  info-ksi_nthreads_max; j++) {
 
sched = info-ksi_scheds[j];
-   LASSERT(list_empty(sched-\
-  kss_tx_conns));
-   LASSERT(list_empty(sched-\
-  kss_rx_conns));
-   LASSERT(list_empty(sched- \
- kss_zombie_noop_txs));
+   LASSERT(list_empty(
+   sched-kss_tx_conns));
+   LASSERT(list_empty(
+   sched-kss_rx_conns));
+   LASSERT(list_empty(
+   sched-kss_zombie_noop_txs));
LASSERT(sched-kss_nconns == 0);
}
}
@@ -2683,8 +2682,8 @@ ksocknal_search_new_ipif(ksock_net_t *net)
list_for_each_entry(tmp, ksocknal_data.ksnd_nets,
ksnn_list) {
for (j = 0; !found  j  tmp-ksnn_ninterfaces; j++) {
-   char *ifnam2 = tmp-ksnn_interfaces[j].\
-ksni_name[0];
+   char *ifnam2 =
+   tmp-ksnn_interfaces[j].ksni_name[0];
char *colon2 = strchr(ifnam2, ':');
 
if (colon2 != NULL)
-- 
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: lustre: socklnd: Remove unnecessary return brackets

2014-05-15 Thread Masaru Nomura
Remove unnecessary brackets from return statements in socklnd.c,
socklnd.h, socklnd_cb.c and socklnd_lib-linux.c to meet
kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|6 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd.h|4 +-
 .../staging/lustre/lnet/klnds/socklnd/socklnd_cb.c |   82 ++--
 .../lustre/lnet/klnds/socklnd/socklnd_lib-linux.c  |   26 +++
 4 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index a391d13..1fb1f8e 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -459,7 +459,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
 
if (id.nid == LNET_NID_ANY ||
id.pid == LNET_PID_ANY)
-   return (-EINVAL);
+   return -EINVAL;
 
/* Have a brand new peer ready... */
rc = ksocknal_create_peer(peer, ni, id);
@@ -469,7 +469,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
route = ksocknal_create_route (ipaddr, port);
if (route == NULL) {
ksocknal_peer_decref(peer);
-   return (-ENOMEM);
+   return -ENOMEM;
}
 
write_lock_bh(ksocknal_data.ksnd_global_lock);
@@ -1951,7 +1951,7 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, 
__u32 netmask)
 
if (ipaddress == 0 ||
netmask == 0)
-   return (-EINVAL);
+   return -EINVAL;
 
write_lock_bh(ksocknal_data.ksnd_global_lock);
 
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
index df2be7a..109a239 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.h
@@ -418,7 +418,7 @@ ksocknal_nid2peerlist (lnet_nid_t nid)
 {
unsigned int hash = ((unsigned int)nid) % 
ksocknal_data.ksnd_peer_hash_size;
 
-   return (ksocknal_data.ksnd_peers [hash]);
+   return ksocknal_data.ksnd_peers[hash];
 }
 
 static inline void
@@ -452,7 +452,7 @@ ksocknal_connsock_addref (ksock_conn_t *conn)
}
read_unlock(ksocknal_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 static inline void
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
index bdf95ea..75bd658 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_cb.c
@@ -120,7 +120,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_lib_send_iov(conn, tx);
 
if (rc = 0)/* sent nothing? */
-   return (rc);
+   return rc;
 
nob = rc;
LASSERT (nob = tx-tx_resid);
@@ -133,7 +133,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
if (nob  (int) iov-iov_len) {
iov-iov_base = (void *)((char *)iov-iov_base + nob);
iov-iov_len -= nob;
-   return (rc);
+   return rc;
}
 
nob -= iov-iov_len;
@@ -141,7 +141,7 @@ ksocknal_send_iov (ksock_conn_t *conn, ksock_tx_t *tx)
tx-tx_niov--;
} while (nob != 0);
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -158,7 +158,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_lib_send_kiov(conn, tx);
 
if (rc = 0)/* sent nothing? */
-   return (rc);
+   return rc;
 
nob = rc;
LASSERT (nob = tx-tx_resid);
@@ -179,7 +179,7 @@ ksocknal_send_kiov (ksock_conn_t *conn, ksock_tx_t *tx)
tx-tx_nkiov--;
} while (nob != 0);
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -198,7 +198,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
rc = ksocknal_connsock_addref(conn);
if (rc != 0) {
LASSERT (conn-ksnc_closing);
-   return (-ESHUTDOWN);
+   return -ESHUTDOWN;
}
 
do {
@@ -245,7 +245,7 @@ ksocknal_transmit (ksock_conn_t *conn, ksock_tx_t *tx)
} while (tx-tx_resid != 0);
 
ksocknal_connsock_decref(conn);
-   return (rc);
+   return rc;
 }
 
 int
@@ -262,7 +262,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
rc = ksocknal_lib_recv_iov(conn);
 
if (rc = 0)
-   return (rc);
+   return rc;
 
/* received something... */
nob = rc;
@@ -282,7 +282,7 @@ ksocknal_recv_iov (ksock_conn_t *conn)
if (nob  (int)iov-iov_len) {
iov-iov_len -= nob

[PATCH] staging: lustre: socklnd: Fix indenting

2014-05-14 Thread Masaru Nomura
Fixed indenting of if statement in socklnd.c to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..b3c4fc3 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -2514,7 +2514,8 @@ ksocknal_debug_peerhash (lnet_ni_t *ni)
list_for_each (tmp, _data.ksnd_peers[i]) {
peer = list_entry (tmp, ksock_peer_t, ksnp_list);
 
-   if (peer->ksnp_ni == ni) break;
+   if (peer->ksnp_ni == ni)
+   break;
 
peer = NULL;
}
-- 
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: lustre: socklnd: Add a required space

2014-05-14 Thread Masaru Nomura
Added a required space before open brace and parenthsis
in socklnd.c to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..adcd688 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1571,7 +1571,7 @@ ksocknal_terminate_conn (ksock_conn_t *conn)
conn->ksnc_tx_ready = 1;
 
if (!conn->ksnc_tx_scheduled &&
-   !list_empty(>ksnc_tx_queue)){
+   !list_empty(>ksnc_tx_queue)) {
list_add_tail (>ksnc_tx_list,
   >kss_tx_conns);
conn->ksnc_tx_scheduled = 1;
@@ -2098,7 +2098,7 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
struct libcfs_ioctl_data *data = arg;
int rc;
 
-   switch(cmd) {
+   switch (cmd) {
case IOC_LIBCFS_GET_INTERFACE: {
ksock_net_t   *net = ni->ni_data;
ksock_interface_t *iface;
-- 
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: lustre: socklnd: Remove unnecessary () from return statement

2014-05-14 Thread Masaru Nomura
Remove unnecessary brackets from return statements in socklnd.c
to meet kernel coding style.

Signed-off-by: Masaru Nomura 
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|   42 ++--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..b42d283 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -58,10 +58,10 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
iface = >ksnn_interfaces[i];
 
if (iface->ksni_ipaddr == ip)
-   return (iface);
+   return iface;
}
 
-   return (NULL);
+   return NULL;
 }
 
 ksock_route_t *
@@ -71,7 +71,7 @@ ksocknal_create_route (__u32 ipaddr, int port)
 
LIBCFS_ALLOC (route, sizeof (*route));
if (route == NULL)
-   return (NULL);
+   return NULL;
 
atomic_set (>ksnr_refcount, 1);
route->ksnr_peer = NULL;
@@ -85,7 +85,7 @@ ksocknal_create_route (__u32 ipaddr, int port)
route->ksnr_conn_count = 0;
route->ksnr_share_count = 0;
 
-   return (route);
+   return route;
 }
 
 void
@@ -197,9 +197,9 @@ ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t 
id)
CDEBUG(D_NET, "got peer [%p] -> %s (%d)\n",
   peer, libcfs_id2str(id),
   atomic_read(>ksnp_refcount));
-   return (peer);
+   return peer;
}
-   return (NULL);
+   return NULL;
 }
 
 ksock_peer_t *
@@ -213,7 +213,7 @@ ksocknal_find_peer (lnet_ni_t *ni, lnet_process_id_t id)
ksocknal_peer_addref(peer);
read_unlock(_data.ksnd_global_lock);
 
-   return (peer);
+   return peer;
 }
 
 void
@@ -318,7 +318,7 @@ ksocknal_get_peer_info (lnet_ni_t *ni, int index,
}
  out:
read_unlock(_data.ksnd_global_lock);
-   return (rc);
+   return rc;
 }
 
 void
@@ -506,7 +506,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
 
write_unlock_bh(_data.ksnd_global_lock);
 
-   return (0);
+   return 0;
 }
 
 void
@@ -620,7 +620,7 @@ ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ip)
 
ksocknal_txlist_done(ni, , 1);
 
-   return (rc);
+   return rc;
 }
 
 ksock_conn_t *
@@ -652,13 +652,13 @@ ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index)
ksocknal_conn_addref(conn);
read_unlock(_data. \
 ksnd_global_lock);
-   return (conn);
+   return conn;
}
}
}
 
read_unlock(_data.ksnd_global_lock);
-   return (NULL);
+   return NULL;
 }
 
 ksock_sched_t *
@@ -709,7 +709,7 @@ ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs)
}
 
read_unlock(_data.ksnd_global_lock);
-   return (nip);
+   return nip;
 }
 
 int
@@ -741,7 +741,7 @@ ksocknal_match_peerip (ksock_interface_t *iface, __u32 
*ips, int nips)
}
 
LASSERT (best >= 0);
-   return (best);
+   return best;
 }
 
 int
@@ -847,7 +847,7 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int 
n_peerips)
 
write_unlock_bh(global_lock);
 
-   return (n_ips);
+   return n_ips;
 }
 
 void
@@ -1709,7 +1709,7 @@ ksocknal_close_peer_conns_locked (ksock_peer_t *peer, 
__u32 ipaddr, int why)
}
}
 
-   return (count);
+   return count;
 }
 
 int
@@ -1725,7 +1725,7 @@ ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int 
why)
 
write_unlock_bh(_data.ksnd_global_lock);
 
-   return (count);
+   return count;
 }
 
 int
@@ -1766,7 +1766,7 @@ ksocknal_close_matching_conns (lnet_process_id_t id, 
__u32 ipaddr)
 
/* wildcards always succeed */
if (id.nid == LNET_NID_ANY || id.pid == LNET_PID_ANY || ipaddr == 0)
-   return (0);
+   return 0;
 
if (count == 0)
return -ENOENT;
@@ -1937,7 +1937,7 @@ ksocknal_push (lnet_ni_t *ni, lnet_process_id_t id)
 
}
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -1999,7 +1999,7 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, 
__u32 netmask)
 
write_unlock_bh(_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 void
@@ -2088,7 +2088,7 @@ ksocknal_del_interface(lnet_ni_t *ni, __u32 ipaddress)
 
write_unlock_bh(_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 int
-- 
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  ht

[PATCH] staging: lustre: socklnd: Remove unnecessary () from return statement

2014-05-14 Thread Masaru Nomura
Remove unnecessary brackets from return statements in socklnd.c
to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|   42 ++--
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..b42d283 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -58,10 +58,10 @@ ksocknal_ip2iface(lnet_ni_t *ni, __u32 ip)
iface = net-ksnn_interfaces[i];
 
if (iface-ksni_ipaddr == ip)
-   return (iface);
+   return iface;
}
 
-   return (NULL);
+   return NULL;
 }
 
 ksock_route_t *
@@ -71,7 +71,7 @@ ksocknal_create_route (__u32 ipaddr, int port)
 
LIBCFS_ALLOC (route, sizeof (*route));
if (route == NULL)
-   return (NULL);
+   return NULL;
 
atomic_set (route-ksnr_refcount, 1);
route-ksnr_peer = NULL;
@@ -85,7 +85,7 @@ ksocknal_create_route (__u32 ipaddr, int port)
route-ksnr_conn_count = 0;
route-ksnr_share_count = 0;
 
-   return (route);
+   return route;
 }
 
 void
@@ -197,9 +197,9 @@ ksocknal_find_peer_locked (lnet_ni_t *ni, lnet_process_id_t 
id)
CDEBUG(D_NET, got peer [%p] - %s (%d)\n,
   peer, libcfs_id2str(id),
   atomic_read(peer-ksnp_refcount));
-   return (peer);
+   return peer;
}
-   return (NULL);
+   return NULL;
 }
 
 ksock_peer_t *
@@ -213,7 +213,7 @@ ksocknal_find_peer (lnet_ni_t *ni, lnet_process_id_t id)
ksocknal_peer_addref(peer);
read_unlock(ksocknal_data.ksnd_global_lock);
 
-   return (peer);
+   return peer;
 }
 
 void
@@ -318,7 +318,7 @@ ksocknal_get_peer_info (lnet_ni_t *ni, int index,
}
  out:
read_unlock(ksocknal_data.ksnd_global_lock);
-   return (rc);
+   return rc;
 }
 
 void
@@ -506,7 +506,7 @@ ksocknal_add_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ipaddr, int port)
 
write_unlock_bh(ksocknal_data.ksnd_global_lock);
 
-   return (0);
+   return 0;
 }
 
 void
@@ -620,7 +620,7 @@ ksocknal_del_peer (lnet_ni_t *ni, lnet_process_id_t id, 
__u32 ip)
 
ksocknal_txlist_done(ni, zombies, 1);
 
-   return (rc);
+   return rc;
 }
 
 ksock_conn_t *
@@ -652,13 +652,13 @@ ksocknal_get_conn_by_idx (lnet_ni_t *ni, int index)
ksocknal_conn_addref(conn);
read_unlock(ksocknal_data. \
 ksnd_global_lock);
-   return (conn);
+   return conn;
}
}
}
 
read_unlock(ksocknal_data.ksnd_global_lock);
-   return (NULL);
+   return NULL;
 }
 
 ksock_sched_t *
@@ -709,7 +709,7 @@ ksocknal_local_ipvec (lnet_ni_t *ni, __u32 *ipaddrs)
}
 
read_unlock(ksocknal_data.ksnd_global_lock);
-   return (nip);
+   return nip;
 }
 
 int
@@ -741,7 +741,7 @@ ksocknal_match_peerip (ksock_interface_t *iface, __u32 
*ips, int nips)
}
 
LASSERT (best = 0);
-   return (best);
+   return best;
 }
 
 int
@@ -847,7 +847,7 @@ ksocknal_select_ips(ksock_peer_t *peer, __u32 *peerips, int 
n_peerips)
 
write_unlock_bh(global_lock);
 
-   return (n_ips);
+   return n_ips;
 }
 
 void
@@ -1709,7 +1709,7 @@ ksocknal_close_peer_conns_locked (ksock_peer_t *peer, 
__u32 ipaddr, int why)
}
}
 
-   return (count);
+   return count;
 }
 
 int
@@ -1725,7 +1725,7 @@ ksocknal_close_conn_and_siblings (ksock_conn_t *conn, int 
why)
 
write_unlock_bh(ksocknal_data.ksnd_global_lock);
 
-   return (count);
+   return count;
 }
 
 int
@@ -1766,7 +1766,7 @@ ksocknal_close_matching_conns (lnet_process_id_t id, 
__u32 ipaddr)
 
/* wildcards always succeed */
if (id.nid == LNET_NID_ANY || id.pid == LNET_PID_ANY || ipaddr == 0)
-   return (0);
+   return 0;
 
if (count == 0)
return -ENOENT;
@@ -1937,7 +1937,7 @@ ksocknal_push (lnet_ni_t *ni, lnet_process_id_t id)
 
}
 
-   return (rc);
+   return rc;
 }
 
 int
@@ -1999,7 +1999,7 @@ ksocknal_add_interface(lnet_ni_t *ni, __u32 ipaddress, 
__u32 netmask)
 
write_unlock_bh(ksocknal_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 void
@@ -2088,7 +2088,7 @@ ksocknal_del_interface(lnet_ni_t *ni, __u32 ipaddress)
 
write_unlock_bh(ksocknal_data.ksnd_global_lock);
 
-   return (rc);
+   return rc;
 }
 
 int
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message

[PATCH] staging: lustre: socklnd: Add a required space

2014-05-14 Thread Masaru Nomura
Added a required space before open brace and parenthsis
in socklnd.c to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..adcd688 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -1571,7 +1571,7 @@ ksocknal_terminate_conn (ksock_conn_t *conn)
conn-ksnc_tx_ready = 1;
 
if (!conn-ksnc_tx_scheduled 
-   !list_empty(conn-ksnc_tx_queue)){
+   !list_empty(conn-ksnc_tx_queue)) {
list_add_tail (conn-ksnc_tx_list,
   sched-kss_tx_conns);
conn-ksnc_tx_scheduled = 1;
@@ -2098,7 +2098,7 @@ ksocknal_ctl(lnet_ni_t *ni, unsigned int cmd, void *arg)
struct libcfs_ioctl_data *data = arg;
int rc;
 
-   switch(cmd) {
+   switch (cmd) {
case IOC_LIBCFS_GET_INTERFACE: {
ksock_net_t   *net = ni-ni_data;
ksock_interface_t *iface;
-- 
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: lustre: socklnd: Fix indenting

2014-05-14 Thread Masaru Nomura
Fixed indenting of if statement in socklnd.c to meet kernel coding style.

Signed-off-by: Masaru Nomura massa.nom...@gmail.com
---
 .../staging/lustre/lnet/klnds/socklnd/socklnd.c|3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c 
b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
index 21d36ee..b3c4fc3 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd.c
@@ -2514,7 +2514,8 @@ ksocknal_debug_peerhash (lnet_ni_t *ni)
list_for_each (tmp, ksocknal_data.ksnd_peers[i]) {
peer = list_entry (tmp, ksock_peer_t, ksnp_list);
 
-   if (peer-ksnp_ni == ni) break;
+   if (peer-ksnp_ni == ni)
+   break;
 
peer = NULL;
}
-- 
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/