[PATCH] fs: nfsd:xdr4.h: add missing conditional group CONFIG_NFSD_V3

2015-02-12 Thread Bas Peters
This patch adds a missing conditional group that has been causing build
breakages due to undefined struct members being referenced when
CONFIG_NFSD_v3 is not set.

This patch applies against linux-next.

Signed-off-by: Bas Peters 
---
 fs/nfsd/xdr4.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 0bda93e..5d1597f 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -630,9 +630,11 @@ void warn_on_nonidempotent_op(struct nfsd4_op *op);
 static inline void
 set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
 {
+   cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode);
+
+#ifdef CONFIG_NFSD_V3
BUG_ON(!fhp->fh_pre_saved);
cinfo->atomic = fhp->fh_post_saved;
-   cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode);
 
cinfo->before_change = fhp->fh_pre_change;
cinfo->after_change = fhp->fh_post_change;
@@ -640,7 +642,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct 
svc_fh *fhp)
cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec;
cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec;
cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec;
-
+#endif
 }
 
 int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
-- 
2.1.0

--
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] fs: nfsd:xdr4.h: add missing conditional group CONFIG_NFSD_V3

2015-02-12 Thread Bas Peters
This patch adds a missing conditional group that has been causing build
breakages due to undefined struct members being referenced when
CONFIG_NFSD_v3 is not set.

This patch applies against linux-next.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 fs/nfsd/xdr4.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
index 0bda93e..5d1597f 100644
--- a/fs/nfsd/xdr4.h
+++ b/fs/nfsd/xdr4.h
@@ -630,9 +630,11 @@ void warn_on_nonidempotent_op(struct nfsd4_op *op);
 static inline void
 set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp)
 {
+   cinfo-change_supported = IS_I_VERSION(fhp-fh_dentry-d_inode);
+
+#ifdef CONFIG_NFSD_V3
BUG_ON(!fhp-fh_pre_saved);
cinfo-atomic = fhp-fh_post_saved;
-   cinfo-change_supported = IS_I_VERSION(fhp-fh_dentry-d_inode);
 
cinfo-before_change = fhp-fh_pre_change;
cinfo-after_change = fhp-fh_post_change;
@@ -640,7 +642,7 @@ set_change_info(struct nfsd4_change_info *cinfo, struct 
svc_fh *fhp)
cinfo-before_ctime_nsec = fhp-fh_pre_ctime.tv_nsec;
cinfo-after_ctime_sec = fhp-fh_post_attr.ctime.tv_sec;
cinfo-after_ctime_nsec = fhp-fh_post_attr.ctime.tv_nsec;
-
+#endif
 }
 
 int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *);
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
Markus,

2015-02-11 13:18 GMT+01:00 SF Markus Elfring :
>>> https://lkml.org/lkml/2014/10/31/606
>>> http://article.gmane.org/gmane.linux.kernel/1818924
>>> https://systeme.lip6.fr/pipermail/cocci/2014-October/001321.html
>>
>> Oh, I see you already made the exact same change.
>
> Would you like to add any tags to my update suggestion?

No, it's fine, I should've checked before submitting the patch.

>
> Regards,
> Markus
--
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] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

2015-02-11 Thread Bas Peters
2015-02-11 13:10 GMT+01:00 SF Markus Elfring :
>> kfree() checks its argument. It is therefore unnecessary to do this twice.
>>
>> This issue was detected using Coccinelle.
>
> Would you like to integrate my update suggestion 'fs-DLM: Deletion of
> unnecessary checks before the function call "kfree"'?
> https://lkml.org/lkml/2014/11/29/88
> http://article.gmane.org/gmane.linux.kernel/1840524
> https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg778279.html

I'll drop that too :)

> Regards,
> Markus
>
--
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] fs: proc: inode.c: remove unnecessary type cast

2015-02-11 Thread Bas Peters
Issue was detected using Coccinelle.

Signed-off-by: Bas Peters 
---
 fs/proc/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 8420a2f..e16ee87 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -57,7 +57,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
struct proc_inode *ei;
struct inode *inode;
 
-   ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, 
GFP_KERNEL);
+   ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
if (!ei)
return NULL;
ei->pid = NULL;
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
2015-02-11 12:30 GMT+01:00 SF Markus Elfring :
>> kfree checks whether the pointer it is passed is NULL. The two foregoing
>> checks are therefore unnecessary.
>>
>> This issue was detected using Coccinelle.
>
> Would you like to integrate my update suggestion "btrfs: Deletion of
> unnecessary checks before six function calls"?
> https://lkml.org/lkml/2014/10/31/606
> http://article.gmane.org/gmane.linux.kernel/1818924
> https://systeme.lip6.fr/pipermail/cocci/2014-October/001321.html

Oh, I see you already made the exact same change.
I'll just drop my patch in that case.

>
> Regards,
> Markus
>
--
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] fs: ufs: super.c: remove unnecessary casting of value.

2015-02-11 Thread Bas Peters
It is not necessary to cast the value returned by kmem_cache_alloc(),
thus it can be deleted.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters 
---
 fs/ufs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index da73801..1e4fbf7 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1415,7 +1415,7 @@ static struct kmem_cache * ufs_inode_cachep;
 static struct inode *ufs_alloc_inode(struct super_block *sb)
 {
struct ufs_inode_info *ei;
-   ei = (struct ufs_inode_info *)kmem_cache_alloc(ufs_inode_cachep, 
GFP_NOFS);
+   ei = kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
if (!ei)
return NULL;
ei->vfs_inode.i_version = 1;
-- 
2.1.0

--
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] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

2015-02-11 Thread Bas Peters
kfree() checks its argument. It is therefore unnecessary to do this
twice.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters 
---
 fs/dlm/lockspace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index f3e7278..b660b93 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -674,8 +674,7 @@ static int new_lockspace(const char *name, const char 
*cluster,
  out_lkbidr:
idr_destroy(>ls_lkbidr);
for (i = 0; i < DLM_REMOVE_NAMES_MAX; i++) {
-   if (ls->ls_remove_names[i])
-   kfree(ls->ls_remove_names[i]);
+   kfree(ls->ls_remove_names[i]);
}
  out_rsbtbl:
vfree(ls->ls_rsbtbl);
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
kfree checks whether the pointer it is passed is NULL. The two foregoing
checks are therefore unnecessary.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters 
---
 fs/btrfs/free-space-cache.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index d6c03f7..7d2d817 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1976,8 +1976,7 @@ new_bitmap:
 
 out:
if (info) {
-   if (info->bitmap)
-   kfree(info->bitmap);
+   kfree(info->bitmap);
kmem_cache_free(btrfs_free_space_cachep, info);
}
 
@@ -3427,8 +3426,7 @@ again:
 
if (info)
kmem_cache_free(btrfs_free_space_cachep, info);
-   if (map)
-   kfree(map);
+   kfree(map);
return 0;
 }
 
-- 
2.1.0

--
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] net: wireless: libertas: debugfs.c: remove unnecessary check before calling debugfs_remove

2015-02-11 Thread Bas Peters
Debugfs_remove will check for error or NULL for us, so it is not
necessary to do this here.

Signed-off-by: Bas Peters 
---
 drivers/net/wireless/libertas/debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/debugfs.c 
b/drivers/net/wireless/libertas/debugfs.c
index cc6a0a5..26cbf1d 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -742,8 +742,7 @@ void lbs_debugfs_init(void)
 
 void lbs_debugfs_remove(void)
 {
-   if (lbs_dir)
-debugfs_remove(lbs_dir);
+   debugfs_remove(lbs_dir);
 }
 
 void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
-- 
2.1.0

--
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] net: wireless: libertas: debugfs.c: remove unnecessary check before calling debugfs_remove

2015-02-11 Thread Bas Peters
Debugfs_remove will check for error or NULL for us, so it is not
necessary to do this here.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/net/wireless/libertas/debugfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/wireless/libertas/debugfs.c 
b/drivers/net/wireless/libertas/debugfs.c
index cc6a0a5..26cbf1d 100644
--- a/drivers/net/wireless/libertas/debugfs.c
+++ b/drivers/net/wireless/libertas/debugfs.c
@@ -742,8 +742,7 @@ void lbs_debugfs_init(void)
 
 void lbs_debugfs_remove(void)
 {
-   if (lbs_dir)
-debugfs_remove(lbs_dir);
+   debugfs_remove(lbs_dir);
 }
 
 void lbs_debugfs_init_one(struct lbs_private *priv, struct net_device *dev)
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
kfree checks whether the pointer it is passed is NULL. The two foregoing
checks are therefore unnecessary.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 fs/btrfs/free-space-cache.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index d6c03f7..7d2d817 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -1976,8 +1976,7 @@ new_bitmap:
 
 out:
if (info) {
-   if (info-bitmap)
-   kfree(info-bitmap);
+   kfree(info-bitmap);
kmem_cache_free(btrfs_free_space_cachep, info);
}
 
@@ -3427,8 +3426,7 @@ again:
 
if (info)
kmem_cache_free(btrfs_free_space_cachep, info);
-   if (map)
-   kfree(map);
+   kfree(map);
return 0;
 }
 
-- 
2.1.0

--
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] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

2015-02-11 Thread Bas Peters
kfree() checks its argument. It is therefore unnecessary to do this
twice.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 fs/dlm/lockspace.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index f3e7278..b660b93 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -674,8 +674,7 @@ static int new_lockspace(const char *name, const char 
*cluster,
  out_lkbidr:
idr_destroy(ls-ls_lkbidr);
for (i = 0; i  DLM_REMOVE_NAMES_MAX; i++) {
-   if (ls-ls_remove_names[i])
-   kfree(ls-ls_remove_names[i]);
+   kfree(ls-ls_remove_names[i]);
}
  out_rsbtbl:
vfree(ls-ls_rsbtbl);
-- 
2.1.0

--
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] fs: ufs: super.c: remove unnecessary casting of value.

2015-02-11 Thread Bas Peters
It is not necessary to cast the value returned by kmem_cache_alloc(),
thus it can be deleted.

This issue was detected using Coccinelle.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 fs/ufs/super.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/ufs/super.c b/fs/ufs/super.c
index da73801..1e4fbf7 100644
--- a/fs/ufs/super.c
+++ b/fs/ufs/super.c
@@ -1415,7 +1415,7 @@ static struct kmem_cache * ufs_inode_cachep;
 static struct inode *ufs_alloc_inode(struct super_block *sb)
 {
struct ufs_inode_info *ei;
-   ei = (struct ufs_inode_info *)kmem_cache_alloc(ufs_inode_cachep, 
GFP_NOFS);
+   ei = kmem_cache_alloc(ufs_inode_cachep, GFP_NOFS);
if (!ei)
return NULL;
ei-vfs_inode.i_version = 1;
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
2015-02-11 12:30 GMT+01:00 SF Markus Elfring elfr...@users.sourceforge.net:
 kfree checks whether the pointer it is passed is NULL. The two foregoing
 checks are therefore unnecessary.

 This issue was detected using Coccinelle.

 Would you like to integrate my update suggestion btrfs: Deletion of
 unnecessary checks before six function calls?
 https://lkml.org/lkml/2014/10/31/606
 http://article.gmane.org/gmane.linux.kernel/1818924
 https://systeme.lip6.fr/pipermail/cocci/2014-October/001321.html

Oh, I see you already made the exact same change.
I'll just drop my patch in that case.


 Regards,
 Markus

--
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] fs: dlm: lockspace.c: removal of unnecessary check before calling kfree()

