[PATCH] Staging: iio: accel: Fixed NULL comparison style

2015-12-13 Thread Bhaktipriya Shridhar
This patch fixes checkpatch.pl check:
CHECK: Comparison to NULL could be written "!rx_p"
+   if (*rx_p == NULL) {

Signed-off-by: Bhaktipriya Shridhar 
---
 drivers/staging/iio/accel/sca3000_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_ring.c 
b/drivers/staging/iio/accel/sca3000_ring.c
index 20b878d..5339b10 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -48,7 +48,7 @@ static int sca3000_read_data(struct sca3000_state *st,
}
};
*rx_p = kmalloc(len, GFP_KERNEL);
-   if (*rx_p == NULL) {
+   if (!rx_p) {
ret = -ENOMEM;
goto error_ret;
}
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging: iio: accel: Fixed NULL comparison style

2015-12-13 Thread Dan Carpenter
On Sun, Dec 13, 2015 at 12:54:27PM +0300, Bhaktipriya Shridhar wrote:
> This patch fixes checkpatch.pl check:
> CHECK: Comparison to NULL could be written "!rx_p"
> +   if (*rx_p == NULL) {
> 

Actually it should be "if (!*rx_p)".  checkpatch.pl appears to have a
bug here.

regards,
dan carpenter

> Signed-off-by: Bhaktipriya Shridhar 
> ---
>  drivers/staging/iio/accel/sca3000_ring.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/iio/accel/sca3000_ring.c 
> b/drivers/staging/iio/accel/sca3000_ring.c
> index 20b878d..5339b10 100644
> --- a/drivers/staging/iio/accel/sca3000_ring.c
> +++ b/drivers/staging/iio/accel/sca3000_ring.c
> @@ -48,7 +48,7 @@ static int sca3000_read_data(struct sca3000_state *st,
>   }
>   };
>   *rx_p = kmalloc(len, GFP_KERNEL);
> - if (*rx_p == NULL) {
> + if (!rx_p) {
>   ret = -ENOMEM;
>   goto error_ret;
>   }
> -- 
> 2.1.4
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] Staging: iio: accel: Fixed NULL comparison style

2015-12-13 Thread Bhaktipriya Shridhar
The variable u8 **rx_p, is a pointer-to-pointer and hence the check should
be "if (!*rx_p)" and not "if (!rx_p)".
In the earlier version, checkpatch.pl gave the following check, which was
buggy:
CHECK: Comparison to NULL could be written "!rx_p"
+   if (*rx_p == NULL) {

Signed-off-by: Bhaktipriya Shridhar 
---
 Changes in v2:
-Replaced "if (!rx_p)" with "if (!*rx_p)"
 
 drivers/staging/iio/accel/sca3000_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_ring.c 
b/drivers/staging/iio/accel/sca3000_ring.c
index 5339b10..1920dc60 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -48,7 +48,7 @@ static int sca3000_read_data(struct sca3000_state *st,
}
};
*rx_p = kmalloc(len, GFP_KERNEL);
-   if (!rx_p) {
+   if (!*rx_p) {
ret = -ENOMEM;
goto error_ret;
}
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/7] staging-Lustre: Fine-tuning for some function implementations

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 14:40:14 +0100

Several update suggestions were taken into account
from static source code analysis.

Markus Elfring (7):
  Delete unnecessary goto statements in six functions
  Rename a jump label for ptlrpc_req_finished() calls
  Rename a jump label for a kfree(key) call
  Delete an unnecessary variable initialisation in mgc_process_recover_log()
  Less checks in mgc_process_recover_log() after error detection
  A few checks less in mgc_process_recover_log() after error detection
  Rename a jump label for module_put() calls

 drivers/staging/lustre/lustre/llite/file.c |  26 ++---
 drivers/staging/lustre/lustre/llite/lloop.c|   8 +-
 drivers/staging/lustre/lustre/llite/namei.c|  13 +--
 drivers/staging/lustre/lustre/llite/xattr.c|  20 ++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c| 124 ++---
 drivers/staging/lustre/lustre/mgc/mgc_request.c|  53 -
 drivers/staging/lustre/lustre/osc/osc_request.c|  52 -
 drivers/staging/lustre/lustre/ptlrpc/llog_client.c |  22 ++--
 8 files changed, 152 insertions(+), 166 deletions(-)

-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/7] staging: lustre: Delete unnecessary goto statements in six functions

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 09:30:47 +0100

Six goto statements referred to a source code position directly behind them.
Thus omit such unnecessary jumps.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/llite/namei.c | 1 -
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 7 ---
 2 files changed, 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 64db5e8..2113dd4 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -554,7 +554,6 @@ static struct dentry *ll_lookup_it(struct inode *parent, 
struct dentry *dentry,
retval = NULL;
else
retval = dentry;
-   goto out;
  out:
if (req)
ptlrpc_req_finished(req);
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c 
b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 294c050..920b1e9 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1181,7 +1181,6 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp,
ptlrpc_request_set_replen(req);
 
rc = mdc_queue_wait(req);
-   goto out;
 out:
ptlrpc_req_finished(req);
return rc;
@@ -1216,7 +1215,6 @@ static int mdc_ioc_hsm_ct_register(struct obd_import 
*imp, __u32 archives)
ptlrpc_request_set_replen(req);
 
rc = mdc_queue_wait(req);
-   goto out;
 out:
ptlrpc_req_finished(req);
return rc;
@@ -1282,7 +1280,6 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import 
*imp)
ptlrpc_request_set_replen(req);
 
rc = mdc_queue_wait(req);
-   goto out;
 out:
ptlrpc_req_finished(req);
return rc;
@@ -1362,8 +1359,6 @@ static int mdc_ioc_hsm_state_set(struct obd_export *exp,
ptlrpc_request_set_replen(req);
 
rc = mdc_queue_wait(req);
-   goto out;
-
 out:
ptlrpc_req_finished(req);
return rc;
@@ -1427,8 +1422,6 @@ static int mdc_ioc_hsm_request(struct obd_export *exp,
ptlrpc_request_set_replen(req);
 
rc = mdc_queue_wait(req);
-   goto out;
-
 out:
ptlrpc_req_finished(req);
return rc;
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/7] staging: lustre: Rename a jump label for ptlrpc_req_finished() calls

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 10:33:38 +0100

This issue was detected by using the Coccinelle software.

Choose a jump label according to the current Linux coding style convention.
I suggest to improve this implementation detail by the reuse of a script
like the following for the semantic patch language.

@rename_jump_label exists@
identifier work;
type return_type;
@@
 return_type work(...)
 {
 ... when any
 goto
-out
+finish_request
 ;
 ... when any
-out
+finish_request
 :
 ptlrpc_req_finished(...);
 ... when any
 }

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/llite/file.c | 26 +--
 drivers/staging/lustre/lustre/llite/namei.c| 12 ++---
 drivers/staging/lustre/lustre/llite/xattr.c| 20 
 drivers/staging/lustre/lustre/mdc/mdc_request.c| 54 +++---
 drivers/staging/lustre/lustre/osc/osc_request.c| 28 +--
 drivers/staging/lustre/lustre/ptlrpc/llog_client.c | 22 -
 6 files changed, 81 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 31cd6b3..b94df54 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -427,27 +427,27 @@ static int ll_intent_file_open(struct dentry *dentry, 
void *lmm,
*/
if (!it_disposition(itp, DISP_OPEN_OPEN) ||
 it_open_error(DISP_OPEN_OPEN, itp))
-   goto out;
+   goto finish_request;
ll_release_openhandle(inode, itp);
-   goto out;
+   goto finish_request;
}
 
if (it_disposition(itp, DISP_LOOKUP_NEG)) {
rc = -ENOENT;
-   goto out;
+   goto finish_request;
}
 
if (rc != 0 || it_open_error(DISP_OPEN_OPEN, itp)) {
rc = rc ? rc : it_open_error(DISP_OPEN_OPEN, itp);
CDEBUG(D_VFSTRACE, "lock enqueue: err: %d\n", rc);
-   goto out;
+   goto finish_request;
}
 
rc = ll_prep_inode(&inode, req, NULL, itp);
if (!rc && itp->d.lustre.it_lock_mode)
ll_set_lock_data(sbi->ll_md_exp, inode, itp, NULL);
 
-out:
+finish_request:
ptlrpc_req_finished(req);
ll_intent_drop_lock(itp);
 
@@ -2900,13 +2900,13 @@ static int __ll_inode_revalidate(struct dentry *dentry, 
__u64 ibits)
oit.it_create_mode &= ~M_CHECK_STALE;
if (rc < 0) {
rc = ll_inode_revalidate_fini(inode, rc);
-   goto out;
+   goto finish_request;
}
 
rc = ll_revalidate_it_finish(req, &oit, inode);
if (rc != 0) {
ll_intent_release(&oit);
-   goto out;
+   goto finish_request;
}
 
/* Unlinked? Unhash dentry, so it is not picked up later by
@@ -2946,7 +2946,7 @@ static int __ll_inode_revalidate(struct dentry *dentry, 
__u64 ibits)
 
rc = ll_prep_inode(&inode, req, NULL, NULL);
}
-out:
+finish_request:
ptlrpc_req_finished(req);
return rc;
 }
@@ -3315,25 +3315,25 @@ static int ll_layout_fetch(struct inode *inode, struct 
ldlm_lock *lock)
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (body == NULL) {
rc = -EPROTO;
-   goto out;
+   goto finish_request;
}
 
lmmsize = body->eadatasize;
if (lmmsize == 0) /* empty layout */ {
rc = 0;
-   goto out;
+   goto finish_request;
}
 
lmm = req_capsule_server_sized_get(&req->rq_pill, &RMF_EADATA, lmmsize);
if (lmm == NULL) {
rc = -EFAULT;
-   goto out;
+   goto finish_request;
}
 
lvbdata = libcfs_kvzalloc(lmmsize, GFP_NOFS);
if (lvbdata == NULL) {
rc = -ENOMEM;
-   goto out;
+   goto finish_request;
}
 
memcpy(lvbdata, lmm, lmmsize);
@@ -3345,7 +3345,7 @@ static int ll_layout_fetch(struct inode *inode, struct 
ldlm_lock *lock)
lock->l_lvb_len = lmmsize;
unlock_res_and_lock(lock);
 
-out:
+finish_request:
ptlrpc_req_finished(req);
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 2113dd4..7501f70 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -686,7 +686,7 @@ static struct inode *ll_create_node(struct inode *dir, 
struct lookup_intent *it)
rc = ll_prep_inode(&inode, request, dir->i_sb, it);
if (rc) {
inode = ERR_PTR(rc);
-   goto out;
+   goto finish_request;
}
 

[PATCH 3/7] staging: lustre: Rename a jump label for a kfree(key) call

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 10:56:35 +0100

This issue was detected by using the Coccinelle software.

Choose a jump label according to the current Linux coding style convention.

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c 
b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 2a76685..2085ba6 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1125,7 +1125,7 @@ static int mdc_ioc_fid2path(struct obd_export *exp, 
struct getinfo_fid2path *gf)
 
if (!fid_is_sane(&gf->gf_fid)) {
rc = -EINVAL;
-   goto out;
+   goto free_key;
}
 
/* Val is struct getinfo_fid2path result plus path */
@@ -1133,20 +1133,19 @@ static int mdc_ioc_fid2path(struct obd_export *exp, 
struct getinfo_fid2path *gf)
 
rc = obd_get_info(NULL, exp, keylen, key, &vallen, gf, NULL);
if (rc != 0 && rc != -EREMOTE)
-   goto out;
+   goto free_key;
 
if (vallen <= sizeof(*gf)) {
rc = -EPROTO;
-   goto out;
+   goto free_key;
} else if (vallen > sizeof(*gf) + gf->gf_pathlen) {
rc = -EOVERFLOW;
-   goto out;
+   goto free_key;
}
 
CDEBUG(D_IOCTL, "path get "DFID" from %llu #%d\n%s\n",
   PFID(&gf->gf_fid), gf->gf_recno, gf->gf_linkno, gf->gf_path);
-
-out:
+free_key:
kfree(key);
return rc;
 }
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/7] staging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover_log()

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 12:00:32 +0100

