Re: [PATCH 00/10] staging: comedi: adl_pci9118: tidy up ai command support

2015-10-20 Thread Ian Abbott

On 19/10/15 21:12, H Hartley Sweeten wrote:

Clean up the analog input async command support code and the interrupt
handler.

H Hartley Sweeten (10):
   staging: comedi: adl_pci9118: TRIG_INT is not vaild for scan_begin_src
   staging: comedi: adl_pci9118: remove unnecessary check in 
check_channel_list()
   staging: comedi: adl_pci9118: tidy up check_channel_list()
   staging: comedi: adl_pci9118: remove unused defines
   staging: comedi: adl_pci9118: remove PCI9118_CHANLEN
   staging: comedi: adl_pci9118: rename interrupt_pci9118_ai_mode4_switch()
   staging: comedi: adl_pci9118: rename valid_samples_in_act_dma_buf()
   staging: comedi: adl_pci9118: rename move_block_from_dma()
   staging: comedi: adl_pci9118: rename interrupt_*() functions
   staging: comedi: adl_pci9118: tidy up pci9118_ai_setup_dma()

  drivers/staging/comedi/drivers/adl_pci9118.c | 225 ---
  1 file changed, 100 insertions(+), 125 deletions(-)



Looks good!

Reviewed-by: Ian Abbott 

--
-=( Ian Abbott @ MEV Ltd.E-mail:  )=-
-=(  Web: http://www.mev.co.uk/  )=-
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 01/10] staging: lustre: remove unused OBD_SLAB_CPT_ALLOC* macros

2015-10-20 Thread Mike Rapoport
The OBD_SLAB_CPT_ALLOC* macros are not used and can be removed

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/include/obd_support.h | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/obd_support.h 
b/drivers/staging/lustre/lustre/include/obd_support.h
index abc53f1..bef80e2 100644
--- a/drivers/staging/lustre/lustre/include/obd_support.h
+++ b/drivers/staging/lustre/lustre/include/obd_support.h
@@ -529,8 +529,6 @@ do {
  \
 
 #define OBD_SLAB_ALLOC_GFP(ptr, slab, size, flags)   \
__OBD_SLAB_ALLOC_VERBOSE(ptr, slab, NULL, 0, size, flags)
-#define OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, size, flags)   \
-   __OBD_SLAB_ALLOC_VERBOSE(ptr, slab, cptab, cpt, size, flags)
 
 #define OBD_SLAB_FREE(ptr, slab, size) \
 do { \
@@ -541,21 +539,12 @@ do {  
  \
 #define OBD_SLAB_ALLOC(ptr, slab, size)
  \
OBD_SLAB_ALLOC_GFP(ptr, slab, size, GFP_NOFS)
 
-#define OBD_SLAB_CPT_ALLOC(ptr, slab, cptab, cpt, size)
  \
-   OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, size, GFP_NOFS)
-
 #define OBD_SLAB_ALLOC_PTR(ptr, slab)\
OBD_SLAB_ALLOC(ptr, slab, sizeof(*(ptr)))
 
-#define OBD_SLAB_CPT_ALLOC_PTR(ptr, slab, cptab, cpt)\
-   OBD_SLAB_CPT_ALLOC(ptr, slab, cptab, cpt, sizeof(*(ptr)))
-
 #define OBD_SLAB_ALLOC_PTR_GFP(ptr, slab, flags) \
OBD_SLAB_ALLOC_GFP(ptr, slab, sizeof(*(ptr)), flags)
 
-#define OBD_SLAB_CPT_ALLOC_PTR_GFP(ptr, slab, cptab, cpt, flags)   
  \
-   OBD_SLAB_CPT_ALLOC_GFP(ptr, slab, cptab, cpt, sizeof(*(ptr)), flags)
-
 #define OBD_SLAB_FREE_PTR(ptr, slab) \
OBD_SLAB_FREE((ptr), (slab), sizeof(*(ptr)))
 
-- 
2.1.0

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


[PATCH 00/10] staging: lustre: remove OBD_SLAB_ALLOC/FREE and friends

2015-10-20 Thread Mike Rapoport
These patches replace OBD_SLAB_ALLOC/FREE and friends with direct use of
kmem_cache_alloc/free.

Mike Rapoport (10):
  staging: lustre: remove unused OBD_SLAB_CPT_ALLOC* macros
  staging: lustre: replace OBDO_ALLOC with kmem_cache_alloc
  staging: lustre: replace OBDO_FREE with kmem_cache_free
  staging: lustre: remove unused OBDO_{ALLOC,FREE} macros
  staging: lustre: replace OBD_SLAB_ALLOC_PTR with kmem_cache_alloc
  staging: lustre: replace OBD_SLAB_ALLOC_PTR_GFP with kmem_cache_alloc
  staging: lustre: replace OBD_SLAB_ALLOC_GFP with kmem_cache_alloc
  staging: lustre: replace OBD_SLAB_FREE_PTR with kmem_cache_free
  staging: lustre: replace OBD_SLAB_FREE with kmem_cache_free
  staging: lustre: remove unused OBD_SLAB_ALLOC* and OBD_SLAB_FREE* macros

 drivers/staging/lustre/lustre/include/obd_class.h  | 10 -
 .../staging/lustre/lustre/include/obd_support.h| 45 --
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c | 20 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   |  4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c |  4 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c |  8 ++--
 drivers/staging/lustre/lustre/llite/file.c |  8 ++--
 drivers/staging/lustre/lustre/llite/llite_close.c  |  4 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|  5 ++-
 drivers/staging/lustre/lustre/llite/namei.c|  4 +-
 drivers/staging/lustre/lustre/llite/remote_perm.c  | 11 ++
 drivers/staging/lustre/lustre/llite/super25.c  |  4 +-
 drivers/staging/lustre/lustre/llite/vvp_dev.c  |  8 ++--
 drivers/staging/lustre/lustre/llite/xattr_cache.c  |  6 +--
 drivers/staging/lustre/lustre/lov/lov_dev.c| 12 +++---
 drivers/staging/lustre/lustre/lov/lov_ea.c |  7 ++--
 drivers/staging/lustre/lustre/lov/lov_lock.c   | 16 
 drivers/staging/lustre/lustre/lov/lov_object.c |  4 +-
 drivers/staging/lustre/lustre/lov/lov_request.c| 15 +---
 drivers/staging/lustre/lustre/lov/lovsub_dev.c |  4 +-
 drivers/staging/lustre/lustre/lov/lovsub_lock.c|  4 +-
 drivers/staging/lustre/lustre/lov/lovsub_object.c  |  4 +-
 drivers/staging/lustre/lustre/obdclass/cl_lock.c   |  4 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c |  6 +--
 drivers/staging/lustre/lustre/obdclass/genops.c|  4 +-
 .../staging/lustre/lustre/obdecho/echo_client.c| 16 
 drivers/staging/lustre/lustre/osc/osc_cache.c  |  4 +-
 drivers/staging/lustre/lustre/osc/osc_dev.c|  8 ++--
 drivers/staging/lustre/lustre/osc/osc_io.c |  4 +-
 drivers/staging/lustre/lustre/osc/osc_lock.c   |  4 +-
 drivers/staging/lustre/lustre/osc/osc_object.c |  4 +-
 drivers/staging/lustre/lustre/osc/osc_quota.c  |  8 ++--
 drivers/staging/lustre/lustre/osc/osc_request.c| 10 ++---
 drivers/staging/lustre/lustre/ptlrpc/client.c  |  4 +-
 34 files changed, 114 insertions(+), 169 deletions(-)

-- 
2.1.0

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


[PATCH 03/10] staging: lustre: replace OBDO_FREE with kmem_cache_free

2015-10-20 Thread Mike Rapoport
Use kmem_cache_free directly instead of wrapping macro.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/llite/file.c| 2 +-
 drivers/staging/lustre/lustre/llite/llite_close.c | 2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c   | 2 +-
 drivers/staging/lustre/lustre/llite/namei.c   | 2 +-
 drivers/staging/lustre/lustre/lov/lov_request.c   | 4 ++--
 drivers/staging/lustre/lustre/osc/osc_request.c   | 6 +++---
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 02c9910..e724a142 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -1295,7 +1295,7 @@ static int ll_lov_recreate(struct inode *inode, struct 
ost_id *oi, u32 ost_idx)
goto out;
 out:
ccc_inode_lsm_put(inode, lsm);
-   OBDO_FREE(oa);
+   kmem_cache_free(obdo_cachep, oa);
return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_close.c 
b/drivers/staging/lustre/lustre/llite/llite_close.c
index 8ee1eb4..3f348a3 100644
--- a/drivers/staging/lustre/lustre/llite/llite_close.c
+++ b/drivers/staging/lustre/lustre/llite/llite_close.c
@@ -252,7 +252,7 @@ int ll_som_update(struct inode *inode, struct md_op_data 
*op_data)
NULL, 0, NULL, 0, , NULL);
ptlrpc_req_finished(request);
 
-   OBDO_FREE(oa);
+   kmem_cache_free(obdo_cachep, oa);
return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index cfb60c8..4a8c759 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1789,7 +1789,7 @@ int ll_iocontrol(struct inode *inode, struct file *file,
   OBD_MD_FLGROUP;
obdo_set_parent_fid(oinfo.oi_oa, _i2info(inode)->lli_fid);
rc = obd_setattr_rqset(sbi->ll_dt_exp, , NULL);
-   OBDO_FREE(oinfo.oi_oa);
+   kmem_cache_free(obdo_cachep, oinfo.oi_oa);
ccc_inode_lsm_put(inode, lsm);
 
if (rc && rc != -EPERM && rc != -EACCES)
diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index e069f31..2ca2200 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -933,7 +933,7 @@ int ll_objects_destroy(struct ptlrpc_request *request, 
struct inode *dir)
   POSTID(>lsm_oi), rc);
 out_free_memmd:
obd_free_memmd(ll_i2dtexp(dir), );
-   OBDO_FREE(oa);
+   kmem_cache_free(obdo_cachep, oa);
 out:
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
b/drivers/staging/lustre/lustre/lov/lov_request.c
index f4c7019..1a150c2 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -67,7 +67,7 @@ void lov_finish_set(struct lov_request_set *set)
list_del_init(>rq_link);
 
if (req->rq_oi.oi_oa)
-   OBDO_FREE(req->rq_oi.oi_oa);
+   kmem_cache_free(obdo_cachep, req->rq_oi.oi_oa);
kfree(req->rq_oi.oi_osfs);
kfree(req);
}
@@ -236,7 +236,7 @@ static int common_attr_done(struct lov_request_set *set)
memcpy(set->set_oi->oi_oa, tmp_oa, sizeof(*set->set_oi->oi_oa));
 out:
if (tmp_oa)
-   OBDO_FREE(tmp_oa);
+   kmem_cache_free(obdo_cachep, tmp_oa);
return rc;
 
 }
diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c 
b/drivers/staging/lustre/lustre/osc/osc_request.c
index 58c4664..57189ad 100644
--- a/drivers/staging/lustre/lustre/osc/osc_request.c
+++ b/drivers/staging/lustre/lustre/osc/osc_request.c
@@ -878,7 +878,7 @@ static int osc_shrink_grant_interpret(const struct lu_env 
*env,
LASSERT(body);
osc_update_grant(cli, body);
 out:
-   OBDO_FREE(oa);
+   kmem_cache_free(obdo_cachep, oa);
return rc;
 }
 
@@ -1789,7 +1789,7 @@ static int brw_interpret(const struct lu_env *env,
}
cl_object_put(env, obj);
}
-   OBDO_FREE(aa->aa_oa);
+   kmem_cache_free(obdo_cachep, aa->aa_oa);
 
cl_req_completion(env, aa->aa_clerq, rc < 0 ? rc :
  req->rq_bulk->bd_nob_transferred);
@@ -2005,7 +2005,7 @@ out:
LASSERT(req == NULL);
 
if (oa)
-   OBDO_FREE(oa);
+   kmem_cache_free(obdo_cachep, oa);
kfree(pga);
/* this should happen rarely and is pretty bad, it makes the
 * pending list not follow the dirty order */
-- 
2.1.0

___
devel mailing list
de...@linuxdriverproject.org

[PATCH 06/10] staging: lustre: replace OBD_SLAB_ALLOC_PTR_GFP with kmem_cache_alloc

2015-10-20 Thread Mike Rapoport
The OBD_SLAB_ALLOC_PTR_GFP macro expands to call to kmem_cache_alloc,
which may be used directly.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/lclient/lcommon_cl.c  | 10 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c|  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c  |  2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c  |  2 +-
 drivers/staging/lustre/lustre/llite/file.c  |  2 +-
 drivers/staging/lustre/lustre/llite/remote_perm.c   |  2 +-
 drivers/staging/lustre/lustre/llite/super25.c   |  2 +-
 drivers/staging/lustre/lustre/llite/vvp_dev.c   |  4 ++--
 drivers/staging/lustre/lustre/llite/xattr_cache.c   |  2 +-
 drivers/staging/lustre/lustre/lov/lov_dev.c |  6 +++---
 drivers/staging/lustre/lustre/lov/lov_ea.c  |  2 +-
 drivers/staging/lustre/lustre/lov/lov_lock.c|  6 +++---
 drivers/staging/lustre/lustre/lov/lov_object.c  |  2 +-
 drivers/staging/lustre/lustre/lov/lovsub_dev.c  |  2 +-
 drivers/staging/lustre/lustre/lov/lovsub_lock.c |  2 +-
 drivers/staging/lustre/lustre/lov/lovsub_object.c   |  2 +-
 drivers/staging/lustre/lustre/obdclass/cl_lock.c|  2 +-
 drivers/staging/lustre/lustre/obdclass/cl_object.c  |  2 +-
 drivers/staging/lustre/lustre/obdclass/genops.c |  2 +-
 drivers/staging/lustre/lustre/obdecho/echo_client.c |  8 
 drivers/staging/lustre/lustre/osc/osc_cache.c   |  2 +-
 drivers/staging/lustre/lustre/osc/osc_dev.c |  4 ++--
 drivers/staging/lustre/lustre/osc/osc_io.c  |  2 +-
 drivers/staging/lustre/lustre/osc/osc_lock.c|  2 +-
 drivers/staging/lustre/lustre/osc/osc_object.c  |  2 +-
 drivers/staging/lustre/lustre/ptlrpc/client.c   |  2 +-
 26 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c 
b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
index ef2e266..7794bfa 100644
--- a/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
+++ b/drivers/staging/lustre/lustre/lclient/lcommon_cl.c
@@ -116,7 +116,7 @@ void *ccc_key_init(const struct lu_context *ctx, struct 
lu_context_key *key)
 {
struct ccc_thread_info *info;
 
-   OBD_SLAB_ALLOC_PTR_GFP(info, ccc_thread_kmem, GFP_NOFS);
+   info = kmem_cache_alloc(ccc_thread_kmem, GFP_NOFS | __GFP_ZERO);
if (info == NULL)
info = ERR_PTR(-ENOMEM);
return info;
@@ -135,7 +135,7 @@ void *ccc_session_key_init(const struct lu_context *ctx,
 {
struct ccc_session *session;
 
-   OBD_SLAB_ALLOC_PTR_GFP(session, ccc_session_kmem, GFP_NOFS);
+   session = kmem_cache_alloc(ccc_session_kmem, GFP_NOFS | __GFP_ZERO);
if (session == NULL)
session = ERR_PTR(-ENOMEM);
return session;
@@ -251,7 +251,7 @@ int ccc_req_init(const struct lu_env *env, struct cl_device 
*dev,
struct ccc_req *vrq;
int result;
 
-   OBD_SLAB_ALLOC_PTR_GFP(vrq, ccc_req_kmem, GFP_NOFS);
+   vrq = kmem_cache_alloc(ccc_req_kmem, GFP_NOFS | __GFP_ZERO);
if (vrq != NULL) {
cl_req_slice_add(req, >crq_cl, dev, _req_ops);
result = 0;
@@ -327,7 +327,7 @@ struct lu_object *ccc_object_alloc(const struct lu_env *env,
struct ccc_object *vob;
struct lu_object  *obj;
 
-   OBD_SLAB_ALLOC_PTR_GFP(vob, ccc_object_kmem, GFP_NOFS);
+   vob = kmem_cache_alloc(ccc_object_kmem, GFP_NOFS | __GFP_ZERO);
if (vob != NULL) {
struct cl_object_header *hdr;
 
@@ -396,7 +396,7 @@ int ccc_lock_init(const struct lu_env *env,
 
CLOBINVRNT(env, obj, ccc_object_invariant(obj));
 
-   OBD_SLAB_ALLOC_PTR_GFP(clk, ccc_lock_kmem, GFP_NOFS);
+   clk = kmem_cache_alloc(ccc_lock_kmem, GFP_NOFS | __GFP_ZERO);
if (clk != NULL) {
cl_lock_slice_add(lock, >clk_cl, obj, lkops);
result = 0;
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index 57b997d..644a413 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -112,7 +112,7 @@ struct ldlm_interval *ldlm_interval_alloc(struct ldlm_lock 
*lock)
struct ldlm_interval *node;
 
LASSERT(lock->l_resource->lr_type == LDLM_EXTENT);
-   OBD_SLAB_ALLOC_PTR_GFP(node, ldlm_interval_slab, GFP_NOFS);
+   node = kmem_cache_alloc(ldlm_interval_slab, GFP_NOFS | __GFP_ZERO);
if (node == NULL)
return NULL;
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 1600375..b1a347f 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -415,7 +415,7 @@ static struct ldlm_lock *ldlm_lock_new(struct ldlm_resource 
*resource)
if (resource == NULL)
LBUG();
 
-   

[PATCH 07/10] staging: lustre: replace OBD_SLAB_ALLOC_GFP with kmem_cache_alloc

2015-10-20 Thread Mike Rapoport
Use kmem_cache_free directly instead of wrapping macro.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/llite/remote_perm.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c 
b/drivers/staging/lustre/lustre/llite/remote_perm.c
index 7b5ec41..4257d74 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -82,9 +82,7 @@ static struct hlist_head *alloc_rmtperm_hash(void)
struct hlist_head *hash;
int i;
 
-   OBD_SLAB_ALLOC_GFP(hash, ll_rmtperm_hash_cachep,
-  REMOTE_PERM_HASHSIZE * sizeof(*hash),
-  GFP_IOFS);
+   hash = kmem_cache_alloc(ll_rmtperm_hash_cachep, GFP_IOFS | __GFP_ZERO);
if (!hash)
return NULL;
 
-- 
2.1.0

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


[PATCH 09/10] staging: lustre: replace OBD_SLAB_FREE with kmem_cache_free

2015-10-20 Thread Mike Rapoport
Use kmem_cache_free directly instead of wrapping macro.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_extent.c   | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c | 2 +-
 drivers/staging/lustre/lustre/ldlm/ldlm_resource.c | 6 +++---
 drivers/staging/lustre/lustre/llite/remote_perm.c  | 5 ++---
 drivers/staging/lustre/lustre/lov/lov_ea.c | 5 ++---
 5 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
index 644a413..c787888 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_extent.c
@@ -126,7 +126,7 @@ void ldlm_interval_free(struct ldlm_interval *node)
if (node) {
LASSERT(list_empty(>li_group));
LASSERT(!interval_is_intree(>li_node));
-   OBD_SLAB_FREE(node, ldlm_interval_slab, sizeof(*node));
+   kmem_cache_free(ldlm_interval_slab, node);
}
 }
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index b1a347f..7f8c700 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -392,7 +392,7 @@ static void lock_handle_addref(void *lock)
 static void lock_handle_free(void *lock, int size)
 {
LASSERT(size == sizeof(struct ldlm_lock));
-   OBD_SLAB_FREE(lock, ldlm_lock_slab, size);
+   kmem_cache_free(ldlm_lock_slab, lock);
 }
 
 static struct portals_handle_ops lock_handle_ops = {
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
index 6077ffb..342c465 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_resource.c
@@ -1124,7 +1124,7 @@ ldlm_resource_get(struct ldlm_namespace *ns, struct 
ldlm_resource *parent,
lu_ref_fini(>lr_reference);
/* We have taken lr_lvb_mutex. Drop it. */
mutex_unlock(>lr_lvb_mutex);
-   OBD_SLAB_FREE(res, ldlm_resource_slab, sizeof(*res));
+   kmem_cache_free(ldlm_resource_slab, res);
 
res = hlist_entry(hnode, struct ldlm_resource, lr_hash);
/* Synchronize with regard to resource creation. */
@@ -1218,7 +1218,7 @@ int ldlm_resource_putref(struct ldlm_resource *res)
cfs_hash_bd_unlock(ns->ns_rs_hash, , 1);
if (ns->ns_lvbo && ns->ns_lvbo->lvbo_free)
ns->ns_lvbo->lvbo_free(res);
-   OBD_SLAB_FREE(res, ldlm_resource_slab, sizeof(*res));
+   kmem_cache_free(ldlm_resource_slab, res);
return 1;
}
return 0;
@@ -1248,7 +1248,7 @@ int ldlm_resource_putref_locked(struct ldlm_resource *res)
 */
if (ns->ns_lvbo && ns->ns_lvbo->lvbo_free)
ns->ns_lvbo->lvbo_free(res);
-   OBD_SLAB_FREE(res, ldlm_resource_slab, sizeof(*res));
+   kmem_cache_free(ldlm_resource_slab, res);
 
cfs_hash_bd_lock(ns->ns_rs_hash, , 1);
return 1;
diff --git a/drivers/staging/lustre/lustre/llite/remote_perm.c 
b/drivers/staging/lustre/lustre/llite/remote_perm.c
index 4257d74..c902133 100644
--- a/drivers/staging/lustre/lustre/llite/remote_perm.c
+++ b/drivers/staging/lustre/lustre/llite/remote_perm.c
@@ -74,7 +74,7 @@ static inline void free_ll_remote_perm(struct ll_remote_perm 
*lrp)
 
if (!hlist_unhashed(>lrp_list))
hlist_del(>lrp_list);
-   OBD_SLAB_FREE(lrp, ll_remote_perm_cachep, sizeof(*lrp));
+   kmem_cache_free(ll_remote_perm_cachep, lrp);
 }
 
 static struct hlist_head *alloc_rmtperm_hash(void)
@@ -104,8 +104,7 @@ void free_rmtperm_hash(struct hlist_head *hash)
for (i = 0; i < REMOTE_PERM_HASHSIZE; i++)
hlist_for_each_entry_safe(lrp, next, hash + i, lrp_list)
free_ll_remote_perm(lrp);
-   OBD_SLAB_FREE(hash, ll_rmtperm_hash_cachep,
- REMOTE_PERM_HASHSIZE * sizeof(*hash));
+   kmem_cache_free(ll_rmtperm_hash_cachep, hash);
 }
 
 static inline int remote_perm_hashfunc(uid_t uid)
diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c 
b/drivers/staging/lustre/lustre/lov/lov_ea.c
index a453cb9..34c1346 100644
--- a/drivers/staging/lustre/lustre/lov/lov_ea.c
+++ b/drivers/staging/lustre/lustre/lov/lov_ea.c
@@ -110,7 +110,7 @@ struct lov_stripe_md *lsm_alloc_plain(__u16 stripe_count, 
int *size)
 
 err:
while (--i >= 0)
-   OBD_SLAB_FREE(lsm->lsm_oinfo[i], lov_oinfo_slab, sizeof(*loi));
+   kmem_cache_free(lov_oinfo_slab, lsm->lsm_oinfo[i]);
kvfree(lsm);
return NULL;
 }
@@ -121,8 +121,7 @@ void lsm_free_plain(struct lov_stripe_md *lsm)
int i;
 
for (i = 0; i < 

[PATCH 05/10] staging: lustre: replace OBD_SLAB_ALLOC_PTR with kmem_cache_alloc

2015-10-20 Thread Mike Rapoport
The OBD_SLAB_ALLOC_PTR macro expands to call to kmem_cache_alloc,
which may be used directly.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/lustre/lustre/osc/osc_quota.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_quota.c 
b/drivers/staging/lustre/lustre/osc/osc_quota.c
index 3b32928..98b9bcd 100644
--- a/drivers/staging/lustre/lustre/osc/osc_quota.c
+++ b/drivers/staging/lustre/lustre/osc/osc_quota.c
@@ -35,7 +35,7 @@ static inline struct osc_quota_info *osc_oqi_alloc(u32 id)
 {
struct osc_quota_info *oqi;
 
-   OBD_SLAB_ALLOC_PTR(oqi, osc_quota_kmem);
+   oqi = kmem_cache_alloc(osc_quota_kmem, GFP_NOFS | __GFP_ZERO);
if (oqi != NULL)
oqi->oqi_id = id;
 
-- 
2.1.0

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


Re: [PATCH 00/23] Update driver to 0.9-294

2015-10-20 Thread Moni Shoua
>
> Perhaps I did not chose my words carefully enough.
>
> The largest issue on the TODO list is the refactoring of the code to be 
> shared between the hfi1 and qib driver.  While the hardware between hfi1 and 
> qib is similar and thus the initial code looked similar, our performance 
> tuning on hfi1 has revealed that some changes will be required to the hfi1 
> code to fully utilize the hardware.  We would like to get these updates in to 
> make sure that the refactoring work is done properly for the 2 hardware types.
Please keep in mind that there are 3 HW types (our SoftRoCE driver)
that needs to be part of the framework.
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 06/13] staging: wilc1000: chage_virtual_intf: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 85 ---
 1 file changed, 45 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 264fcb9..422d462 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2534,9 +2534,11 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
u8 interface_type;
u16 TID = 0;
u8 i;
+   struct wilc *wl;
 
nic = netdev_priv(dev);
priv = wiphy_priv(wiphy);
+   wl = nic->wilc;
 
PRINT_D(HOSTAPD_DBG, "In Change virtual interface function\n");
PRINT_D(HOSTAPD_DBG, "Wireless interface name =%s\n", dev->name);
@@ -2571,30 +2573,31 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
interface_type = nic->iftype;
nic->iftype = STATION_MODE;
 
-   if (g_linux_wlan->initialized) {
-   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv, 
g_linux_wlan->vif[0].bssid, TID);
+   if (wl->initialized) {
+   host_int_del_All_Rx_BASession(priv->hWILCWFIDrv,
+ wl->vif[0].bssid, TID);
/* ensure that the message Q is empty */
host_int_wait_msg_queue_idle();
 
/*Eliminate host interface blocking state*/
-   up(_linux_wlan->cfg_event);
+   up(>cfg_event);
 
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wilc1000_wlan_deinit(wl);
wilc1000_wlan_init(dev, nic);
g_wilc_initialized = 1;
nic->iftype = interface_type;
 
/*Setting interface 1 drv handler and mac address in 
newly downloaded FW*/
-   
host_int_set_wfi_drv_handler(g_linux_wlan->vif[0].hif_drv);
-   host_int_set_MacAddress(g_linux_wlan->vif[0].hif_drv,
-   g_linux_wlan->vif[0].src_addr);
+   host_int_set_wfi_drv_handler(wl->vif[0].hif_drv);
+   host_int_set_MacAddress(wl->vif[0].hif_drv,
+   wl->vif[0].src_addr);
host_int_set_operation_mode(priv->hWILCWFIDrv, 
STATION_MODE);
 
/*Add saved WEP keys, if any*/
if (g_wep_keys_saved) {
-   
host_int_set_WEPDefaultKeyID(g_linux_wlan->vif[0].hif_drv,
+   host_int_set_WEPDefaultKeyID(wl->vif[0].hif_drv,
 
g_key_wep_params.key_idx);
-   
host_int_add_wep_key_bss_sta(g_linux_wlan->vif[0].hif_drv,
+   host_int_add_wep_key_bss_sta(wl->vif[0].hif_drv,
 
g_key_wep_params.key,
 
g_key_wep_params.key_len,
 
g_key_wep_params.key_idx);
@@ -2612,22 +2615,22 @@ static int change_virtual_intf(struct wiphy *wiphy, 
struct net_device *dev,
PRINT_D(CFG80211_DBG, "gtk %x %x %x\n", 
g_key_gtk_params.key[0],
g_key_gtk_params.key[1],
g_key_gtk_params.key[2]);
-   
add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
-   g_linux_wlan->vif[0].ndev,
+   add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy,
+   wl->vif[0].ndev,
g_add_ptk_key_params.key_idx,
g_add_ptk_key_params.pairwise,
g_add_ptk_key_params.mac_addr,
(struct key_params 
*)(_key_ptk_params));
 
-   
add_key(g_linux_wlan->vif[0].ndev->ieee80211_ptr->wiphy,
-   g_linux_wlan->vif[0].ndev,
+   add_key(wl->vif[0].ndev->ieee80211_ptr->wiphy,
+   wl->vif[0].ndev,
g_add_gtk_key_params.key_idx,
g_add_gtk_key_params.pairwise,
g_add_gtk_key_params.mac_addr,
 

[PATCH 04/13] staging: wilc1000: mac_open: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5fcbfac..ebedffa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1167,9 +1167,13 @@ int mac_open(struct net_device *ndev)
int ret = 0;
int i = 0;
struct wilc_priv *priv;
+   struct wilc *wl;
+
+   nic = netdev_priv(ndev);
+   wl = nic->wilc;
 
 #ifdef WILC_SPI
-   if (!g_linux_wlan || !g_linux_wlan->wilc_spidev) {
+   if (!wl|| !wl->wilc_spidev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
@@ -1200,16 +1204,16 @@ int mac_open(struct net_device *ndev)
PRINT_D(INIT_DBG, "Mac address: %pM\n", mac_add);
 
/* loop through the NUM of supported devices and set the MAC address */
-   for (i = 0; i < g_linux_wlan->vif_num; i++) {
-   if (ndev == g_linux_wlan->vif[i].ndev) {
-   memcpy(g_linux_wlan->vif[i].src_addr, mac_add, 
ETH_ALEN);
-   g_linux_wlan->vif[i].hif_drv = priv->hWILCWFIDrv;
+   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;
}
}
 
/* TODO: get MAC address whenever the source is EPROM - hardcoded and 
copy it to ndev*/
-   memcpy(ndev->dev_addr, g_linux_wlan->vif[i].src_addr, ETH_ALEN);
+   memcpy(ndev->dev_addr, wl->vif[i].src_addr, ETH_ALEN);
 
if (!is_valid_ether_addr(ndev->dev_addr)) {
PRINT_ER("Error: Wrong MAC address\n");
@@ -1222,13 +1226,13 @@ int mac_open(struct net_device *ndev)
wilc_mgmt_frame_register(nic->wilc_netdev->ieee80211_ptr->wiphy, 
nic->wilc_netdev->ieee80211_ptr,
 nic->g_struct_frame_reg[1].frame_type, 
nic->g_struct_frame_reg[1].reg);
netif_wake_queue(ndev);
-   g_linux_wlan->open_ifcs++;
+   wl->open_ifcs++;
nic->mac_opened = 1;
return 0;
 
 _err_:
wilc_deinit_host_int(ndev);
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wilc1000_wlan_deinit(wl);
return ret;
 }
 
-- 
1.9.1

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


[PATCH 02/13] staging: wilc1000: wilc1000_wlan_init: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

This patch use netdev private data member wilc instead of global variable
g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8fa6b7c..39341a8 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1027,14 +1027,15 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
+   struct wilc *wl = nic->wilc;
 
-   if (!g_linux_wlan->initialized) {
-   g_linux_wlan->mac_status = WILC_MAC_STATUS_INIT;
-   g_linux_wlan->close = 0;
+   if (!wl->initialized) {
+   wl->mac_status = WILC_MAC_STATUS_INIT;
+   wl->close = 0;
 
-   wlan_init_locks(g_linux_wlan);
+   wlan_init_locks(wl);
 
-   linux_to_wlan(, g_linux_wlan);
+   linux_to_wlan(, wl);
 
ret = wilc_wlan_init();
if (ret < 0) {
@@ -1044,7 +1045,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   if (init_irq(g_linux_wlan)) {
+   if (init_irq(wl)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
@@ -1073,7 +1074,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
/*Download firmware*/
-   ret = linux_wlan_firmware_download(g_linux_wlan);
+   ret = linux_wlan_firmware_download(wl);
if (ret < 0) {
PRINT_ER("Failed to download firmware\n");
ret = -EIO;
@@ -1101,7 +1102,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
PRINT_D(INIT_DBG, "* Firmware Ver = %s  ***\n", 
Firmware_ver);
}
/* Initialize firmware with default configuration */
-   ret = linux_wlan_init_test_config(dev, g_linux_wlan);
+   ret = linux_wlan_init_test_config(dev, wl);
 
if (ret < 0) {
PRINT_ER("Failed to configure firmware\n");
@@ -1109,7 +1110,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_fw_start_;
}
 
-   g_linux_wlan->initialized = true;
+   wl->initialized = true;
return 0; /*success*/
 
 _fail_fw_start_:
@@ -1121,14 +1122,14 @@ _fail_irq_enable_:
 _fail_irq_init_:
 #endif
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   deinit_irq(g_linux_wlan);
+   deinit_irq(wl);
 
 #endif
-   wlan_deinitialize_threads(g_linux_wlan);
+   wlan_deinitialize_threads(wl);
 _fail_wilc_wlan_:
wilc_wlan_cleanup();
 _fail_locks_:
-   wlan_deinit_locks(g_linux_wlan);
+   wlan_deinit_locks(wl);
PRINT_ER("WLAN Iinitialization FAILED\n");
} else {
PRINT_D(INIT_DBG, "wilc1000 already initialized\n");
-- 
1.9.1

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


[PATCH 03/13] staging: wilc1000: wlan_init_locks: change parameter and use wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

This patch changes function parameter type wilc with net_device and use netdev
private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 25 +++--
 1 file changed, 15 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 39341a8..5fcbfac 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -920,23 +920,28 @@ void wilc1000_wlan_deinit(struct wilc *nic)
}
 }
 
-int wlan_init_locks(struct wilc *p_nic)
+int wlan_init_locks(struct net_device *dev)
 {
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
PRINT_D(INIT_DBG, "Initializing Locks ...\n");
 
-   mutex_init(_linux_wlan->hif_cs);
-   mutex_init(_linux_wlan->rxq_cs);
+   mutex_init(>hif_cs);
+   mutex_init(>rxq_cs);
 
-   spin_lock_init(_linux_wlan->txq_spinlock);
-   sema_init(_linux_wlan->txq_add_to_head_cs, 1);
+   spin_lock_init(>txq_spinlock);
+   sema_init(>txq_add_to_head_cs, 1);
 
-   sema_init(_linux_wlan->txq_event, 0);
+   sema_init(>txq_event, 0);
 
-   sema_init(_linux_wlan->cfg_event, 0);
-   sema_init(_linux_wlan->sync_event, 0);
+   sema_init(>cfg_event, 0);
+   sema_init(>sync_event, 0);
 
-   sema_init(_linux_wlan->txq_thread_started, 0);
+   sema_init(>txq_thread_started, 0);
 
return 0;
 }
@@ -1033,7 +1038,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
wl->mac_status = WILC_MAC_STATUS_INIT;
wl->close = 0;
 
-   wlan_init_locks(wl);
+   wlan_init_locks(dev);
 
linux_to_wlan(, wl);
 
-- 
1.9.1

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


[PATCH 09/13] staging: wilc1000: add_key: use netdev private wilc instead of g_linux_wlan

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 1533804..8aea4b5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -1086,8 +1086,12 @@ static int add_key(struct wiphy *wiphy, struct 
net_device *netdev, u8 key_index,
u8 u8gmode = NO_ENCRYPT;
u8 u8pmode = NO_ENCRYPT;
enum AUTHTYPE tenuAuth_type = ANY;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(netdev);
+   wl = nic->wilc;
 
PRINT_D(CFG80211_DBG, "Adding key with cipher suite = %x\n", 
params->cipher);
 
@@ -1259,7 +1263,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
}
 
/*save keys only on interface 0 (wifi 
interface)*/
-   if (!g_gtk_keys_saved && netdev == 
g_linux_wlan->vif[0].ndev) {
+   if (!g_gtk_keys_saved && netdev == 
wl->vif[0].ndev) {
g_add_gtk_key_params.key_idx = 
key_index;
g_add_gtk_key_params.pairwise = 
pairwise;
if (!mac_addr) {
@@ -1295,7 +1299,7 @@ static int add_key(struct wiphy *wiphy, struct net_device 
*netdev, u8 key_index,
}
 
/*save keys only on interface 0 (wifi 
interface)*/
-   if (!g_ptk_keys_saved && netdev == 
g_linux_wlan->vif[0].ndev) {
+   if (!g_ptk_keys_saved && netdev == 
wl->vif[0].ndev) {
g_add_ptk_key_params.key_idx = 
key_index;
g_add_ptk_key_params.pairwise = 
pairwise;
if (!mac_addr) {
-- 
1.9.1

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


[PATCH 11/13] staging: wilc1000: wilc_mgmt_frame_register: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index eea7f3b..59db1d5 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2397,12 +2397,11 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, 
struct wireless_dev *wdev,
 
struct wilc_priv *priv;
perInterface_wlan_t *nic;
-
+   struct wilc *wl;
 
priv = wiphy_priv(wiphy);
nic = netdev_priv(priv->wdev->netdev);
-
-
+   wl = nic->wilc;
 
if (!frame_type)
return;
@@ -2430,7 +2429,7 @@ void wilc_mgmt_frame_register(struct wiphy *wiphy, struct 
wireless_dev *wdev,
 
}
/*If mac is closed, then return*/
-   if (!g_linux_wlan->initialized) {
+   if (!wl->initialized) {
PRINT_D(GENERIC_DBG, "Return since mac is closed\n");
return;
}
-- 
1.9.1

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


[PATCH 07/13] staging: wilc1000: wilc1000_wlan_deinit: change argument and use wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

This patch changes function argument wilc with net_device and use nic->wilc
instead of global variable g_linux_wlan. The null check codes should be placed
before it is used so move it.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 45 +--
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  7 ++--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 3 files changed, 29 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 93475aa..2c4673c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -49,7 +49,6 @@ extern bool g_obtainingIP;
 extern u16 Set_machw_change_vir_if(bool bValue);
 extern void resolve_disconnect_aberration(void *drvHandler);
 extern u8 gau8MulticastMacAddrList[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
 extern struct timer_list hDuringIpTimer;
 
 static int linux_wlan_device_power(int on_off)
@@ -860,15 +859,21 @@ _fail_:
 }
 
 /**/
-void wilc1000_wlan_deinit(struct wilc *nic)
+void wilc1000_wlan_deinit(struct net_device *dev)
 {
-   if (g_linux_wlan->initialized)  {
-   printk("Deinitializing wilc1000  ...\n");
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
 
-   if (nic == NULL) {
-   PRINT_ER("nic is NULL\n");
-   return;
-   }
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
+
+   if (!wl) {
+   netdev_err(dev, "wl is NULL\n");
+   return;
+   }
+
+   if (wl->initialized){
+   netdev_info(dev, "Deinitializing wilc1000...\n");
 
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
/* johnny : remove */
@@ -879,18 +884,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
 #ifdef WILC_SDIO
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
disable_sdio_interrupt();
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
 #endif
-   if (_linux_wlan->txq_event != NULL)
-   up(_linux_wlan->txq_event);
+   if (>txq_event != NULL)
+   up(>txq_event);
 
PRINT_D(INIT_DBG, "Deinitializing Threads\n");
-   wlan_deinitialize_threads(nic);
+   wlan_deinitialize_threads(wl);
 
PRINT_D(INIT_DBG, "Deinitializing IRQ\n");
-   deinit_irq(g_linux_wlan);
+   deinit_irq(wl);
 
wilc_wlan_stop();
 
@@ -900,18 +905,18 @@ void wilc1000_wlan_deinit(struct wilc *nic)
   #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
-   mutex_lock(_linux_wlan->hif_cs);
+   mutex_lock(>hif_cs);
disable_sdio_interrupt();
-   mutex_unlock(_linux_wlan->hif_cs);
+   mutex_unlock(>hif_cs);
   #endif
 #endif
 
/*De-Initialize locks*/
PRINT_D(INIT_DBG, "Deinitializing Locks\n");
-   wlan_deinit_locks(g_linux_wlan);
+   wlan_deinit_locks(wl);
 
/* announce that wilc1000 is not initialized */
-   g_linux_wlan->initialized = false;
+   wl->initialized = false;
 
PRINT_D(INIT_DBG, "wilc1000 deinitialization Done\n");
 
@@ -1232,7 +1237,7 @@ int mac_open(struct net_device *ndev)
 
 _err_:
wilc_deinit_host_int(ndev);
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
return ret;
 }
 
@@ -1431,7 +1436,7 @@ int mac_close(struct net_device *ndev)
if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
wl->close = 1;
-   wilc1000_wlan_deinit(wl);
+   wilc1000_wlan_deinit(ndev);
WILC_WFI_deinit_mon_interface();
}
 
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 422d462..33a082f 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2523,7 +2523,6 @@ static int set_power_mgmt(struct wiphy *wiphy, struct 
net_device *dev,
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-void wilc1000_wlan_deinit(struct wilc *nic);
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic);
 
 static int change_virtual_intf(struct wiphy *wiphy, struct net_device *dev,
@@ -2582,7 +2581,7 @@ static int change_virtual_intf(struct wiphy *wiphy, 

[PATCH 08/13] staging: wilc1000: CfgConnectResult: use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 33a082f..1533804 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -537,11 +537,15 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
struct net_device *dev;
struct host_if_drv *pstrWFIDrv;
u8 NullBssid[ETH_ALEN] = {0};
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
connecting = 0;
 
priv = (struct wilc_priv *)pUserVoid;
dev = priv->dev;
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
pstrWFIDrv = (struct host_if_drv *)priv->hWILCWFIDrv;
 
if (enuConnDisconnEvent == CONN_DISCONN_EVENT_CONN_RESP) {
@@ -624,12 +628,12 @@ static void CfgConnectResult(enum conn_event 
enuConnDisconnEvent,
u8WLANChannel = INVALID_CHANNEL;
/*Incase "P2P CLIENT Connected" send deauthentication reason by 
3 to force the WPA_SUPPLICANT to directly change
 *  virtual interface to station*/
-   if ((pstrWFIDrv->IFC_UP) && (dev == g_linux_wlan->vif[1].ndev)) 
{
+   if ((pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 3;
}
/*Incase "P2P CLIENT during connection(not connected)" send 
deauthentication reason by 1 to force the WPA_SUPPLICANT
 *  to scan again and retry the connection*/
-   else if ((!pstrWFIDrv->IFC_UP) && (dev == 
g_linux_wlan->vif[1].ndev)) {
+   else if ((!pstrWFIDrv->IFC_UP) && (dev == wl->vif[1].ndev)) {
pstrDisconnectNotifInfo->u16reason = 1;
}
cfg80211_disconnected(dev, pstrDisconnectNotifInfo->u16reason, 
pstrDisconnectNotifInfo->ie,
-- 
1.9.1

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


[PATCH 05/13] staging: wilc1000: mac_close: use netdev private wilc instead of g_linux_wlan

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 16 +---
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index ebedffa..93475aa 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1383,6 +1383,7 @@ int mac_close(struct net_device *ndev)
struct wilc_priv *priv;
perInterface_wlan_t *nic;
struct host_if_drv *pstrWFIDrv;
+   struct wilc *wl;
 
nic = netdev_priv(ndev);
 
@@ -1392,6 +1393,7 @@ int mac_close(struct net_device *ndev)
}
 
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
+   wl = nic->wilc;
 
if (priv == NULL) {
PRINT_ER("priv = NULL\n");
@@ -1402,8 +1404,8 @@ int mac_close(struct net_device *ndev)
 
PRINT_D(GENERIC_DBG, "Mac close\n");
 
-   if (g_linux_wlan == NULL) {
-   PRINT_ER("g_linux_wlan = NULL\n");
+   if (!wl) {
+   PRINT_ER("wl = NULL\n");
return 0;
}
 
@@ -1412,8 +1414,8 @@ int mac_close(struct net_device *ndev)
return 0;
}
 
-   if ((g_linux_wlan->open_ifcs) > 0) {
-   g_linux_wlan->open_ifcs--;
+   if ((wl->open_ifcs) > 0) {
+   wl->open_ifcs--;
} else {
PRINT_ER("ERROR: MAC close called while number of opened 
interfaces is zero\n");
return 0;
@@ -1426,10 +1428,10 @@ int mac_close(struct net_device *ndev)
wilc_deinit_host_int(nic->wilc_netdev);
}
 
-   if (g_linux_wlan->open_ifcs == 0) {
+   if (wl->open_ifcs == 0) {
PRINT_D(GENERIC_DBG, "Deinitializing wilc1000\n");
-   g_linux_wlan->close = 1;
-   wilc1000_wlan_deinit(g_linux_wlan);
+   wl->close = 1;
+   wilc1000_wlan_deinit(wl);
WILC_WFI_deinit_mon_interface();
}
 
-- 
1.9.1

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


[PATCH 01/13] staging: wilc1000: add wilc to netdev private data structure

2015-10-20 Thread Tony Cho
From: Glen Lee 

This patch add wilc to struct perInterface_wlan_t which is netdev private
data to access wilc via netdev_priv function. Assign wilc to nic->wilc.
The global variable g_linux_wlan will be replaced with netdev private data
member wilc step by step.

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

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 5701e58..8fa6b7c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1662,6 +1662,7 @@ int wilc_netdev_init(struct wilc **wilc)
 
nic->u8IfIdx = g_linux_wlan->vif_num;
nic->wilc_netdev = ndev;
+   nic->wilc = *wilc;
g_linux_wlan->vif[g_linux_wlan->vif_num].ndev = ndev;
g_linux_wlan->vif_num++;
ndev->netdev_ops = _netdev_ops;
diff --git a/drivers/staging/wilc1000/wilc_wfi_netdevice.h 
b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
index e0c66bc..40a44f8 100644
--- a/drivers/staging/wilc1000/wilc_wfi_netdevice.h
+++ b/drivers/staging/wilc1000/wilc_wfi_netdevice.h
@@ -199,7 +199,7 @@ typedef struct {
struct_frame_reg g_struct_frame_reg[num_reg_frame];
struct net_device *wilc_netdev;
struct net_device_stats netstats;
-
+   struct wilc *wilc;
 } perInterface_wlan_t;
 
 struct WILC_WFI_mon_priv {
-- 
1.9.1

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


[PATCH 13/13] staging: wilc1000: init_irq: change argument and use netdev private wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

This patch changes function argument type wilc with net_device and use
netdev private data member wilc instead of p_nic.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/linux_wlan.c | 18 +++---
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 2c4673c..bb5bd81 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -259,10 +259,14 @@ irqreturn_t isr_bh_routine(int irq, void *userdata)
 }
 
 #if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
-static int init_irq(struct wilc *p_nic)
+static int init_irq(struct net_device *dev)
 {
int ret = 0;
-   struct wilc *nic = p_nic;
+   perInterface_wlan_t *nic;
+   struct wilc *wl;
+
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
 
/*initialize GPIO and register IRQ num*/
/*GPIO request*/
@@ -275,23 +279,23 @@ static int init_irq(struct wilc *p_nic)
  * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
  */
 #else
-   nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+   wl->dev_irq_num = gpio_to_irq(GPIO_NUM);
 #endif
} else {
ret = -1;
PRINT_ER("could not obtain gpio for WILC_INTR\n");
}
 
-   if ((ret != -1) && (request_threaded_irq(nic->dev_irq_num, 
isr_uh_routine, isr_bh_routine,
+   if ((ret != -1) && (request_threaded_irq(wl->dev_irq_num, 
isr_uh_routine, isr_bh_routine,
  IRQF_TRIGGER_LOW | 
IRQF_ONESHOT,   /*Without IRQF_ONESHOT the uh will remain kicked in 
and dont gave a chance to bh*/
- "WILC_IRQ", nic)) < 0) {
+ "WILC_IRQ", wl)) < 0) {
 
PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
ret = -1;
} else {
 
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   nic->dev_irq_num, GPIO_NUM);
+   wl->dev_irq_num, GPIO_NUM);
}
 
return ret;
@@ -1055,7 +1059,7 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
}
 
 #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO)
-   if (init_irq(wl)) {
+   if (init_irq(dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_locks_;
-- 
1.9.1

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


[PATCH 12/13] staging: wilc1000: start_ap: use netdev private data wilc

2015-10-20 Thread Tony Cho
From: Glen Lee 

Use netdev private data member wilc instead of global variable g_linux_wlan.

Signed-off-by: Glen Lee 
Signed-off-by: Tony Cho 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 59db1d5..5559aa6 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -2891,8 +2891,12 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
struct cfg80211_beacon_data *beacon = &(settings->beacon);
struct wilc_priv *priv;
s32 s32Error = 0;
+   struct wilc *wl;
+   perInterface_wlan_t *nic;
 
priv = wiphy_priv(wiphy);
+   nic = netdev_priv(dev);
+   wl = nic->wilc;
PRINT_D(HOSTAPD_DBG, "Starting ap\n");
 
PRINT_D(HOSTAPD_DBG, "Interval = %d\n DTIM period = %d\n Head length = 
%zu Tail length = %zu\n",
@@ -2903,7 +2907,7 @@ static int start_ap(struct wiphy *wiphy, struct 
net_device *dev,
if (s32Error != 0)
PRINT_ER("Error in setting channel\n");
 
-   linux_wlan_set_bssid(dev, g_linux_wlan->vif[0].src_addr);
+   linux_wlan_set_bssid(dev, wl->vif[0].src_addr);
 
s32Error = host_int_add_beacon(priv->hWILCWFIDrv,
settings->beacon_interval,
-- 
1.9.1

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


[PATCH v2] Drivers: hv: vss: run only on supported host versions

2015-10-20 Thread Olaf Hering
The Backup integration service on WS2012 has appearently trouble to
negotiate with a guest which does not support the provided util version.
Currently the VSS driver supports only version 5/0. A WS2012 offers only
version 1/x and 3/x, and vmbus_prep_negotiate_resp correctly returns an
empty icframe_vercnt/icmsg_vercnt. But the host ignores that and
continues to send ICMSGTYPE_NEGOTIATE messages. The result are weird
errors during boot and general misbehaviour.

Check the Windows version to work around the host bug, skip hv_vss_init
on WS2012 and older.

Signed-off-by: Olaf Hering 
---

v2: use if < WS2012R2 instead of switch() as suggested by Vitaly.

 drivers/hv/hv_snapshot.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c
index a548ae4..81882d4 100644
--- a/drivers/hv/hv_snapshot.c
+++ b/drivers/hv/hv_snapshot.c
@@ -331,6 +331,11 @@ static void vss_on_reset(void)
 int
 hv_vss_init(struct hv_util_service *srv)
 {
+   if (vmbus_proto_version < VERSION_WIN8_1) {
+   pr_warn("Integration service 'Backup (volume snapshot)'"
+   " not supported on this host version.\n");
+   return -ENOTSUPP;
+   }
recv_buffer = srv->recv_buffer;
 
/*
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 00/23] Update driver to 0.9-294

2015-10-20 Thread ira.weiny
On Tue, Oct 20, 2015 at 03:45:47PM +0300, Moni Shoua wrote:
> >
> > Perhaps I did not chose my words carefully enough.
> >
> > The largest issue on the TODO list is the refactoring of the code to be
> > shared between the hfi1 and qib driver.  While the hardware between hfi1
> > and qib is similar and thus the initial code looked similar, our
> > performance tuning on hfi1 has revealed that some changes will be required
> > to the hfi1 code to fully utilize the hardware.  We would like to get these
> > updates in to make sure that the refactoring work is done properly for the
> > 2 hardware types.
>
> Please keep in mind that there are 3 HW types (our SoftRoCE driver)
> that needs to be part of the framework.

Understood, however, unlike SoftRoCE, qib and hfi currently share a lot of code
to drive the hardware.

The underlying reason for the TODO item "Remove software processing of IB
protocol..." is because we have a large amount of duplicated code between these
drivers.  _Some_ of which, at a high level, is sharable with SoftRoCE.

These patches (and more to follow), further differentiate the 2 drivers along
hardware lines.  Accepting these patches will help us make sure that we don't
create some common code between qib and hfi which, because of our testing we
now know, needs to be separated out.

This is a separate issue from the higher level code sharing which will be done
with SoftRoCE.

Ira

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


Re: [RFC][PATCH 1/2] WIP: Devicetree bindings for Ion

2015-10-20 Thread Mitchel Humpherys
On Tue, Oct 13 2015 at 11:14:23 AM, Andrew  wrote:
> On 2015-10-12 21:39, Mitchel Humpherys wrote:
>> On Tue, Oct 06 2015 at 05:35:41 PM, Rob Herring 
>> wrote:
>>> On Tue, Oct 6, 2015 at 3:47 PM, Laura Abbott 
>>> wrote:
>>
>> [...]
>>
 +Example:
 +
 +   ion {
 +   compatbile = "linux,ion";
 +   #address-cells = <1>;
 +   #size-cells = <0>;
 +
 +   ion-system-heap {
 +   linux,ion-heap-id = <0>;
 +   linux,ion-heap-type = ;
 +   linux,ion-heap-name = "system";
>>>
>>> How does this vary across platforms? Is all of this being pushed down
>>> to DT, because there is no coordination of this at the kernel ABI
>>> level across platforms. In other words, why can't heap 0 be hardcoded
>>> as system heap in the driver. It seems to me any 1 of these 3
>>> properties could be used to derive the other 2.
>>
>> The heap-id<->heap-type mapping isn't necessarily 1:1.  As Laura
>> indicated elsewhere on this thread, a given heap might need to be
>> contiguous on one platform but not on another.  In that case you just
>> swap out the heap-type here and there's no need for userspace to change.
>>
>> The heap-name, OTOH, could be derived from the heap-id, which is what we
>> hackishly do here [1] and here[2].
>
> By the way, since we agreed that heap id and heap type mappings
> are not 1:1 - we have a problem with the current API.
>
> In userspace we currently have this:
>
> int ion_alloc(int fd, size_t len, size_t align, unsigned int heap_mask,
>   unsigned int flags, ion_user_handle_t *handle);
>
> We do not specify here what TYPE of heap we want the allocation to come
> from.
> This may lead to very unpleasant stuff when porting from one platfrom to
> another.

What "unpleasant stuff" are you referring to, exactly?  Abstracting the
heap type away from userspace has actually made our lives easier since
userspace doesn't need to know anything about the properties of the
underlying platform.  It just asks for a buffer from the "camera" heap,
for example.  On some platforms that's contiguous, on others it's not.


-Mitch

-- 
Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 12/19] staging/wilc1000: use device pointer for phy creation

2015-10-20 Thread Arnd Bergmann
wilc_create_wiphy tries to get a pointer to a device from the
global wilc1000_sdio_func variable. This is a layering violation
and we can use the wilc1000_dev->dev pointer instead.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 9 ++---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +-
 drivers/staging/wilc1000/wilc_wlan.h  | 1 +
 4 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index aa6f5c7db139..abcb70bb1bd7 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1638,7 +1638,7 @@ int wilc_netdev_init(struct device *dev, const struct 
wilc1000_ops *ops)
{
struct wireless_dev *wdev;
/*Register WiFi*/
-   wdev = wilc_create_wiphy(ndev);
+   wdev = wilc_create_wiphy(ndev, wilc1000_dev->dev);
 
/* set netdev, tony */
if (dev)
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 702c40c1df4b..7405fb8bae42 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -11,9 +11,6 @@
  */
 
 #include "wilc_wfi_cfgoperations.h"
-#ifdef WILC_SDIO
-#include "linux_wlan_sdio.h"
-#endif
 #include "host_interface.h"
 #include 
 
@@ -3379,7 +3376,7 @@ _fail_:
  *  @date  01 MAR 2012
  *  @version   1.0
  */
-struct wireless_dev *wilc_create_wiphy(struct net_device *net)
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device 
*dev)
 {
struct wilc_priv *priv;
struct wireless_dev *wdev;
@@ -3431,9 +3428,7 @@ struct wireless_dev *wilc_create_wiphy(struct net_device 
*net)
   wdev->wiphy->max_scan_ssids, wdev->wiphy->max_scan_ie_len, 
wdev->wiphy->signal_type,
   wdev->wiphy->interface_modes, wdev->iftype);
 
-   #ifdef WILC_SDIO
-   set_wiphy_dev(wdev->wiphy, _sdio_func->dev);
-   #endif
+   set_wiphy_dev(wdev->wiphy, dev);
 
/*Register wiphy structure*/
s32Error = wiphy_register(wdev->wiphy);
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index 158d98c0eb87..ab53d9d59081 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,7 +10,7 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-struct wireless_dev *wilc_create_wiphy(struct net_device *net);
+struct wireless_dev *wilc_create_wiphy(struct net_device *net, struct device 
*dev);
 void wilc_free_wiphy(struct net_device *net);
 int WILC_WFI_update_stats(struct wiphy *wiphy, u32 pktlen, u8 changed);
 int wilc_deinit_host_int(struct net_device *net);
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 8c5253cce97c..2297e31b5b75 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -2,6 +2,7 @@
 #define WILC_WLAN_H
 
 #include 
+#include 
 
 #define ISWILC1000(id)   (((id & 0xf000) == 0x10) ? 1 : 0)
 
-- 
2.1.0.rc2

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


[PATCH 13/19] staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c

2015-10-20 Thread Arnd Bergmann
The COMPLEMENT_BOOT code is used only for SDIO and is aware of
details of the SDIO implementation that don't belong into
the common linux_wlan.c file.

This moves the functions to linux_wlan_sdio.c to get them out of
the way.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 95 +++
 drivers/staging/wilc1000/linux_wlan_sdio.c| 89 +++--
 drivers/staging/wilc1000/linux_wlan_sdio.h|  4 --
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  2 +-
 drivers/staging/wilc1000/wilc_wlan.h  |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |  5 ++
 6 files changed, 103 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index abcb70bb1bd7..980c2c8d300d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -483,11 +483,7 @@ _fail_:
 
 }
 
-#ifdef COMPLEMENT_BOOT
-static int repeat_power_cycle(perInterface_wlan_t *nic);
-#endif
-
-static int linux_wlan_start_firmware(perInterface_wlan_t *nic)
+int wilc1000_start_firmware(perInterface_wlan_t *nic)
 {
 
int ret = 0;
@@ -502,19 +498,17 @@ static int linux_wlan_start_firmware(perInterface_wlan_t 
*nic)
/* wait for mac ready */
PRINT_D(INIT_DBG, "Waiting for Firmware to get ready ...\n");
ret = linux_wlan_lock_timeout(_dev->sync_event, 5000);
-   if (ret) {
-#ifdef COMPLEMENT_BOOT
+   if (ret && wilc1000_dev->ops->repeat_power_cycle) {
static int timeout = 5;
 
if (timeout--) {
PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout);
-   ret = repeat_power_cycle(nic);
+   ret = wilc1000_dev->ops->repeat_power_cycle(nic);
} else {
timeout = 5;
ret = -1;
goto _fail_;
}
-#endif
PRINT_D(INIT_DBG, "Firmware start timed out");
goto _fail_;
}
@@ -527,7 +521,8 @@ static int linux_wlan_start_firmware(perInterface_wlan_t 
*nic)
 _fail_:
return ret;
 }
-static int linux_wlan_firmware_download(struct wilc *p_nic)
+
+int wilc1000_firmware_download(struct wilc *p_nic)
 {
 
int ret = 0;
@@ -954,77 +949,6 @@ static void wlan_deinitialize_threads(struct wilc *nic)
}
 }
 
-#ifdef COMPLEMENT_BOOT
-
-#define READY_CHECK_THRESHOLD  30
-static u8 wilc1000_prepare_11b_core(struct wilc *nic)
-{
-   u8 trials = 0;
-
-   while ((wilc1000_core_11b_ready() && (READY_CHECK_THRESHOLD > 
(trials++ {
-   PRINT_D(INIT_DBG, "11b core not ready yet: %u\n", trials);
-   wilc_wlan_cleanup();
-   wilc_wlan_global_reset();
-   sdio_unregister_driver(_bus);
-
-   sdio_register_driver(_bus);
-
-   while (!wilc1000_probe)
-   msleep(100);
-   wilc1000_probe = 0;
-   wilc1000_dev->dev = _sdio_func->dev;
-   nic->ops = _sdio_ops;
-   wilc_wlan_init(nic);
-   }
-
-   if (READY_CHECK_THRESHOLD <= trials)
-   return 1;
-   else
-   return 0;
-
-}
-
-static int repeat_power_cycle(perInterface_wlan_t *nic)
-{
-   int ret = 0;
-   sdio_unregister_driver(_bus);
-
-   sdio_register_driver(_bus);
-
-   /* msleep(1000); */
-   while (!wilc1000_probe)
-   msleep(100);
-   wilc1000_probe = 0;
-   wilc1000_dev->dev = _sdio_func->dev;
-   wilc1000_dev->ops = _sdio_ops;
-   ret = wilc_wlan_init(wilc1000_dev);
-
-   wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
-   #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-   wilc1000_sdio_enable_interrupt();
-   #endif
-
-   if (wilc1000_wlan_get_firmware(nic)) {
-   PRINT_ER("Can't get firmware\n");
-   ret = -1;
-   goto __fail__;
-   }
-
-   /*Download firmware*/
-   ret = linux_wlan_firmware_download(wilc1000_dev);
-   if (ret < 0) {
-   PRINT_ER("Failed to download firmware\n");
-   goto __fail__;
-   }
-   /* Start firmware*/
-   ret = linux_wlan_start_firmware(nic);
-   if (ret < 0)
-   PRINT_ER("Failed to start firmware\n");
-__fail__:
-   return ret;
-}
-#endif
-
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
perInterface_wlan_t *nic = p_nic;
@@ -1051,13 +975,12 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_wilc_wlan_;
}
 
-#if (defined WILC_SDIO) && (defined COMPLEMENT_BOOT)
-   if (wilc1000_prepare_11b_core(wilc1000_dev)) {
+   if (wilc1000_dev->ops->prepare_11b_core &&
+   wilc1000_dev->ops->prepare_11b_core(wilc1000_dev)) 

[PATCH 09/19] staging/wilc1000: move init/exit functions to driver files

2015-10-20 Thread Arnd Bergmann
The driver interfaces are in linux_wlan_sdio.c and linux_wlan_spi.c, so
this is where the init and exit functions should be. Splitting this up
enables further cleanups, including eventually allowing both modules
to be built together.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c  | 49 +++---
 drivers/staging/wilc1000/linux_wlan_sdio.c | 14 +
 drivers/staging/wilc1000/linux_wlan_spi.c  | 16 ++
 drivers/staging/wilc1000/wilc_wlan.h   |  4 +++
 4 files changed, 45 insertions(+), 38 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 53cecb892a84..caa85442c12d 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1725,59 +1725,38 @@ int wilc_netdev_init(void)
return 0;
 }
 
-/*The 1st function called after module inserted*/
-static int __init init_wilc_driver(void)
+void __init wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
-   if (wilc_debugfs_init() < 0) {
+   if (wilc_debugfs_init() < 0)
PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc 
driver\n");
-   return -1;
-   }
 #endif
 
printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-
-#ifdef WILC_SDIO
-   {
-   int ret;
-
-   ret = sdio_register_driver(_bus);
-   if (ret < 0)
-   PRINT_D(INIT_DBG, "init_wilc_driver: Failed register 
sdio driver\n");
-
-   return ret;
-   }
-#else
-   PRINT_D(INIT_DBG, "Initializing netdev\n");
-   if (wilc_netdev_init())
-   PRINT_ER("Couldn't initialize netdev\n");
-   return 0;
-#endif
 }
-late_initcall(init_wilc_driver);
 
-static void __exit exit_wilc_driver(void)
+void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 {
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
#define CLOSE_TIMEOUT (12 * 1000)
 
-   if ((wilc1000_dev != NULL) && 
(((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-  || 
((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+   if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+   wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
unregister_inetaddr_notifier(_dev_notifier);
 
for (i = 0; i < NUM_CONCURRENT_IFC; i++)
nic[i] = 
netdev_priv(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}
 
-   if ((wilc1000_dev != NULL) && wilc1000_dev->wilc_firmware != NULL) {
+   if (wilc1000_dev->wilc_firmware) {
release_firmware(wilc1000_dev->wilc_firmware);
wilc1000_dev->wilc_firmware = NULL;
}
 
-   if ((wilc1000_dev != NULL) && 
(((wilc1000_dev->strInterfaceInfo[0].wilc_netdev) != NULL)
-  || 
((wilc1000_dev->strInterfaceInfo[1].wilc_netdev) != NULL))) {
+   if (wilc1000_dev->strInterfaceInfo[0].wilc_netdev ||
+   wilc1000_dev->strInterfaceInfo[1].wilc_netdev) {
PRINT_D(INIT_DBG, "Waiting for wilc1000_mac_close \n");
 
if (linux_wlan_lock_timeout(_exit_sync, CLOSE_TIMEOUT) < 
0)
@@ -1801,15 +1780,10 @@ static void __exit exit_wilc_driver(void)

free_netdev(wilc1000_dev->strInterfaceInfo[i].wilc_netdev);
}
}
+}
 
-#ifndef WILC_SDIO
-   PRINT_D(INIT_DBG, "SPI unregsiter...\n");
-   spi_unregister_driver(_bus);
-#else
-   PRINT_D(INIT_DBG, "SDIO unregsiter...\n");
-   sdio_unregister_driver(_bus);
-#endif
-
+void __exit wilc1000_exit_driver(void)
+{
kfree(wilc1000_dev);
wilc1000_dev = NULL;
printk("Module_exit Done.\n");
@@ -1818,6 +1792,5 @@ static void __exit exit_wilc_driver(void)
wilc_debugfs_remove();
 #endif
 }
-module_exit(exit_wilc_driver);
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 4e8c4e6d499e..badcae57875c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -237,4 +237,18 @@ int wilc1000_sdio_set_default_speed(void)
 }
 
 
+static int __init init_wilc_sdio_driver(void)
+{
+   wilc1000_init_driver();
+   return sdio_register_driver(_bus);
+}
+late_initcall(init_wilc_sdio_driver);
 
+static void __exit exit_wilc_sdio_driver(void)
+{
+   if (wilc1000_dev)
+   wilc_netdev_free(wilc1000_dev);
+   sdio_unregister_driver(_bus);
+   wilc1000_exit_driver();
+}
+module_exit(exit_wilc_sdio_driver);
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index 43cfeda97030..c90b741824dc 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ 

[PATCH 11/19] staging/wilc1000: move wilc1000_ops to drivers

2015-10-20 Thread Arnd Bergmann
The two instances of struct wilc1000_ops reference functions that
are defined in just one file each. By moving the operations there,
we can mark all those functions as 'static' and avoid a number
of #ifdefs.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c  | 43 --
 drivers/staging/wilc1000/linux_wlan_sdio.c | 24 -
 drivers/staging/wilc1000/linux_wlan_sdio.h | 11 +++-
 drivers/staging/wilc1000/linux_wlan_spi.c  | 29 +---
 drivers/staging/wilc1000/linux_wlan_spi.h  |  8 --
 drivers/staging/wilc1000/wilc_wlan.h   |  2 +-
 6 files changed, 45 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 4ca045bcf537..aa6f5c7db139 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -26,11 +26,7 @@
 #include 
 #include 
 
-#ifdef WILC_SDIO
 #include "linux_wlan_sdio.h"
-#else
-#include "linux_wlan_spi.h"
-#endif
 
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
@@ -915,30 +911,6 @@ static int wlan_deinit_locks(struct wilc *nic)
return 0;
 }
 
-#ifdef WILC_SDIO
-static const struct wilc1000_ops wilc1000_sdio_ops = {
-   .io_type = HIF_SDIO,
-   .io_init = wilc1000_sdio_init,
-   .io_deinit = wilc1000_sdio_deinit,
-   .u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
-   .u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
-   .u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
-   .u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
-};
-#endif
-
-#ifdef WILC_SPI
-static const struct wilc1000_ops wilc1000_spi_ops = {
-   .io_type = HIF_SPI,
-   .io_init = wilc1000_spi_init,
-   .io_deinit = wilc1000_spi_deinit,
-   .u.spi.spi_tx = wilc1000_spi_write,
-   .u.spi.spi_rx = wilc1000_spi_read,
-   .u.spi.spi_trx = wilc1000_spi_write_read,
-   .u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
-};
-#endif
-
 static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
 
@@ -1065,12 +1037,6 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 
wlan_init_locks(wilc1000_dev);
 
-#ifdef WILC_SDIO
-   wilc1000_dev->ops = _sdio_ops;
-#else
-   wilc1000_dev->ops = _spi_ops;
-#endif
-
ret = wilc_wlan_init(wilc1000_dev);
if (ret < 0) {
PRINT_ER("Initializing WILC_Wlan FAILED\n");
@@ -1622,7 +1588,7 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, 
buff, size);
 }
 
-int wilc_netdev_init(void)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops)
 {
 
int i;
@@ -1636,6 +1602,8 @@ int wilc_netdev_init(void)
if (!wilc1000_dev)
return -ENOMEM;
 
+   wilc1000_dev->ops = ops;
+
register_inetaddr_notifier(_dev_notifier);
 
for (i = 0; i < NUM_CONCURRENT_IFC; i++) {
@@ -1672,10 +1640,9 @@ int wilc_netdev_init(void)
/*Register WiFi*/
wdev = wilc_create_wiphy(ndev);
 
-   #ifdef WILC_SDIO
/* set netdev, tony */
-   SET_NETDEV_DEV(ndev, _sdio_func->dev);
-   #endif
+   if (dev)
+   SET_NETDEV_DEV(ndev, dev);
 
if (wdev == NULL) {
PRINT_ER("Can't register WILC Wiphy\n");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index a6ae26739dd8..429bdc85ed62 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,4 +1,5 @@
 #include "wilc_wfi_netdevice.h"
+#include "linux_wlan_sdio.h"
 
 #include 
 #include 
@@ -44,7 +45,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 #endif
 
 
-int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
+static int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
struct sdio_func *func = container_of(wilc1000_dev->dev, struct 
sdio_func, dev);
int ret;
@@ -76,7 +77,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 }
 
 
-int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
+static int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 {
struct sdio_func *func = container_of(wilc1000_dev->dev, struct 
sdio_func, dev);
int size, ret;
@@ -122,7 +123,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 #endif
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc1000_sdio_func = func;
-   if (wilc_netdev_init()) {
+   if (wilc_netdev_init(>dev, _sdio_ops)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
@@ -204,7 +205,7 @@ static int linux_sdio_get_speed(void)

Re: [PATCH] staging/wilc: fix Kconfig dependencies, second try

2015-10-20 Thread Arnd Bergmann
On Monday 19 October 2015 11:53:40 Arnd Bergmann wrote:
> On Monday 19 October 2015 11:39:31 Arnd Bergmann wrote:
> > On Monday 19 October 2015 16:54:23 Tony Cho wrote:
> > > Hi Arnd Bergmann,
> > > 
> > > When I apply this patch, I cannot make WILC1000 module (wilc1000.ko) 
> > > because CONFIG_WILC1000 is y and also I can see some link errors for the 
> > > cfg80211 APIs.
> > > 
> > > Can you consider this patch?
> > 
> > Ah, you are right. I see the same thing now and don't know what caused me
> > to send the patch in an incomplete state.
> > 
> > I hope this snippet is the last missing piece:
> > 
> 
> No, that was not it either, I'll start over to think this through.
> 
> The real solution of course is to make it possible to load both the
> SPI and MMC front-ends at the same time and have a common base driver,
> which I might have to do, in order to clear myself of the shame of sending
> not one but two incorrect fixes for this problem 

I spent too much time on it now, but I have a series that should fix
this part for real and let you build both drivers into the kernel
(or as modules) in a single configuration.

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


[PATCH 19/19] [RFC] staging/wilc1000: use more regular probing

2015-10-20 Thread Arnd Bergmann
So far, my patches tried to do equivalent conversions of the
existing code.  This one goes beyond that by restructuring
how the devices get probed. In particular, the spi driver
no longer creates the netdev until the device is probed,
and I've removed the global wilc1000_sdio_func and wilc_spi_dev
variables in favor of retrieving them from the wilc1000_dev
variable that will eventually get passed through all functions
instead of using a global.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c  |  30 
 drivers/staging/wilc1000/linux_wlan_sdio.c |  54 -
 drivers/staging/wilc1000/linux_wlan_spi.c  | 118 ++---
 drivers/staging/wilc1000/wilc_wlan.h   |   5 +-
 4 files changed, 72 insertions(+), 135 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..6e16c0b32f43 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,19 +1594,7 @@ int wilc_netdev_init(struct device *dev, const struct 
wilc1000_ops *ops,
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_init);
 
-void __init wilc1000_init_driver(void)
-{
-#if defined(WILC_DEBUGFS)
-   if (wilc_debugfs_init() < 0)
-   PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc 
driver\n");
-#endif
-
-   printk("IN INIT FUNCTION\n");
-   printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
-}
-EXPORT_SYMBOL_GPL(wilc1000_init_driver);
-
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
+void wilc_netdev_free(struct wilc *wilc1000_dev)
 {
int i = 0;
perInterface_wlan_t *nic[NUM_CONCURRENT_IFC] = {NULL,};
@@ -1653,16 +1641,28 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
+int __init wilc1000_init_driver(void)
+{
+   int ret = 0;
+#if defined(WILC_DEBUGFS)
+   ret = wilc_debugfs_init();
+   if (ret < 0)
+   PRINT_D(GENERIC_DBG, "fail to create debugfs for wilc 
driver\n");
+#endif
+   return ret;
+
+}
+module_init(wilc1000_init_driver);
+
 void __exit wilc1000_exit_driver(void)
 {
kfree(wilc1000_dev);
wilc1000_dev = NULL;
-   printk("Module_exit Done.\n");
 
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
 #endif
 }
-EXPORT_SYMBOL_GPL(wilc1000_exit_driver);
+module_exit(wilc1000_exit_driver);
 
 MODULE_LICENSE("GPL");
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 1f343ac72530..916c2a1d189d 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -24,7 +24,6 @@
 #endif
 
 
-static struct sdio_func *wilc1000_sdio_func;
 static unsigned int sdio_default_speed;
 
 #define SDIO_VENDOR_ID_WILC 0x0296
@@ -113,6 +112,7 @@ static const struct wilc1000_ops wilc1000_sdio_ops;
 
 static struct sdio_driver wilc_bus;
 static volatile int wilc1000_probe;
+static struct sdio_func *wilc1000_sdio_func;
 
 #define READY_CHECK_THRESHOLD  30
 static u8 wilc1000_prepare_11b_core(struct wilc *nic)
@@ -195,6 +195,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
PRINT_D(INIT_DBG, "wilc1000_sdio_func isn't NULL\n");
return 0;
}
+   wilc1000_sdio_func = func;
 #endif
 
gpio = -1;
@@ -205,13 +206,13 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
}
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
-   wilc1000_sdio_func = func;
if (wilc_netdev_init(>dev, _sdio_ops,
_hif_sdio, gpio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
-   wilc1000_dev->dev = _sdio_func->dev;
+   wilc1000_dev->dev = >dev;
+   sdio_set_drvdata(func, wilc1000_dev);
 
printk("Driver Initializing success\n");
return 0;
@@ -219,18 +220,17 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
 static void linux_sdio_remove(struct sdio_func *func)
 {
-   /**
-*  TODO
-**/
-
+   wilc_netdev_free(sdio_get_drvdata(func));
 }
 
-static struct sdio_driver wilc_bus = {
+static struct sdio_driver wilc1000_sdio_driver = {
.name   = SDIO_MODALIAS,
.id_table   = wilc_sdio_ids,
.probe  = linux_sdio_probe,
.remove = linux_sdio_remove,
 };
+module_driver(wilc1000_sdio_driver, sdio_register_driver, 
sdio_unregister_driver);
+MODULE_LICENSE("GPL");
 
 static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
 {
@@ -268,14 +268,15 @@ static void wilc1000_sdio_disable_interrupt(struct wilc 
*dev)
 static int linux_sdio_set_speed(int speed)
 {
struct mmc_ios ios;
+   struct sdio_func *func = container_of(wilc1000_dev->dev, struct 
sdio_func, dev);
 
-   sdio_claim_host(wilc1000_sdio_func);
+ 

[PATCH 17/19] staging/wilc1000: pass hif operations through initialization

2015-10-20 Thread Arnd Bergmann
The wilc1000_hif_spi and wilc1000_hif_sdio structures are part of
the bus specific code, and the generic code should have no knowledge
of their addresses.

This changes the code to reference them only from the bus
specific initialization code, which we can then use to split
up the driver into separate modules.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c |  4 ++-
 drivers/staging/wilc1000/linux_wlan_sdio.c|  3 ++-
 drivers/staging/wilc1000/linux_wlan_spi.c |  3 ++-
 drivers/staging/wilc1000/wilc_sdio.c  | 35 +--
 drivers/staging/wilc1000/wilc_spi.c   | 34 +-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c  | 29 --
 drivers/staging/wilc1000/wilc_wlan.h  | 11 +
 8 files changed, 53 insertions(+), 67 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 7b0ac31f04a2..04ebb6310070 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1503,7 +1503,8 @@ void WILC_WFI_mgmt_rx(u8 *buff, u32 size)
WILC_WFI_p2p_rx(wilc1000_dev->strInterfaceInfo[1].wilc_netdev, 
buff, size);
 }
 
-int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops, int 
gpio)
+int wilc_netdev_init(struct device *dev, const struct wilc1000_ops *ops,
+const struct wilc1000_hif_ops *hif_ops, int gpio)
 {
 
int i;
@@ -1518,6 +1519,7 @@ int wilc_netdev_init(struct device *dev, const struct 
wilc1000_ops *ops, int gpi
return -ENOMEM;
 
wilc1000_dev->ops = ops;
+   wilc1000_dev->hif_ops = hif_ops;
wilc1000_dev->gpio = gpio;
 
register_inetaddr_notifier(_dev_notifier);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 86251b907197..1f79d986be5c 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -206,7 +206,8 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
 
PRINT_D(INIT_DBG, "Initializing netdev\n");
wilc1000_sdio_func = func;
-   if (wilc_netdev_init(>dev, _sdio_ops, gpio)) {
+   if (wilc_netdev_init(>dev, _sdio_ops,
+   _hif_sdio, gpio)) {
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index c6ea3ef0664f..02b922ab86bb 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -424,7 +424,8 @@ static int __init init_wilc_spi_driver(void)
int ret;
 
wilc1000_init_driver();
-   ret = wilc_netdev_init(NULL, _spi_ops, GPIO_NUM);
+   ret = wilc_netdev_init(NULL, _spi_ops, _hif_spi,
+  GPIO_NUM);
if (ret)
return ret;
 
diff --git a/drivers/staging/wilc1000/wilc_sdio.c 
b/drivers/staging/wilc1000/wilc_sdio.c
index 69b7c72b76c5..5bfc093b6201 100644
--- a/drivers/staging/wilc1000/wilc_sdio.c
+++ b/drivers/staging/wilc1000/wilc_sdio.c
@@ -924,23 +924,22 @@ static int sdio_sync_ext(int nint /*  how mant interrupts 
to enable. */)
  *
  /
 
-wilc_hif_func_t wilc1000_hif_sdio = {
-   sdio_init,
-   sdio_deinit,
-   sdio_read_reg,
-   sdio_write_reg,
-   sdio_read,
-   sdio_write,
-   sdio_sync,
-   sdio_clear_int,
-   sdio_read_int,
-   sdio_clear_int_ext,
-   sdio_read_size,
-   sdio_write,
-   sdio_read,
-   sdio_sync_ext,
-
-   sdio_set_max_speed,
-   sdio_set_default_speed,
+const struct wilc1000_hif_ops wilc1000_hif_sdio = {
+   .hif_init = sdio_init,
+   .hif_deinit = sdio_deinit,
+   .hif_read_reg = sdio_read_reg,
+   .hif_write_reg = sdio_write_reg,
+   .hif_block_rx = sdio_read,
+   .hif_block_tx = sdio_write,
+   .hif_sync = sdio_sync,
+   .hif_clear_int = sdio_clear_int,
+   .hif_read_int = sdio_read_int,
+   .hif_clear_int_ext = sdio_clear_int_ext,
+   .hif_read_size = sdio_read_size,
+   .hif_block_rx_ext = sdio_write,
+   .hif_block_tx_ext = sdio_read,
+   .hif_sync_ext = sdio_sync_ext,
+   .hif_set_max_bus_speed = sdio_set_max_speed,
+   .hif_set_default_bus_speed = sdio_set_default_speed,
 };
 
diff --git a/drivers/staging/wilc1000/wilc_spi.c 
b/drivers/staging/wilc1000/wilc_spi.c
index 4c5659b72f29..a418774d7960 100644
--- a/drivers/staging/wilc1000/wilc_spi.c
+++ b/drivers/staging/wilc1000/wilc_spi.c
@@ -1032,21 +1032,21 @@ static int spi_sync_ext(int nint /*  how mant 
interrupts to enable. */)
  *  Global spi HIF function table
  *
  /
-wilc_hif_func_t wilc1000_hif_spi = {

[PATCH 04/19] staging/wilc1000: move extern declarations to headers

2015-10-20 Thread Arnd Bergmann
'extern' declarations belong into a header file rather than
a .c file, to ensure that the definition matches the declaration.

This moves all declarations into a header file that seems
most appropriate for it.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/host_interface.c | 10 +---
 drivers/staging/wilc1000/host_interface.h | 10 
 drivers/staging/wilc1000/linux_mon.c  |  3 ---
 drivers/staging/wilc1000/linux_wlan.c | 16 -
 drivers/staging/wilc1000/linux_wlan_sdio.c|  3 ---
 drivers/staging/wilc1000/linux_wlan_spi.c |  1 -
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 15 +---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  4 
 drivers/staging/wilc1000/wilc_wlan.c  |  9 +--
 drivers/staging/wilc1000/wilc_wlan.h  | 29 ++-
 11 files changed, 45 insertions(+), 56 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index c8c5f5c602c7..99c78d395653 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -4,16 +4,11 @@
 #include 
 #include "host_interface.h"
 #include "coreconfigurator.h"
+#include "wilc_wlan.h"
 #include "wilc_wlan_if.h"
 #include "wilc_msgqueue.h"
 #include 
 
-extern u8 wilc1000_connecting;
-
-extern struct timer_list wilc1000_during_ip_timer;
-
-extern u8 wilc1000_initialized;
-
 #define HOST_IF_MSG_SCAN0
 #define HOST_IF_MSG_CONNECT 1
 #define HOST_IF_MSG_RCVD_GNRL_ASYNC_INFO2
@@ -268,9 +263,6 @@ static struct host_if_drv *join_req_drv;
 
 static void *host_int_ParseJoinBssParam(tstrNetworkInfo *ptstrNetworkInfo);
 
-extern void wilc1000_chip_sleep_manually(u32 u32SleepTime);
-extern int wilc1000_wlan_get_num_conn_ifcs(void);
-
 static int add_handler_in_list(struct host_if_drv *handler)
 {
int i;
diff --git a/drivers/staging/wilc1000/host_interface.h 
b/drivers/staging/wilc1000/host_interface.h
index 826ed0f30615..1f537ed9d7f3 100644
--- a/drivers/staging/wilc1000/host_interface.h
+++ b/drivers/staging/wilc1000/host_interface.h
@@ -925,4 +925,14 @@ void wilc1000_free_join_params(void *pJoinParams);
 
 s32 wilc1000_get_statistics(struct host_if_drv *hWFIDrv, struct rf_info 
*pstrStatistics);
 
+void wilc1000_resolve_disconnect_aberration(struct host_if_drv *drvHandler);
+
+extern bool wilc1000_optaining_ip;
+extern u8 wilc1000_connected_SSID[6];
+extern u8 
wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
+
+extern int wilc1000_connecting;
+extern u8 wilc1000_initialized;
+extern struct timer_list wilc1000_during_ip_timer;
+
 #endif
diff --git a/drivers/staging/wilc1000/linux_mon.c 
b/drivers/staging/wilc1000/linux_mon.c
index 52443f039a43..50196c3aa61d 100644
--- a/drivers/staging/wilc1000/linux_mon.c
+++ b/drivers/staging/wilc1000/linux_mon.c
@@ -26,9 +26,6 @@ struct wilc_wfi_radiotap_cb_hdr {
 
 static struct net_device *wilc_wfi_mon; /* global monitor netdev */
 
-extern int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-
-
 static u8 srcAdd[6];
 static u8 bssid[6];
 static u8 broadcast[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index be4b1b1199f8..50477d70eb24 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -45,13 +45,6 @@
  #define _linux_wlan_device_removal()  {}
 #endif
 
-extern bool wilc1000_optaining_ip;
-extern u16 wilc1000_set_machw_change_vir_if(bool bValue);
-extern void wilc1000_resolve_disconnect_aberration(void *drvHandler);
-extern u8 
wilc1000_multicast_mac_addr_list[WILC_MULTICAST_TABLE_SIZE][ETH_ALEN];
-void wilc1000_wlan_deinit(struct wilc *nic);
-extern struct timer_list wilc1000_during_ip_timer;
-
 static int linux_wlan_device_power(int on_off)
 {
PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
@@ -98,14 +91,9 @@ static struct semaphore close_exit_sync;
 
 static int wlan_deinit_locks(struct wilc *nic);
 static void wlan_deinitialize_threads(struct wilc *nic);
-extern void WILC_WFI_monitor_rx(u8 *buff, u32 size);
-extern void WILC_WFI_p2p_rx(struct net_device *dev, u8 *buff, u32 size);
 
 static void linux_wlan_tx_complete(void *priv, int status);
 static int  mac_init_fn(struct net_device *ndev);
-int  wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
-int  wilc1000_mac_open(struct net_device *ndev);
-int  wilc1000_mac_close(struct net_device *ndev);
 static struct net_device_stats *mac_stats(struct net_device *dev);
 static int  mac_ioctl(struct net_device *ndev, struct ifreq *req, int cmd);
 static void wilc_set_multicast_list(struct net_device *dev);
@@ -1047,11 +1035,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 
 

[PATCH 14/19] staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO

2015-10-20 Thread Arnd Bergmann
Whether the SDIO function uses an internal or external interrupt
should not be a compiletime decision but be determined at runtime.

This changes the code to pass a GPIO number from the init code
as early as possible, and leaves just one #ifdef WILC_SDIO_IRQ_GPIO
to preserve the previous behavior.

All other locations that check for the interrupt method are turned
into runtime checks based on the gpio number (>=0) or the interrupt
number (>0).

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile |   1 -
 drivers/staging/wilc1000/linux_wlan.c |  66 +++-
 drivers/staging/wilc1000/linux_wlan_sdio.c|  26 ---
 drivers/staging/wilc1000/linux_wlan_spi.c |   2 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 105 +++---
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |   5 +-
 drivers/staging/wilc1000/wilc_wlan.c  |   8 +-
 drivers/staging/wilc1000/wilc_wlan.h  |   2 +-
 8 files changed, 94 insertions(+), 121 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 55b2ac2b15a8..b96fee8f94f2 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
 ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_HW_OOB_INTR) += -DWILC_SDIO_IRQ_GPIO
 ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 980c2c8d300d..beafc543aac3 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -170,7 +170,6 @@ static int dev_state_ev_handler(struct notifier_block 
*this, unsigned long event
 
 }
 
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
 static irqreturn_t isr_uh_routine(int irq, void *user_data)
 {
PRINT_D(INT_DBG, "Interrupt received UH\n");
@@ -208,16 +207,16 @@ static int init_irq(struct wilc *p_nic)
 
/*initialize GPIO and register IRQ num*/
/*GPIO request*/
-   if ((gpio_request(GPIO_NUM, "WILC_INTR") == 0) &&
-   (gpio_direction_input(GPIO_NUM) == 0)) {
+   if ((gpio_request(nic->gpio, "WILC_INTR") == 0) &&
+   (gpio_direction_input(nic->gpio) == 0)) {
 #if defined(CUSTOMER_PLATFORM)
 /*
  TODO : save the registerd irq number to the private wilc context in kernel.
  *
- * ex) nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+ * ex) nic->dev_irq_num = gpio_to_irq(nic->gpio);
  */
 #else
-   nic->dev_irq_num = gpio_to_irq(GPIO_NUM);
+   nic->dev_irq_num = gpio_to_irq(nic->gpio);
 #endif
} else {
ret = -1;
@@ -228,28 +227,25 @@ static int init_irq(struct wilc *p_nic)
  IRQF_TRIGGER_LOW | 
IRQF_ONESHOT,   /*Without IRQF_ONESHOT the uh will remain kicked in 
and dont gave a chance to bh*/
  "WILC_IRQ", nic)) < 0) {
 
-   PRINT_ER("Failed to request IRQ for GPIO: %d\n", GPIO_NUM);
+   PRINT_ER("Failed to request IRQ for GPIO: %d\n", nic->gpio);
ret = -1;
} else {
 
PRINT_D(INIT_DBG, "IRQ request succeeded IRQ-NUM= %d on GPIO: 
%d\n",
-   nic->dev_irq_num, GPIO_NUM);
+   nic->dev_irq_num, nic->gpio);
}
 
return ret;
 }
-#endif
 
 static void deinit_irq(struct wilc *nic)
 {
-#if (defined WILC_SPI) || (defined WILC_SDIO_IRQ_GPIO)
/* Deintialize IRQ */
-   if (>dev_irq_num != 0) {
+   if (nic->gpio >= 0 && >dev_irq_num != 0) {
free_irq(nic->dev_irq_num, wilc1000_dev);
 
-   gpio_free(GPIO_NUM);
+   gpio_free(nic->gpio);
}
-#endif
 }
 
 /*
@@ -830,11 +826,11 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 #endif
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
-#ifdef WILC_SDIO
-   mutex_lock(_dev->hif_cs);
-   wilc1000_sdio_disable_interrupt();
-   mutex_unlock(_dev->hif_cs);
-#endif
+   if (wilc1000_dev->gpio < 0) {
+   mutex_lock(_dev->hif_cs);
+   wilc1000_sdio_disable_interrupt();
+   mutex_unlock(_dev->hif_cs);
+   }
if (_dev->txq_event != NULL)
up(_dev->txq_event);
 
@@ -848,14 +844,13 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup();
-#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
-  #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
-   PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
-
-   mutex_lock(_dev->hif_cs);
-   

[PATCH 01/19] staging/wilc1000: remove unused functions

2015-10-20 Thread Arnd Bergmann
A number of symbols in the wilc1000 driver are completely unused
and can be removed.
This includes two variables that are only written but not read.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/host_interface.c | 311 --
 drivers/staging/wilc1000/host_interface.h | 208 +--
 drivers/staging/wilc1000/wilc_sdio.c  |  56 
 drivers/staging/wilc1000/wilc_spi.c   | 225 
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c |  35 ---
 drivers/staging/wilc1000/wilc_wlan.c  |   4 -
 6 files changed, 1 insertion(+), 838 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 38fead44cce0..194ca3d3e920 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -3421,36 +3421,6 @@ s32 host_int_set_pmkid_info(struct host_if_drv *hif_drv, 
struct host_if_pmkid_at
return s32Error;
 }
 
-s32 host_int_get_pmkid_info(struct host_if_drv *hif_drv,
-   u8 *pu8PmkidInfoArray,
-   u32 u32PmkidInfoLen)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_PMKID_INFO;
-   strWID.type = WID_STR;
-   strWID.size = u32PmkidInfoLen;
-   strWID.val = pu8PmkidInfoArray;
-
-   return 0;
-}
-
-s32 host_int_set_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-u8 *pu8PassPhrase,
-u8 u8Psklength)
-{
-   struct wid strWID;
-
-   if ((u8Psklength > 7) && (u8Psklength < 65)) {
-   strWID.id = (u16)WID_11I_PSK;
-   strWID.type = WID_STR;
-   strWID.val = pu8PassPhrase;
-   strWID.size = u8Psklength;
-   }
-
-   return 0;
-}
-
 s32 host_int_get_MacAddress(struct host_if_drv *hif_drv, u8 *pu8MacAddress)
 {
s32 s32Error = 0;
@@ -3492,19 +3462,6 @@ s32 host_int_set_MacAddress(struct host_if_drv *hif_drv, 
u8 *pu8MacAddress)
 
 }
 
-s32 host_int_get_RSNAConfigPSKPassPhrase(struct host_if_drv *hif_drv,
-u8 *pu8PassPhrase, u8 u8Psklength)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_11I_PSK;
-   strWID.type = WID_STR;
-   strWID.size = u8Psklength;
-   strWID.val = pu8PassPhrase;
-
-   return 0;
-}
-
 s32 host_int_set_start_scan_req(struct host_if_drv *hif_drv, u8 scanSource)
 {
struct wid strWID;
@@ -3517,18 +3474,6 @@ s32 host_int_set_start_scan_req(struct host_if_drv 
*hif_drv, u8 scanSource)
return 0;
 }
 
-s32 host_int_get_start_scan_req(struct host_if_drv *hif_drv, u8 *pu8ScanSource)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_START_SCAN_REQ;
-   strWID.type = WID_CHAR;
-   strWID.val = (s8 *)pu8ScanSource;
-   strWID.size = sizeof(char);
-
-   return 0;
-}
-
 s32 host_int_set_join_req(struct host_if_drv *hif_drv, u8 *pu8bssid,
  const u8 *pu8ssid, size_t ssidLen,
  const u8 *pu8IEs, size_t IEsLen,
@@ -3649,31 +3594,6 @@ s32 host_int_disconnect(struct host_if_drv *hif_drv, u16 
u16ReasonCode)
return s32Error;
 }
 
-s32 host_int_disconnect_station(struct host_if_drv *hif_drv, u8 assoc_id)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_DISCONNECT;
-   strWID.type = WID_CHAR;
-   strWID.val = (s8 *)_id;
-   strWID.size = sizeof(char);
-
-   return 0;
-}
-
-s32 host_int_get_assoc_req_info(struct host_if_drv *hif_drv, u8 
*pu8AssocReqInfo,
-   u32 u32AssocReqInfoLen)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_ASSOC_REQ_INFO;
-   strWID.type = WID_STR;
-   strWID.val = pu8AssocReqInfo;
-   strWID.size = u32AssocReqInfoLen;
-
-   return 0;
-}
-
 s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv, u8 
*pu8AssocRespInfo,
u32 u32MaxAssocRespInfoLen, u32 
*pu32RcvdAssocRespInfoLen)
 {
@@ -3703,19 +3623,6 @@ s32 host_int_get_assoc_res_info(struct host_if_drv 
*hif_drv, u8 *pu8AssocRespInf
return s32Error;
 }
 
-s32 host_int_get_rx_power_level(struct host_if_drv *hif_drv, u8 
*pu8RxPowerLevel,
-   u32 u32RxPowerLevelLen)
-{
-   struct wid strWID;
-
-   strWID.id = (u16)WID_RX_POWER_LEVEL;
-   strWID.type = WID_STR;
-   strWID.val = pu8RxPowerLevel;
-   strWID.size = u32RxPowerLevelLen;
-
-   return 0;
-}
-
 int host_int_set_mac_chnl_num(struct host_if_drv *hif_drv, u8 channel)
 {
int result;
@@ -3796,33 +3703,6 @@ int host_int_set_operation_mode(struct host_if_drv 
*hif_drv, u32 mode)
return result;
 }
 
-s32 host_int_get_host_chnl_num(struct host_if_drv *hif_drv, u8 *pu8ChNo)
-{
-   s32 s32Error = 0;
-   struct host_if_msg msg;
-
-   if (!hif_drv) {
-   

[PATCH 15/19] staging/wilc1000: turn enable_irq/disable_irq into callbacks

2015-10-20 Thread Arnd Bergmann
As a preparation for turning the SDIO side of wilc1000 into a separate
module, this removes the last direct caller from the core module into
the sdio specific portion. All calls to wilc1000_sdio_enable_interrupt()
and wilc1000_sdio_disable_interrupt() now go through a function pointer
in wilc1000_ops. We also change arguments slightly to pass the device,
as we are already touching those lines and the change will be needed
later to remove the global variables.

The linux_wlan_sdio.h file is now unused and gets deleted.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c  | 21 -
 drivers/staging/wilc1000/linux_wlan_sdio.c | 23 +--
 drivers/staging/wilc1000/linux_wlan_sdio.h |  5 -
 drivers/staging/wilc1000/wilc_wlan_if.h|  2 ++
 4 files changed, 27 insertions(+), 24 deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index beafc543aac3..7b0ac31f04a2 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -26,8 +26,6 @@
 #include 
 #include 
 
-#include "linux_wlan_sdio.h"
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -826,9 +824,10 @@ void wilc1000_wlan_deinit(struct wilc *nic)
 #endif
 
PRINT_D(INIT_DBG, "Disabling IRQ\n");
-   if (wilc1000_dev->gpio < 0) {
+   if (wilc1000_dev->gpio < 0 &&
+   wilc1000_dev->ops->disable_interrupt) {
mutex_lock(_dev->hif_cs);
-   wilc1000_sdio_disable_interrupt();
+   wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(_dev->hif_cs);
}
if (_dev->txq_event != NULL)
@@ -845,11 +844,12 @@ void wilc1000_wlan_deinit(struct wilc *nic)
PRINT_D(INIT_DBG, "Deinitializing WILC Wlan\n");
wilc_wlan_cleanup();
 #if defined(PLAT_ALLWINNER_A20) || defined(PLAT_ALLWINNER_A23) || 
defined(PLAT_ALLWINNER_A31)
-   if (wilc1000_dev->gpio < 0) {
+   if (wilc1000_dev->gpio < 0 &&
+   wilc1000_dev->ops->disable_interrupt) {
PRINT_D(INIT_DBG, "Disabling IRQ 2\n");
 
mutex_lock(_dev->hif_cs);
-   wilc1000_sdio_disable_interrupt();
+   wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
mutex_unlock(_dev->hif_cs);
 #endif
 
@@ -983,7 +983,9 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
goto _fail_threads_;
}
 
-   if (wilc1000_dev->gpio < 0 && wilc1000_sdio_enable_interrupt()) 
{
+   if (wilc1000_dev->gpio < 0 &&
+   wilc1000_dev->ops->enable_interrupt &&
+   wilc1000_dev->ops->enable_interrupt(wilc1000_dev)) {
PRINT_ER("couldn't initialize IRQ\n");
ret = -EIO;
goto _fail_irq_init_;
@@ -1039,8 +1041,9 @@ _fail_fw_start_:
wilc_wlan_stop();
 
 _fail_irq_enable_:
-   if (wilc1000_dev->gpio < 0)
-   wilc1000_sdio_disable_interrupt();
+   if (wilc1000_dev->gpio < 0 &&
+   wilc1000_dev->ops->disable_interrupt)
+   wilc1000_dev->ops->disable_interrupt(wilc1000_dev);
 _fail_irq_init_:
if (wilc1000_dev->gpio >= 0)
deinit_irq(wilc1000_dev);
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index 64c8c5725277..86251b907197 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -1,5 +1,4 @@
 #include "wilc_wfi_netdevice.h"
-#include "linux_wlan_sdio.h"
 #include "wilc_wfi_netdevice.h"
 
 #include 
@@ -160,7 +159,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 
wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
if (wilc1000_dev->gpio < 0)
-   wilc1000_sdio_enable_interrupt();
+   wilc1000_dev->ops->enable_interrupt(wilc1000_dev);
 
if (wilc1000_wlan_get_firmware(nic)) {
PRINT_ER("Can't get firmware\n");
@@ -232,13 +231,14 @@ static struct sdio_driver wilc_bus = {
.remove = linux_sdio_remove,
 };
 
-int wilc1000_sdio_enable_interrupt(void)
+static int wilc1000_sdio_enable_interrupt(struct wilc *dev)
 {
+   struct sdio_func *func = container_of(dev->dev, struct sdio_func, dev);
int ret = 0;
 
-   sdio_claim_host(wilc1000_sdio_func);
-   ret = sdio_claim_irq(wilc1000_sdio_func, wilc_sdio_interrupt);
-   sdio_release_host(wilc1000_sdio_func);
+   

[PATCH 10/19] staging/wilc1000: unify device pointer

2015-10-20 Thread Arnd Bergmann
struct wilc has two pointers to store the device, one for sdio_func
and one for spi_device. By changing the pointer to a 'struct device',
we can simplify the logic and avoid a few #ifdefs.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 29 +--
 drivers/staging/wilc1000/linux_wlan_sdio.c|  5 +++--
 drivers/staging/wilc1000/linux_wlan_spi.c | 17 +++-
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  6 +-
 4 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index caa85442c12d..4ca045bcf537 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -474,19 +474,11 @@ int wilc1000_wlan_get_firmware(perInterface_wlan_t *p_nic)
/*  the firmare should be located in /lib/firmware in
 *  root file system with the name specified above */
 
-#ifdef WILC_SDIO
-   if (request_firmware(_firmware, firmware, 
_dev->wilc_sdio_func->dev) != 0) {
+   if (request_firmware(_firmware, firmware, wilc1000_dev->dev) != 0) 
{
PRINT_ER("%s - firmare not available\n", firmware);
ret = -1;
goto _fail_;
}
-#else
-   if (request_firmware(_firmware, firmware, 
_dev->wilc_spidev->dev) != 0) {
-   PRINT_ER("%s - firmare not available\n", firmware);
-   ret = -1;
-   goto _fail_;
-   }
-#endif
wilc1000_dev->wilc_firmware = wilc_firmware;
 
 _fail_:
@@ -1008,7 +1000,7 @@ static u8 wilc1000_prepare_11b_core(struct wilc *nic)
while (!wilc1000_probe)
msleep(100);
wilc1000_probe = 0;
-   wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+   wilc1000_dev->dev = _sdio_func->dev;
nic->ops = _sdio_ops;
wilc_wlan_init(nic);
}
@@ -1031,7 +1023,7 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
while (!wilc1000_probe)
msleep(100);
wilc1000_probe = 0;
-   wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
+   wilc1000_dev->dev = _sdio_func->dev;
wilc1000_dev->ops = _sdio_ops;
ret = wilc_wlan_init(wilc1000_dev);
 
@@ -1214,12 +1206,11 @@ int wilc1000_mac_open(struct net_device *ndev)
int i = 0;
struct wilc_priv *priv;
 
-#ifdef WILC_SPI
-   if (!wilc1000_dev || !wilc1000_dev->wilc_spidev) {
+   if (!wilc1000_dev || !wilc1000_dev->dev) {
netdev_err(ndev, "wilc1000: SPI device not ready\n");
return -ENODEV;
}
-#endif
+
nic = netdev_priv(ndev);
priv = wiphy_priv(nic->wilc_netdev->ieee80211_ptr->wiphy);
PRINT_D(INIT_DBG, "MAC OPEN[%p]\n", ndev);
@@ -1712,16 +1703,6 @@ int wilc_netdev_init(void)
 
}
 
-   #ifndef WILC_SDIO
-   if (!wilc1000_spi_init(_dev->wilc_spidev)) {
-   PRINT_ER("Can't initialize SPI\n");
-   return -1; /* ERROR */
-   }
-   wilc1000_dev->wilc_spidev = wilc_spi_dev;
-   #else
-   wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-   #endif
-
return 0;
 }
 
diff --git a/drivers/staging/wilc1000/linux_wlan_sdio.c 
b/drivers/staging/wilc1000/linux_wlan_sdio.c
index badcae57875c..a6ae26739dd8 100644
--- a/drivers/staging/wilc1000/linux_wlan_sdio.c
+++ b/drivers/staging/wilc1000/linux_wlan_sdio.c
@@ -46,7 +46,7 @@ static void wilc_sdio_interrupt(struct sdio_func *func)
 
 int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 {
-   struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+   struct sdio_func *func = container_of(wilc1000_dev->dev, struct 
sdio_func, dev);
int ret;
u8 data;
 
@@ -78,7 +78,7 @@ int wilc1000_sdio_cmd52(sdio_cmd52_t *cmd)
 
 int wilc1000_sdio_cmd53(sdio_cmd53_t *cmd)
 {
-   struct sdio_func *func = wilc1000_dev->wilc_sdio_func;
+   struct sdio_func *func = container_of(wilc1000_dev->dev, struct 
sdio_func, dev);
int size, ret;
 
sdio_claim_host(func);
@@ -126,6 +126,7 @@ static int linux_sdio_probe(struct sdio_func *func, const 
struct sdio_device_id
PRINT_ER("Couldn't initialize netdev\n");
return -1;
}
+   wilc1000_dev->dev = _sdio_func->dev;
 
printk("Driver Initializing success\n");
return 0;
diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c 
b/drivers/staging/wilc1000/linux_wlan_spi.c
index c90b741824dc..b5e9a1b9f509 100644
--- a/drivers/staging/wilc1000/linux_wlan_spi.c
+++ b/drivers/staging/wilc1000/linux_wlan_spi.c
@@ -9,8 +9,11 @@
 #include 
 #include 
 
+#include "wilc_wfi_netdevice.h"
 #include "linux_wlan_common.h"
 #include "linux_wlan_spi.h"
+#include "wilc_wlan_if.h"
+#include "wilc_wlan.h"
 
 #define USE_SPI_DMA 0   /* johnny add */
 
@@ -409,8 +412,20 @@ int wilc1000_spi_set_max_speed(void)

[PATCH 00/19] staging/wilc1000 cleanups

2015-10-20 Thread Arnd Bergmann
After I screwed up two or three times trying to get the dependencies
with the SPI and SDIO backends right, I ended up taking the time
to do the real fix and make both coexist.

This is a series of patches that address various issues with the
driver, but is mainly targetted at splitting out the spi and sdio
backends into separate drivers that can be built independent of
one another.

The last patch is more experimental than the others, hence the
[RFC] annotation.

Please review and test.

Arnd

Arnd Bergmann (19):
  staging/wilc1000: remove unused functions
  staging/wilc1000: make symbols static if possible
  staging/wilc1000: use proper naming for global symbols
  staging/wilc1000: move extern declarations to headers
  staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT
  staging/wilc1000: avoid static definitions in header
  staging/wilc1000: remove linux_wlan_{device_power,device_detection}
  staging/wilc1000: move wilc_wlan_inp_t into struct wilc
  staging/wilc1000: move init/exit functions to driver files
  staging/wilc1000: unify device pointer
  staging/wilc1000: move wilc1000_ops to drivers
  staging/wilc1000: use device pointer for phy creation
  staging/wilc1000: move COMPLEMENT_BOOT code to linux_wlan_sdio.c
  staging/wilc1000: get rid of WILC_SDIO_IRQ_GPIO
  staging/wilc1000: turn enable_irq/disable_irq into callbacks
  staging/wilc1000: remove WILC_SDIO/WILC_SPI macros
  staging/wilc1000: pass hif operations through initialization
  staging/wilc1000: split out bus specific modules
  [RFC] staging/wilc1000: use more regular probing

 drivers/staging/wilc1000/Kconfig  |  66 +-
 drivers/staging/wilc1000/Makefile |  16 +-
 drivers/staging/wilc1000/coreconfigurator.c   |  12 +-
 drivers/staging/wilc1000/coreconfigurator.h   |  12 +-
 drivers/staging/wilc1000/host_interface.c | 501 +++-
 drivers/staging/wilc1000/host_interface.h | 349 ++-
 drivers/staging/wilc1000/linux_mon.c  |  11 +-
 drivers/staging/wilc1000/linux_wlan.c | 695 +++---
 drivers/staging/wilc1000/linux_wlan_common.h  |  18 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c| 202 +--
 drivers/staging/wilc1000/linux_wlan_sdio.h|  14 -
 drivers/staging/wilc1000/linux_wlan_spi.c | 119 ++--
 drivers/staging/wilc1000/linux_wlan_spi.h |   8 -
 drivers/staging/wilc1000/wilc_debugfs.c   |  20 +-
 drivers/staging/wilc1000/wilc_sdio.c  | 213 +++
 drivers/staging/wilc1000/wilc_spi.c   | 276 +
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 495 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  87 +--
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  21 +-
 drivers/staging/wilc1000/wilc_wlan.c  | 180 +++---
 drivers/staging/wilc1000/wilc_wlan.h  |  49 +-
 drivers/staging/wilc1000/wilc_wlan_cfg.c  |   6 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   |  23 +-
 23 files changed, 1171 insertions(+),  deletions(-)
 delete mode 100644 drivers/staging/wilc1000/linux_wlan_sdio.h

-- 
2.1.0.rc2

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


[PATCH 07/19] staging/wilc1000: remove linux_wlan_{device_power, device_detection}

2015-10-20 Thread Arnd Bergmann
The driver provides an interface for custom power management
and detection that is meant to be filled by people customizing
the driver. The default implementation of this is empty, and
we don't actually want people to have to modify the source code.

If anybody needs this, they need to describe the respective
hardware specifics using device tree or platform data and make
the driver handle this is a more general way.

This removes the empty stubs.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 62 ---
 1 file changed, 62 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index d3cc255cd91b..eb4c6cba4575 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -32,47 +32,6 @@
 #include "linux_wlan_spi.h"
 #endif
 
-#if defined(CUSTOMER_PLATFORM)
-/*
- TODO : Write power control functions as customer platform.
- */
-#else
-
- #define _linux_wlan_device_power_on() {}
- #define _linux_wlan_device_power_off(){}
-
- #define _linux_wlan_device_detection(){}
- #define _linux_wlan_device_removal()  {}
-#endif
-
-static int linux_wlan_device_power(int on_off)
-{
-   PRINT_D(INIT_DBG, "linux_wlan_device_power.. (%d)\n", on_off);
-
-   if (on_off) {
-   _linux_wlan_device_power_on();
-   } else {
-   _linux_wlan_device_power_off();
-   }
-
-   return 0;
-}
-
-static int linux_wlan_device_detection(int on_off)
-{
-   PRINT_D(INIT_DBG, "linux_wlan_device_detection.. (%d)\n", on_off);
-
-#ifdef WILC_SDIO
-   if (on_off) {
-   _linux_wlan_device_detection();
-   } else {
-   _linux_wlan_device_removal();
-   }
-#endif
-
-   return 0;
-}
-
 static int dev_state_ev_handler(struct notifier_block *this, unsigned long 
event, void *ptr);
 
 static struct notifier_block g_dev_notifier = {
@@ -1046,12 +1005,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t 
*nwi, struct wilc *nic)
wilc_wlan_global_reset();
sdio_unregister_driver(_bus);
 
-   linux_wlan_device_detection(0);
-
-   mdelay(100);
-
-   linux_wlan_device_detection(1);
-
sdio_register_driver(_bus);
 
while (!wilc1000_probe)
@@ -1076,14 +1029,6 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
 
sdio_unregister_driver(_bus);
 
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
-   msleep(100);
-   linux_wlan_device_power(1);
-   msleep(80);
-   linux_wlan_device_detection(1);
-   msleep(20);
-
sdio_register_driver(_bus);
 
/* msleep(1000); */
@@ -1794,10 +1739,6 @@ static int __init init_wilc_driver(void)
printk("IN INIT FUNCTION\n");
printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n");
 
-   linux_wlan_device_power(1);
-   msleep(100);
-   linux_wlan_device_detection(1);
-
 #ifdef WILC_SDIO
{
int ret;
@@ -1877,9 +1818,6 @@ static void __exit exit_wilc_driver(void)
 #if defined(WILC_DEBUGFS)
wilc_debugfs_remove();
 #endif
-
-   linux_wlan_device_detection(0);
-   linux_wlan_device_power(0);
 }
 module_exit(exit_wilc_driver);
 
-- 
2.1.0.rc2

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


[PATCH 08/19] staging/wilc1000: move wilc_wlan_inp_t into struct wilc

2015-10-20 Thread Arnd Bergmann
wilc_wlan_inp_t is an unnecessary indirection and requires linux_wlan.c
to have knowledge of the specific sdio and spi front-ends. This
removes the structure and places the members with a constant
'struct wilc1000_ops' pointer inside of 'struct wilc'.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 67 +--
 drivers/staging/wilc1000/wilc_sdio.c  | 17 +++
 drivers/staging/wilc1000/wilc_spi.c   | 17 +++
 drivers/staging/wilc1000/wilc_wfi_netdevice.h |  1 +
 drivers/staging/wilc1000/wilc_wlan.c  | 22 -
 drivers/staging/wilc1000/wilc_wlan.h  |  4 +-
 drivers/staging/wilc1000/wilc_wlan_if.h   | 16 ++-
 7 files changed, 70 insertions(+), 74 deletions(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index eb4c6cba4575..53cecb892a84 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -923,31 +923,29 @@ static int wlan_deinit_locks(struct wilc *nic)
return 0;
 }
 
-static void linux_to_wlan(wilc_wlan_inp_t *nwi, struct wilc *nic)
-{
-
-   PRINT_D(INIT_DBG, "Linux to Wlan services ...\n");
-
-   nwi->os_context.os_private = (void *)nic;
-
 #ifdef WILC_SDIO
-   nwi->io_func.io_type = HIF_SDIO;
-   nwi->io_func.io_init = wilc1000_sdio_init;
-   nwi->io_func.io_deinit = wilc1000_sdio_deinit;
-   nwi->io_func.u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52;
-   nwi->io_func.u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53;
-   nwi->io_func.u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed;
-   nwi->io_func.u.sdio.sdio_set_default_speed = 
wilc1000_sdio_set_default_speed;
-#else
-   nwi->io_func.io_type = HIF_SPI;
-   nwi->io_func.io_init = wilc1000_spi_init;
-   nwi->io_func.io_deinit = wilc1000_spi_deinit;
-   nwi->io_func.u.spi.spi_tx = wilc1000_spi_write;
-   nwi->io_func.u.spi.spi_rx = wilc1000_spi_read;
-   nwi->io_func.u.spi.spi_trx = wilc1000_spi_write_read;
-   nwi->io_func.u.spi.spi_max_speed = wilc1000_spi_set_max_speed;
+static const struct wilc1000_ops wilc1000_sdio_ops = {
+   .io_type = HIF_SDIO,
+   .io_init = wilc1000_sdio_init,
+   .io_deinit = wilc1000_sdio_deinit,
+   .u.sdio.sdio_cmd52 = wilc1000_sdio_cmd52,
+   .u.sdio.sdio_cmd53 = wilc1000_sdio_cmd53,
+   .u.sdio.sdio_set_max_speed = wilc1000_sdio_set_max_speed,
+   .u.sdio.sdio_set_default_speed = wilc1000_sdio_set_default_speed,
+};
+#endif
+
+#ifdef WILC_SPI
+static const struct wilc1000_ops wilc1000_spi_ops = {
+   .io_type = HIF_SPI,
+   .io_init = wilc1000_spi_init,
+   .io_deinit = wilc1000_spi_deinit,
+   .u.spi.spi_tx = wilc1000_spi_write,
+   .u.spi.spi_rx = wilc1000_spi_read,
+   .u.spi.spi_trx = wilc1000_spi_write_read,
+   .u.spi.spi_max_speed = wilc1000_spi_set_max_speed,
+};
 #endif
-}
 
 static int wlan_initialize_threads(perInterface_wlan_t *nic)
 {
@@ -995,7 +993,7 @@ static void wlan_deinitialize_threads(struct wilc *nic)
 #ifdef COMPLEMENT_BOOT
 
 #define READY_CHECK_THRESHOLD  30
-static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, struct wilc *nic)
+static u8 wilc1000_prepare_11b_core(struct wilc *nic)
 {
u8 trials = 0;
 
@@ -1011,8 +1009,8 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, 
struct wilc *nic)
msleep(100);
wilc1000_probe = 0;
wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-   linux_to_wlan(nwi, nic);
-   wilc_wlan_init(nwi);
+   nic->ops = _sdio_ops;
+   wilc_wlan_init(nic);
}
 
if (READY_CHECK_THRESHOLD <= trials)
@@ -1025,8 +1023,6 @@ static u8 wilc1000_prepare_11b_core(wilc_wlan_inp_t *nwi, 
struct wilc *nic)
 static int repeat_power_cycle(perInterface_wlan_t *nic)
 {
int ret = 0;
-   wilc_wlan_inp_t nwi;
-
sdio_unregister_driver(_bus);
 
sdio_register_driver(_bus);
@@ -1036,8 +1032,8 @@ static int repeat_power_cycle(perInterface_wlan_t *nic)
msleep(100);
wilc1000_probe = 0;
wilc1000_dev->wilc_sdio_func = wilc1000_sdio_func;
-   linux_to_wlan(, wilc1000_dev);
-   ret = wilc_wlan_init();
+   wilc1000_dev->ops = _sdio_ops;
+   ret = wilc_wlan_init(wilc1000_dev);
 
wilc1000_dev->mac_status = WILC_MAC_STATUS_INIT;
#if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO)
@@ -1067,7 +1063,6 @@ __fail__:
 
 int wilc1000_wlan_init(struct net_device *dev, perInterface_wlan_t *p_nic)
 {
-   wilc_wlan_inp_t nwi;
perInterface_wlan_t *nic = p_nic;
int ret = 0;
 
@@ -1078,9 +1073,13 @@ int wilc1000_wlan_init(struct net_device *dev, 
perInterface_wlan_t *p_nic)
 
wlan_init_locks(wilc1000_dev);
 
-   linux_to_wlan(, wilc1000_dev);
+#ifdef WILC_SDIO
+   wilc1000_dev->ops = _sdio_ops;

[PATCH 16/19] staging/wilc1000: remove WILC_SDIO/WILC_SPI macros

2015-10-20 Thread Arnd Bergmann
The last remaining user of WILC_SDIO macro checks for the correct
time to wait in an interrupt for the PLL to settle. We can
replace this with a runtime check and remove both WILC_SDIO and
WILC_SPI, as we no longer need conditional compilation based on
the hardware type.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile| 3 +--
 drivers/staging/wilc1000/wilc_wlan.c | 5 -
 drivers/staging/wilc1000/wilc_wlan.h | 7 ++-
 3 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index b96fee8f94f2..9ce30e92ea3a 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -1,7 +1,6 @@
 obj-$(CONFIG_WILC1000) += wilc1000.o
 
-ccflags-$(CONFIG_WILC1000_SDIO) += -DWILC_SDIO -DCOMPLEMENT_BOOT
-ccflags-$(CONFIG_WILC1000_SPI) += -DWILC_SPI
+ccflags-$(CONFIG_WILC1000_SDIO) += -DCOMPLEMENT_BOOT
 
 ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
diff --git a/drivers/staging/wilc1000/wilc_wlan.c 
b/drivers/staging/wilc1000/wilc_wlan.c
index d12a4e7df32c..038c9b2eee6c 100644
--- a/drivers/staging/wilc1000/wilc_wlan.c
+++ b/drivers/staging/wilc1000/wilc_wlan.c
@@ -1238,7 +1238,10 @@ static void wilc_pllupdate_isr_ext(u32 int_stats)
g_wlan.hif_func.hif_clear_int_ext(PLL_INT_CLR);
 
/* Waiting for PLL */
-   mdelay(WILC_PLL_TO);
+   if (g_wlan.io_func->io_type == HIF_SDIO)
+   mdelay(WILC_PLL_TO_SDIO);
+   else
+   mdelay(WILC_PLL_TO_SPI);
 
/* poll till read a valid data */
while (!(ISWILC1000(wilc_get_chipid(true)) && --trials)) {
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index 2e9b5d50ff7e..2f636534fc5d 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -143,11 +143,8 @@
 #define WILC_CFG_RSP_STATUS 2
 #define WILC_CFG_RSP_SCAN 3
 
-#ifdef WILC_SDIO
-#define WILC_PLL_TO4
-#else
-#define WILC_PLL_TO2
-#endif
+#define WILC_PLL_TO_SDIO   4
+#define WILC_PLL_TO_SPI2
 
 
 #define ABORT_INT   BIT(31)
-- 
2.1.0.rc2

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


[PATCH 02/19] staging/wilc1000: make symbols static if possible

2015-10-20 Thread Arnd Bergmann
All symbols that are only referenced in the file that defines
them can be declared 'static' to avoid namespace pollution,
to produce better object code, and to make the source more
readable.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Makefile |  3 +-
 drivers/staging/wilc1000/coreconfigurator.c   |  6 +--
 drivers/staging/wilc1000/host_interface.c | 28 +++
 drivers/staging/wilc1000/host_interface.h | 29 
 drivers/staging/wilc1000/linux_mon.c  |  6 +--
 drivers/staging/wilc1000/linux_wlan.c | 25 +-
 drivers/staging/wilc1000/linux_wlan_sdio.c|  4 +-
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 58 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h |  1 -
 drivers/staging/wilc1000/wilc_wlan.c  | 26 ++
 10 files changed, 85 insertions(+), 101 deletions(-)

diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 64c2f1b83dfb..55b2ac2b15a8 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -8,8 +8,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \
-DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \
-DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\"
 
-ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \
-   -Wno-unused-function -DWILC_DEBUGFS
+ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 -DWILC_DEBUGFS
 #ccflags-y += -DTCP_ACK_FILTER
 
 ccflags-$(CONFIG_WILC1000_PREALLOCATE_AT_LOADING_DRIVER) += -DMEMORY_STATIC \
diff --git a/drivers/staging/wilc1000/coreconfigurator.c 
b/drivers/staging/wilc1000/coreconfigurator.c
index 427adfd295da..28ab89b3a65d 100644
--- a/drivers/staging/wilc1000/coreconfigurator.c
+++ b/drivers/staging/wilc1000/coreconfigurator.c
@@ -287,7 +287,7 @@ static inline u16 get_asoc_id(u8 *data)
return asoc_id;
 }
 
-u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
+static u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 u16TagParamOffset)
 {
u16 u16index;
 
@@ -315,7 +315,7 @@ u8 *get_tim_elm(u8 *pu8msa, u16 u16RxLen, u16 
u16TagParamOffset)
 
 /* This function gets the current channel information from
  * the 802.11n beacon/probe response frame */
-u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
 {
u16 index;
 
@@ -333,7 +333,7 @@ u8 get_current_channel_802_11n(u8 *pu8msa, u16 u16RxLen)
return 0;  /* no MIB here */
 }
 
-u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
+static u8 get_current_channel(u8 *pu8msa, u16 u16RxLen)
 {
/* Extract current channel information from */
/* the beacon/probe response frame  */
diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 194ca3d3e920..4e9dfb493b9f 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -232,7 +232,7 @@ struct join_bss_param {
 static struct host_if_drv *wfidrv_list[NUM_CONCURRENT_IFC + 1];
 struct host_if_drv *terminated_handle;
 bool g_obtainingIP;
-u8 P2P_LISTEN_STATE;
+static u8 P2P_LISTEN_STATE;
 static struct task_struct *hif_thread_handler;
 static WILC_MsgQueueHandle hif_msg_q;
 static struct semaphore hif_sema_thread;
@@ -256,10 +256,10 @@ static u32 inactive_time;
 static u8 del_beacon;
 
 static u8 *join_req;
-u8 *info_element;
+static u8 *info_element;
 static u8 mode_11i;
-u8 auth_type;
-u32 join_req_size;
+static u8 auth_type;
+static u32 join_req_size;
 static u32 info_element_size;
 static struct host_if_drv *join_req_drv;
 #define REAL_JOIN_REQ 0
@@ -398,7 +398,9 @@ static s32 Handle_SetOperationMode(struct host_if_drv 
*hif_drv,
return s32Error;
 }
 
-s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 host_int_get_ipaddress(struct host_if_drv *hif_drv, u8 *u16ipadd, 
u8 idx);
+
+static s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 
idx)
 {
 
s32 s32Error = 0;
@@ -433,7 +435,7 @@ s32 Handle_set_IPAddress(struct host_if_drv *hif_drv, u8 
*pu8IPAddr, u8 idx)
return s32Error;
 }
 
-s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 idx)
+static s32 Handle_get_IPAddress(struct host_if_drv *hif_drv, u8 *pu8IPAddr, u8 
idx)
 {
 
s32 s32Error = 0;
@@ -812,6 +814,9 @@ static s32 Handle_wait_msg_q_empty(void)
return 0;
 }
 
+static s32 Handle_ScanDone(struct host_if_drv *hif_drv,
+  enum scan_event enuEvent);
+
 static s32 Handle_Scan(struct host_if_drv *hif_drv,
   struct scan_attr *pstrHostIFscanAttr)
 {
@@ -1484,6 +1489,11 @@ done:
return s32Error;
 }
 
+static s32 host_int_get_assoc_res_info(struct host_if_drv *hif_drv,
+  u8 *pu8AssocRespInfo,
+  

[PATCH 18/19] staging/wilc1000: split out bus specific modules

2015-10-20 Thread Arnd Bergmann
The SPI and SDIO specific code is now separate enough that
we just need to restructure the Makefile and Kconfig logic
a bit and export a couple of symbols from the common module
to have separate bus glue drivers.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/Kconfig   | 66 +-
 drivers/staging/wilc1000/Makefile  |  9 ++--
 drivers/staging/wilc1000/linux_wlan.c  |  6 +++
 drivers/staging/wilc1000/linux_wlan_sdio.c |  1 +
 drivers/staging/wilc1000/linux_wlan_spi.c  |  1 +
 drivers/staging/wilc1000/wilc_debugfs.c|  2 +
 drivers/staging/wilc1000/wilc_wlan.c   |  1 +
 7 files changed, 45 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/wilc1000/Kconfig b/drivers/staging/wilc1000/Kconfig
index ee51b4278088..2923122346ef 100644
--- a/drivers/staging/wilc1000/Kconfig
+++ b/drivers/staging/wilc1000/Kconfig
@@ -1,41 +1,12 @@
-config WILC1000_DRIVER
-   bool "WILC1000 support (WiFi only)"
-   depends on CFG80211 && WEXT_CORE && INET
-   ---help---
- This module only support IEEE 802.11n WiFi.
-
-if WILC1000_DRIVER
-
 config WILC1000
tristate
-
-choice
-prompt "Memory Allocation"
-default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-
-config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
-   bool "Preallocate memory at loading driver"
+   select WIRELESS_EXT
---help---
- This choice supports static allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- during initial time. The driver will also free the buffer
- by calling network device stop.
-
-config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
-bool "Dynamically allocate memory in real time"
----help---
- This choice supports dynamic allocation of the memory
- for the receive buffer. The driver will allocate the RX buffer
- when it is required.
-endchoice
-
-choice
-   prompt "Bus Type"
-   default WILC1000_SDIO
+ This module only support IEEE 802.11n WiFi.
 
 config WILC1000_SDIO
-   bool "SDIO support"
-   depends on MMC
+   tristate "Atmel WILC1000 SDIO (WiFi only)"
+   depends on CFG80211 && INET && MMC
select WILC1000
---help---
  This module adds support for the SDIO interface of adapters using
@@ -48,9 +19,9 @@ config WILC1000_SDIO
  this if your platform is using the SDIO bus.
 
 config WILC1000_SPI
-   depends on SPI
+   tristate "Atmel WILC1000 SPI (WiFi only)"
+   depends on CFG80211 && INET && SPI
select WILC1000
-   bool "SPI support"
---help---
  This module adds support for the SPI interface of adapters using
  WILC1000 chipset. The Atmel WILC1000 has a Serial Peripheral
@@ -59,10 +30,31 @@ config WILC1000_SPI
  full-duplex slave synchronous serial interface that is available
  immediately following reset when pin 9 (SDIO_SPI_CFG) is tied to
  VDDIO. Select this if your platform is using the SPI bus.
+
+choice
+prompt "WILC1000 Memory Allocation"
+depends on WILC1000
+default WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+
+config WILC1000_PREALLOCATE_AT_LOADING_DRIVER
+   bool "Preallocate memory at loading driver"
+   ---help---
+ This choice supports static allocation of the memory
+ for the receive buffer. The driver will allocate the RX buffer
+ during initial time. The driver will also free the buffer
+ by calling network device stop.
+
+config WILC1000_DYNAMICALLY_ALLOCATE_MEMROY
+bool "Dynamically allocate memory in real time"
+---help---
+ This choice supports dynamic allocation of the memory
+ for the receive buffer. The driver will allocate the RX buffer
+ when it is required.
 endchoice
 
+
 config WILC1000_HW_OOB_INTR
-   bool "Use out of band interrupt"
+   bool "WILC1000 out of band interrupt"
depends on WILC1000_SDIO
default n
---help---
@@ -71,5 +63,3 @@ config WILC1000_HW_OOB_INTR
  mechanism for SDIO host controllers that don't support SDIO interrupt.
  Select this option If the SDIO host controller in your platform
  doesn't support SDIO time devision interrupt.
-
-endif
diff --git a/drivers/staging/wilc1000/Makefile 
b/drivers/staging/wilc1000/Makefile
index 9ce30e92ea3a..198d536da57c 100644
--- a/drivers/staging/wilc1000/Makefile
+++ b/drivers/staging/wilc1000/Makefile
@@ -18,8 +18,11 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += 
-DWILC_NORMAL_ALLOC
 wilc1000-objs := wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \
wilc_msgqueue.o \
coreconfigurator.o host_interface.o \
-   wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o \
+   wilc_wlan_cfg.o wilc_debugfs.o \

[PATCH 06/19] staging/wilc1000: avoid static definitions in header

2015-10-20 Thread Arnd Bergmann
The wilc_wfi_cfgoperations.h header defines the ieee80211_txrx_stypes
and cipher_suites variables that are only used in wilc_wfi_cfgoperations.c
and should not be shared in a header file.

This moves over all that data into the .c file, and also moves all
the macro definitions from the file that are also not needed here.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 84 +++
 drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 83 --
 2 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
index 0ed05aafa5bf..702c40c1df4b 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.c
@@ -17,6 +17,90 @@
 #include "host_interface.h"
 #include 
 
+/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
+#define NO_ENCRYPT 0
+#define ENCRYPT_ENABLEDBIT(0)
+#define WEPBIT(1)
+#define WEP_EXTENDED   BIT(2)
+#define WPABIT(3)
+#define WPA2   BIT(4)
+#define AESBIT(5)
+#define TKIP   BIT(6)
+
+/*Public action frame index IDs*/
+#define FRAME_TYPE_ID  0
+#define ACTION_CAT_ID  24
+#define ACTION_SUBTYPE_ID  25
+#define P2P_PUB_ACTION_SUBTYPE 30
+
+/*Public action frame Attribute IDs*/
+#define ACTION_FRAME   0xd0
+#define GO_INTENT_ATTR_ID  0x04
+#define CHANLIST_ATTR_ID   0x0b
+#define OPERCHAN_ATTR_ID   0x11
+#define PUB_ACTION_ATTR_ID 0x04
+#define P2PELEM_ATTR_ID0xdd
+
+/*Public action subtype values*/
+#define GO_NEG_REQ 0x00
+#define GO_NEG_RSP 0x01
+#define GO_NEG_CONF0x02
+#define P2P_INV_REQ0x03
+#define P2P_INV_RSP0x04
+#define PUBLIC_ACT_VENDORSPEC  0x09
+#define GAS_INTIAL_REQ 0x0a
+#define GAS_INTIAL_RSP 0x0b
+
+#define INVALID_CHANNEL0
+
+#define nl80211_SCAN_RESULT_EXPIRE (3 * HZ)
+#define SCAN_RESULT_EXPIRE (40 * HZ)
+
+static const u32 cipher_suites[] = {
+   WLAN_CIPHER_SUITE_WEP40,
+   WLAN_CIPHER_SUITE_WEP104,
+   WLAN_CIPHER_SUITE_TKIP,
+   WLAN_CIPHER_SUITE_CCMP,
+   WLAN_CIPHER_SUITE_AES_CMAC,
+};
+
+static const struct ieee80211_txrx_stypes
+   wilc_wfi_cfg80211_mgmt_types[NUM_NL80211_IFTYPES] = {
+   [NL80211_IFTYPE_STATION] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4)
+   },
+   [NL80211_IFTYPE_AP] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+   BIT(IEEE80211_STYPE_ACTION >> 4)
+   },
+   [NL80211_IFTYPE_P2P_CLIENT] = {
+   .tx = 0x,
+   .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+   BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+   BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+   BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+   BIT(IEEE80211_STYPE_AUTH >> 4) |
+   BIT(IEEE80211_STYPE_DEAUTH >> 4)
+   }
+};
+
+/* Time to stay on the channel */
+#define WILC_WFI_DWELL_PASSIVE 100
+#define WILC_WFI_DWELL_ACTIVE  40
+
+#define TCP_ACK_FILTER_LINK_SPEED_THRESH   54
+#define DEFAULT_LINK_SPEED 72
+
+
 #define IS_MANAGMEMENT 0x100
 #define IS_MANAGMEMENT_CALLBACK0x080
 #define IS_MGMT_STATUS_SUCCES  0x040
diff --git a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h 
b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
index ae2aaea508db..158d98c0eb87 100644
--- a/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
+++ b/drivers/staging/wilc1000/wilc_wfi_cfgoperations.h
@@ -10,86 +10,6 @@
 #define NM_WFI_CFGOPERATIONS
 #include "wilc_wfi_netdevice.h"
 
-/* The following macros describe the bitfield map used by the firmware to 
determine its 11i mode */
-#define NO_ENCRYPT 0
-#define ENCRYPT_ENABLEDBIT(0)
-#define WEPBIT(1)
-#define WEP_EXTENDED   BIT(2)
-#define WPABIT(3)
-#define WPA2   BIT(4)

[PATCH 05/19] staging/wilc1000: use NO_SECURITY instead of NO_ENCRYPT

2015-10-20 Thread Arnd Bergmann
The linux_wlan.c file uses a set of enums from wilc_wlan_if.h,
with the exception of the NO_ENCRYPT that comes from
wilc_wfi_cfgoperations.h. The two sets of enums clearly have
the same intention but are defined a bit different.

To prepare to clean up the ones in wilc_wfi_cfgoperations.h, this
first changes over the only other user.

Signed-off-by: Arnd Bergmann 
---
 drivers/staging/wilc1000/linux_wlan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 50477d70eb24..d3cc255cd91b 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -701,7 +701,7 @@ static int linux_wlan_init_test_config(struct net_device 
*dev, struct wilc *p_ni
if (!wilc_wlan_cfg_set(0, WID_POWER_MANAGEMENT, c_val, 1, 0, 0))
goto _fail_;
 
-   c_val[0] = NO_ENCRYPT; /* NO_ENCRYPT, 0x79 */
+   c_val[0] = NO_SECURITY; /* NO_ENCRYPT, 0x79 */
if (!wilc_wlan_cfg_set(0, WID_11I_MODE, c_val, 1, 0, 0))
goto _fail_;
 
-- 
2.1.0.rc2

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


Re: [PATCH] Staging: comedi: removing useless init/exit

2015-10-20 Thread Greg KH
On Wed, Oct 21, 2015 at 08:41:52AM +0530, Ronit Halder wrote:
> Removing init and exit functions as they do nothing.

Really?  Did you test this?

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


[PATCH] Staging: comedi: removing useless init/exit

2015-10-20 Thread Ronit Halder
Removing init and exit functions as they do nothing.

Signed-off-by: Ronit Halder 
---
 drivers/staging/comedi/comedi_usb.c | 10 --
 1 file changed, 10 deletions(-)

diff --git a/drivers/staging/comedi/comedi_usb.c 
b/drivers/staging/comedi/comedi_usb.c
index 9c946d4..ed13bf6 100644
--- a/drivers/staging/comedi/comedi_usb.c
+++ b/drivers/staging/comedi/comedi_usb.c
@@ -144,16 +144,6 @@ void comedi_usb_driver_unregister(struct comedi_driver 
*comedi_driver,
 }
 EXPORT_SYMBOL_GPL(comedi_usb_driver_unregister);
 
-static int __init comedi_usb_init(void)
-{
-   return 0;
-}
-module_init(comedi_usb_init);
-
-static void __exit comedi_usb_exit(void)
-{
-}
-module_exit(comedi_usb_exit);
 
 MODULE_AUTHOR("http://www.comedi.org;);
 MODULE_DESCRIPTION("Comedi USB interface module");
-- 
2.6.0

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