2015-02-11 Thread Bas Peters
2015-02-11 13:10 GMT+01:00 SF Markus Elfring elfr...@users.sourceforge.net:
 kfree() checks its argument. It is therefore unnecessary to do this twice.

 This issue was detected using Coccinelle.

 Would you like to integrate my update suggestion 'fs-DLM: Deletion of
 unnecessary checks before the function call kfree'?
 https://lkml.org/lkml/2014/11/29/88
 http://article.gmane.org/gmane.linux.kernel/1840524
 https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg778279.html

I'll drop that too :)

 Regards,
 Markus

--
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] fs: proc: inode.c: remove unnecessary type cast

2015-02-11 Thread Bas Peters
Issue was detected using Coccinelle.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 fs/proc/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 8420a2f..e16ee87 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -57,7 +57,7 @@ static struct inode *proc_alloc_inode(struct super_block *sb)
struct proc_inode *ei;
struct inode *inode;
 
-   ei = (struct proc_inode *)kmem_cache_alloc(proc_inode_cachep, 
GFP_KERNEL);
+   ei = kmem_cache_alloc(proc_inode_cachep, GFP_KERNEL);
if (!ei)
return NULL;
ei-pid = NULL;
-- 
2.1.0

--
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] fs: btrfs: free-space-cache.c: remove two unnecessary checks before calling kfree()

2015-02-11 Thread Bas Peters
Markus,

2015-02-11 13:18 GMT+01:00 SF Markus Elfring elfr...@users.sourceforge.net:
 https://lkml.org/lkml/2014/10/31/606
 http://article.gmane.org/gmane.linux.kernel/1818924
 https://systeme.lip6.fr/pipermail/cocci/2014-October/001321.html

 Oh, I see you already made the exact same change.

 Would you like to add any tags to my update suggestion?

No, it's fine, I should've checked before submitting the patch.


 Regards,
 Markus
--
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 2/6] staging: rtl8188eu: hal: removed code indent error

2015-02-10 Thread Bas Peters
>> @@ -101,8 +101,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
>> *adapt, u8 *powerlevel)
>>   ptr++;
>>   }
>>   }
>> - rtl88eu_dm_txpower_track_adjust(_data->odmpriv, 1, ,
>> - _value);
>> + rtl88eu_dm_txpower_track_adjust(_data->odmpriv, 1, , 
>> _value);
> you are introducing one warning to fix one error. line over 80 character.

Isn't that warning more of a guideline, rather than an actual warning?
This seems more readable than:

- rtl88eu_dm_txpower_track_adjust(_data->odmpriv, 1, ,
- _value);
+ rtl88eu_dm_txpower_track_adjust(_data->odmpriv, 1,
+
 , _value);

Bas
--
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 2/6] staging: rtl8188eu: hal: removed code indent error

2015-02-10 Thread Bas Peters
 @@ -101,8 +101,7 @@ void rtl88eu_phy_rf6052_set_cck_txpower(struct adapter 
 *adapt, u8 *powerlevel)
   ptr++;
   }
   }
 - rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction,
 - pwrtrac_value);
 + rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction, 
 pwrtrac_value);
 you are introducing one warning to fix one error. line over 80 character.

Isn't that warning more of a guideline, rather than an actual warning?
This seems more readable than:

- rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1, direction,
- pwrtrac_value);
+ rtl88eu_dm_txpower_track_adjust(hal_data-odmpriv, 1,
+
 direction, pwrtrac_value);

Bas
--
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/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-08 12:15 GMT+01:00 Sergei Shtylyov :
> Hello.
>
> On 2/8/2015 12:55 AM, Bas Peters wrote:
>
>> This patch removes assignment of variables in if conditions,
>> as specified in CodingStyle.
>
>
>> Signed-off-by: Bas Peters 
>> ---
>>   drivers/usb/core/hcd.c | 15 ++-
>>   1 file changed, 10 insertions(+), 5 deletions(-)
>
>
>> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
>> index 11cee55..37c40d1 100644
>> --- a/drivers/usb/core/hcd.c
>> +++ b/drivers/usb/core/hcd.c
>
> [...]
>>
>> @@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
>> /* "reset" is misnamed; its role is now one-time init. the
>> controller
>>  * should already have been reset (and boot firmware kicked off
>> etc).
>>  */
>> -   if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0)
>> {
>> +   retval = hcd->driver->reset(hcd);
>
>
>This will crash if 'hcd->driver->reset' is NULL (which is only checked
> below).
>
>> +   if (hcd->driver->reset && retval < 0) {
>
>
>It wasn't equivalent change anyway as the right part of && is only
> executed if the left part is true.

I'll fix this and your other comments and resend.

>
> WBR, Sergei
>

With kind regards,

Bas
--
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: Kill I4L?

2015-02-09 Thread Bas Peters
2015-02-09 0:59 GMT+01:00 Karsten Keil :
> Am 08.02.2015 um 20:47 schrieb Tilman Schmidt:
>> Am 07.02.2015 um 21:43 schrieb Paul Bolle:
>>> On Sat, 2015-02-07 at 11:19 -0800, Joe Perches wrote:
 Does anyone still use these cards?
>>
>>> 0) Good question.
>>
>> I very much doubt it. It was an ISA card, not even PnP. I'd imagine
>> any systems of that kind would be retired by now.
>>
>
> Agreed in general, but I know people still running such ISA based
> machines - mostly PC in industrial environments with ISDN uplinks for
> service and maintenance.
> And I4L is also used in some vending machines for card authorization so
> far I know.
> They usually using old kernels (<3.0) so they are not directly affected
> if this will be removed.
>
>>> 2) Broader picture: if I remember correctly there are now four
>>> different flavors of ISDN in the kernel: - really old: pre-i4l
>>
>> I don't think any traces of that are still present in current kernel
>> releases. It should all have been left behind on the switch to 2.6.
>>
>
> Yes.
>
>>> - very old: i4l - just old: CAPI - not so old: mISDN
>>
>> Those are the in-tree ones. To make matters worse, the Asterisk people
>> invented three more (Zaptel, DAHDI and vISDN) which are maintained
>> out-of-tree. Apparently they weren't satisfied with any the in-tree
>> ones and didn't feel like helping to improve one of them to match
>> their needs.
>>
>>> [snip] So the current ISDN situation is a bit messy.
>>
>> That's putting it mildly.
>>
>>> Tilman might be able to provide a clearer, and maybe less grumpy,
>>> summary of the current situation.
>>
>> Don't know about either. ;-)
>>
>>> [M]aybe we should consider, say, removing i4l and pre i4l and see
>>> who complains. That might be a rude thing to do. So perhaps the
>>> various ISDN flavors should be left alone until ... what exactly?
>>
>> I'd support that step. I don't think it'll hurt anyone because the
>> cards supported by i4l are mostly ISA cards anyway. The only exceptions
>> are the HiSax family which is now supported by mISDN, and the Hypercope
>> family which is supported by CAPI.
>>
>> In the past we had Documentation/feature-removal-schedule.txt for
>> announcing removals like that but Linus shot that down on 2012-10-01
>> (commit 9c0ece069b32e8e122aea71aa47181c10eb85ba7) so I guess
>> somebody could just submit a patch series starting with
>>
>> --- a/drivers/isdn/Kconfig
>> +++ b/drivers/isdn/Kconfig
>> @@ -20,25 +20,6 @@ menuconfig ISDN
>>
>>  if ISDN
>>
>> -menuconfig ISDN_I4L
>> -   tristate "Old ISDN4Linux (deprecated)"
>> -   depends on TTY
>> -   ---help---
>> - This driver allows you to use an ISDN adapter for networking
>> - connections and as dialin/out device.  The isdn-tty's have a
>> built
>> - in AT-compatible modem emulator.  Network devices support
>> autodial,
>> - channel-bundling, callback and caller-authentication without
>> having
>> - a daemon running.  A reduced T.70 protocol is supported with
>> tty's
>> - suitable for German BTX.  On D-Channel, the protocols EDSS1
>> - (Euro-ISDN) and 1TR6 (German style) are supported.  See
>> -  for more information.
>> -
>> - ISDN support in the linux kernel is moving towards a new API,
>> - called CAPI (Common ISDN Application Programming Interface).
>> - Therefore the old ISDN4Linux layer will eventually become
>> obsolete.
>> - It is still available, though, for use with adapters that
>> are not
>> - supported by the new CAPI subsystem yet.
>> -
>>  source "drivers/isdn/i4l/Kconfig"
>>
>>  menuconfig ISDN_CAPI
>>
>> and working its way from that to remove anything that's become
>> unreachable.
>>
>> Shall I?
>>
>
> But I4L is still the default in some Distros, so we should allow a
> warning period. But again, I'm fine with this to do it.

Is there any explicit reason why 'dead' drivers that might still have
some users ought to be removed?
Does it hurt anyone to leave the code in there, despite it barely
being used? We're not talking about
a particularly huge driver here, either.

>
> Karsten
--
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 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-09 3:15 GMT+01:00 Peter Chen :
> On Sat, Feb 07, 2015 at 10:55:01PM +0100, Bas Peters wrote:
>> This patch removes assignment of variables in if conditions in
>> accordance witht the CodingStyle.
>
> %s/witht/with

Typo, my bad. Should I fix the commit message and resend?

>
>>
>> Signed-off-by: Bas Peters 
>> ---
>>  drivers/usb/core/devio.c | 15 ++-
>>  1 file changed, 10 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
>> index 0b59731..ea3c737 100644
>> --- a/drivers/usb/core/devio.c
>> +++ b/drivers/usb/core/devio.c
>> @@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
>> __user *arg)
>>   ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
>>   if (ret)
>>   return ret;
>> - if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
>> + tbuf = kmalloc(len1, GFP_KERNEL);
>> + if (!tbuf) {
>>   ret = -ENOMEM;
>>   goto done;
>>   }
>> @@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
>> __user *arg)
>>
>>   if (copy_from_user(, arg, sizeof(setintf)))
>>   return -EFAULT;
>> - if ((ret = checkintf(ps, setintf.interface)))
>> + ret = checkintf(ps, setintf.interface);
>> + if (ret)
>>   return ret;
>>
>>   destroy_async_on_interface(ps, setintf.interface);
>> @@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
>> struct usbdevfs_urb *uurb
>>   number_of_packets = uurb->number_of_packets;
>>   isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
>>  number_of_packets;
>> - if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
>> + isopkt = kmalloc(isofrmlen, GFP_KERNEL);
>> + if (!isopkt)
>>   return -ENOMEM;
>>   if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
>>   ret = -EFAULT;
>> @@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
>> *ps, void __user *arg)
>>
>>   if (get_user(ifnum, (unsigned int __user *)arg))
>>   return -EFAULT;
>> - if ((ret = releaseintf(ps, ifnum)) < 0)
>> + ret = releaseintf(ps, ifnum);
>> + if (ret < 0)
>>   return ret;
>>   destroy_async_on_interface (ps, ifnum);
>>   return 0;
>> @@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
>> usbdevfs_ioctl *ctl)
>>   struct usb_driver   *driver = NULL;
>>
>>   /* alloc buffer */
>> - if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
>> + size = _IOC_SIZE(ctl->ioctl_code);
>> + if (size > 0) {
>>   buf = kmalloc(size, GFP_KERNEL);
>>   if (buf == NULL)
>>   return -ENOMEM;
>> --
>> 2.1.0
>>
>
> --
>
> Best Regards,
> Peter Chen
--
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 1/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-09 3:15 GMT+01:00 Peter Chen peter.c...@freescale.com:
 On Sat, Feb 07, 2015 at 10:55:01PM +0100, Bas Peters wrote:
 This patch removes assignment of variables in if conditions in
 accordance witht the CodingStyle.

 %s/witht/with

Typo, my bad. Should I fix the commit message and resend?



 Signed-off-by: Bas Peters baspeter...@gmail.com
 ---
  drivers/usb/core/devio.c | 15 ++-
  1 file changed, 10 insertions(+), 5 deletions(-)

 diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
 index 0b59731..ea3c737 100644
 --- a/drivers/usb/core/devio.c
 +++ b/drivers/usb/core/devio.c
 @@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
 __user *arg)
   ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
   if (ret)
   return ret;
 - if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
 + tbuf = kmalloc(len1, GFP_KERNEL);
 + if (!tbuf) {
   ret = -ENOMEM;
   goto done;
   }
 @@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
 __user *arg)

   if (copy_from_user(setintf, arg, sizeof(setintf)))
   return -EFAULT;
 - if ((ret = checkintf(ps, setintf.interface)))
 + ret = checkintf(ps, setintf.interface);
 + if (ret)
   return ret;

   destroy_async_on_interface(ps, setintf.interface);
 @@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
 struct usbdevfs_urb *uurb
   number_of_packets = uurb-number_of_packets;
   isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
  number_of_packets;
 - if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
 + isopkt = kmalloc(isofrmlen, GFP_KERNEL);
 + if (!isopkt)
   return -ENOMEM;
   if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
   ret = -EFAULT;
 @@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
 *ps, void __user *arg)

   if (get_user(ifnum, (unsigned int __user *)arg))
   return -EFAULT;
 - if ((ret = releaseintf(ps, ifnum))  0)
 + ret = releaseintf(ps, ifnum);
 + if (ret  0)
   return ret;
   destroy_async_on_interface (ps, ifnum);
   return 0;
 @@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
 usbdevfs_ioctl *ctl)
   struct usb_driver   *driver = NULL;

   /* alloc buffer */
 - if ((size = _IOC_SIZE(ctl-ioctl_code))  0) {
 + size = _IOC_SIZE(ctl-ioctl_code);
 + if (size  0) {
   buf = kmalloc(size, GFP_KERNEL);
   if (buf == NULL)
   return -ENOMEM;
 --
 2.1.0


 --

 Best Regards,
 Peter Chen
--
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: Kill I4L?

2015-02-09 Thread Bas Peters
2015-02-09 0:59 GMT+01:00 Karsten Keil kk...@linux-pingi.de:
 Am 08.02.2015 um 20:47 schrieb Tilman Schmidt:
 Am 07.02.2015 um 21:43 schrieb Paul Bolle:
 On Sat, 2015-02-07 at 11:19 -0800, Joe Perches wrote:
 Does anyone still use these cards?

 0) Good question.

 I very much doubt it. It was an ISA card, not even PnP. I'd imagine
 any systems of that kind would be retired by now.


 Agreed in general, but I know people still running such ISA based
 machines - mostly PC in industrial environments with ISDN uplinks for
 service and maintenance.
 And I4L is also used in some vending machines for card authorization so
 far I know.
 They usually using old kernels (3.0) so they are not directly affected
 if this will be removed.

 2) Broader picture: if I remember correctly there are now four
 different flavors of ISDN in the kernel: - really old: pre-i4l

 I don't think any traces of that are still present in current kernel
 releases. It should all have been left behind on the switch to 2.6.


 Yes.

 - very old: i4l - just old: CAPI - not so old: mISDN

 Those are the in-tree ones. To make matters worse, the Asterisk people
 invented three more (Zaptel, DAHDI and vISDN) which are maintained
 out-of-tree. Apparently they weren't satisfied with any the in-tree
 ones and didn't feel like helping to improve one of them to match
 their needs.

 [snip] So the current ISDN situation is a bit messy.

 That's putting it mildly.

 Tilman might be able to provide a clearer, and maybe less grumpy,
 summary of the current situation.

 Don't know about either. ;-)

 [M]aybe we should consider, say, removing i4l and pre i4l and see
 who complains. That might be a rude thing to do. So perhaps the
 various ISDN flavors should be left alone until ... what exactly?

 I'd support that step. I don't think it'll hurt anyone because the
 cards supported by i4l are mostly ISA cards anyway. The only exceptions
 are the HiSax family which is now supported by mISDN, and the Hypercope
 family which is supported by CAPI.

 In the past we had Documentation/feature-removal-schedule.txt for
 announcing removals like that but Linus shot that down on 2012-10-01
 (commit 9c0ece069b32e8e122aea71aa47181c10eb85ba7) so I guess
 somebody could just submit a patch series starting with

 --- a/drivers/isdn/Kconfig
 +++ b/drivers/isdn/Kconfig
 @@ -20,25 +20,6 @@ menuconfig ISDN

  if ISDN

 -menuconfig ISDN_I4L
 -   tristate Old ISDN4Linux (deprecated)
 -   depends on TTY
 -   ---help---
 - This driver allows you to use an ISDN adapter for networking
 - connections and as dialin/out device.  The isdn-tty's have a
 built
 - in AT-compatible modem emulator.  Network devices support
 autodial,
 - channel-bundling, callback and caller-authentication without
 having
 - a daemon running.  A reduced T.70 protocol is supported with
 tty's
 - suitable for German BTX.  On D-Channel, the protocols EDSS1
 - (Euro-ISDN) and 1TR6 (German style) are supported.  See
 - file:Documentation/isdn/README for more information.
 -
 - ISDN support in the linux kernel is moving towards a new API,
 - called CAPI (Common ISDN Application Programming Interface).
 - Therefore the old ISDN4Linux layer will eventually become
 obsolete.
 - It is still available, though, for use with adapters that
 are not
 - supported by the new CAPI subsystem yet.
 -
  source drivers/isdn/i4l/Kconfig

  menuconfig ISDN_CAPI

 and working its way from that to remove anything that's become
 unreachable.

 Shall I?


 But I4L is still the default in some Distros, so we should allow a
 warning period. But again, I'm fine with this to do it.

Is there any explicit reason why 'dead' drivers that might still have
some users ought to be removed?
Does it hurt anyone to leave the code in there, despite it barely
being used? We're not talking about
a particularly huge driver here, either.


 Karsten
--
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/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-09 Thread Bas Peters
2015-02-08 12:15 GMT+01:00 Sergei Shtylyov sergei.shtyl...@cogentembedded.com:
 Hello.

 On 2/8/2015 12:55 AM, Bas Peters wrote:

 This patch removes assignment of variables in if conditions,
 as specified in CodingStyle.


 Signed-off-by: Bas Peters baspeter...@gmail.com
 ---
   drivers/usb/core/hcd.c | 15 ++-
   1 file changed, 10 insertions(+), 5 deletions(-)


 diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
 index 11cee55..37c40d1 100644
 --- a/drivers/usb/core/hcd.c
 +++ b/drivers/usb/core/hcd.c

 [...]

 @@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
 /* reset is misnamed; its role is now one-time init. the
 controller
  * should already have been reset (and boot firmware kicked off
 etc).
  */
 -   if (hcd-driver-reset  (retval = hcd-driver-reset(hcd))  0)
 {
 +   retval = hcd-driver-reset(hcd);


This will crash if 'hcd-driver-reset' is NULL (which is only checked
 below).

 +   if (hcd-driver-reset  retval  0) {


It wasn't equivalent change anyway as the right part of  is only
 executed if the left part is true.

I'll fix this and your other comments and resend.


 WBR, Sergei


With kind regards,

Bas
--
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] drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes

2015-02-07 Thread Bas Peters
Fixes errors thrown by checkpatch over a space issue and the
incorrect indentation of a switch statement.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/cypress_atacb.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/storage/cypress_atacb.c 
b/drivers/usb/storage/cypress_atacb.c
index 8514a2d..b3466d1 100644
--- a/drivers/usb/storage/cypress_atacb.c
+++ b/drivers/usb/storage/cypress_atacb.c
@@ -96,13 +96,13 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */
goto invalid_fld;
/* check protocol */
-   switch((save_cmnd[1] >> 1) & 0xf) {
-   case 3: /*no DATA */
-   case 4: /* PIO in */
-   case 5: /* PIO out */
-   break;
-   default:
-   goto invalid_fld;
+   switch ((save_cmnd[1] >> 1) & 0xf) {
+   case 3: /*no DATA */
+   case 4: /* PIO in */
+   case 5: /* PIO out */
+   break;
+   default:
+   goto invalid_fld;
}
 
/* first build the ATACB command */
@@ -132,8 +132,7 @@ static void cypress_atacb_passthrough(struct scsi_cmnd 
*srb, struct us_data *us)
|| save_cmnd[11])
goto invalid_fld;
}
-   }
-   else { /* ATA12 */
+   } else { /* ATA12 */
srb->cmnd[ 6] = save_cmnd[3]; /* features */
srb->cmnd[ 7] = save_cmnd[4]; /* sector count */
srb->cmnd[ 8] = save_cmnd[5]; /* lba low */
-- 
2.1.0

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


[PATCH 1/3] drivers: usb: storage: alauda.c: properly place braces after function declarations

2015-02-07 Thread Bas Peters
This patch places braces on a new line following function declarations.

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/alauda.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/storage/alauda.c b/drivers/usb/storage/alauda.c
index 62c2d9d..4b55ab6 100644
--- a/drivers/usb/storage/alauda.c
+++ b/drivers/usb/storage/alauda.c
@@ -207,7 +207,8 @@ static struct alauda_card_info alauda_card_ids[] = {
{ 0,}
 };
 
-static struct alauda_card_info *alauda_card_find_id(unsigned char id) {
+static struct alauda_card_info *alauda_card_find_id(unsigned char id)
+{
int i;
 
for (i = 0; alauda_card_ids[i].id != 0; i++)
@@ -223,7 +224,8 @@ static struct alauda_card_info 
*alauda_card_find_id(unsigned char id) {
 static unsigned char parity[256];
 static unsigned char ecc2[256];
 
-static void nand_init_ecc(void) {
+static void nand_init_ecc(void)
+{
int i, j, a;
 
parity[0] = 0;
@@ -247,7 +249,8 @@ static void nand_init_ecc(void) {
 }
 
 /* compute 3-byte ecc on 256 bytes */
-static void nand_compute_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_compute_ecc(unsigned char *data, unsigned char *ecc)
+{
int i, j, a;
unsigned char par = 0, bit, bits[8] = {0};
 
@@ -270,11 +273,13 @@ static void nand_compute_ecc(unsigned char *data, 
unsigned char *ecc) {
ecc[2] = ecc2[par];
 }
 
-static int nand_compare_ecc(unsigned char *data, unsigned char *ecc) {
+static int nand_compare_ecc(unsigned char *data, unsigned char *ecc)
+{
return (data[0] == ecc[0] && data[1] == ecc[1] && data[2] == ecc[2]);
 }
 
-static void nand_store_ecc(unsigned char *data, unsigned char *ecc) {
+static void nand_store_ecc(unsigned char *data, unsigned char *ecc)
+{
memcpy(data, ecc, 3);
 }
 
-- 
2.1.0

--
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] drivers: usb: storage: fix some checkpatch errors

2015-02-07 Thread Bas Peters
This patchset adresses checkpatch errors in a few of the files in usb
storage. More to follow.

Bas Peters (3):
  drivers: usb: storage: alauda.c: properly place braces after function 
   declarations
  drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes
  drivers: usb: storage: datafab.c: clean up a variety of checkpatch
errors.

 drivers/usb/storage/alauda.c|  15 ++-
 drivers/usb/storage/cypress_atacb.c |  17 ++--
 drivers/usb/storage/datafab.c   | 183 ++--
 3 files changed, 111 insertions(+), 104 deletions(-)

-- 
2.1.0

--
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] drivers: usb: storage: datafab.c: clean up a variety of checkpatch errors.

2015-02-07 Thread Bas Peters
This patch cleans up a variety of checkpatch errors:

Bunch of space issues.
C99 comments converted to /* */ format.
Some switch statement indentations.
"foo * bar" -> "foo *bar"

Signed-off-by: Bas Peters 
---
 drivers/usb/storage/datafab.c | 183 +-
 1 file changed, 93 insertions(+), 90 deletions(-)

diff --git a/drivers/usb/storage/datafab.c b/drivers/usb/storage/datafab.c
index 7b17c21..78f867d 100644
--- a/drivers/usb/storage/datafab.c
+++ b/drivers/usb/storage/datafab.c
@@ -10,7 +10,7 @@
  *   Many thanks to Robert Baruch for the SanDisk SmartMedia reader driver
  *   which I used as a template for this driver.
  *
- *   Some bugfixes and scatter-gather code by Gregory P. Smith 
+ *   Some bugfixes and scatter-gather code by Gregory P. Smith
  *   (greg-...@electricrain.com)
  *
  *   Fix for media change by Joerg Schneider (j...@joergschneider.com)
@@ -35,8 +35,8 @@
 
 /*
  * This driver attempts to support USB CompactFlash reader/writer devices
- * based on Datafab USB-to-ATA chips.  It was specifically developed for the 
- * Datafab MDCFE-B USB CompactFlash reader but has since been found to work 
+ * based on Datafab USB-to-ATA chips.  It was specifically developed for the
+ * Datafab MDCFE-B USB CompactFlash reader but has since been found to work
  * with a variety of Datafab-based devices from a number of manufacturers.
  * I've received a report of this driver working with a Datafab-based
  * SmartMedia device though please be aware that I'm personally unable to
@@ -153,11 +153,12 @@ static int datafab_read_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* we can support up to 28-bit addressing.  I don't know if Datafab
+* supports beyond 24-bit addressing.  It's kind of hard to test
+* since it requires > 8GB CF card.
+*/
+
if (sectors > 0x0FFF)
return USB_STOR_TRANSPORT_ERROR;
 
@@ -169,9 +170,10 @@ static int datafab_read_data(struct us_data *us,
 
totallen = sectors * info->ssize;
 
-   // Since we don't read more than 64 KB at a time, we have to create
-   // a bounce buffer and move the data a piece at a time between the
-   // bounce buffer and the actual transfer buffer.
+   /* Since we don't read more than 64 KB at a time, we have to create
+* a bounce buffer and move the data a piece at a time between the
+* bounce buffer and the actual transfer buffer.
+*/
 
alloclen = min(totallen, 65536u);
buffer = kmalloc(alloclen, GFP_NOIO);
@@ -179,8 +181,9 @@ static int datafab_read_data(struct us_data *us,
return USB_STOR_TRANSPORT_ERROR;
 
do {
-   // loop, never allocate or transfer more than 64k at once
-   // (min(128k, 255*info->ssize) is the real limit)
+   /* loop, never allocate or transfer more than 64k at once
+* (min(128k, 255*info->ssize) is the real limit)
+*/
 
len = min(totallen, alloclen);
thistime = (len / info->ssize) & 0xff;
@@ -196,17 +199,17 @@ static int datafab_read_data(struct us_data *us,
command[6] = 0x20;
command[7] = 0x01;
 
-   // send the read command
+   /* send the read command */
result = datafab_bulk_write(us, command, 8);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // read the result
+   /* read the result */
result = datafab_bulk_read(us, buffer, len);
if (result != USB_STOR_XFER_GOOD)
goto leave;
 
-   // Store the data in the transfer buffer
+   /* Store the data in the transfer buffer */
usb_stor_access_xfer_buf(buffer, len, us->srb,
 , _offset, TO_XFER_BUF);
 
@@ -237,11 +240,11 @@ static int datafab_write_data(struct us_data *us,
unsigned int sg_offset = 0;
struct scatterlist *sg = NULL;
 
-   // we're working in LBA mode.  according to the ATA spec, 
-   // we can support up to 28-bit addressing.  I don't know if Datafab
-   // supports beyond 24-bit addressing.  It's kind of hard to test 
-   // since it requires > 8GB CF card.
-   //
+   /* we're working in LBA mode.  according to the ATA spec,
+* we can support up to 28-bit addressing.  I don't know if Datafab
+* support

[PATCH 2/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg->msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card->interface.rcvcallb_skb(card->myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING "actcapi: alloc_skb failed\n");
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb->data;
char *t = tmp;
-- 
2.1.0

--
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/7] drivers: isdn: act2000: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of if conditions, which is not in
accordance with the CodingStyle.
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
spin_lock_irqsave(>lock, flags);
if (chan->fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (chan->fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
switch (chan->fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (strlen(c->parm.num)) {
if (card->ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l2prot = (c->arg >> 8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING "L3 protocol unknown\n");
return -1;
}
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l3prot = (c->arg >> 8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan->fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "act2000: (%s) 

[PATCH 2/6] drivers: usb: core: devio.c: fix whitespace errors thrown by checkpatch.pl

2015-02-07 Thread Bas Peters
This patch fixes errors generated by checkpatch.pl relating to
whitespace issues.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 61 
 1 file changed, 31 insertions(+), 30 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index ea3c737..7c932d9 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -103,7 +103,7 @@ MODULE_PARM_DESC(usbfs_snoop, "true to log all usbfs 
traffic");
 #define snoop(dev, format, arg...) \
do {\
if (usbfs_snoop)\
-   dev_info(dev , format , ## arg);\
+   dev_info(dev, format, ## arg);  \
} while (0)
 
 enum snoop_when {
@@ -1320,7 +1320,7 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
is_in = (uurb->endpoint & USB_ENDPOINT_DIR_MASK) != 0;
 
u = 0;
-   switch(uurb->type) {
+   switch (uurb->type) {
case USBDEVFS_URB_TYPE_CONTROL:
if (!usb_endpoint_xfer_control(>desc))
return -EINVAL;
@@ -1944,38 +1944,39 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
retval = -EHOSTUNREACH;
else if (!(intf = usb_ifnum_to_if(ps->dev, ctl->ifno)))
retval = -EINVAL;
-   else switch (ctl->ioctl_code) {
-
-   /* disconnect kernel driver from interface */
-   case USBDEVFS_DISCONNECT:
-   if (intf->dev.driver) {
-   driver = to_usb_driver(intf->dev.driver);
-   dev_dbg(>dev, "disconnect by usbfs\n");
-   usb_driver_release_interface(driver, intf);
-   } else
-   retval = -ENODATA;
-   break;
+   else
+   switch (ctl->ioctl_code) {
+
+   /* disconnect kernel driver from interface */
+   case USBDEVFS_DISCONNECT:
+   if (intf->dev.driver) {
+   driver = to_usb_driver(intf->dev.driver);
+   dev_dbg(>dev, "disconnect by usbfs\n");
+   usb_driver_release_interface(driver, intf);
+   } else
+   retval = -ENODATA;
+   break;
 
-   /* let kernel drivers try to (re)bind to the interface */
-   case USBDEVFS_CONNECT:
-   if (!intf->dev.driver)
-   retval = device_attach(>dev);
-   else
-   retval = -EBUSY;
-   break;
+   /* let kernel drivers try to (re)bind to the interface */
+   case USBDEVFS_CONNECT:
+   if (!intf->dev.driver)
+   retval = device_attach(>dev);
+   else
+   retval = -EBUSY;
+   break;
 
-   /* talk directly to the interface's driver */
-   default:
-   if (intf->dev.driver)
-   driver = to_usb_driver(intf->dev.driver);
-   if (driver == NULL || driver->unlocked_ioctl == NULL) {
-   retval = -ENOTTY;
-   } else {
-   retval = driver->unlocked_ioctl(intf, ctl->ioctl_code, 
buf);
-   if (retval == -ENOIOCTLCMD)
+   /* talk directly to the interface's driver */
+   default:
+   if (intf->dev.driver)
+   driver = to_usb_driver(intf->dev.driver);
+   if (driver == NULL || driver->unlocked_ioctl == NULL) {
retval = -ENOTTY;
+   } else {
+   retval = driver->unlocked_ioctl(intf, 
ctl->ioctl_code, buf);
+   if (retval == -ENOIOCTLCMD)
+   retval = -ENOTTY;
+   }
}
-   }
 
/* cleanup and return */
if (retval >= 0
-- 
2.1.0

--
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/6] drivers: usb: core: hub.c: remove NULL initialization of static variables.

2015-02-07 Thread Bas Peters
NULL initialization of static variables is unnecessary as GCC kindly does
this for us.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aeb50bb..82983d9 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -49,7 +49,7 @@ static void hub_event(struct work_struct *work);
 DEFINE_MUTEX(usb_port_peer_mutex);
 
 /* cycle leds on hubs that aren't blinking for attention */
-static bool blinkenlights = 0;
+static bool blinkenlights;
 module_param (blinkenlights, bool, S_IRUGO);
 MODULE_PARM_DESC (blinkenlights, "true to cycle leds on hubs");
 
@@ -78,7 +78,7 @@ MODULE_PARM_DESC(initial_descriptor_timeout,
  * otherwise the new scheme is used.  If that fails and "use_both_schemes"
  * is set, then the driver will make another attempt, using the other scheme.
  */
-static bool old_scheme_first = 0;
+static bool old_scheme_first;
 module_param(old_scheme_first, bool, S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(old_scheme_first,
 "start with the old device initialization scheme");
-- 
2.1.0

--
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 6/6] drivers: usb: core: endpoint.c: fix trivial whitespace issue

2015-02-07 Thread Bas Peters
Changes space-based indentation to tab-based indentation.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/endpoint.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c
index 39a2402..101983b 100644
--- a/drivers/usb/core/endpoint.c
+++ b/drivers/usb/core/endpoint.c
@@ -51,7 +51,7 @@ static ssize_t wMaxPacketSize_show(struct device *dev,
 {
struct ep_device *ep = to_ep_device(dev);
return sprintf(buf, "%04x\n",
-   usb_endpoint_maxp(ep->desc) & 0x07ff);
+   usb_endpoint_maxp(ep->desc) & 0x07ff);
 }
 static DEVICE_ATTR_RO(wMaxPacketSize);
 
-- 
2.1.0

--
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/6] drivers: usb: core: fix various checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors found when running the
checkpatch script on the directory.

Bas Peters (6):
  drivers: usb: core: devio.c: remove assignment of variables in if
conditions.
  drivers: usb: core: devio.c: fix whitespace errors thrown by
checkpatch.pl
  drivers: usb: core: hcd.c: remove assignment of variables in if
conditions.
  drivers: usb: core: hub.c: remove NULL initialization of static
variables.
  drivers: usb: core: hub.c: remove assignment of variables in if
conditions.
  drivers: usb: core: endpoint.c: fix trivial whitespace issue

 drivers/usb/core/devio.c| 76 -
 drivers/usb/core/endpoint.c |  2 +-
 drivers/usb/core/hcd.c  | 15 ++---
 drivers/usb/core/hub.c  | 11 ---
 4 files changed, 58 insertions(+), 46 deletions(-)

-- 
2.1.0

--
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/6] drivers: usb: core: hub.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
As specified in the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hub.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 82983d9..9afe8b0 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -671,8 +671,8 @@ resubmit:
if (hub->quiescing)
return;
 
-   if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0
-   && status != -ENODEV && status != -EPERM)
+   status = usb_submit_urb (hub->urb, GFP_ATOMIC);
+   if (status != 0 && status != -ENODEV && status != -EPERM)
dev_err (hub->intfdev, "resubmit --> %d\n", status);
 }
 
@@ -795,7 +795,8 @@ int usb_hub_clear_tt_buffer(struct urb *urb)
 * since each TT has "at least two" buffers that can need it (and
 * there can be many TTs per hub).  even if they're uncommon.
 */
-   if ((clear = kmalloc (sizeof *clear, GFP_ATOMIC)) == NULL) {
+   clear = kmalloc (sizeof *clear, GFP_ATOMIC);
+   if (clear == NULL) {
dev_err (>dev, "can't save CLEAR_TT_BUFFER state\n");
/* FIXME recover somehow ... RESET_TT? */
return -ENOMEM;
-- 
2.1.0

--
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/6] drivers: usb: core: devio.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions in
accordance witht the CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/devio.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index 0b59731..ea3c737 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -1081,7 +1081,8 @@ static int proc_bulk(struct usb_dev_state *ps, void 
__user *arg)
ret = usbfs_increase_memory_usage(len1 + sizeof(struct urb));
if (ret)
return ret;
-   if (!(tbuf = kmalloc(len1, GFP_KERNEL))) {
+   tbuf = kmalloc(len1, GFP_KERNEL);
+   if (!tbuf) {
ret = -ENOMEM;
goto done;
}
@@ -1223,7 +1224,8 @@ static int proc_setintf(struct usb_dev_state *ps, void 
__user *arg)
 
if (copy_from_user(, arg, sizeof(setintf)))
return -EFAULT;
-   if ((ret = checkintf(ps, setintf.interface)))
+   ret = checkintf(ps, setintf.interface);
+   if (ret)
return ret;
 
destroy_async_on_interface(ps, setintf.interface);
@@ -1392,7 +1394,8 @@ static int proc_do_submiturb(struct usb_dev_state *ps, 
struct usbdevfs_urb *uurb
number_of_packets = uurb->number_of_packets;
isofrmlen = sizeof(struct usbdevfs_iso_packet_desc) *
   number_of_packets;
-   if (!(isopkt = kmalloc(isofrmlen, GFP_KERNEL)))
+   isopkt = kmalloc(isofrmlen, GFP_KERNEL);
+   if (!isopkt)
return -ENOMEM;
if (copy_from_user(isopkt, iso_frame_desc, isofrmlen)) {
ret = -EFAULT;
@@ -1901,7 +1904,8 @@ static int proc_releaseinterface(struct usb_dev_state 
*ps, void __user *arg)
 
if (get_user(ifnum, (unsigned int __user *)arg))
return -EFAULT;
-   if ((ret = releaseintf(ps, ifnum)) < 0)
+   ret = releaseintf(ps, ifnum);
+   if (ret < 0)
return ret;
destroy_async_on_interface (ps, ifnum);
return 0;
@@ -1916,7 +1920,8 @@ static int proc_ioctl(struct usb_dev_state *ps, struct 
usbdevfs_ioctl *ctl)
struct usb_driver   *driver = NULL;
 
/* alloc buffer */
-   if ((size = _IOC_SIZE(ctl->ioctl_code)) > 0) {
+   size = _IOC_SIZE(ctl->ioctl_code);
+   if (size > 0) {
buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;
-- 
2.1.0

--
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/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.

2015-02-07 Thread Bas Peters
This patch removes assignment of variables in if conditions,
as specified in CodingStyle.

Signed-off-by: Bas Peters 
---
 drivers/usb/core/hcd.c | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 11cee55..37c40d1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2683,15 +2683,18 @@ int usb_add_hcd(struct usb_hcd *hcd,
 * bottom up so that hcds can customize the root hubs before hub_wq
 * starts talking to them.  (Note, bus id is assigned early too.)
 */
-   if ((retval = hcd_buffer_create(hcd)) != 0) {
+   retval = hcd_buffer_create(hcd);
+   if (retval != 0) {
dev_dbg(hcd->self.controller, "pool alloc failed\n");
goto err_create_buf;
}
 
-   if ((retval = usb_register_bus(>self)) < 0)
+   retval = usb_register_bus(>self);
+   if (retval < 0)
goto err_register_bus;
 
-   if ((rhdev = usb_alloc_dev(NULL, >self, 0)) == NULL) {
+   rhdev = usb_alloc_dev(NULL, >self, 0);
+   if (rhdev == NULL) {
dev_err(hcd->self.controller, "unable to allocate root hub\n");
retval = -ENOMEM;
goto err_allocate_root_hub;
@@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
/* "reset" is misnamed; its role is now one-time init. the controller
 * should already have been reset (and boot firmware kicked off etc).
 */
-   if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) {
+   retval = hcd->driver->reset(hcd);
+   if (hcd->driver->reset && retval < 0) {
dev_err(hcd->self.controller, "can't setup: %d\n", retval);
goto err_hcd_driver_setup;
}
@@ -2765,7 +2769,8 @@ int usb_add_hcd(struct usb_hcd *hcd,
}
 
/* starting here, usbcore will pay attention to this root hub */
-   if ((retval = register_root_hub(hcd)) != 0)
+   retval = register_root_hub(hcd);
+   if (retval != 0)
goto err_register_root_hub;
 
retval = sysfs_create_group(>dev.kobj, _bus_attr_group);
-- 
2.1.0

--
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 6/7] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include 
 #include 
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
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 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

--
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 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Please discard all these e-mails, something went wrong and I sent the
wrong directory of patches.

2015-02-07 22:54 GMT+01:00 Bas Peters :
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/isdnloop/isdnloop.c | 18 ++
>  1 file changed, 10 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/isdn/isdnloop/isdnloop.c 
> b/drivers/isdn/isdnloop/isdnloop.c
> index 5a4da94..af96317 100644
> --- a/drivers/isdn/isdnloop/isdnloop.c
> +++ b/drivers/isdn/isdnloop/isdnloop.c
> @@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
> isdn_ctrl cmd;
>
> while (card->sndcount[ch]) {
> -   if ((skb = skb_dequeue(>bqueue[ch]))) {
> +   skb = skb_dequeue(>bqueue[ch]);
> +   if (skb) {
> len = skb->len;
> card->sndcount[ch] -= len;
> ack = *(skb->head); /* used as scratch area */
> @@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
> u_char *p;
> isdn_ctrl cmd;
>
> -   if ((skb = skb_dequeue(>dqueue)))
> +   skb = skb_dequeue(>dqueue);
> +   if (skb)
> avail = skb->len;
> else
> avail = 0;
> @@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
>  {
> struct sk_buff *skb;
> int len = strlen(s) + ((ch >= 0) ? 3 : 0);
> -
> -   if (!(skb = dev_alloc_skb(len))) {
> +   skb = dev_alloc_skb(len);
> +   if (!skb) {
> printk(KERN_WARNING "isdnloop: Out of memory in 
> isdnloop_fake\n");
> return 1;
> }
> @@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
>  {
> isdnloop_card *card;
> int i;
> -
> -   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
> +   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
> +   if (!card) {
> printk(KERN_WARNING
>"isdnloop: (%s) Could not allocate card-struct.\n", 
> id);
> return (isdnloop_card *) 0;
> @@ -1489,8 +1491,8 @@ static int
>  isdnloop_addcard(char *id1)
>  {
> isdnloop_card *card;
> -
> -   if (!(card = isdnloop_initcard(id1))) {
> +   card = isdnloop_initcard(id1);
> +   if (!card) {
> return -EIO;
> }
> printk(KERN_INFO
> --
> 2.1.0
>
--
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/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

--
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 V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patchset adresses many checkpatch errors found in the act2000 driver.
>
> Bas Peters (7):
>   drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
>   drivers: isdn: act2000: capi.c: fix checkpatch errors
>   drivers: isdn: act2000: remove assignments of variables in if
> conditions
>   drivers: isdn: act2000: module.c: remove NULL-initialization of static
> variable.
>   drivers: isdn: act2000: module.c: remove parenthesres around return
>  values.
>   drivers: isdn: act2000: fix wrongly positioned brace.
>   drivers: isdn: act2000: capi.c: add macro \ and fix brace
>
>  drivers/isdn/act2000/act2000_isa.c | 11 +
>  drivers/isdn/act2000/capi.c| 10 +---
>  drivers/isdn/act2000/module.c  | 47 
> +++---
>  3 files changed, 42 insertions(+), 26 deletions(-)
>
> --
> 2.1.0
>
--
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 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
Please discard this

2015-02-07 22:53 GMT+01:00 Bas Peters :
> This patch adresses various checkpatch errors:
> 3 assignments in if conditions
> 1 return value enclosed in parenthesis
>
> Signed-off-by: Bas Peters 
> ---
>  drivers/isdn/act2000/act2000_isa.c | 11 +++
>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/isdn/act2000/act2000_isa.c 
> b/drivers/isdn/act2000/act2000_isa.c
> index b5fad29..048507e 100644
> --- a/drivers/isdn/act2000/act2000_isa.c
> +++ b/drivers/isdn/act2000/act2000_isa.c
> @@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
> int serial = 0;
>
> found = 0;
> -   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
> +   reg = inb(portbase + ISA_COR);
> +   if (reg != 0xff) {
> outb(reg | ISA_COR_RESET, portbase + ISA_COR);
> mdelay(10);
> outb(reg, portbase + ISA_COR);
> @@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
> while (1) {
> spin_lock_irqsave(>lock, flags);
> if (!(card->sbuf)) {
> -   if ((card->sbuf = skb_dequeue(>sndq))) {
> +   card->sbuf = skb_dequeue(>sndq);
> +   if (card->sbuf) {
> card->ack_msg = card->sbuf->data;
> msg = (actcapi_msg *)card->sbuf->data;
> if ((msg->hdr.cmd.cmd == 0x86) &&
> @@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
> printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
> return -EPROTO;
> }
> -   if ((p = strchr(fid.revision, '\n')))
> +   p = strchr(fid.revision, '\n');
> +   if (p)
> *p = '\0';
> printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
> if (card->flags & ACT2000_FLAGS_IVALID) {
> @@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
> __user *cb)
> }
> kfree(buf);
> msleep_interruptible(500);
> -   return (act2000_isa_getid(card));
> +   return act2000_isa_getid(card);
>  }
> --
> 2.1.0
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

--
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/7] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
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] Fix checkpatch errors in drivers/isdn/isdnloop

2015-02-07 Thread Bas Peters
This patchset adresses various checkpatch errors in the abovementioned driver.

Bas Peters (3):
  drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in
if conditions, in accordance with the CodingStyle.
  drivers: isdn: isdnloop: isdnloop.c: Fix brace positions according to 
   CodingStyle specifications.
  drivers: isdn: isdnloop: isdnloop.c: Remove parenthesis around return 
   values, as specified in CodingStyle.

 drivers/isdn/isdnloop/isdnloop.c | 64 +++-
 1 file changed, 30 insertions(+), 34 deletions(-)

-- 
2.1.0

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


[PATCH 1/3] drivers: isdn: isdnloop: isdnloop.c: remove assignment of variables in if conditions, in accordance with the CodingStyle.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/isdnloop/isdnloop.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c
index 5a4da94..af96317 100644
--- a/drivers/isdn/isdnloop/isdnloop.c
+++ b/drivers/isdn/isdnloop/isdnloop.c
@@ -59,7 +59,8 @@ isdnloop_bchan_send(isdnloop_card *card, int ch)
isdn_ctrl cmd;
 
while (card->sndcount[ch]) {
-   if ((skb = skb_dequeue(>bqueue[ch]))) {
+   skb = skb_dequeue(>bqueue[ch]);
+   if (skb) {
len = skb->len;
card->sndcount[ch] -= len;
ack = *(skb->head); /* used as scratch area */
@@ -317,7 +318,8 @@ isdnloop_polldchan(unsigned long data)
u_char *p;
isdn_ctrl cmd;
 
-   if ((skb = skb_dequeue(>dqueue)))
+   skb = skb_dequeue(>dqueue);
+   if (skb)
avail = skb->len;
else
avail = 0;
@@ -471,8 +473,8 @@ isdnloop_fake(isdnloop_card *card, char *s, int ch)
 {
struct sk_buff *skb;
int len = strlen(s) + ((ch >= 0) ? 3 : 0);
-
-   if (!(skb = dev_alloc_skb(len))) {
+   skb = dev_alloc_skb(len);
+   if (!skb) {
printk(KERN_WARNING "isdnloop: Out of memory in 
isdnloop_fake\n");
return 1;
}
@@ -1439,8 +1441,8 @@ isdnloop_initcard(char *id)
 {
isdnloop_card *card;
int i;
-
-   if (!(card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(isdnloop_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "isdnloop: (%s) Could not allocate card-struct.\n", id);
return (isdnloop_card *) 0;
@@ -1489,8 +1491,8 @@ static int
 isdnloop_addcard(char *id1)
 {
isdnloop_card *card;
-
-   if (!(card = isdnloop_initcard(id1))) {
+   card = isdnloop_initcard(id1);
+   if (!card) {
return -EIO;
}
printk(KERN_INFO
-- 
2.1.0

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


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.

Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
-   if ((skb = card->xskb[channel])) {
+   skb = card->xskb[channel];
+   if (skb) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch & 2);
if (!eflag) {
-   if ((cnt = card->rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card->rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING "icn: 
receive out of memory\n");
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n");
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card->doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card->doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card->doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card->other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c->driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   "icn: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   "icn: if_writecmd called with invalid driverId!\n");
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(c

[PATCH 1/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(>lock, flags);
if (!(card->sbuf)) {
-   if ((card->sbuf = skb_dequeue(>sndq))) {
+   card->sbuf = skb_dequeue(>sndq);
+   if (card->sbuf) {
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
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/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses many checkpatch errors found in the act2000 driver. 

Bas Peters (7):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.
  drivers: isdn: act2000: capi.c: add macro \ and fix brace

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c| 10 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 42 insertions(+), 26 deletions(-)

-- 
2.1.0

--
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/7] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
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 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
2015-02-07 21:43 GMT+01:00 Paul Bolle :
> [Adding Tilman.]
>
> On Sat, 2015-02-07 at 11:19 -0800, Joe Perches wrote:
>> Does anyone still use these cards?
>
> 0) Good question.
>
> 1) None of the (two dozen) commits in drivers/isdn/act2000/ added since
> v2.6.12 appear to be triggered complaints, suggestions, etc. of actual
> users.
>
> 2) Broader picture: if I remember correctly there are now four different
> flavors of ISDN in the kernel:
> - really old: pre-i4l
> - very old: i4l
> - just old: CAPI
> - not so old: mISDN
>
> I could spend another 24 hours refining and relabeling these categories,
> and matching the various drivers to these categories. But I'm pretty
> sure none of the current categories contain all the drivers. And I'm
> certain all current categories support one or more drivers that none of
> the other categories do. So the current ISDN situation is a bit messy.
>
> Tilman might be able to provide a clearer, and maybe less grumpy,
> summary of the current situation.
>
> 3) Anyhow, this is an i4l card. i4l is deprecated since v2.6.22. And it
> was obsolete before that!
>
> 4) Furthermore, it seems consumer grade ISDN is on the way out. Eg, my
> ISP will disconnect my, let's call it, ADSL over ISDN connection in less
> that two months because they can't be bothered anymore to support that
> niche.
>
> 5) So we could let the various flavors of ISDN limp along for another
> few years. But maybe we should consider, say, removing i4l and pre i4l
> and see who complains. That might be a rude thing to do. So perhaps the
> various ISDN flavors should be left alone until ... what exactly?
>
>
> Paul Bolle
>

In that case I will drop this patchset. I thought it might have been
useful and a good way to learn
but I'm just wasting everyone's time with it if it's that deprecated.

Regards,

Bas
--
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/7] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
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/7] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
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 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

--
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 6/7] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include 
 #include 
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
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/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses many checkpatch errors found in the act2000 driver. 

Bas Peters (7):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.
  drivers: isdn: act2000: capi.c: add macro \ and fix brace

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c| 10 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 42 insertions(+), 26 deletions(-)

-- 
2.1.0

--
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/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(>lock, flags);
if (!(card->sbuf)) {
-   if ((card->sbuf = skb_dequeue(>sndq))) {
+   card->sbuf = skb_dequeue(>sndq);
+   if (card->sbuf) {
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
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/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg->msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card->interface.rcvcallb_skb(card->myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING "actcapi: alloc_skb failed\n");
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb->data;
char *t = tmp;
-- 
2.1.0

--
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/7] drivers: isdn: act2000: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of if conditions, which is not in
accordance with the CodingStyle.
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
spin_lock_irqsave(>lock, flags);
if (chan->fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (chan->fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
switch (chan->fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (strlen(c->parm.num)) {
if (card->ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l2prot = (c->arg >> 8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING "L3 protocol unknown\n");
return -1;
}
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l3prot = (c->arg >> 8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan->fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   "act2000: (%s) 

Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
I must have missed something. I fixed it on my end. Do I now resend
the entire patchset or just this particular patch?

regards,

Bas

2015-02-07 19:02 GMT+01:00 Julia Lawall :
> On Sat, 7 Feb 2015, Sergei Shtylyov wrote:
>
>> Hello.
>>
>> On 02/07/2015 08:06 PM, Bas Peters wrote:
>>
>> > This patch fixes the following checkpatch errors:
>> > 1. trailing statement
>> > 1. assignment of variable in if condition
>> > 1. incorrectly placed brace after function definition
>>
>> > Signed-off-by: Bas Peters 
>> > ---
>> >   drivers/isdn/act2000/capi.c | 9 ++---
>> >   1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> > diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
>> > index 3f66ca2..5d677e6 100644
>> > --- a/drivers/isdn/act2000/capi.c
>> > +++ b/drivers/isdn/act2000/capi.c
>> > @@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
>> > m->hdr.cmd.cmd = c; \
>> > m->hdr.cmd.subcmd = s;  \
>> > m->hdr.msgnum = actcapi_nextsmsg(card); \
>> > -   } else m = NULL;\
>> > +   } else
>
> It looks like a \ was lost on this line.  It should have caused a compiler
> error.
>
> julia
>
>> > +   m = NULL;   \
>>
>>Documentation/CodingStyle has an extra rule for such case: *else* branch
>> should also have {} since *if* branch has {}.
>>
>> [...]
>>
>> WNR, Sergei
>>
>>
--
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 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
Thanks, will take that into account in future patches.

With kind regards,

Bas

2015-02-07 18:51 GMT+01:00 Sergei Shtylyov :
> Hello.
>
> On 02/07/2015 08:06 PM, Bas Peters wrote:
>
>> This patch fixes the following checkpatch errors:
>> 1. trailing statement
>> 1. assignment of variable in if condition
>> 1. incorrectly placed brace after function definition
>
>
>> Signed-off-by: Bas Peters 
>> ---
>>   drivers/isdn/act2000/capi.c | 9 ++---
>>   1 file changed, 6 insertions(+), 3 deletions(-)
>
>
>> diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
>> index 3f66ca2..5d677e6 100644
>> --- a/drivers/isdn/act2000/capi.c
>> +++ b/drivers/isdn/act2000/capi.c
>> @@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr
>> *hdr)
>> m->hdr.cmd.cmd = c; \
>> m->hdr.cmd.subcmd = s;  \
>> m->hdr.msgnum = actcapi_nextsmsg(card); \
>> -   } else m = NULL;\
>> +   } else
>> +   m = NULL;   \
>
>
>Documentation/CodingStyle has an extra rule for such case: *else* branch
> should also have {} since *if* branch has {}.
>
> [...]
>
> WNR, Sergei
>
--
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/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m->hdr.cmd.cmd = c; \
m->hdr.cmd.subcmd = s;  \
m->hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg->msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card->interface.rcvcallb_skb(card->myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING "actcapi: alloc_skb failed\n");
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb->data;
char *t = tmp;
-- 
2.1.0

--
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/6] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(>lock, flags);
if (!(card->sbuf)) {
-   if ((card->sbuf = skb_dequeue(>sndq))) {
+   card->sbuf = skb_dequeue(>sndq);
+   if (card->sbuf) {
card->ack_msg = card->sbuf->data;
msg = (actcapi_msg *)card->sbuf->data;
if ((msg->hdr.cmd.cmd == 0x86) &&
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n");
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision);
if (card->flags & ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-- 
2.1.0

--
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 6/6] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include 
 #include 
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p->eaz == eaz)
-   return (p->msn);
+   return p->msn;
p = p->next;
}
return ("\0");
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c->driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   "act2000: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   "act2000: if_writecmd called with invalid driverId!\n");
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   "act2000: if_readstatus called with invalid driverId!\n");
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   "act2000: if_sendbuf called with invalid driverId!\n");
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of variables in if conditions in module.c.

Signed-off-by: Bas Peters 
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card->flags & ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
spin_lock_irqsave(>lock, flags);
if (chan->fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (chan->fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
switch (chan->fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
if (strlen(c->parm.num)) {
if (card->ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card->flags & ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l2prot = (c->arg >> 8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING "L3 protocol unknown\n");
return -1;
}
-   if (!(chan = find_channel(card, c->arg & 0x0f)))
+   chan = find_channel(card, c->arg & 0x0f);
+   if (!chan)
break;
chan->l3prot = (c->arg >> 8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan->fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   

[PATCH 0/6] drivers: isdn: act2000: fix a variety of checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset tackles a variety of checkpatch errors. Some apparent errors were 
ommitted because fixing them would in no way contribute to readability.

Signed-off-by: Bas Peters 

Bas Peters (6):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c|  9 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 41 insertions(+), 26 deletions(-)

-- 
2.1.0

--
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 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Sorry, will fix and send again.

2015-02-07 17:09 GMT+01:00 Varka Bhadram :
> Hi,
>
> On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:
>
> Missed Signed-off-by line...
>
>
>> ---
>>   drivers/isdn/icn/icn.h | 5 ++---
>>   1 file changed, 2 insertions(+), 3 deletions(-)
>>
>
>
> --
> Thanks,
> Varka Bhadram.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.

Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
-   if ((skb = card->xskb[channel])) {
+   skb = card->xskb[channel];
+   if (skb) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch & 2);
if (!eflag) {
-   if ((cnt = card->rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card->rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING "icn: 
receive out of memory\n");
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n");
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card->doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card->doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card->doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card->other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c->driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   "icn: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   "icn: if_writecmd called with invalid driverId!\n");
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(c

[PATCH 0/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

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


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters 
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

--
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/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

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


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG "icn: outb_p(0x%02x,0x%03x)\n", v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

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


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card->xlen[channel] = 0;
card->sndcount[channel] = 0;
-   if ((skb = card->xskb[channel])) {
+   skb = card->xskb[channel];
+   if (skb) {
card->xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch & 2);
if (!eflag) {
-   if ((cnt = card->rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card->rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING "icn: 
receive out of memory\n");
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{"BCON_",  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{"BDIS_",  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG "icn_loadboot called, buffaddr=%08lx\n", (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING "icn: Could not allocate code buffer\n");
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card->doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card->doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card->doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card->doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card->other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c->driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   "icn: if_command %d called with invalid driverId %d!\n",
   c->command, c->driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   "icn: if_writecmd called with invalid driverId!\n");
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card->flags & ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_readstatus(buf, len, card));
+   return icn_readstatus(buf, 

[PATCH 0/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

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


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG icn: outb_p(0x%02x,0x%03x)\n, v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG icn: outb_p(0x%02x,0x%03x)\n, v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

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


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card-xlen[channel] = 0;
card-sndcount[channel] = 0;
-   if ((skb = card-xskb[channel])) {
+   skb = card-xskb[channel];
+   if (skb) {
card-xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch  2);
if (!eflag) {
-   if ((cnt = card-rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card-rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING icn: 
receive out of memory\n);
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{BCON_,  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{BDIS_,  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG icn_loadboot called, buffaddr=%08lx\n, (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING icn: Could not allocate code buffer\n);
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card-doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card-doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card-doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card-doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card-other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c-driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   icn: if_command %d called with invalid driverId %d!\n,
   c-command, c-driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card-flags  ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   icn: if_writecmd called with invalid driverId!\n);
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card-flags  ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_readstatus(buf, len, card));
+   return icn_readstatus(buf, len, card);
}

Re: [PATCH 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
Thanks, will take that into account in future patches.

With kind regards,

Bas

2015-02-07 18:51 GMT+01:00 Sergei Shtylyov sergei.shtyl...@cogentembedded.com:
 Hello.

 On 02/07/2015 08:06 PM, Bas Peters wrote:

 This patch fixes the following checkpatch errors:
 1. trailing statement
 1. assignment of variable in if condition
 1. incorrectly placed brace after function definition


 Signed-off-by: Bas Peters baspeter...@gmail.com
 ---
   drivers/isdn/act2000/capi.c | 9 ++---
   1 file changed, 6 insertions(+), 3 deletions(-)


 diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
 index 3f66ca2..5d677e6 100644
 --- a/drivers/isdn/act2000/capi.c
 +++ b/drivers/isdn/act2000/capi.c
 @@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr
 *hdr)
 m-hdr.cmd.cmd = c; \
 m-hdr.cmd.subcmd = s;  \
 m-hdr.msgnum = actcapi_nextsmsg(card); \
 -   } else m = NULL;\
 +   } else
 +   m = NULL;   \


Documentation/CodingStyle has an extra rule for such case: *else* branch
 should also have {} since *if* branch has {}.

 [...]

 WNR, Sergei

--
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 2/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
I must have missed something. I fixed it on my end. Do I now resend
the entire patchset or just this particular patch?

regards,

Bas

2015-02-07 19:02 GMT+01:00 Julia Lawall julia.law...@lip6.fr:
 On Sat, 7 Feb 2015, Sergei Shtylyov wrote:

 Hello.

 On 02/07/2015 08:06 PM, Bas Peters wrote:

  This patch fixes the following checkpatch errors:
  1. trailing statement
  1. assignment of variable in if condition
  1. incorrectly placed brace after function definition

  Signed-off-by: Bas Peters baspeter...@gmail.com
  ---
drivers/isdn/act2000/capi.c | 9 ++---
1 file changed, 6 insertions(+), 3 deletions(-)

  diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
  index 3f66ca2..5d677e6 100644
  --- a/drivers/isdn/act2000/capi.c
  +++ b/drivers/isdn/act2000/capi.c
  @@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
  m-hdr.cmd.cmd = c; \
  m-hdr.cmd.subcmd = s;  \
  m-hdr.msgnum = actcapi_nextsmsg(card); \
  -   } else m = NULL;\
  +   } else

 It looks like a \ was lost on this line.  It should have caused a compiler
 error.

 julia

  +   m = NULL;   \

Documentation/CodingStyle has an extra rule for such case: *else* branch
 should also have {} since *if* branch has {}.

 [...]

 WNR, Sergei


--
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/6] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m-hdr.cmd.cmd = c; \
m-hdr.cmd.subcmd = s;  \
m-hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg-msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card-interface.rcvcallb_skb(card-myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING actcapi: alloc_skb failed\n);
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb-data;
char *t = tmp;
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove NULL-initialization of static variable.

2015-02-07 Thread Bas Peters
GCC takes care of this for us, thus it is not needed and theoretically
only hoggs memory, allbeit only a bit.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/module.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 352916a..9359b36 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -28,7 +28,7 @@ static unsigned short act2000_isa_ports[] =
 static act2000_card *cards = (act2000_card *) NULL;
 
 /* Parameters to be set by insmod */
-static int   act_bus  =  0;
+static int   act_bus;
 static int   act_port = -1;  /* -1 = Autoprobe  */
 static int   act_irq  = -1;
 static char *act_id   = \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0;
-- 
2.1.0

--
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/6] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(card-lock, flags);
if (!(card-sbuf)) {
-   if ((card-sbuf = skb_dequeue(card-sndq))) {
+   card-sbuf = skb_dequeue(card-sndq);
+   if (card-sbuf) {
card-ack_msg = card-sbuf-data;
msg = (actcapi_msg *)card-sbuf-data;
if ((msg-hdr.cmd.cmd == 0x86) 
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING act2000: Wrong Firmware-ID!\n);
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO act2000: Firmware-ID: %s\n, fid.revision);
if (card-flags  ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
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 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Sorry, will fix and send again.

2015-02-07 17:09 GMT+01:00 Varka Bhadram varkabhad...@gmail.com:
 Hi,

 On Saturday 07 February 2015 09:26 PM, Bas Peters wrote:

 Missed Signed-off-by line...


 ---
   drivers/isdn/icn/icn.h | 5 ++---
   1 file changed, 2 insertions(+), 3 deletions(-)



 --
 Thanks,
 Varka Bhadram.

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


[PATCH 1/2] drivers: isdn: icn: icn.c: clean up all checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up various trivial checkpatch errors such as variable
declarations in if statements, return values in parenthesis and a
wrongly placed brace.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/icn/icn.c | 52 ++
 1 file changed, 31 insertions(+), 21 deletions(-)

diff --git a/drivers/isdn/icn/icn.c b/drivers/isdn/icn/icn.c
index 6a7447c..f499d5a 100644
--- a/drivers/isdn/icn/icn.c
+++ b/drivers/isdn/icn/icn.c
@@ -62,7 +62,8 @@ icn_free_queue(icn_card *card, int channel)
skb_queue_purge(queue);
card-xlen[channel] = 0;
card-sndcount[channel] = 0;
-   if ((skb = card-xskb[channel])) {
+   skb = card-xskb[channel];
+   if (skb) {
card-xskb[channel] = NULL;
dev_kfree_skb(skb);
}
@@ -272,8 +273,10 @@ icn_pollbchan_receive(int channel, icn_card *card)
rbnext;
icn_maprelease_channel(card, mch  2);
if (!eflag) {
-   if ((cnt = card-rcvidx[channel])) {
-   if (!(skb = dev_alloc_skb(cnt))) {
+   cnt = card-rcvidx[channel];
+   if (cnt) {
+   skb = dev_alloc_skb(cnt);
+   if (!skb) {
printk(KERN_WARNING icn: 
receive out of memory\n);
break;
}
@@ -409,8 +412,7 @@ typedef struct icn_stat {
int action;
 } icn_stat;
 /* *INDENT-OFF* */
-static icn_stat icn_stat_table[] =
-{
+static icn_stat icn_stat_table[] = {
{BCON_,  ISDN_STAT_BCONN, 1}, /* B-Channel connected*/
{BDIS_,  ISDN_STAT_BHUP,  2}, /* B-Channel disconnected */
/*
@@ -807,7 +809,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
 #ifdef BOOT_DEBUG
printk(KERN_DEBUG icn_loadboot called, buffaddr=%08lx\n, (ulong) 
buffer);
 #endif
-   if (!(codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL))) {
+   codebuf = kmalloc(ICN_CODE_STAGE1, GFP_KERNEL);
+   if (!codebuf) {
printk(KERN_WARNING icn: Could not allocate code buffer\n);
ret = -ENOMEM;
goto out;
@@ -878,7 +881,8 @@ icn_loadboot(u_char __user *buffer, icn_card *card)
}
SLEEP(1);
OUTB_P(0xff, ICN_RUN);  /* Start Boot-Code */
-   if ((ret = icn_check_loader(card-doubleS0 ? 2 : 1))) {
+   ret = icn_check_loader(card-doubleS0 ? 2 : 1);
+   if (ret) {
goto out_kfree;
}
if (!card-doubleS0) {
@@ -1246,10 +1250,11 @@ icn_command(isdn_ctrl *c, icn_card *card)
dev.firstload = 0;
}
icn_stopcard(card);
-   return (icn_loadboot(arg, card));
+   return icn_loadboot(arg, card);
case ICN_IOCTL_LOADPROTO:
icn_stopcard(card);
-   if ((i = (icn_loadproto(arg, card
+   i = icn_loadproto(arg, card);
+   if (i)
return i;
if (card-doubleS0)
i = icn_loadproto(arg + ICN_CODE_STAGE2, 
card-other);
@@ -1262,7 +1267,7 @@ icn_command(isdn_ctrl *c, icn_card *card)
   arg,
   sizeof(cdef)))
return -EFAULT;
-   return (icn_addcard(cdef.port, cdef.id1, cdef.id2));
+   return icn_addcard(cdef.port, cdef.id1, cdef.id2);
break;
case ICN_IOCTL_LEASEDCFG:
if (a) {
@@ -1458,7 +1463,7 @@ if_command(isdn_ctrl *c)
icn_card *card = icn_findcard(c-driver);
 
if (card)
-   return (icn_command(c, card));
+   return icn_command(c, card);
printk(KERN_ERR
   icn: if_command %d called with invalid driverId %d!\n,
   c-command, c-driver);
@@ -1473,7 +1478,7 @@ if_writecmd(const u_char __user *buf, int len, int id, 
int channel)
if (card) {
if (!(card-flags  ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_writecmd(buf, len, 1, card));
+   return icn_writecmd(buf, len, 1, card);
}
printk(KERN_ERR
   icn: if_writecmd called with invalid driverId!\n);
@@ -1488,7 +1493,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card-flags  ICN_FLAGS_RUNNING))
return -ENODEV;
-   return (icn_readstatus(buf, len, card));
+   return

[PATCH 0/2] drivers: isdn: icn: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch cleans up all checkpatch errors in the icn directory.

Bas Peters (2):
  drivers: isdn: icn: icn.c: clean up all checkpatch errors
  drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

 drivers/isdn/icn/icn.c | 52 ++
 drivers/isdn/icn/icn.h |  5 ++---
 2 files changed, 33 insertions(+), 24 deletions(-)

-- 
2.1.0

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


[PATCH 2/2] drivers: isdn: icn: icn.h Clean up trivial checkpatch errors.

2015-02-07 Thread Bas Peters
Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/icn/icn.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/icn/icn.h b/drivers/isdn/icn/icn.h
index b713466..05daed2 100644
--- a/drivers/isdn/icn/icn.h
+++ b/drivers/isdn/icn/icn.h
@@ -54,7 +54,7 @@ typedef struct icn_cdef {
 
 /* some useful macros for debugging */
 #ifdef ICN_DEBUG_PORT
-#define OUTB_P(v, p) {printk(KERN_DEBUG icn: outb_p(0x%02x,0x%03x)\n, v, p); 
outb_p(v, p);}
+#define OUTB_P(v, p) {printk(KERN_DEBUG icn: outb_p(0x%02x,0x%03x)\n, v, p); 
outb_p(v, p); }
 #else
 #define OUTB_P outb
 #endif
@@ -186,8 +186,7 @@ typedef icn_dev *icn_devptr;
 #ifdef __KERNEL__
 
 static icn_card *cards = (icn_card *) 0;
-static u_char chan2bank[] =
-{0, 4, 8, 12};  /* for icn_map_channel() */
+static u_char chan2bank[] = {0, 4, 8, 12}; /* for icn_map_channel() */
 
 static icn_dev dev;
 
-- 
2.1.0

--
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 6/6] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include linux/slab.h
 #include linux/init.h
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove parenthesres around return values.

2015-02-07 Thread Bas Peters
return is not a function, therefore parentheses are not needed.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/module.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 9359b36..889ffcb 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -111,7 +111,7 @@ act2000_find_eaz(act2000_card *card, char eaz)
 
while (p) {
if (p-eaz == eaz)
-   return (p-msn);
+   return p-msn;
p = p-next;
}
return (\0);
@@ -293,7 +293,7 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (ret)
return ret;
if (card-flags  ACT2000_FLAGS_RUNNING)
-   return (actcapi_manufacturer_req_msn(card));
+   return actcapi_manufacturer_req_msn(card);
return 0;
case ACT2000_IOCTL_ADDCARD:
if (copy_from_user(cdef, arg,
@@ -520,7 +520,7 @@ if_command(isdn_ctrl *c)
act2000_card *card = act2000_findcard(c-driver);
 
if (card)
-   return (act2000_command(card, c));
+   return act2000_command(card, c);
printk(KERN_ERR
   act2000: if_command %d called with invalid driverId %d!\n,
   c-command, c-driver);
@@ -535,7 +535,7 @@ if_writecmd(const u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (len);
+   return len;
}
printk(KERN_ERR
   act2000: if_writecmd called with invalid driverId!\n);
@@ -550,7 +550,7 @@ if_readstatus(u_char __user *buf, int len, int id, int 
channel)
if (card) {
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_readstatus(buf, len, card));
+   return act2000_readstatus(buf, len, card);
}
printk(KERN_ERR
   act2000: if_readstatus called with invalid driverId!\n);
@@ -565,7 +565,7 @@ if_sendbuf(int id, int channel, int ack, struct sk_buff 
*skb)
if (card) {
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   return (act2000_sendbuf(card, channel, ack, skb));
+   return act2000_sendbuf(card, channel, ack, skb);
}
printk(KERN_ERR
   act2000: if_sendbuf called with invalid driverId!\n);
-- 
2.1.0

--
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/6] drivers: isdn: act2000: module.c: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of variables in if conditions in module.c.

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card-flags  ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
spin_lock_irqsave(card-lock, flags);
if (chan-fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
if (chan-fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
switch (chan-fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
if (strlen(c-parm.num)) {
if (card-ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-l2prot = (c-arg  8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING L3 protocol unknown\n);
return -1;
}
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-l3prot = (c-arg  8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan-fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   act2000: (%s) Could not allocate card-struct

[PATCH 0/6] drivers: isdn: act2000: fix a variety of checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset tackles a variety of checkpatch errors. Some apparent errors were 
ommitted because fixing them would in no way contribute to readability.

Signed-off-by: Bas Peters baspeter...@gmail.com

Bas Peters (6):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c|  9 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 41 insertions(+), 26 deletions(-)

-- 
2.1.0

--
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/7] drivers: isdn: act2000: remove assignments of variables in if conditions

2015-02-07 Thread Bas Peters
This patch removes all assignments of if conditions, which is not in
accordance with the CodingStyle.
---
 drivers/isdn/act2000/module.c | 30 --
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index c3a1b06..352916a 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -289,7 +289,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
if (copy_from_user(tmp, arg,
   sizeof(tmp)))
return -EFAULT;
-   if ((ret = act2000_set_msn(card, tmp)))
+   ret = act2000_set_msn(card, tmp);
+   if (ret)
return ret;
if (card-flags  ACT2000_FLAGS_RUNNING)
return (actcapi_manufacturer_req_msn(card));
@@ -312,7 +313,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_DIAL:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
spin_lock_irqsave(card-lock, flags);
if (chan-fsm_state != ACT2000_STATE_NULL) {
@@ -341,7 +343,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_ACCEPTD:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
if (chan-fsm_state == ACT2000_STATE_ICALL)
actcapi_select_b2_protocol_req(card, chan);
@@ -353,7 +356,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_HANGUP:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
switch (chan-fsm_state) {
case ACT2000_STATE_ICALL:
@@ -368,7 +372,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETEAZ:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
if (strlen(c-parm.num)) {
if (card-ptype == ISDN_PTYPE_EURO) {
@@ -388,7 +393,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_CLREAZ:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-eazmask = 0;
actcapi_listen_req(card);
@@ -396,7 +402,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
case ISDN_CMD_SETL2:
if (!(card-flags  ACT2000_FLAGS_RUNNING))
return -ENODEV;
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-l2prot = (c-arg  8);
return 0;
@@ -407,7 +414,8 @@ act2000_command(act2000_card *card, isdn_ctrl *c)
printk(KERN_WARNING L3 protocol unknown\n);
return -1;
}
-   if (!(chan = find_channel(card, c-arg  0x0f)))
+   chan = find_channel(card, c-arg  0x0f);
+   if (!chan)
break;
chan-l3prot = (c-arg  8);
return 0;
@@ -424,7 +432,8 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, 
struct sk_buff *skb)
act2000_chan *chan;
actcapi_msg *msg;
 
-   if (!(chan = find_channel(card, channel)))
+   chan = find_channel(card, channel);
+   if (!chan)
return -1;
if (chan-fsm_state != ACT2000_STATE_ACTIVE)
return -1;
@@ -573,7 +582,8 @@ act2000_alloccard(int bus, int port, int irq, char *id)
 {
int i;
act2000_card *card;
-   if (!(card = kzalloc(sizeof(act2000_card), GFP_KERNEL))) {
+   card = kzalloc(sizeof(act2000_card), GFP_KERNEL);
+   if (!card) {
printk(KERN_WARNING
   act2000: (%s) Could not allocate card-struct.\n, id);

[PATCH V2 0/7] drivers: isdn: act2000: fix checkpatch errors.

2015-02-07 Thread Bas Peters
This patchset adresses many checkpatch errors found in the act2000 driver. 

Bas Peters (7):
  drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors
  drivers: isdn: act2000: capi.c: fix checkpatch errors
  drivers: isdn: act2000: remove assignments of variables in if
conditions
  drivers: isdn: act2000: module.c: remove NULL-initialization of static
variable.
  drivers: isdn: act2000: module.c: remove parenthesres around return   
 values.
  drivers: isdn: act2000: fix wrongly positioned brace.
  drivers: isdn: act2000: capi.c: add macro \ and fix brace

 drivers/isdn/act2000/act2000_isa.c | 11 +
 drivers/isdn/act2000/capi.c| 10 +---
 drivers/isdn/act2000/module.c  | 47 +++---
 3 files changed, 42 insertions(+), 26 deletions(-)

-- 
2.1.0

--
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/7] drivers: isdn: act2000: act2000_isa.c: Fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch adresses various checkpatch errors:
3 assignments in if conditions
1 return value enclosed in parenthesis

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/act2000_isa.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/isdn/act2000/act2000_isa.c 
b/drivers/isdn/act2000/act2000_isa.c
index b5fad29..048507e 100644
--- a/drivers/isdn/act2000/act2000_isa.c
+++ b/drivers/isdn/act2000/act2000_isa.c
@@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase)
int serial = 0;
 
found = 0;
-   if ((reg = inb(portbase + ISA_COR)) != 0xff) {
+   reg = inb(portbase + ISA_COR);
+   if (reg != 0xff) {
outb(reg | ISA_COR_RESET, portbase + ISA_COR);
mdelay(10);
outb(reg, portbase + ISA_COR);
@@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card)
while (1) {
spin_lock_irqsave(card-lock, flags);
if (!(card-sbuf)) {
-   if ((card-sbuf = skb_dequeue(card-sndq))) {
+   card-sbuf = skb_dequeue(card-sndq);
+   if (card-sbuf) {
card-ack_msg = card-sbuf-data;
msg = (actcapi_msg *)card-sbuf-data;
if ((msg-hdr.cmd.cmd == 0x86) 
@@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card)
printk(KERN_WARNING act2000: Wrong Firmware-ID!\n);
return -EPROTO;
}
-   if ((p = strchr(fid.revision, '\n')))
+   p = strchr(fid.revision, '\n');
+   if (p)
*p = '\0';
printk(KERN_INFO act2000: Firmware-ID: %s\n, fid.revision);
if (card-flags  ACT2000_FLAGS_IVALID) {
@@ -439,5 +442,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef 
__user *cb)
}
kfree(buf);
msleep_interruptible(500);
-   return (act2000_isa_getid(card));
+   return act2000_isa_getid(card);
 }
-- 
2.1.0

--
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/7] drivers: isdn: act2000: capi.c: fix checkpatch errors

2015-02-07 Thread Bas Peters
This patch fixes the following checkpatch errors:
1. trailing statement
1. assignment of variable in if condition
1. incorrectly placed brace after function definition

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/capi.c | 9 ++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 3f66ca2..5d677e6 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,7 +113,8 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m-hdr.cmd.cmd = c; \
m-hdr.cmd.subcmd = s;  \
m-hdr.msgnum = actcapi_nextsmsg(card); \
-   } else m = NULL;\
+   } else
+   m = NULL;   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
@@ -563,7 +564,8 @@ actcapi_data_b3_ind(act2000_card *card, struct sk_buff 
*skb) {
blocknr = msg-msg.data_b3_ind.blocknr;
skb_pull(skb, 19);
card-interface.rcvcallb_skb(card-myid, chan, skb);
-   if (!(skb = alloc_skb(11, GFP_ATOMIC))) {
+   skb = alloc_skb(11, GFP_ATOMIC);
+   if (!skb) {
printk(KERN_WARNING actcapi: alloc_skb failed\n);
return 1;
}
@@ -990,7 +992,8 @@ actcapi_debug_dlpd(actcapi_dlpd *dlpd)
 }
 
 #ifdef DEBUG_DUMP_SKB
-static void dump_skb(struct sk_buff *skb) {
+static void dump_skb(struct sk_buff *skb)
+{
char tmp[80];
char *p = skb-data;
char *t = tmp;
-- 
2.1.0

--
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 6/7] drivers: isdn: act2000: fix wrongly positioned brace.

2015-02-07 Thread Bas Peters
Trivial, but why not? :)

Signed-off-by: Bas Peters baspeter...@gmail.com
---
 drivers/isdn/act2000/module.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c
index 889ffcb..9ba98ce 100644
--- a/drivers/isdn/act2000/module.c
+++ b/drivers/isdn/act2000/module.c
@@ -19,8 +19,7 @@
 #include linux/slab.h
 #include linux/init.h
 
-static unsigned short act2000_isa_ports[] =
-{
+static unsigned short act2000_isa_ports[] = {
0x0200, 0x0240, 0x0280, 0x02c0, 0x0300, 0x0340, 0x0380,
0xcfe0, 0xcfa0, 0xcf60, 0xcf20, 0xcee0, 0xcea0, 0xce60,
 };
-- 
2.1.0

--
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 7/7] drivers: isdn: act2000: capi.c: add macro \ and fix brace

2015-02-07 Thread Bas Peters
This patch adds the \ that was accidentally deleted in patch 2. It also adds a 
brace after the else statement, which is required due to the fact that the if 
statement has braces.

---
 drivers/isdn/act2000/capi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/isdn/act2000/capi.c b/drivers/isdn/act2000/capi.c
index 5d677e6..0043b3c 100644
--- a/drivers/isdn/act2000/capi.c
+++ b/drivers/isdn/act2000/capi.c
@@ -113,8 +113,9 @@ actcapi_chkhdr(act2000_card *card, actcapi_msghdr *hdr)
m-hdr.cmd.cmd = c; \
m-hdr.cmd.subcmd = s;  \
m-hdr.msgnum = actcapi_nextsmsg(card); \
-   } else
+   } else {\
m = NULL;   \
+   }   \
}
 
 #define ACTCAPI_CHKSKB if (!skb) { \
-- 
2.1.0

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


  1   2   >