The variable "mne_swab" will eventually be set to an appropriate value
from a call of the ptlrpc_rep_need_swab() function.
Thus let us omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 2c48847..da130f4 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -1293,7 +1293,7 @@ static int mgc_process_recover_log(struct obd_device *obd,
struct page **pages;
int nrpages;
bool eof = true;
-   bool mne_swab = false;
+   bool mne_swab;
int i;
int ealen;
int rc;
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v2] Staging: iio: accel: Fixed NULL comparison style

2015-12-13 Thread Dan Carpenter
You have to resend it to apply on the original code, we are not going to
apply the first version of this patch.  In other words it is:

-   if (*rx_p == NULL) {
+   if (!*rxp) {

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/7] staging: lustre: Less checks in mgc_process_recover_log() after error detection

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 12:21:17 +0100

A few checks would be performed by the mgc_process_recover_log() function
even if it is known already that the passed variable "pages" contained
a null pointer.

* Let us return directly if a call of the kcalloc() function failed.

* Move assignments for the variables "eof" and "req" behind
  this memory allocation.

* Delete a sanity check then.

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 25 -
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index da130f4..f3b4c30 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -1285,14 +1285,14 @@ static int mgc_apply_recover_logs(struct obd_device 
*mgc,
 static int mgc_process_recover_log(struct obd_device *obd,
   struct config_llog_data *cld)
 {
-   struct ptlrpc_request *req = NULL;
+   struct ptlrpc_request *req;
struct config_llog_instance *cfg = &cld->cld_cfg;
struct mgs_config_body *body;
struct mgs_config_res  *res;
struct ptlrpc_bulk_desc *desc;
struct page **pages;
int nrpages;
-   bool eof = true;
+   bool eof;
bool mne_swab;
int i;
int ealen;
@@ -1309,10 +1309,11 @@ static int mgc_process_recover_log(struct obd_device 
*obd,
nrpages = CONFIG_READ_NRPAGES_INIT;
 
pages = kcalloc(nrpages, sizeof(*pages), GFP_KERNEL);
-   if (pages == NULL) {
-   rc = -ENOMEM;
-   goto out;
-   }
+   if (!pages)
+   return -ENOMEM;
+
+   req = NULL;
+   eof = true;
 
for (i = 0; i < nrpages; i++) {
pages[i] = alloc_page(GFP_KERNEL);
@@ -1432,14 +1433,12 @@ out:
if (rc == 0 && !eof)
goto again;
 
-   if (pages) {
-   for (i = 0; i < nrpages; i++) {
-   if (pages[i] == NULL)
-   break;
-   __free_page(pages[i]);
-   }
-   kfree(pages);
+   for (i = 0; i < nrpages; i++) {
+   if (pages[i] == NULL)
+   break;
+   __free_page(pages[i]);
}
+   kfree(pages);
return rc;
 }
 
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 6/7] staging: lustre: A few checks less in mgc_process_recover_log() after error detection

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 13:03:58 +0100

A few checks would be performed by the mgc_process_recover_log() function
even if it was determined that a call of the alloc_page() function failed.

* This implementation detail could be improved by adjustments
  for jump targets according to the Linux coding style convention.

* Move the assignment for the variable "eof" behind the memory allocation.

* Delete another sanity check then.

* The variable "req" will eventually be set to an appropriate pointer
  from a call of the ptlrpc_request_alloc() function.
  Thus let us omit the explicit initialisation before.

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 32 +++--
 1 file changed, 14 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index f3b4c30..7048722 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -1312,17 +1312,15 @@ static int mgc_process_recover_log(struct obd_device 
*obd,
if (!pages)
return -ENOMEM;
 
-   req = NULL;
-   eof = true;
-
for (i = 0; i < nrpages; i++) {
pages[i] = alloc_page(GFP_KERNEL);
if (pages[i] == NULL) {
rc = -ENOMEM;
-   goto out;
+   goto free_pages;
}
}
 
+   eof = true;
 again:
LASSERT(cld_is_recover(cld));
LASSERT(mutex_is_locked(&cld->cld_lock));
@@ -1330,12 +1328,12 @@ again:
   &RQF_MGS_CONFIG_READ);
if (req == NULL) {
rc = -ENOMEM;
-   goto out;
+   goto free_pages;
}
 
rc = ptlrpc_request_pack(req, LUSTRE_MGS_VERSION, MGS_CONFIG_READ);
if (rc)
-   goto out;
+   goto finish_request;
 
/* pack request */
body = req_capsule_client_get(&req->rq_pill, &RMF_MGS_CONFIG_BODY);
@@ -1344,7 +1342,7 @@ again:
if (strlcpy(body->mcb_name, cld->cld_logname, sizeof(body->mcb_name))
>= sizeof(body->mcb_name)) {
rc = -E2BIG;
-   goto out;
+   goto finish_request;
}
body->mcb_offset = cfg->cfg_last_idx + 1;
body->mcb_type   = cld->cld_type;
@@ -1356,7 +1354,7 @@ again:
MGS_BULK_PORTAL);
if (desc == NULL) {
rc = -ENOMEM;
-   goto out;
+   goto finish_request;
}
 
for (i = 0; i < nrpages; i++)
@@ -1365,12 +1363,12 @@ again:
ptlrpc_request_set_replen(req);
rc = ptlrpc_queue_wait(req);
if (rc)
-   goto out;
+   goto finish_request;
 
res = req_capsule_server_get(&req->rq_pill, &RMF_MGS_CONFIG_RES);
if (res->mcr_size < res->mcr_offset) {
rc = -EINVAL;
-   goto out;
+   goto finish_request;
}
 
/* always update the index even though it might have errors with
@@ -1384,18 +1382,18 @@ again:
ealen = sptlrpc_cli_unwrap_bulk_read(req, req->rq_bulk, 0);
if (ealen < 0) {
rc = ealen;
-   goto out;
+   goto finish_request;
}
 
if (ealen > nrpages << PAGE_CACHE_SHIFT) {
rc = -EINVAL;
-   goto out;
+   goto finish_request;
}
 
if (ealen == 0) { /* no logs transferred */
if (!eof)
rc = -EINVAL;
-   goto out;
+   goto finish_request;
}
 
mne_swab = !!ptlrpc_rep_need_swab(req);
@@ -1425,14 +1423,12 @@ again:
 
ealen -= PAGE_CACHE_SIZE;
}
-
-out:
-   if (req)
-   ptlrpc_req_finished(req);
+finish_request:
+   ptlrpc_req_finished(req);
 
if (rc == 0 && !eof)
goto again;
-
+free_pages:
for (i = 0; i < nrpages; i++) {
if (pages[i] == NULL)
break;
-- 
2.6.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 7/7] staging: lustre: Rename a jump label for module_put() calls

2015-12-13 Thread SF Markus Elfring
From: Markus Elfring 
Date: Sun, 13 Dec 2015 14:05:57 +0100

This issue was detected by using the Coccinelle software.

Choose a jump label according to the current Linux coding style convention.
I suggest to improve this implementation detail by the reuse of a script
like the following for the semantic patch language.

@rename_jump_label exists@
identifier target != put_module, work;
type return_type;
@@
 return_type work(...)
 {
 ... when any
 goto
-target
+put_module
 ;
 ... when any
-target
+put_module
 :
 module_put(...);
 ... when any
 }

Signed-off-by: Markus Elfring 
---
 drivers/staging/lustre/lustre/llite/lloop.c |  8 ++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c | 52 -
 drivers/staging/lustre/lustre/osc/osc_request.c | 24 ++--
 3 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lloop.c 
b/drivers/staging/lustre/lustre/llite/lloop.c
index 420d391..ebeef3b 100644
--- a/drivers/staging/lustre/lustre/llite/lloop.c
+++ b/drivers/staging/lustre/lustre/llite/lloop.c
@@ -484,14 +484,14 @@ static int loop_set_fd(struct lloop_device *lo, struct 
file *unused,
 
error = -EBUSY;
if (lo->lo_state != LLOOP_UNBOUND)
-   goto out;
+   goto put_module;
 
mapping = file->f_mapping;
inode = mapping->host;
 
error = -EINVAL;
if (!S_ISREG(inode->i_mode) || inode->i_sb->s_magic != LL_SUPER_MAGIC)
-   goto out;
+   goto put_module;
 
if (!(file->f_mode & FMODE_WRITE))
lo_flags |= LO_FLAGS_READ_ONLY;
@@ -500,7 +500,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file 
*unused,
 
if ((loff_t)(sector_t)size != size) {
error = -EFBIG;
-   goto out;
+   goto put_module;
}
 
/* remove all pages in cache so as dirty pages not to be existent. */
@@ -542,7 +542,7 @@ static int loop_set_fd(struct lloop_device *lo, struct file 
*unused,
down(&lo->lo_sem);
return 0;
 
-out:
+put_module:
/* This is safe: open() is still holding a reference. */
module_put(THIS_MODULE);
return error;
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c 
b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 2085ba6..eaeca9a 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1734,7 +1734,7 @@ static int mdc_iocontrol(unsigned int cmd, struct 
obd_export *exp, int len,
switch (cmd) {
case OBD_IOC_CHANGELOG_SEND:
rc = mdc_ioc_changelog_send(obd, karg);
-   goto out;
+   goto put_module;
case OBD_IOC_CHANGELOG_CLEAR: {
struct ioc_changelog *icc = karg;
struct changelog_setinfo cs = {
@@ -1745,47 +1745,47 @@ static int mdc_iocontrol(unsigned int cmd, struct 
obd_export *exp, int len,
rc = obd_set_info_async(NULL, exp, strlen(KEY_CHANGELOG_CLEAR),
KEY_CHANGELOG_CLEAR, sizeof(cs), &cs,
NULL);
-   goto out;
+   goto put_module;
}
case OBD_IOC_FID2PATH:
rc = mdc_ioc_fid2path(exp, karg);
-   goto out;
+   goto put_module;
case LL_IOC_HSM_CT_START:
rc = mdc_ioc_hsm_ct_start(exp, karg);
/* ignore if it was already registered on this MDS. */
if (rc == -EEXIST)
rc = 0;
-   goto out;
+   goto put_module;
case LL_IOC_HSM_PROGRESS:
rc = mdc_ioc_hsm_progress(exp, karg);
-   goto out;
+   goto put_module;
case LL_IOC_HSM_STATE_GET:
rc = mdc_ioc_hsm_state_get(exp, karg);
-   goto out;
+   goto put_module;
case LL_IOC_HSM_STATE_SET:
rc = mdc_ioc_hsm_state_set(exp, karg);
-   goto out;
+   goto put_module;
case LL_IOC_HSM_ACTION:
rc = mdc_ioc_hsm_current_action(exp, karg);
-   goto out;
+   goto put_module;
case LL_IOC_HSM_REQUEST:
rc = mdc_ioc_hsm_request(exp, karg);
-   goto out;
+   goto put_module;
case OBD_IOC_CLIENT_RECOVER:
rc = ptlrpc_recover_import(imp, data->ioc_inlbuf1, 0);
if (rc < 0)
-   goto out;
+   goto put_module;
rc = 0;
-   goto out;
+   goto put_module;
case IOC_OSC_SET_ACTIVE:
rc = ptlrpc_set_import_active(imp, data->ioc_offset);
-   goto out;
+   goto put_module;
case OBD_IOC_POLL_QUOTACHECK:
rc = mdc_quota_poll_check(exp, (struct if_quotacheck *)karg);
-   

[PATCH v3] Staging: iio: accel: Fixed NULL comparison style

2015-12-13 Thread Bhaktipriya Shridhar
The variable u8 **rx_p, is a pointer-to-pointer and hence the check
should
be "if (!*rx_p)" and not "if (!rx_p)".
In the earlier version, checkpatch.pl gave the following check, which
was incorrect:
CHECK: Comparison to NULL could be written "!rx_p"
+   if (*rx_p == NULL) {

Signed-off-by: Bhaktipriya Shridhar 
---
 Changes in v3:
- Replaced "if (!rx_p)" with "if (!*rx_p)"
- Changes are made on the original code

 drivers/staging/iio/accel/sca3000_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/sca3000_ring.c 
b/drivers/staging/iio/accel/sca3000_ring.c
index 20b878d..1920dc60 100644
--- a/drivers/staging/iio/accel/sca3000_ring.c
+++ b/drivers/staging/iio/accel/sca3000_ring.c
@@ -48,7 +48,7 @@ static int sca3000_read_data(struct sca3000_state *st,
}
};
*rx_p = kmalloc(len, GFP_KERNEL);
-   if (*rx_p == NULL) {
+   if (!*rx_p) {
ret = -ENOMEM;
goto error_ret;
}
-- 
2.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V3 0/4] scsi: storvsc: Properly support FC hosts

2015-12-13 Thread K. Y. Srinivasan
Properly support FC hosts. Additional cleanup patches are also
included.

V2: Comments from Dan Carpenter  and
from Johannes Thumshirn  addressed.

V3: Fixed build issues reported by kbuild test robot 

K. Y. Srinivasan (4):
  scsi: storvsc: Fix a bug in the layout of the hv_fc_wwn_packet
  scsi: storvsc: Properly support Fibre Channel devices
  scsi: storvsc: Refactor the code in storvsc_channel_init()
  scsi: storvsc: Tighten up the interrupt path

 drivers/scsi/storvsc_drv.c |  275 +--
 1 files changed, 160 insertions(+), 115 deletions(-)

-- 
1.7.4.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V3 1/4] scsi: storvsc: Fix a bug in the layout of the hv_fc_wwn_packet

2015-12-13 Thread K. Y. Srinivasan
The hv_fc_wwn_packet is exchanged over vmbus. Make the definition in Linux match
the Window's definition.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Johannes Thumshirn 
Reviewed-by: Long Li 
Tested-by: Alex Ng 
---
 drivers/scsi/storvsc_drv.c |5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index c41f674..00bb4bd 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -92,9 +92,8 @@ enum vstor_packet_operation {
  */
 
 struct hv_fc_wwn_packet {
-   boolprimary_active;
-   u8  reserved1;
-   u8  reserved2;
+   u8  primary_active;
+   u8  reserved1[3];
u8  primary_port_wwn[8];
u8  primary_node_wwn[8];
u8  secondary_port_wwn[8];
-- 
1.7.4.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH V3 3/4] scsi: storvsc: Refactor the code in storvsc_channel_init()

2015-12-13 Thread K. Y. Srinivasan
The function storvsc_channel_init() repeatedly interacts with the host to
extract various channel properties. Refactor this code to eliminate code
repetition.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Long Li 
Reviewed-by: Johannes Thumshirn 
Tested-by: Alex Ng 
---
V2: Fixed error paths - Dan Carpenter 

 drivers/scsi/storvsc_drv.c |  126 
 1 files changed, 46 insertions(+), 80 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 220b794..d6ca4f2 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -723,29 +723,17 @@ static void cache_wwn(struct storvsc_device *stor_device,
}
 }
 
-static int storvsc_channel_init(struct hv_device *device, bool is_fc)
+
+static int storvsc_execute_vstor_op(struct hv_device *device,
+   struct storvsc_cmd_request *request,
+   bool status_check)
 {
-   struct storvsc_device *stor_device;
-   struct storvsc_cmd_request *request;
struct vstor_packet *vstor_packet;
-   int ret, t, i;
-   int max_chns;
-   bool process_sub_channels = false;
-
-   stor_device = get_out_stor_device(device);
-   if (!stor_device)
-   return -ENODEV;
+   int ret, t;
 
-   request = &stor_device->init_request;
vstor_packet = &request->vstor_packet;
 
-   /*
-* Now, initiate the vsc/vsp initialization protocol on the open
-* channel
-*/
-   memset(request, 0, sizeof(struct storvsc_cmd_request));
init_completion(&request->wait_event);
-   vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
ret = vmbus_sendpacket(device->channel, vstor_packet,
@@ -761,17 +749,50 @@ static int storvsc_channel_init(struct hv_device *device, 
bool is_fc)
if (t == 0)
return -ETIMEDOUT;
 
+   if (!status_check)
+   return ret;
+
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
vstor_packet->status != 0)
return -EINVAL;
 
+   return ret;
+}
+
+static int storvsc_channel_init(struct hv_device *device, bool is_fc)
+{
+   struct storvsc_device *stor_device;
+   struct storvsc_cmd_request *request;
+   struct vstor_packet *vstor_packet;
+   int ret, i;
+   int max_chns;
+   bool process_sub_channels = false;
+
+   stor_device = get_out_stor_device(device);
+   if (!stor_device)
+   return -ENODEV;
+
+   request = &stor_device->init_request;
+   vstor_packet = &request->vstor_packet;
+
+   /*
+* Now, initiate the vsc/vsp initialization protocol on the open
+* channel
+*/
+   memset(request, 0, sizeof(struct storvsc_cmd_request));
+   vstor_packet->operation = VSTOR_OPERATION_BEGIN_INITIALIZATION;
+   ret = storvsc_execute_vstor_op(device, request, true);
+   if (ret)
+   return ret;
+   /*
+* Query host supported protocol version.
+*/
 
for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) {
/* reuse the packet for version range supported */
memset(vstor_packet, 0, sizeof(struct vstor_packet));
vstor_packet->operation =
VSTOR_OPERATION_QUERY_PROTOCOL_VERSION;
-   vstor_packet->flags = REQUEST_COMPLETION_FLAG;
 
vstor_packet->version.major_minor =
vmstor_protocols[i].protocol_version;
@@ -780,20 +801,10 @@ static int storvsc_channel_init(struct hv_device *device, 
bool is_fc)
 * The revision number is only used in Windows; set it to 0.
 */
vstor_packet->version.revision = 0;
-
-   ret = vmbus_sendpacket(device->channel, vstor_packet,
-  (sizeof(struct vstor_packet) -
-   vmscsi_size_delta),
-  (unsigned long)request,
-  VM_PKT_DATA_INBAND,
-  VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
+   ret = storvsc_execute_vstor_op(device, request, false);
if (ret != 0)
return ret;
 
-   t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
-   if (t == 0)
-   return -ETIMEDOUT;
-
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO)
return -EINVAL;
 
@@ -817,26 +828,10 @@ static int storvsc_channel_init(struct hv_device *device, 
bool is_fc)
 
memset(vstor_packet, 0, sizeof(struct vstor_packet));
vstor_packet->operation = VSTOR_OPERATION_QUERY_PROPERTIES;
-   vstor_packet->flags = REQUEST_COMPLETION_FLAG;
-
-   ret = vmbus_sendpacket(device->channel, vstor_packet,

[PATCH V3 2/4] scsi: storvsc: Properly support Fibre Channel devices

2015-12-13 Thread K. Y. Srinivasan
For FC devices managed by this driver, atttach the appropriate transport
template. This will allow us to create the appropriate sysfs files for
these devices. With this we can publish the wwn for both the port and the node.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Long Li 
Tested-by: Alex Ng 
---
V2: Fixed error paths - Dan Carpenter 
V3: Fixed build issues reported by kbuild test robot 

 drivers/scsi/storvsc_drv.c |  181 ---
 1 files changed, 134 insertions(+), 47 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index 00bb4bd..220b794 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -41,6 +41,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * All wire protocol details (storage protocol between the guest and the host)
@@ -397,6 +398,9 @@ static int storvsc_timeout = 180;
 
 static int msft_blist_flags = BLIST_TRY_VPD_PAGES;
 
+#ifdef CONFIG_SCSI_FC_ATTRS
+static struct scsi_transport_template *fc_transport_template;
+#endif
 
 static void storvsc_on_channel_callback(void *context);
 
@@ -456,6 +460,11 @@ struct storvsc_device {
/* Used for vsc/vsp channel reset process */
struct storvsc_cmd_request init_request;
struct storvsc_cmd_request reset_request;
+   /*
+* Currently active port and node names for FC devices.
+*/
+   u64 node_name;
+   u64 port_name;
 };
 
 struct hv_host_device {
@@ -695,7 +704,26 @@ static void  handle_multichannel_storage(struct hv_device 
*device, int max_chns)
vmbus_are_subchannels_present(device->channel);
 }
 
-static int storvsc_channel_init(struct hv_device *device)
+static void cache_wwn(struct storvsc_device *stor_device,
+ struct vstor_packet *vstor_packet)
+{
+   /*
+* Cache the currently active port and node ww names.
+*/
+   if (vstor_packet->wwn_packet.primary_active) {
+   stor_device->node_name =
+   wwn_to_u64(vstor_packet->wwn_packet.primary_node_wwn);
+   stor_device->port_name =
+   wwn_to_u64(vstor_packet->wwn_packet.primary_port_wwn);
+   } else {
+   stor_device->node_name =
+   wwn_to_u64(vstor_packet->wwn_packet.secondary_node_wwn);
+   stor_device->port_name =
+   wwn_to_u64(vstor_packet->wwn_packet.secondary_port_wwn);
+   }
+}
+
+static int storvsc_channel_init(struct hv_device *device, bool is_fc)
 {
struct storvsc_device *stor_device;
struct storvsc_cmd_request *request;
@@ -727,19 +755,15 @@ static int storvsc_channel_init(struct hv_device *device)
   VM_PKT_DATA_INBAND,
   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
-   goto cleanup;
+   return ret;
 
t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
-   if (t == 0) {
-   ret = -ETIMEDOUT;
-   goto cleanup;
-   }
+   if (t == 0)
+   return -ETIMEDOUT;
 
if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO ||
-   vstor_packet->status != 0) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   vstor_packet->status != 0)
+   return -EINVAL;
 
 
for (i = 0; i < ARRAY_SIZE(vmstor_protocols); i++) {
@@ -764,18 +788,14 @@ static int storvsc_channel_init(struct hv_device *device)
   VM_PKT_DATA_INBAND,
   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
if (ret != 0)
-   goto cleanup;
+   return ret;
 
t = wait_for_completion_timeout(&request->wait_event, 5*HZ);
-   if (t == 0) {
-   ret = -ETIMEDOUT;
-   goto cleanup;
-   }
+   if (t == 0)
+   return -ETIMEDOUT;
 
-   if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO)
+   return -EINVAL;
 
if (vstor_packet->status == 0) {
vmstor_proto_version =
@@ -791,10 +811,8 @@ static int storvsc_channel_init(struct hv_device *device)
}
}
 
-   if (vstor_packet->status != 0) {
-   ret = -EINVAL;
-   goto cleanup;
-   }
+   if (vstor_packet->status != 0)
+   return -EINVAL;
 
 
memset(vstor_packet, 0, sizeof(struct vstor_packet));
@@ -809,19 +827,15 @@ static int storvsc_channel_init(struct hv_device *device)
   VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED);
 
if (ret != 0

[PATCH V3 4/4] scsi: storvsc: Tighten up the interrupt path

2015-12-13 Thread K. Y. Srinivasan
On the interrupt path, we repeatedly establish the pointer to the
storvsc_device. Fix this.

Signed-off-by: K. Y. Srinivasan 
Reviewed-by: Long Li 
Reviewed-by: Johannes Thumshirn 
Tested-by: Alex Ng 
---
 drivers/scsi/storvsc_drv.c |   23 ---
 1 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c
index d6ca4f2..b68aebe 100644
--- a/drivers/scsi/storvsc_drv.c
+++ b/drivers/scsi/storvsc_drv.c
@@ -945,19 +945,16 @@ static void storvsc_handle_error(struct vmscsi_request 
*vm_srb,
 }
 
 
-static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request)
+static void storvsc_command_completion(struct storvsc_cmd_request *cmd_request,
+  struct storvsc_device *stor_dev)
 {
struct scsi_cmnd *scmnd = cmd_request->cmd;
-   struct hv_host_device *host_dev = shost_priv(scmnd->device->host);
struct scsi_sense_hdr sense_hdr;
struct vmscsi_request *vm_srb;
struct Scsi_Host *host;
-   struct storvsc_device *stor_dev;
-   struct hv_device *dev = host_dev->dev;
u32 payload_sz = cmd_request->payload_sz;
void *payload = cmd_request->payload;
 
-   stor_dev = get_in_stor_device(dev);
host = stor_dev->host;
 
vm_srb = &cmd_request->vstor_packet.vm_srb;
@@ -987,14 +984,13 @@ static void storvsc_command_completion(struct 
storvsc_cmd_request *cmd_request)
kfree(payload);
 }
 
-static void storvsc_on_io_completion(struct hv_device *device,
+static void storvsc_on_io_completion(struct storvsc_device *stor_device,
  struct vstor_packet *vstor_packet,
  struct storvsc_cmd_request *request)
 {
-   struct storvsc_device *stor_device;
struct vstor_packet *stor_pkt;
+   struct hv_device *device = stor_device->device;
 
-   stor_device = hv_get_drvdata(device);
stor_pkt = &request->vstor_packet;
 
/*
@@ -1049,7 +1045,7 @@ static void storvsc_on_io_completion(struct hv_device 
*device,
stor_pkt->vm_srb.data_transfer_length =
vstor_packet->vm_srb.data_transfer_length;
 
-   storvsc_command_completion(request);
+   storvsc_command_completion(request, stor_device);
 
if (atomic_dec_and_test(&stor_device->num_outstanding_req) &&
stor_device->drain_notify)
@@ -1058,21 +1054,19 @@ static void storvsc_on_io_completion(struct hv_device 
*device,
 
 }
 
-static void storvsc_on_receive(struct hv_device *device,
+static void storvsc_on_receive(struct storvsc_device *stor_device,
 struct vstor_packet *vstor_packet,
 struct storvsc_cmd_request *request)
 {
struct storvsc_scan_work *work;
-   struct storvsc_device *stor_device;
 
switch (vstor_packet->operation) {
case VSTOR_OPERATION_COMPLETE_IO:
-   storvsc_on_io_completion(device, vstor_packet, request);
+   storvsc_on_io_completion(stor_device, vstor_packet, request);
break;
 
case VSTOR_OPERATION_REMOVE_DEVICE:
case VSTOR_OPERATION_ENUMERATE_BUS:
-   stor_device = get_in_stor_device(device);
work = kmalloc(sizeof(struct storvsc_scan_work), GFP_ATOMIC);
if (!work)
return;
@@ -1083,7 +1077,6 @@ static void storvsc_on_receive(struct hv_device *device,
break;
 
case VSTOR_OPERATION_FCHBA_DATA:
-   stor_device = get_in_stor_device(device);
cache_wwn(stor_device, vstor_packet);
 #ifdef CONFIG_SCSI_FC_ATTRS
fc_host_node_name(stor_device->host) = stor_device->node_name;
@@ -1133,7 +1126,7 @@ static void storvsc_on_channel_callback(void *context)
vmscsi_size_delta));
complete(&request->wait_event);
} else {
-   storvsc_on_receive(device,
+   storvsc_on_receive(stor_device,
(struct vstor_packet *)packet,
request);
}
-- 
1.7.4.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: comedi: pcmcia: fixed a line with over 80 chars

2015-12-13 Thread Philippe Loctaux
This patch fixes the checkpatch.pl warning:

WARNING: line over 80 characters

Signed-off-by: Philippe Loctaux 
---
 drivers/staging/comedi/comedi_pcmcia.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/comedi_pcmcia.h 
b/drivers/staging/comedi/comedi_pcmcia.h
index 5d3db2b..245e6bd 100644
--- a/drivers/staging/comedi/comedi_pcmcia.h
+++ b/drivers/staging/comedi/comedi_pcmcia.h
@@ -38,8 +38,10 @@ int comedi_pcmcia_driver_register(struct comedi_driver *,
 void comedi_pcmcia_driver_unregister(struct comedi_driver *,
 struct pcmcia_driver *);
 
-/**
- * module_comedi_pcmcia_driver() - Helper macro for registering a comedi 
PCMCIA driver
+/*
+ * module_comedi_pcmcia_driver()
+ * Helper macro for registering a comedi PCMCIA driver
+ *
  * @__comedi_driver: comedi_driver struct
  * @__pcmcia_driver: pcmcia_driver struct
  *
-- 
2.6.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH net-next] hv_netvsc: Fix race condition on Multi-Send Data field

2015-12-13 Thread David Miller
From: Haiyang Zhang 
Date: Thu, 10 Dec 2015 12:19:35 -0800

> In commit 2a04ae8acb14 ("hv_netvsc: remove locking in netvsc_send()"), the
> locking for MSD (Multi-Send Data) field was removed. This could cause a
> race condition between RNDIS control messages and data packets processing,
> because these two types of traffic are not synchronized.
> This patch fixes this issue by sending control messages out directly
> without reading MSD field.
> 
> Signed-off-by: Haiyang Zhang 
> Reviewed-by: K. Y. Srinivasan 

Applied.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 00/12] Use index of interface to communicate with wilc device

2015-12-13 Thread Glen Lee
Wilc device now use index of wfidrv_list which is list of host_if_drv pointers.
Each host_if_drv correspond with each wilc_vif interface, so we can use index
of vif. Therefore, so no need to make another list, wfidrv_list, to lookup
which interface the device is communicating.

Here are brief steps,
Firstly, Pass wilc_vif, currently being used, as msg argument to host interface
thread to use index of vif.
Secondly, Remove argument hif_drv since wilc_vif has it in it's member.
Thirdly, use index of vif to communicate with wilc device.
Lastly, remove unused structure and functions related with wfidrv_list
because it is not used anymore.

Last patch is bug fix which was found during patching this.

Glen Lee (12):
  staging: wilc1000: pass vif to hostIFthread
  staging: wilc1000: remove argument hif_drv
  staging: wilc1000: take vif instead of drv in hostIFthread
  staging: wilc1000: pass struct wilc
  staging: wilc1000: use vif index to communicate with wilc device
  staging: wilc1000: wilc_set_wfi_drv_handler: pass vif index
  staging: wilc1000: change join_req_drv type and it's name
  staging: wilc1000: remove used functions
  staging: wilc1000: remove drv of struct host_if_msg
  staging: wilc1000: remove wilc of struct host_if_drv
  staging: wilc1000: set hif_drv before it is used
  staging: wilc1000: bug fix on memory free

 drivers/staging/wilc1000/coreconfigurator.h   |  11 +-
 drivers/staging/wilc1000/host_interface.c | 790 +++---
 drivers/staging/wilc1000/host_interface.h | 144 ++--
 drivers/staging/wilc1000/linux_wlan.c |  23 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 265 
 drivers/staging/wilc1000/wilc_wlan.c  |   3 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |   9 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.h  |   4 +-
 8 files changed, 643 insertions(+), 606 deletions(-)

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/12] staging: wilc1000: pass vif to hostIFthread

2015-12-13 Thread Glen Lee
We will pass vif, which is currently being used as net_device, instead of
hif_dev. This is the first step to use index of vif to pass to the driver.
Add new argument vif to all the functions that send message to hostIFthread and
set vif to msg.vif. As a result, hostIfthread will get vif.
In later patch, we will remove drv of host_if_msg and use vif instead of it.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 235 ++
 drivers/staging/wilc1000/host_interface.h | 165 +++
 drivers/staging/wilc1000/linux_wlan.c |  22 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 166 ---
 4 files changed, 342 insertions(+), 246 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f7e560e..c52a8e1 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -194,6 +194,7 @@ struct host_if_msg {
u16 id;
union message_body body;
struct host_if_drv *drv;
+   struct wilc_vif *vif;
 };
 
 struct join_bss_param {
@@ -389,9 +390,13 @@ static s32 handle_set_operation_mode(struct host_if_drv 
*hif_drv,
return result;
 }
 
-static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, 
u8 idx);
+static s32 host_int_get_ipaddress(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv,
+ u8 *u16ipadd, u8 idx);
 
-static s32 handle_set_ip_address(struct host_if_drv *hif_drv, u8 *ip_addr, u8 
idx)
+static s32 handle_set_ip_address(struct wilc_vif *vif,
+struct host_if_drv *hif_drv, u8 *ip_addr,
+u8 idx)
 {
s32 result = 0;
struct wid wid;
@@ -413,7 +418,7 @@ static s32 handle_set_ip_address(struct host_if_drv 
*hif_drv, u8 *ip_addr, u8 id
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
 get_id_from_handler(hif_drv));
 
-   host_int_get_ipaddress(hif_drv, firmware_ip_addr, idx);
+   host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);
 
if (result) {
PRINT_ER("Failed to set IP address\n");
@@ -425,7 +430,8 @@ static s32 handle_set_ip_address(struct host_if_drv 
*hif_drv, u8 *ip_addr, u8 id
return result;
 }
 
-static s32 handle_get_ip_address(struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct wilc_vif *vif,
+struct host_if_drv *hif_drv, u8 idx)
 {
s32 result = 0;
struct wid wid;
@@ -445,7 +451,7 @@ static s32 handle_get_ip_address(struct host_if_drv 
*hif_drv, u8 idx)
kfree(wid.val);
 
if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
-   wilc_setup_ipaddress(hif_drv, set_ip[idx], idx);
+   wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx);
 
if (result != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -1490,7 +1496,8 @@ static s32 host_int_get_assoc_res_info(struct host_if_drv 
*hif_drv,
   u32 u32MaxAssocRespInfoLen,
   u32 *pu32RcvdAssocRespInfoLen);
 
-static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv *hif_drv,
+static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
+   struct host_if_drv *hif_drv,
struct rcvd_async_info 
*pstrRcvdGnrlAsyncInfo)
 {
s32 result = 0;
@@ -1619,7 +1626,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
 
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == 
SUCCESSFUL_STATUSCODE)) {
-   wilc_set_power_mgmt(hif_drv, 0, 0);
+   wilc_set_power_mgmt(vif, hif_drv, 0, 0);
 
PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED 
and Connect Status : Successful\n");
hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1662,7 +1669,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct host_if_drv 
*hif_drv,
 
if (hif_drv->usr_conn_req.conn_result) {
wilc_optaining_ip = false;
-   wilc_set_power_mgmt(hif_drv, 0, 0);
+   wilc_set_power_mgmt(vif, hif_drv, 0, 0);
 

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
  NULL,
@@ -1984,7 +1991,8 @@ _WPAPtk_end_case_:
return result;
 }
 
-static void Handle_Disconnect(struct host_if_drv *hif_drv)
+static void Handle_Disconnect(struct wilc_vif *vif,
+ struct host_if_drv *hif_drv)
 {
struct wid wid;
 
@@ -1999,7 +2007,7 @@ static 

[PATCH 02/12] staging: wilc1000: remove argument hif_drv

2015-12-13 Thread Glen Lee
In previous patch we add new argument vif which has hif_drv in it's member.
Therefore, no need to pass hif_drv in those functions. Remove argument
struct host_if_drv and use hif_drv of vif.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 176 -
 drivers/staging/wilc1000/host_interface.h | 127 +---
 drivers/staging/wilc1000/linux_wlan.c |  20 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 223 +++---
 4 files changed, 264 insertions(+), 282 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c52a8e1..d4bcf39 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -451,7 +451,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif,
kfree(wid.val);
 
if (memcmp(get_ip[idx], set_ip[idx], IP_ALEN) != 0)
-   wilc_setup_ipaddress(vif, hif_drv, set_ip[idx], idx);
+   wilc_setup_ipaddress(vif, set_ip[idx], idx);
 
if (result != 0) {
PRINT_ER("Failed to get IP address\n");
@@ -1626,7 +1626,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
 
if ((u8MacStatus == MAC_CONNECTED) &&
(strConnectInfo.u16ConnectStatus == 
SUCCESSFUL_STATUSCODE)) {
-   wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+   wilc_set_power_mgmt(vif, 0, 0);
 
PRINT_D(HOSTINF_DBG, "MAC status : CONNECTED 
and Connect Status : Successful\n");
hif_drv->hif_state = HOST_IF_CONNECTED;
@@ -1669,7 +1669,7 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif *vif,
 
if (hif_drv->usr_conn_req.conn_result) {
wilc_optaining_ip = false;
-   wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+   wilc_set_power_mgmt(vif, 0, 0);
 

hif_drv->usr_conn_req.conn_result(CONN_DISCONN_EVENT_DISCONN_NOTIF,
  NULL,
@@ -2007,7 +2007,7 @@ static void Handle_Disconnect(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Sending disconnect request\n");
 
wilc_optaining_ip = false;
-   wilc_set_power_mgmt(vif, hif_drv, 0, 0);
+   wilc_set_power_mgmt(vif, 0, 0);
 
eth_zero_addr(wilc_connected_ssid);
 
@@ -2075,15 +2075,14 @@ static void Handle_Disconnect(struct wilc_vif *vif,
up(&hif_drv->sem_test_disconn_block);
 }
 
-void wilc_resolve_disconnect_aberration(struct wilc_vif *vif,
-   struct host_if_drv *hif_drv)
+void wilc_resolve_disconnect_aberration(struct wilc_vif *vif)
 {
-   if (!hif_drv)
+   if (!vif->hif_drv)
return;
-   if ((hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
-   (hif_drv->hif_state == HOST_IF_CONNECTING)) {
+   if ((vif->hif_drv->hif_state == HOST_IF_WAITING_CONN_RESP) ||
+   (vif->hif_drv->hif_state == HOST_IF_CONNECTING)) {
PRINT_D(HOSTINF_DBG, "\n\n<< correcting Supplicant state 
machine >>\n\n");
-   wilc_disconnect(vif, hif_drv, 1);
+   wilc_disconnect(vif, 1);
}
 }
 
@@ -3033,11 +3032,11 @@ s32 wilc_remove_key(struct host_if_drv *hif_drv, const 
u8 *pu8StaAddress)
return 0;
 }
 
-int wilc_remove_wep_key(struct wilc_vif *vif,
-   struct host_if_drv *hif_drv, u8 index)
+int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
 {
int result = 0;
struct host_if_msg msg;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
result = -EFAULT;
@@ -3062,11 +3061,11 @@ int wilc_remove_wep_key(struct wilc_vif *vif,
return result;
 }
 
-int wilc_set_wep_default_keyid(struct wilc_vif *vif,
-  struct host_if_drv *hif_drv, u8 index)
+int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 index)
 {
int result = 0;
struct host_if_msg msg;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
result = -EFAULT;
@@ -3091,11 +3090,12 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif,
return result;
 }
 
-int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, struct host_if_drv *hif_drv,
-const u8 *key, u8 len, u8 index)
+int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const u8 *key, u8 len,
+u8 index)
 {
int result = 0;
struct host_if_msg msg;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
if (!hif_drv) {
PRINT_ER("driver is null\n");
@@ -3124,12 +3124,12 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, 
struct host_if_drv *hif_drv,
return result;
 }
 

[PATCH 08/12] staging: wilc1000: remove used functions

2015-12-13 Thread Glen Lee
This patch remove unused functions add_handler_in_list and
remove_handler_in_list, and it's related global variable wfidrv_list and codes.
label fail_timer_2 and it's codes are removed since label is not used anymore.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 44 ---
 1 file changed, 44 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 76e891c..5bf2a47 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -226,7 +226,6 @@ struct join_bss_param {
u8 start_time[4];
 };
 
-static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
 bool wilc_optaining_ip;
 static u8 P2P_LISTEN_STATE;
@@ -266,34 +265,6 @@ static struct wilc_vif *join_req_vif;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-static int add_handler_in_list(struct host_if_drv *handler)
-{
-   int i;
-
-   for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
-   if (!wfidrv_list[i]) {
-   wfidrv_list[i] = handler;
-   return 0;
-   }
-   }
-
-   return -ENOBUFS;
-}
-
-static int remove_handler_in_list(struct host_if_drv *handler)
-{
-   int i;
-
-   for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
-   if (wfidrv_list[i] == handler) {
-   wfidrv_list[i] = NULL;
-   return 0;
-   }
-   }
-
-   return -EINVAL;
-}
-
 /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
  * special purpose in wilc device, so we add 1 to the index to starts from 1.
  * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
@@ -3845,7 +3816,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 {
s32 result = 0;
struct host_if_drv *hif_drv;
-   int err;
struct wilc_vif *vif;
struct wilc *wilc;
 
@@ -3865,11 +3835,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
}
hif_drv->wilc = wilc;
*hif_drv_handler = hif_drv;
-   err = add_handler_in_list(hif_drv);
-   if (err) {
-   result = -EFAULT;
-   goto _fail_timer_2;
-   }
 
wilc_optaining_ip = false;
 
@@ -3939,10 +3904,6 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
 
return result;
 
-_fail_timer_2:
-   del_timer_sync(&hif_drv->connect_timer);
-   del_timer_sync(&hif_drv->scan_timer);
-   kthread_stop(hif_thread_handler);
 _fail_mq_:
wilc_mq_destroy(&hif_msg_q);
 _fail_:
@@ -3954,7 +3915,6 @@ s32 wilc_deinit(struct wilc_vif *vif)
s32 result = 0;
struct host_if_msg msg;
struct host_if_drv *hif_drv = vif->hif_drv;
-   int ret;
 
if (!hif_drv)   {
PRINT_ER("hif_drv = NULL\n");
@@ -4009,10 +3969,6 @@ s32 wilc_deinit(struct wilc_vif *vif)
wilc_mq_destroy(&hif_msg_q);
}
 
-   ret = remove_handler_in_list(hif_drv);
-   if (ret)
-   result = -ENOENT;
-
kfree(hif_drv);
 
clients_count--;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/12] staging: wilc1000: wilc_set_wfi_drv_handler: pass vif index

2015-12-13 Thread Glen Lee
Pass index of vif instead of hif_drv. wilc_get_vif_idx is used to get correct
index of vif.
In the handler function handle_set_wfi_drv_handler, use vif instead of hif_drv,
and use hif_drv_handler->handler instead of hif_drv when deinitialize wilc
device.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 14 ++
 drivers/staging/wilc1000/host_interface.h |  3 ++-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 +++-
 3 files changed, 15 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 0893331..840253b 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -313,7 +313,7 @@ static int get_id_from_handler(struct host_if_drv *handler)
  * special purpose in wilc device, so we add 1 to the index to starts from 1.
  * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
  */
-static int wilc_get_vif_idx(struct wilc_vif *vif)
+int wilc_get_vif_idx(struct wilc_vif *vif)
 {
return vif->u8IfIdx + 1;
 }
@@ -363,17 +363,16 @@ static s32 handle_set_wfi_drv_handler(struct wilc_vif 
*vif,
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
wid.val = (s8 *)&hif_drv_handler->handler;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
  hif_drv_handler->handler);
 
-   if (!hif_drv)
+   if (!hif_drv_handler->handler)
up(&hif_sema_driver);
 
if (result) {
@@ -3631,15 +3630,14 @@ int wilc_wait_msg_queue_idle(void)
return result;
 }
 
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv *hif_drv)
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index)
 {
int result = 0;
struct host_if_msg msg;
 
memset(&msg, 0, sizeof(struct host_if_msg));
msg.id = HOST_IF_MSG_SET_WFIDRV_HANDLER;
-   msg.body.drv.handler = get_id_from_handler(hif_drv);
-   msg.drv = hif_drv;
+   msg.body.drv.handler = index;
msg.vif = vif;
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3994,7 +3992,7 @@ s32 wilc_deinit(struct wilc_vif *vif)
 
del_timer_sync(&hif_drv->remain_on_ch_timer);
 
-   wilc_set_wfi_drv_handler(vif, NULL);
+   wilc_set_wfi_drv_handler(vif, 0);
down(&hif_sema_driver);
 
if (hif_drv->usr_scan_req.scan_result) {
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 9716bc8..8922f29 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -367,13 +367,14 @@ s32 wilc_remain_on_channel(struct wilc_vif *vif, u32 
u32SessionID,
   void *pvUserArg);
 s32 wilc_listen_state_expired(struct wilc_vif *vif, u32 u32SessionID);
 s32 wilc_frame_register(struct wilc_vif *vif, u16 u16FrameType, bool bReg);
-int wilc_set_wfi_drv_handler(struct wilc_vif *vif, struct host_if_drv 
*hif_drv);
+int wilc_set_wfi_drv_handler(struct wilc_vif *vif, int index);
 int wilc_set_operation_mode(struct wilc_vif *vif, u32 mode);
 
 void wilc_free_join_params(void *pJoinParams);
 
 s32 wilc_get_statistics(struct wilc_vif *vif, struct rf_info *pstrStatistics);
 void wilc_resolve_disconnect_aberration(struct wilc_vif *vif);
+int wilc_get_vif_idx(struct wilc_vif *vif);
 
 extern bool wilc_optaining_ip;
 extern u8 wilc_connected_ssid[6];
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index da4c4ad..53fb2d4 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -628,7 +628,7 @@ static int scan(struct wiphy *wiphy, struct 
cfg80211_scan_request *request)
 
priv->u32RcvdChCount = 0;
 
-   wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
+   wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
reset_shadow_found();
 
priv->bCfgScanning = true;
@@ -709,7 +709,7 @@ static int connect(struct wiphy *wiphy, struct net_device 
*dev,
vif = netdev_priv(priv->dev);
pstrWFIDrv = (struct host_if_drv *)(priv->hWILCWFIDrv);
 
-   wilc_set_wfi_drv_handler(vif, priv->hWILCWFIDrv);
+   wilc_set_wfi_drv_handler(vif, wilc_get_vif_idx(vif));
 
PRINT_D(CFG80211_DBG, "Connecting to SSID [%s] on netdev [%p] host if 
[%p]\n", sme->ssid, dev, priv->hWILCWFIDrv);
if (!(strncmp(sme->ssid, "DIRECT-", 7))) {
@@ -2142,7 +2142,8 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
wilc_initialized = 1;
vif->iftype = interfac

[PATCH 12/12] staging: wilc1000: bug fix on memory free

2015-12-13 Thread Glen Lee
Set tx_buffer to NULL not to free again the memory that is already freed,
which could cause system crash when device is failed.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/wilc_wlan.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 00f3464..83af51b 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1374,6 +1374,7 @@ void wilc_wlan_cleanup(struct net_device *dev)
kfree(wilc->rx_buffer);
wilc->rx_buffer = NULL;
kfree(wilc->tx_buffer);
+   wilc->tx_buffer = NULL;
 
acquire_bus(wilc, ACQUIRE_AND_WAKEUP);
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 05/12] staging: wilc1000: use vif index to communicate with wilc device

2015-12-13 Thread Glen Lee
We now have vif index in all functions related with host interface thread.
wilc_get_vif_idx and wilc_get_vif_from_idx are added to get id and vif
respectively.
Relace get_id_from_handler with wilc_get_vif_idx and get_handler_from_id with
wilc_get_vif_from_idx. Remove unused function get_handler_from_id as well.
We get vif where wilc_get_vif_from_idx is called, so pass vif to msg.vif.

There are two get_id_from_handler left. They will be removed in later patch.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 127 +++---
 1 file changed, 81 insertions(+), 46 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 259cefc..0893331 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -309,11 +309,28 @@ static int get_id_from_handler(struct host_if_drv 
*handler)
return 0;
 }
 
-static struct host_if_drv *get_handler_from_id(int id)
+/* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
+ * special purpose in wilc device, so we add 1 to the index to starts from 1.
+ * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
+ */
+static int wilc_get_vif_idx(struct wilc_vif *vif)
 {
-   if (id <= 0 || id >= ARRAY_SIZE(wfidrv_list))
+   return vif->u8IfIdx + 1;
+}
+
+/* We need to minus 1 from idx which is from wilc device to get real index
+ * of wilc->vif[], because we add 1 when pass to wilc device in the function
+ * wilc_get_vif_idx.
+ * As a result, the index should be between 0 and NUM_CONCURRENT_IFC -1.
+ */
+static struct wilc_vif *wilc_get_vif_from_idx(struct wilc *wilc, int idx)
+{
+   int index = idx - 1;
+
+   if (index < 0 || index >= NUM_CONCURRENT_IFC)
return NULL;
-   return wfidrv_list[id];
+
+   return wilc->vif[index];
 }
 
 static s32 handle_set_channel(struct wilc_vif *vif,
@@ -331,7 +348,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
 
if (result) {
PRINT_ER("Failed to set channel\n");
@@ -380,7 +397,7 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
wid.size = sizeof(u32);
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
 
if ((hif_op_mode->mode) == IDLE_MODE)
up(&hif_sema_driver);
@@ -418,7 +435,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 
*ip_addr, u8 idx)
wid.size = IP_ALEN;
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
 
host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);
 
@@ -444,7 +461,7 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
wid.size = IP_ALEN;
 
result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
 
@@ -488,7 +505,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
result = -EFAULT;
@@ -511,7 +528,7 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;
 
result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
-get_id_from_handler(hif_drv));
+wilc_get_vif_idx(vif));
 
if (result) {
PRINT_ER("Failed to get mac address\n");
@@ -807,7 +824,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif,
}
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list,
- wid_cnt, get_id_from_handler(hif_drv));
+ wid_cnt, wilc_get_vif_idx(vif));
 
if (result)
PRINT_ER("Error in setting CFG params\n");
@@ -932,7 +949,7 @@ static s32 Handle_Scan(struct wilc_vif *vif,
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
  u32WidsCount,
- get_id_from_handler(hif_drv));
+

[PATCH 03/12] staging: wilc1000: take vif instead of drv in hostIFthread

2015-12-13 Thread Glen Lee
In the first patch, we sent vif to hostIFthread. we can use vif instead of
drv in the all functions which handle the commands from cfg operations.
Change first argument host_if_drv with wilc_vif and use hif_drv of wilc_vif.
Pass vif to the functions as well.
In case of timer callback functions, set vif to the data and use vif instead
of hif_drv.
Lastly, initialize u32RcvdAssocRespInfoLen since changing hif_drv with vif
causes one uninitialied build warning.
Now we have vif that currently being used so we can use interface index of
wilc_vif to send to wilc device.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 238 +-
 1 file changed, 135 insertions(+), 103 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index d4bcf39..e8c14cc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -316,11 +316,12 @@ static struct host_if_drv *get_handler_from_id(int id)
return wfidrv_list[id];
 }
 
-static s32 handle_set_channel(struct host_if_drv *hif_drv,
+static s32 handle_set_channel(struct wilc_vif *vif,
  struct channel_attr *hif_set_ch)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -340,11 +341,12 @@ static s32 handle_set_channel(struct host_if_drv *hif_drv,
return result;
 }
 
-static s32 handle_set_wfi_drv_handler(struct host_if_drv *hif_drv,
+static s32 handle_set_wfi_drv_handler(struct wilc_vif *vif,
  struct drv_handler *hif_drv_handler)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_SET_DRV_HANDLER;
wid.type = WID_INT;
@@ -365,11 +367,12 @@ static s32 handle_set_wfi_drv_handler(struct host_if_drv 
*hif_drv,
return result;
 }
 
-static s32 handle_set_operation_mode(struct host_if_drv *hif_drv,
+static s32 handle_set_operation_mode(struct wilc_vif *vif,
 struct op_mode *hif_op_mode)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
@@ -394,13 +397,12 @@ static s32 host_int_get_ipaddress(struct wilc_vif *vif,
  struct host_if_drv *hif_drv,
  u8 *u16ipadd, u8 idx);
 
-static s32 handle_set_ip_address(struct wilc_vif *vif,
-struct host_if_drv *hif_drv, u8 *ip_addr,
-u8 idx)
+static s32 handle_set_ip_address(struct wilc_vif *vif, u8 *ip_addr, u8 idx)
 {
s32 result = 0;
struct wid wid;
char firmware_ip_addr[4] = {0};
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
if (ip_addr[0] < 192)
ip_addr[0] = 0;
@@ -430,11 +432,11 @@ static s32 handle_set_ip_address(struct wilc_vif *vif,
return result;
 }
 
-static s32 handle_get_ip_address(struct wilc_vif *vif,
-struct host_if_drv *hif_drv, u8 idx)
+static s32 handle_get_ip_address(struct wilc_vif *vif, u8 idx)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
@@ -465,11 +467,12 @@ static s32 handle_get_ip_address(struct wilc_vif *vif,
return result;
 }
 
-static s32 handle_set_mac_address(struct host_if_drv *hif_drv,
+static s32 handle_set_mac_address(struct wilc_vif *vif,
  struct set_mac_addr *set_mac_addr)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
if (!mac_buf) {
@@ -495,11 +498,12 @@ static s32 handle_set_mac_address(struct host_if_drv 
*hif_drv,
return result;
 }
 
-static s32 handle_get_mac_address(struct host_if_drv *hif_drv,
+static s32 handle_get_mac_address(struct wilc_vif *vif,
  struct get_mac_addr *get_mac_addr)
 {
s32 result = 0;
struct wid wid;
+   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
@@ -518,11 +522,12 @@ static s32 handle_get_mac_address(struct host_if_drv 
*hif_drv,
return result;
 }
 
-static s32 handle_cfg_param(struct host_if_drv *hif_drv,
+static s32 handle_cfg_param(struct wilc_vif *vif,
struct cfg_param_attr *cfg_param_attr)
 {
s32 result = 0;
struct wid wid_list[32];
+   struct host_if_drv *hif_drv = vif->hif_drv;
u8 wid_cnt = 0;
 
down(&hif_drv->sem_cfg_values);
@@ -818,10 +823,10 @@ static void Handle_wait_msg_q_e

[PATCH 09/12] staging: wilc1000: remove drv of struct host_if_msg

2015-12-13 Thread Glen Lee
This patch remove drv of struct host_if msg and it's related codes.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 50 ++-
 1 file changed, 3 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 5bf2a47..39e93fa 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -193,7 +193,6 @@ union message_body {
 struct host_if_msg {
u16 id;
union message_body body;
-   struct host_if_drv *drv;
struct wilc_vif *vif;
 };
 
@@ -2787,7 +2786,6 @@ static int hostIFthread(void *pvArg)
 {
u32 u32Ret;
struct host_if_msg msg;
-   struct host_if_drv *hif_drv;
struct wilc *wilc = (struct wilc*)pvArg;
struct wilc_vif *vif;
 
@@ -2795,7 +2793,6 @@ static int hostIFthread(void *pvArg)
 
while (1) {
wilc_mq_recv(&hif_msg_q, &msg, sizeof(struct host_if_msg), 
&u32Ret);
-   hif_drv = (struct host_if_drv *)msg.drv;
vif = msg.vif;
if (msg.id == HOST_IF_MSG_EXIT) {
PRINT_D(GENERIC_DBG, "THREAD: Exiting HostIfThread\n");
@@ -2810,7 +2807,7 @@ static int hostIFthread(void *pvArg)
}
 
if (msg.id == HOST_IF_MSG_CONNECT &&
-   hif_drv->usr_scan_req.scan_result) {
+   vif->hif_drv->usr_scan_req.scan_result) {
PRINT_D(HOSTINF_DBG, "Requeue connect request till scan 
done received\n");
wilc_mq_send(&hif_msg_q, &msg, sizeof(struct 
host_if_msg));
usleep_range(2 * 1000, 2 * 1000);
@@ -2860,7 +2857,7 @@ static int hostIFthread(void *pvArg)
break;
 
case HOST_IF_MSG_RCVD_SCAN_COMPLETE:
-   del_timer(&hif_drv->scan_timer);
+   del_timer(&vif->hif_drv->scan_timer);
PRINT_D(HOSTINF_DBG, "scan completed successfully\n");
 
if (!wilc_wlan_get_num_conn_ifcs(wilc))
@@ -2868,7 +2865,7 @@ static int hostIFthread(void *pvArg)
 
Handle_ScanDone(msg.vif, SCAN_EVENT_DONE);
 
-   if (hif_drv->remain_on_ch_pending)
+   if (vif->hif_drv->remain_on_ch_pending)
Handle_RemainOnChan(msg.vif,
&msg.body.remain_on_ch);
 
@@ -3052,7 +3049,6 @@ int wilc_remove_wep_key(struct wilc_vif *vif, u8 index)
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = REMOVEKEY;
-   msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.index = index;
 
@@ -3081,7 +3077,6 @@ int wilc_set_wep_default_keyid(struct wilc_vif *vif, u8 
index)
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = DEFAULTKEY;
-   msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.index = index;
 
@@ -3110,7 +3105,6 @@ int wilc_add_wep_key_bss_sta(struct wilc_vif *vif, const 
u8 *key, u8 len,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY;
-   msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
@@ -3149,7 +3143,6 @@ int wilc_add_wep_key_bss_ap(struct wilc_vif *vif, const 
u8 *key, u8 len,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WEP;
msg.body.key_info.action = ADDKEY_AP;
-   msg.drv = hif_drv;
msg.vif = vif;
msg.body.key_info.attr.wep.key = kmemdup(key, len, GFP_KERNEL);
if (!msg.body.key_info.attr.wep.key)
@@ -3222,7 +3215,6 @@ s32 wilc_add_ptk(struct wilc_vif *vif, const u8 *pu8Ptk, 
u8 u8PtkKeylen,
msg.body.key_info.attr.wpa.key_len = u8KeyLen;
msg.body.key_info.attr.wpa.mac_addr = mac_addr;
msg.body.key_info.attr.wpa.mode = u8Ciphermode;
-   msg.drv = hif_drv;
msg.vif = vif;
 
result = wilc_mq_send(&hif_msg_q, &msg, sizeof(struct host_if_msg));
@@ -3264,7 +3256,6 @@ s32 wilc_add_rx_gtk(struct wilc_vif *vif, const u8 
*pu8RxGtk, u8 u8GtkKeylen,
 
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = WPA_RX_GTK;
-   msg.drv = hif_drv;
msg.vif = vif;
 
if (mode == AP_MODE) {
@@ -3316,7 +3307,6 @@ s32 wilc_set_pmkid_info(struct wilc_vif *vif,
msg.id = HOST_IF_MSG_KEY;
msg.body.key_info.type = PMKSA;
msg.body.key_info.action = ADDKEY;
-   msg.drv = hif_drv;
msg.vif = vif;
 
for (i = 0; i < pu8PmkidInfoArray->numpmkid; i++) {
@@ -3337,13 +3327,11 @@ s32 wilc_get_mac_address(struct wilc_vif *vif, u8 
*pu8MacAddress)
 {
s32 result = 0;
struc

[PATCH 07/12] staging: wilc1000: change join_req_drv type and it's name

2015-12-13 Thread Glen Lee
To use wilc_get_vif_idx instead of the last get_id_from_handler, join_req_drv
needs to be changed it's type with wilc_vif and name as well.
As a result, get_id_from_handler is not used anymore, so remove it.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 33 +--
 1 file changed, 9 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 840253b..76e891c 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -259,7 +259,7 @@ static u8 mode_11i;
 static u8 auth_type;
 static u32 join_req_size;
 static u32 info_element_size;
-static struct host_if_drv *join_req_drv;
+static struct wilc_vif *join_req_vif;
 #define REAL_JOIN_REQ 0
 #define FLUSHED_JOIN_REQ 1
 #define FLUSHED_BYTE_POS 79
@@ -294,21 +294,6 @@ static int remove_handler_in_list(struct host_if_drv 
*handler)
return -EINVAL;
 }
 
-static int get_id_from_handler(struct host_if_drv *handler)
-{
-   int i;
-
-   if (!handler)
-   return 0;
-
-   for (i = 1; i < ARRAY_SIZE(wfidrv_list); i++) {
-   if (wfidrv_list[i] == handler)
-   return i;
-   }
-
-   return 0;
-}
-
 /* The u8IfIdx starts from 0 to NUM_CONCURRENT_IFC -1, but 0 index used as
  * special purpose in wilc device, so we add 1 to the index to starts from 1.
  * As a result, the returned index will be 1 to NUM_CONCURRENT_IFC.
@@ -1235,7 +1220,7 @@ static s32 Handle_Connect(struct wilc_vif *vif,
 
if (memcmp("DIRECT-", pstrHostIFconnectAttr->ssid, 7)) {
memcpy(join_req, pu8CurrByte, join_req_size);
-   join_req_drv = hif_drv;
+   join_req_vif = vif;
}
 
PRINT_D(GENERIC_DBG, "send HOST_IF_WAITING_CONN_RESP\n");
@@ -1349,7 +1334,7 @@ static s32 Handle_FlushConnect(struct wilc_vif *vif)
 
result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
  u32WidsCount,
- get_id_from_handler(join_req_drv));
+ wilc_get_vif_idx(join_req_vif));
if (result) {
PRINT_ER("failed to send config packet\n");
result = -EINVAL;
@@ -1423,12 +1408,12 @@ static s32 Handle_ConnectTimeout(struct wilc_vif *vif)
 
eth_zero_addr(wilc_connected_ssid);
 
-   if (join_req && join_req_drv == hif_drv) {
+   if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element && join_req_drv == hif_drv) {
+   if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
@@ -1715,12 +1700,12 @@ static s32 Handle_RcvdGnrlAsyncInfo(struct wilc_vif 
*vif,
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
 
-   if (join_req && join_req_drv == hif_drv) {
+   if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element && join_req_drv == hif_drv) {
+   if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
@@ -2089,12 +2074,12 @@ static void Handle_Disconnect(struct wilc_vif *vif)
hif_drv->usr_conn_req.ies_len = 0;
kfree(hif_drv->usr_conn_req.ies);
 
-   if (join_req && join_req_drv == hif_drv) {
+   if (join_req && join_req_vif == vif) {
kfree(join_req);
join_req = NULL;
}
 
-   if (info_element && join_req_drv == hif_drv) {
+   if (info_element && join_req_vif == vif) {
kfree(info_element);
info_element = NULL;
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 04/12] staging: wilc1000: pass struct wilc

2015-12-13 Thread Glen Lee
Pass struct wilc to the following functions. The functions need wilc to
get proper vif using id from wilc device.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/coreconfigurator.h | 11 ++-
 drivers/staging/wilc1000/host_interface.c   |  9 ++---
 drivers/staging/wilc1000/wilc_wlan.c|  2 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c|  9 +
 drivers/staging/wilc1000/wilc_wlan_cfg.h|  4 +++-
 5 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/wilc1000/coreconfigurator.h 
b/drivers/staging/wilc1000/coreconfigurator.h
index 3f2a7d3..fc43d04 100644
--- a/drivers/staging/wilc1000/coreconfigurator.h
+++ b/drivers/staging/wilc1000/coreconfigurator.h
@@ -135,9 +135,10 @@ s32 wilc_dealloc_network_info(tstrNetworkInfo 
*pstrNetworkInfo);
 s32 wilc_parse_assoc_resp_info(u8 *pu8Buffer, u32 u32BufferLen,
   tstrConnectRespInfo **ppstrConnectRespInfo);
 s32 wilc_dealloc_assoc_resp_info(tstrConnectRespInfo *pstrConnectRespInfo);
-
-void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length);
-void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length);
-void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length);
-
+void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
+u32 u32Length);
+void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
+   u32 u32Length);
+void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
+  u32 u32Length);
 #endif
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index e8c14cc..259cefc 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4021,7 +4021,8 @@ s32 wilc_deinit(struct wilc_vif *vif)
return result;
 }
 
-void wilc_network_info_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_network_info_received(struct wilc *wilc, u8 *pu8Buffer,
+   u32 u32Length)
 {
s32 result = 0;
struct host_if_msg msg;
@@ -4050,7 +4051,8 @@ void wilc_network_info_received(u8 *pu8Buffer, u32 
u32Length)
PRINT_ER("Error in sending network info message queue message 
parameters: Error(%d)\n", result);
 }
 
-void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_gnrl_async_info_received(struct wilc *wilc, u8 *pu8Buffer,
+  u32 u32Length)
 {
s32 result = 0;
struct host_if_msg msg;
@@ -4091,7 +4093,8 @@ void wilc_gnrl_async_info_received(u8 *pu8Buffer, u32 
u32Length)
up(&hif_sema_deinit);
 }
 
-void wilc_scan_complete_received(u8 *pu8Buffer, u32 u32Length)
+void wilc_scan_complete_received(struct wilc *wilc, u8 *pu8Buffer,
+u32 u32Length)
 {
s32 result = 0;
struct host_if_msg msg;
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index 768a42c..00f3464 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -988,7 +988,7 @@ static void wilc_wlan_handle_rxq(struct wilc *wilc)
} else {
struct wilc_cfg_rsp rsp;
 
-   
wilc_wlan_cfg_indicate_rx(&buffer[pkt_offset + offset], pkt_len, &rsp);
+   wilc_wlan_cfg_indicate_rx(wilc, 
&buffer[pkt_offset + offset], pkt_len, &rsp);
if (rsp.type == WILC_CFG_RSP) {
PRINT_D(RX_DBG, 
"wilc->cfg_seq_no = %d - rsp.seq_no = %d\n", wilc->cfg_seq_no, rsp.seq_no);
if (wilc->cfg_seq_no == 
rsp.seq_no)
diff --git a/drivers/staging/wilc1000/wilc_wlan_cfg.c 
b/drivers/staging/wilc1000/wilc_wlan_cfg.c
index f62c0e6..b72c77b 100644
--- a/drivers/staging/wilc1000/wilc_wlan_cfg.c
+++ b/drivers/staging/wilc1000/wilc_wlan_cfg.c
@@ -495,7 +495,8 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 
buffer_size)
return ret;
 }
 
-int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct wilc_cfg_rsp *rsp)
+int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
+ struct wilc_cfg_rsp *rsp)
 {
int ret = 1;
u8 msg_type;
@@ -522,17 +523,17 @@ int wilc_wlan_cfg_indicate_rx(u8 *frame, int size, struct 
wilc_cfg_rsp *rsp)
rsp->seq_no = msg_id;
/*call host interface info parse as well*/
PRINT_INFO(RX_DBG, "Info message received\n");
-   wilc_gnrl_async_info_received(frame - 4, size + 4);
+   wilc_gnrl_async_info_received(wilc, frame - 4, size + 4);
break;
 
case 'N':
-   wilc_network_info_received(frame - 4, size + 4);
+   wilc_network_info_received(wi

[PATCH 10/12] staging: wilc1000: remove wilc of struct host_if_drv

2015-12-13 Thread Glen Lee
vif has wilc in it's members so no need to have wilc in host_if_drv.
It is redundant so just remove it and use wilc of vif.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 100 --
 drivers/staging/wilc1000/host_interface.h |   1 -
 2 files changed, 41 insertions(+), 60 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 39e93fa..f97ea49 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -293,7 +293,6 @@ static s32 handle_set_channel(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_CURRENT_CHANNEL;
wid.type = WID_CHAR;
@@ -302,7 +301,7 @@ static s32 handle_set_channel(struct wilc_vif *vif,
 
PRINT_D(HOSTINF_DBG, "Setting channel\n");
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
 
if (result) {
@@ -343,14 +342,13 @@ static s32 handle_set_operation_mode(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_SET_OPERATION_MODE;
wid.type = WID_INT;
wid.val = (s8 *)&hif_op_mode->mode;
wid.size = sizeof(u32);
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
 
if ((hif_op_mode->mode) == IDLE_MODE)
@@ -388,7 +386,7 @@ static s32 handle_set_ip_address(struct wilc_vif *vif, u8 
*ip_addr, u8 idx)
wid.val = (u8 *)ip_addr;
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
 
host_int_get_ipaddress(vif, hif_drv, firmware_ip_addr, idx);
@@ -407,14 +405,13 @@ static s32 handle_get_ip_address(struct wilc_vif *vif, u8 
idx)
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_IP_ADDRESS;
wid.type = WID_STR;
wid.val = kmalloc(IP_ALEN, GFP_KERNEL);
wid.size = IP_ALEN;
 
-   result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
 
PRINT_INFO(HOSTINF_DBG, "%pI4\n", wid.val);
@@ -443,7 +440,6 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
u8 *mac_buf = kmalloc(ETH_ALEN, GFP_KERNEL);
 
if (!mac_buf) {
@@ -458,7 +454,7 @@ static s32 handle_set_mac_address(struct wilc_vif *vif,
wid.size = ETH_ALEN;
PRINT_D(GENERIC_DBG, "mac addr = :%pM\n", wid.val);
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
if (result) {
PRINT_ER("Failed to set mac address\n");
@@ -474,14 +470,13 @@ static s32 handle_get_mac_address(struct wilc_vif *vif,
 {
s32 result = 0;
struct wid wid;
-   struct host_if_drv *hif_drv = vif->hif_drv;
 
wid.id = (u16)WID_MAC_ADDR;
wid.type = WID_STR;
wid.val = get_mac_addr->mac_addr;
wid.size = ETH_ALEN;
 
-   result = wilc_send_config_pkt(hif_drv->wilc, GET_CFG, &wid, 1,
+   result = wilc_send_config_pkt(vif->wilc, GET_CFG, &wid, 1,
 wilc_get_vif_idx(vif));
 
if (result) {
@@ -777,7 +772,7 @@ static s32 handle_cfg_param(struct wilc_vif *vif,
wid_cnt++;
}
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, wid_list,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, wid_list,
  wid_cnt, wilc_get_vif_idx(vif));
 
if (result)
@@ -901,7 +896,7 @@ static s32 Handle_Scan(struct wilc_vif *vif,
else if (hif_drv->hif_state == HOST_IF_IDLE)
scan_while_connected = false;
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, strWIDList,
+   result = wilc_send_config_pkt(vif->wilc, SET_CFG, strWIDList,
  u32WidsCount,
  wilc_get_vif_idx(vif));
 
@@ -947,7 +942,7 @@ static s32 Handle_ScanDone(struct wilc_vif *vif,
wid.val = (s8 *)&u8abort_running_scan;
wid.size = sizeof(char);
 
-   result = wilc_send_config_pkt(hif_drv->wilc, SET_CFG, &wid, 

[PATCH 11/12] staging: wilc1000: set hif_drv before it is used

2015-12-13 Thread Glen Lee
We are using hif_drv of vif, so it needs to be set before it is used.
Set hif_drv to vif->hifdrv soon after it is allocated.

Signed-off-by: Glen Lee 
---
 drivers/staging/wilc1000/host_interface.c | 6 ++
 drivers/staging/wilc1000/linux_wlan.c | 1 -
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index f97ea49..0125e3d 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3775,6 +3775,7 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
struct host_if_drv *hif_drv;
struct wilc_vif *vif;
struct wilc *wilc;
+   int i;
 
vif = netdev_priv(dev);
wilc = vif->wilc;
@@ -3791,6 +3792,11 @@ s32 wilc_init(struct net_device *dev, struct host_if_drv 
**hif_drv_handler)
goto _fail_;
}
*hif_drv_handler = hif_drv;
+   for (i = 0; i < wilc->vif_num; i++)
+   if (dev == wilc->vif[i]->ndev) {
+   wilc->vif[i]->hif_drv = hif_drv;
+   break;
+   }
 
wilc_optaining_ip = false;
 
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index a50e3ff..54fe9d7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1036,7 +1036,6 @@ int wilc_mac_open(struct net_device *ndev)
for (i = 0; i < wl->vif_num; i++) {
if (ndev == wl->vif[i]->ndev) {
memcpy(wl->vif[i]->src_addr, mac_add, ETH_ALEN);
-   wl->vif[i]->hif_drv = priv->hWILCWFIDrv;
break;
}
}
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/7] staging: lustre: Rename a jump label for ptlrpc_req_finished() calls

2015-12-13 Thread Dan Carpenter
Markus, please stop sending these things to rename out labels unless
there is a bug.  CodingStyle allows out labels.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2 0/4] scsi: storvsc: Properly support FC hosts

2015-12-13 Thread Dan Carpenter
Thanks, K. Y.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: comedi: fix block comments coding style issue in comedi.h

2015-12-13 Thread maomao xu
Fix up block comments to make a trailing */ on a separate line

Signed-off-by: maomao xu 
---
 drivers/staging/comedi/comedi.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index 66edda1..ec5e59c 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -895,7 +895,8 @@ enum amplc_dio_ts_clock_src {
 };
 
 /* Values for setting a gate source with INSN_CONFIG_SET_GATE_SRC for
- * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver). */
+ * 8254 counter subdevices on Amplicon DIO boards (amplc_dio200 driver).
+ */
 enum amplc_dio_gate_source {
AMPLC_DIO_GAT_VCC,  /* internal high logic level */
AMPLC_DIO_GAT_GND,  /* internal low logic level */
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel