[PATCH 2/3] staging: sm750fb: simplify PLL divisors calculations

2015-10-21 Thread Mike Rapoport
The calcPllValues currently uses arrays of PLL parametres that contain
possible PLL control register field values and redundant data that is
calculated according to those values. The usage of these arrays can be
replaced with simple arithmetics.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/ddk750_chip.c | 44 ---
 1 file changed, 10 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 069d6e5..7084a4a 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -303,33 +303,14 @@ int ddk750_initHw(initchip_param_t *pInitParam)
 */
 unsigned int calcPllValue(unsigned int request_orig, pll_value_t *pll)
 {
-   /* used for primary and secondary channel pixel clock pll */
-   static pllcalparam xparm_PIXEL[] = {
-   /* 2^0 = 1*/{0, 0, 0, 1},
-   /* 2^ 1 =2*/{1, 0, 1, 2},
-   /* 2^ 2  = 4*/  {2, 0, 2, 4},
-   {3, 0, 3, 8},
-   {4, 1, 3, 16},
-   {5, 2, 3, 32},
-   /* 2^6 = 64  */ {6, 3, 3, 64},
-   };
-
-   /* used for MXCLK (chip clock) */
-   static pllcalparam xparm_MXCLK[] = {
-   /* 2^0 = 1*/{0, 0, 0, 1},
-   /* 2^ 1 =2*/{1, 0, 1, 2},
-   /* 2^ 2  = 4*/  {2, 0, 2, 4},
-   {3, 0, 3, 8},
-   };
-
/* as sm750 register definition, N located in 2,15 and M located in 
1,255   */
int N, M, X, d;
-   int xcnt;
int mini_diff;
unsigned int RN, quo, rem, fl_quo;
unsigned int input, request;
unsigned int tmpClock, ret;
-   pllcalparam *xparm;
+   const int max_OD = 3;
+   int max_d;
 
if (getChipType() == SM750LE) {
/* SM750LE don't have prgrammable PLL and M/N values to work on.
@@ -343,15 +324,8 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
input = pll->inputFreq / 1000;
 
/* for MXCLK register , no POD provided, so need be treated differently 
*/
-
-   if (pll->clockType != MXCLK_PLL) {
-   xparm = &xparm_PIXEL[0];
-   xcnt = ARRAY_SIZE(xparm_PIXEL);
-   } else {
-   xparm = &xparm_MXCLK[0];
-   xcnt = ARRAY_SIZE(xparm_MXCLK);
-   }
-
+   if (pll->clockType == MXCLK_PLL)
+   max_d = 3;
 
for (N = 15; N > 1; N--) {
/* RN will not exceed maximum long if @request <= 285 MHZ (for 
32bit cpu) */
@@ -360,8 +334,8 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
rem = RN % input;/* rem always small than 14318181 */
fl_quo = (rem * 1 / input);
 
-   for (d = xcnt - 1; d >= 0; d--) {
-   X = xparm[d].value;
+   for (d = max_d; d >= 0; d--) {
+   X = (1 << d);
M = quo * X;
M += fl_quo * X / 1;
/* round step */
@@ -374,8 +348,10 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
if (diff < mini_diff) {
pll->M = M;
pll->N = N;
-   pll->OD = xparm[d].od;
-   pll->POD = xparm[d].pod;
+   pll->POD = 0;
+   if (d > max_OD)
+   pll->POD = d - max_OD;
+   pll->OD = d - pll->POD;
mini_diff = diff;
ret = tmpClock;
}
-- 
2.1.0

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


[PATCH 3/3] staging: sm750fb: remove unused pllcalparam typedef

2015-10-21 Thread Mike Rapoport
The pllcalparam type is not used and can be removed.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/ddk750_chip.c | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index 7084a4a..0331d34 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -4,13 +4,6 @@
 #include "ddk750_reg.h"
 #include "ddk750_chip.h"
 #include "ddk750_power.h"
-typedef struct _pllcalparam {
-   unsigned char power;/* d : 0~ 6*/
-   unsigned char pod;
-   unsigned char od;
-   unsigned char value;/* value of  2 power d (2^d) */
-}
-pllcalparam;
 
 logical_chip_type_t getChipType(void)
 {
-- 
2.1.0

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


[PATCH 0/3] staging: sm750fb: simplify PLL divisors calculations

2015-10-21 Thread Mike Rapoport
Hi,

These patches simplify PLL divisors calculations in sm750fb.
The first patch is not strictly related to that, but when I removed '#if 1'
while working on the calculations, I've decided to do that for other
occurencies as well.

I've checked that the PLL control register field values are the same as
previously by comparing results of old and new version of calcPllValues in a
standalone programm.

Sudip, I'll really apreciate if you can test it on the hardware.

Mike Rapoport (3):
  staging: sm750fb: remove '#if 1' conditionals
  staging: sm750fb: simplify PLL divisors calculations
  staging: sm750fb: remove unused pllcalparam typedef

 drivers/staging/sm750fb/ddk750_chip.c | 64 ---
 drivers/staging/sm750fb/ddk750_mode.c |  3 +-
 drivers/staging/sm750fb/sm750_hw.c|  3 +-
 3 files changed, 17 insertions(+), 53 deletions(-)

-- 
2.1.0

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


[PATCH 1/3] staging: sm750fb: remove '#if 1' conditionals

2015-10-21 Thread Mike Rapoport
The code enclosed in '#if 1' anyway gets compiled. Removing useless
conditionals.

Signed-off-by: Mike Rapoport 
---
 drivers/staging/sm750fb/ddk750_chip.c | 13 +
 drivers/staging/sm750fb/ddk750_mode.c |  3 +--
 drivers/staging/sm750fb/sm750_hw.c|  3 +--
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index bab3d91..069d6e5 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -60,11 +60,10 @@ static void setChipClock(unsigned int frequency)
 {
pll_value_t pll;
unsigned int ulActualMxClk;
-#if 1
+
/* Cheok_0509: For SM750LE, the chip clock is fixed. Nothing to set. */
if (getChipType() == SM750LE)
return;
-#endif
 
if (frequency) {
/*
@@ -88,11 +87,11 @@ static void setChipClock(unsigned int frequency)
 static void setMemoryClock(unsigned int frequency)
 {
unsigned int ulReg, divisor;
- #if 1
+
/* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. 
*/
if (getChipType() == SM750LE)
return;
-#endif
+
if (frequency) {
/* Set the frequency to the maximum frequency that the DDR 
Memory can take
which is 336MHz. */
@@ -135,11 +134,11 @@ static void setMemoryClock(unsigned int frequency)
 static void setMasterClock(unsigned int frequency)
 {
unsigned int ulReg, divisor;
-#if 1
+
/* Cheok_0509: For SM750LE, the memory clock is fixed. Nothing to set. 
*/
if (getChipType() == SM750LE)
return;
-#endif
+
if (frequency) {
/* Set the frequency to the maximum frequency that the SM750 
engine can
run, which is about 190 MHz. */
@@ -332,13 +331,11 @@ unsigned int calcPllValue(unsigned int request_orig, 
pll_value_t *pll)
unsigned int tmpClock, ret;
pllcalparam *xparm;
 
-#if 1
if (getChipType() == SM750LE) {
/* SM750LE don't have prgrammable PLL and M/N values to work on.
Just return the requested clock. */
return request_orig;
}
-#endif
 
ret = 0;
mini_diff = ~0;
diff --git a/drivers/staging/sm750fb/ddk750_mode.c 
b/drivers/staging/sm750fb/ddk750_mode.c
index 2399b17..fa35926 100644
--- a/drivers/staging/sm750fb/ddk750_mode.c
+++ b/drivers/staging/sm750fb/ddk750_mode.c
@@ -168,14 +168,13 @@ static int programModeRegisters(mode_parameter_t 
*pModeParam, pll_value_t *pll)
*/
 
POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg);
-#if 1
+
while ((PEEK32(PANEL_DISPLAY_CTRL) & ~ulReservedBits) != 
(ulTmpValue|ulReg)) {
cnt++;
if (cnt > 1000)
break;
POKE32(PANEL_DISPLAY_CTRL, ulTmpValue|ulReg);
}
-#endif
} else {
ret = -1;
}
diff --git a/drivers/staging/sm750fb/sm750_hw.c 
b/drivers/staging/sm750fb/sm750_hw.c
index 92e194d..8a5a897 100644
--- a/drivers/staging/sm750fb/sm750_hw.c
+++ b/drivers/staging/sm750fb/sm750_hw.c
@@ -276,7 +276,7 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
ret = 0;
par = container_of(crtc, struct lynxfb_par, crtc);
share = par->share;
-#if 1
+
if (!share->accel_off) {
/* set 2d engine pixel format according to mode bpp */
switch (var->bits_per_pixel) {
@@ -293,7 +293,6 @@ int hw_sm750_crtc_setMode(struct lynxfb_crtc *crtc,
}
hw_set2dformat(&share->accel, fmt);
}
-#endif
 
/* set timing */
modparm.pixel_clock = ps_to_hz(var->pixclock);
-- 
2.1.0

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


[PATCH] Staging: lustre: lustre_log: Remove unused functions

2015-10-21 Thread Shraddha Barke
Remove the functions which are defined but not used anywhere

Signed-off-by: Shraddha Barke 
---
 drivers/staging/lustre/lustre/include/lustre_log.h | 90 --
 1 file changed, 90 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_log.h 
b/drivers/staging/lustre/lustre/include/lustre_log.h
index 5d3b2df..1de0c4d 100644
--- a/drivers/staging/lustre/lustre/include/lustre_log.h
+++ b/drivers/staging/lustre/lustre/include/lustre_log.h
@@ -80,37 +80,6 @@ struct cat_handle_data {
struct llog_handle  *chd_next_log; /* llog to be used next */
 };
 
-static inline void logid_to_fid(struct llog_logid *id, struct lu_fid *fid)
-{
-   /* For compatibility purposes we identify pre-OSD (~< 2.3.51 MDS)
-* logid's by non-zero ogen (inode generation) and convert them
-* into IGIF */
-   if (id->lgl_ogen == 0) {
-   fid->f_seq = id->lgl_oi.oi.oi_seq;
-   fid->f_oid = id->lgl_oi.oi.oi_id;
-   fid->f_ver = 0;
-   } else {
-   lu_igif_build(fid, id->lgl_oi.oi.oi_id, id->lgl_ogen);
-   }
-}
-
-static inline void fid_to_logid(struct lu_fid *fid, struct llog_logid *id)
-{
-   id->lgl_oi.oi.oi_seq = fid->f_seq;
-   id->lgl_oi.oi.oi_id = fid->f_oid;
-   id->lgl_ogen = 0;
-}
-
-static inline void logid_set_id(struct llog_logid *log_id, __u64 id)
-{
-   log_id->lgl_oi.oi.oi_id = id;
-}
-
-static inline __u64 logid_id(struct llog_logid *log_id)
-{
-   return log_id->lgl_oi.oi.oi_id;
-}
-
 struct llog_handle;
 
 /* llog.c  -  general API */
@@ -286,19 +255,6 @@ struct llog_ctxt {
 #define LLOG_PROC_BREAK 0x0001
 #define LLOG_DEL_RECORD 0x0002
 
-static inline int llog_obd2ops(struct llog_ctxt *ctxt,
-  struct llog_operations **lop)
-{
-   if (ctxt == NULL)
-   return -ENOTCONN;
-
-   *lop = ctxt->loc_logops;
-   if (*lop == NULL)
-   return -EOPNOTSUPP;
-
-   return 0;
-}
-
 static inline int llog_handle2ops(struct llog_handle *loghandle,
  struct llog_operations **lop)
 {
@@ -309,18 +265,6 @@ static inline int llog_handle2ops(struct llog_handle 
*loghandle,
return 0;
 }
 
-static inline int llog_data_len(int len)
-{
-   return cfs_size_round(len);
-}
-
-static inline int llog_get_size(struct llog_handle *loghandle)
-{
-   if (loghandle && loghandle->lgh_hdr)
-   return loghandle->lgh_hdr->llh_count;
-   return 0;
-}
-
 static inline struct llog_ctxt *llog_ctxt_get(struct llog_ctxt *ctxt)
 {
atomic_inc(&ctxt->loc_refcount);
@@ -421,40 +365,6 @@ static inline int llog_next_block(const struct lu_env *env,
return rc;
 }
 
-static inline int llog_prev_block(const struct lu_env *env,
- struct llog_handle *loghandle,
- int prev_idx, void *buf, int len)
-{
-   struct llog_operations *lop;
-   int rc;
-
-   rc = llog_handle2ops(loghandle, &lop);
-   if (rc)
-   return rc;
-   if (lop->lop_prev_block == NULL)
-   return -EOPNOTSUPP;
-
-   rc = lop->lop_prev_block(env, loghandle, prev_idx, buf, len);
-   return rc;
-}
-
-static inline int llog_connect(struct llog_ctxt *ctxt,
-  struct llog_logid *logid, struct llog_gen *gen,
-  struct obd_uuid *uuid)
-{
-   struct llog_operations  *lop;
-   int  rc;
-
-   rc = llog_obd2ops(ctxt, &lop);
-   if (rc)
-   return rc;
-   if (lop->lop_connect == NULL)
-   return -EOPNOTSUPP;
-
-   rc = lop->lop_connect(ctxt, logid, gen, uuid);
-   return rc;
-}
-
 /* llog.c */
 int llog_declare_write_rec(const struct lu_env *env,
   struct llog_handle *handle,
-- 
2.1.4

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


[PATCH 06/11] staging: lustre: move cfs_ip_addr_* function from kernel libcfs to LNet

2015-10-21 Thread James Simmons
Both of cfs_ip_addr_parse and cfs_ip_addr_match which are located in
libcfs kernel module are used only for LNet so move this into the
nidstring handling code where it belongs. Also create user land
versions of these functions in the libcfs user land library.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/15085
Reviewed-by: Bob Glossman 
Reviewed-by: Dmitry Eremin 
Reviewed-by: frank zago 
Reviewed-by: Oleg Drokin 
---
 .../lustre/include/linux/libcfs/libcfs_string.h|2 -
 drivers/staging/lustre/include/linux/lnet/nidstr.h |2 +
 drivers/staging/lustre/lnet/lnet/nidstrings.c  |   60 +++
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |   62 
 4 files changed, 62 insertions(+), 64 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
index 908efaa..d8d2e7d 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
@@ -100,7 +100,5 @@ void cfs_expr_list_free(struct cfs_expr_list *expr_list);
 int cfs_expr_list_parse(char *str, int len, unsigned min, unsigned max,
struct cfs_expr_list **elpp);
 void cfs_expr_list_free_list(struct list_head *list);
-int cfs_ip_addr_parse(char *str, int len, struct list_head *list);
-int cfs_ip_addr_match(__u32 addr, struct list_head *list);
 
 #endif
diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h 
b/drivers/staging/lustre/include/linux/lnet/nidstr.h
index b32f8cd..1536366 100644
--- a/drivers/staging/lustre/include/linux/lnet/nidstr.h
+++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h
@@ -72,6 +72,8 @@ int cfs_parse_nidlist(char *str, int len, struct list_head 
*list);
 int cfs_print_nidlist(char *buffer, int count, struct list_head *list);
 int cfs_match_nid(lnet_nid_t nid, struct list_head *list);
 
+int cfs_ip_addr_parse(char *str, int len, struct list_head *list);
+int cfs_ip_addr_match(__u32 addr, struct list_head *list);
 bool cfs_nidrange_is_contiguous(struct list_head *nidlist);
 void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
   char *max_nid, size_t nidstr_length);
diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index 6a778b9..a02c1f6 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -113,6 +113,44 @@ static int libcfs_ip_str2addr(const char *str, int nob, 
__u32 *addr)
return 0;
 }
 
+int
+cfs_ip_addr_parse(char *str, int len, struct list_head *list)
+{
+   struct cfs_expr_list *el;
+   struct cfs_lstr src;
+   int rc;
+   int i;
+
+   src.ls_str = str;
+   src.ls_len = len;
+   i = 0;
+
+   while (src.ls_str != NULL) {
+   struct cfs_lstr res;
+
+   if (!cfs_gettok(&src, '.', &res)) {
+   rc = -EINVAL;
+   goto out;
+   }
+
+   rc = cfs_expr_list_parse(res.ls_str, res.ls_len, 0, 255, &el);
+   if (rc != 0)
+   goto out;
+
+   list_add_tail(&el->el_link, list);
+   i++;
+   }
+
+   if (i == 4)
+   return 0;
+
+   rc = -EINVAL;
+out:
+   cfs_expr_list_free_list(list);
+
+   return rc;
+}
+
 static int
 libcfs_ip_addr_range_print(char *buffer, int count, struct list_head *list)
 {
@@ -128,6 +166,28 @@ libcfs_ip_addr_range_print(char *buffer, int count, struct 
list_head *list)
return i;
 }
 
+/**
+ * Matches address (\a addr) against address set encoded in \a list.
+ *
+ * \retval 1 if \a addr matches
+ * \retval 0 otherwise
+ */
+int
+cfs_ip_addr_match(__u32 addr, struct list_head *list)
+{
+   struct cfs_expr_list *el;
+   int i = 0;
+
+   list_for_each_entry_reverse(el, list, el_link) {
+   if (!cfs_expr_list_match(addr & 0xff, el))
+   return 0;
+   addr >>= 8;
+   i++;
+   }
+
+   return i == 4;
+}
+
 static void libcfs_decnum_addr2str(__u32 addr, char *str)
 {
snprintf(str, LNET_NIDSTR_SIZE, "%u", addr);
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index 5166961..d40be53 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -562,65 +562,3 @@ cfs_expr_list_free_list(struct list_head *list)
}
 }
 EXPORT_SYMBOL(cfs_expr_list_free_list);
-
-int
-cfs_ip_addr_parse(char *str, int len, struct list_head *list)
-{
-   struct cfs_expr_list*el;
-   struct cfs_lstr src;
-   int rc;
-   int i;
-
-   src.ls_str = str;
-  

[PATCH 04/11] staging: lustre: remove cfs_ip_addr_free wrapper

2015-10-21 Thread James Simmons
No need to have a one line wrapper in libcfs that only
is used to delete a list which is only done once in the
LNet layer.

Signed-off-by: James Simmons 
---
 .../lustre/include/linux/libcfs/libcfs_string.h|1 -
 drivers/staging/lustre/lnet/lnet/config.c  |2 +-
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |7 ---
 3 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
index d178e43..908efaa 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
@@ -102,6 +102,5 @@ int cfs_expr_list_parse(char *str, int len, unsigned min, 
unsigned max,
 void cfs_expr_list_free_list(struct list_head *list);
 int cfs_ip_addr_parse(char *str, int len, struct list_head *list);
 int cfs_ip_addr_match(__u32 addr, struct list_head *list);
-void cfs_ip_addr_free(struct list_head *list);
 
 #endif
diff --git a/drivers/staging/lustre/lnet/lnet/config.c 
b/drivers/staging/lustre/lnet/lnet/config.c
index b09a438..1b3bc83 100644
--- a/drivers/staging/lustre/lnet/lnet/config.c
+++ b/drivers/staging/lustre/lnet/lnet/config.c
@@ -824,7 +824,7 @@ lnet_match_network_token(char *token, int len, __u32 
*ipaddrs, int nip)
for (rc = i = 0; !rc && i < nip; i++)
rc = cfs_ip_addr_match(ipaddrs[i], &list);
 
-   cfs_ip_addr_free(&list);
+   cfs_expr_list_free_list(&list);
 
return rc;
 }
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index 896185f..5166961 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -624,10 +624,3 @@ cfs_ip_addr_match(__u32 addr, struct list_head *list)
return i == 4;
 }
 EXPORT_SYMBOL(cfs_ip_addr_match);
-
-void
-cfs_ip_addr_free(struct list_head *list)
-{
-   cfs_expr_list_free_list(list);
-}
-EXPORT_SYMBOL(cfs_ip_addr_free);
-- 
1.7.1

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


[PATCH 03/11] staging: lustre: remove libcfs_init_string function

2015-10-21 Thread James Simmons
All the function libcfs_init_string did was initialize
a spinlock. We can initialize the spinlock statically
instead.

Signed-off-by: James Simmons 
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |2 --
 drivers/staging/lustre/lnet/lnet/nidstrings.c  |8 +---
 drivers/staging/lustre/lustre/libcfs/module.c  |2 --
 3 files changed, 1 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 385ced1..4d74e8a 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -152,8 +152,6 @@ extern struct miscdevice libcfs_dev;
 extern char lnet_upcall[1024];
 extern char lnet_debug_log_upcall[1024];
 
-extern void libcfs_init_nidstrings(void);
-
 extern struct cfs_psdev_ops libcfs_psdev_ops;
 
 extern struct cfs_wi_sched *cfs_sched_rehash;
diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index 81ec3a8..fdbdf06 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -61,13 +61,7 @@
 static char  libcfs_nidstrings[LNET_NIDSTR_COUNT][LNET_NIDSTR_SIZE];
 static int   libcfs_nidstring_idx;
 
-static spinlock_t libcfs_nidstring_lock;
-
-void libcfs_init_nidstrings(void)
-{
-   spin_lock_init(&libcfs_nidstring_lock);
-}
-EXPORT_SYMBOL(libcfs_init_nidstrings);
+static DEFINE_SPINLOCK(libcfs_nidstring_lock);
 
 char *
 libcfs_next_nidstring(void)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c 
b/drivers/staging/lustre/lustre/libcfs/module.c
index 0d9b223..50e8fd2 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -701,8 +701,6 @@ static int init_libcfs_module(void)
 {
int rc;
 
-   libcfs_init_nidstrings();
-
rc = libcfs_debug_init(5 * 1024 * 1024);
if (rc < 0) {
pr_err("LustreError: libcfs_debug_init: %d\n", rc);
-- 
1.7.1

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


[PATCH 09/11] staging: lustre: provide separate buffers for libcfs_*2str()

2015-10-21 Thread James Simmons
From: Dmitry Eremin 

Provide duplicates with separate buffers for libcfs_*2str() functions.

Replace libcfs_nid2str() with libcfs_nid2str_r() function in critical
places.

Provide buffer size for nf_addr2str functions.

Use __u32 as nf_type always

Signed-off-by: Dmitry Eremin 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6070
Reviewed-on: http://review.whamcloud.com/13185
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
---
 drivers/staging/lustre/include/linux/lnet/nidstr.h |   31 -
 drivers/staging/lustre/lnet/lnet/api-ni.c  |6 +-
 drivers/staging/lustre/lnet/lnet/nidstrings.c  |  138 ++--
 drivers/staging/lustre/lnet/lnet/router.c  |2 +-
 .../lustre/lustre/obdclass/lprocfs_status.c|   11 +-
 .../staging/lustre/lustre/obdclass/obd_config.c|9 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |7 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|8 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|5 +-
 9 files changed, 121 insertions(+), 96 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h 
b/drivers/staging/lustre/include/linux/lnet/nidstr.h
index 4e7c9a5..46ad914 100644
--- a/drivers/staging/lustre/include/linux/lnet/nidstr.h
+++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h
@@ -57,12 +57,29 @@ struct list_head;
 #define LNET_NIDSTR_COUNT  1024/* # of nidstrings */
 #define LNET_NIDSTR_SIZE   32  /* size of each one (see below for usage) */
 
-int libcfs_isknown_lnd(int type);
-char *libcfs_lnd2modname(int type);
-char *libcfs_lnd2str(int type);
+/* support decl needed by both kernel and user space */
+char *libcfs_next_nidstring(void);
+int libcfs_isknown_lnd(__u32 lnd);
+char *libcfs_lnd2modname(__u32 lnd);
+char *libcfs_lnd2str_r(__u32 lnd, char *buf, size_t buf_size);
+static inline char *libcfs_lnd2str(__u32 lnd)
+{
+   return libcfs_lnd2str_r(lnd, libcfs_next_nidstring(),
+   LNET_NIDSTR_SIZE);
+}
 int libcfs_str2lnd(const char *str);
-char *libcfs_net2str(__u32 net);
-char *libcfs_nid2str(lnet_nid_t nid);
+char *libcfs_net2str_r(__u32 net, char *buf, size_t buf_size);
+static inline char *libcfs_net2str(__u32 net)
+{
+   return libcfs_net2str_r(net, libcfs_next_nidstring(),
+   LNET_NIDSTR_SIZE);
+}
+char *libcfs_nid2str_r(lnet_nid_t nid, char *buf, size_t buf_size);
+static inline char *libcfs_nid2str(lnet_nid_t nid)
+{
+   return libcfs_nid2str_r(nid, libcfs_next_nidstring(),
+   LNET_NIDSTR_SIZE);
+}
 __u32 libcfs_str2net(const char *str);
 lnet_nid_t libcfs_str2nid(const char *str);
 int libcfs_str2anynid(lnet_nid_t *nid, const char *str);
@@ -79,10 +96,10 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, 
char *min_nid,
   char *max_nid, size_t nidstr_length);
 
 struct netstrfns {
-   int nf_type;
+   __u32   nf_type;
char*nf_name;
char*nf_modname;
-   void(*nf_addr2str)(__u32 addr, char *str);
+   void(*nf_addr2str)(__u32 addr, char *str, size_t size);
int (*nf_str2addr)(const char *str, int nob, __u32 *addr);
int (*nf_parse_addrlist)(char *str, int len,
 struct list_head *list);
diff --git a/drivers/staging/lustre/lnet/lnet/api-ni.c 
b/drivers/staging/lustre/lnet/lnet/api-ni.c
index 53ad5ef..3954126 100644
--- a/drivers/staging/lustre/lnet/lnet/api-ni.c
+++ b/drivers/staging/lustre/lnet/lnet/api-ni.c
@@ -263,7 +263,7 @@ static void lnet_assert_wire_constants(void)
 }
 
 static lnd_t *
-lnet_find_lnd_by_type(int type)
+lnet_find_lnd_by_type(__u32 type)
 {
lnd_t *lnd;
struct list_head *tmp;
@@ -272,7 +272,7 @@ lnet_find_lnd_by_type(int type)
list_for_each(tmp, &the_lnet.ln_lnds) {
lnd = list_entry(tmp, lnd_t, lnd_list);
 
-   if ((int)lnd->lnd_type == type)
+   if (lnd->lnd_type == type)
return lnd;
}
 
@@ -962,7 +962,7 @@ lnet_startup_lndnis(void)
struct list_head nilist;
int i;
int rc = 0;
-   int lnd_type;
+   __u32 lnd_type;
int nicount = 0;
char *nets = lnet_get_networks();
 
diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index 4402b80..b7a65da 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -693,8 +693,8 @@ void cfs_nidrange_find_min_max(struct list_head *nidlist, 
char *min_nid,
 
nf->nf_min_max(nidlist, &min_addr, &max_addr);
}
-   nf->nf_addr2str(min_addr, min_addr_str);
-   nf->nf_addr2str(max_addr, max_addr_str);
+   nf->nf_addr2str(min_addr, min_addr_str, sizeof(min_addr_str));
+   nf->nf_addr2str(max_addr, max_addr_str, sizeof(max_addr_str));
 
snprintf(min_nid, nidstr_len

[PATCH 07/11] staging: lustre: Avoid nid range related forward declarations in nidstring.c

2015-10-21 Thread James Simmons
Since forward declarations are frowned on upstream we move
the NID range handling to near the start of the nidstring.c
file.

Signed-off-by: James Simmons 
Reviewed-on: http://review.whamcloud.com/15086
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-by: Dmitry Eremin 
Reviewed-by: Bob Glossman 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/lnet/lnet/nidstrings.c |  782 +
 1 files changed, 395 insertions(+), 387 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index a02c1f6..1874dfe 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -63,6 +63,8 @@ static int   libcfs_nidstring_idx;
 
 static DEFINE_SPINLOCK(libcfs_nidstring_lock);
 
+static struct netstrfns *libcfs_namenum2netstrfns(const char *name);
+
 char *
 libcfs_next_nidstring(void)
 {
@@ -80,20 +82,403 @@ libcfs_next_nidstring(void)
 }
 EXPORT_SYMBOL(libcfs_next_nidstring);
 
-static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
+/**
+ * Nid range list syntax.
+ * \verbatim
+ *
+ *  :==  [ ' '  ]
+ * :==  '@' 
+ *:== '*' |
+ *|
+ *  
+ * :== ...
+ *  
+ *:==  |
+ *   
+ *:== '['  [ ',' ] ']'
+ *   :==  |
+ *'-'  |
+ *'-'  '/' 
+ *  :==  | 
+ *  :== "lo" | "tcp" | "o2ib" | "cib" | "openib" | "iib" |
+ *   "vib" | "ra" | "elan" | "mx" | "ptl"
+ * \endverbatim
+ */
+
+/**
+ * Structure to represent \ token of the syntax.
+ *
+ * One of this is created for each \ parsed.
+ */
+struct nidrange {
+   /**
+* Link to list of this structures which is built on nid range
+* list parsing.
+*/
+   struct list_head nr_link;
+   /**
+* List head for addrrange::ar_link.
+*/
+   struct list_head nr_addrranges;
+   /**
+* Flag indicating that *@ is found.
+*/
+   int nr_all;
+   /**
+* Pointer to corresponding element of libcfs_netstrfns.
+*/
+   struct netstrfns *nr_netstrfns;
+   /**
+* Number of network. E.g. 5 if \ is "elan5".
+*/
+   int nr_netnum;
+};
+
+/**
+ * Structure to represent \ token of the syntax.
+ */
+struct addrrange {
+   /**
+* Link to nidrange::nr_addrranges.
+*/
+   struct list_head ar_link;
+   /**
+* List head for cfs_expr_list::el_list.
+*/
+   struct list_head ar_numaddr_ranges;
+};
+
+/**
+ * Parses \ token on the syntax.
+ *
+ * Allocates struct addrrange and links to \a nidrange via
+ * (nidrange::nr_addrranges)
+ *
+ * \retval 0 if \a src parses to '*' | \ | \
+ * \retval -errno otherwise
+ */
+static int
+parse_addrange(const struct cfs_lstr *src, struct nidrange *nidrange)
+{
+   struct addrrange *addrrange;
+
+   if (src->ls_len == 1 && src->ls_str[0] == '*') {
+   nidrange->nr_all = 1;
+   return 0;
+   }
+
+   LIBCFS_ALLOC(addrrange, sizeof(struct addrrange));
+   if (addrrange == NULL)
+   return -ENOMEM;
+   list_add_tail(&addrrange->ar_link, &nidrange->nr_addrranges);
+   INIT_LIST_HEAD(&addrrange->ar_numaddr_ranges);
+
+   return nidrange->nr_netstrfns->nf_parse_addrlist(src->ls_str,
+   src->ls_len,
+   &addrrange->ar_numaddr_ranges);
+}
+
+/**
+ * Finds or creates struct nidrange.
+ *
+ * Checks if \a src is a valid network name, looks for corresponding
+ * nidrange on the ist of nidranges (\a nidlist), creates new struct
+ * nidrange if it is not found.
+ *
+ * \retval pointer to struct nidrange matching network specified via \a src
+ * \retval NULL if \a src does not match any network
+ */
+static struct nidrange *
+add_nidrange(const struct cfs_lstr *src,
+struct list_head *nidlist)
+{
+   struct netstrfns *nf;
+   struct nidrange *nr;
+   int endlen;
+   unsigned netnum;
+
+   if (src->ls_len >= LNET_NIDSTR_SIZE)
+   return NULL;
+
+   nf = libcfs_namenum2netstrfns(src->ls_str);
+   if (nf == NULL)
+   return NULL;
+   endlen = src->ls_len - strlen(nf->nf_name);
+   if (endlen == 0)
+   /* network name only, e.g. "elan" or "tcp" */
+   netnum = 0;
+   else {
+   /* e.g. "elan25" or "tcp23", refuse to parse if
+* network name is not appended with decimal or
+* hexadecimal number */
+   if (!cfs_str2num_check(src->ls_str + strlen(nf->nf_name),
+  endlen, &netnum, 0, MAX_NUMERIC_VALUE))
+   return NULL;
+   }
+
+   list_for_each_entry(nr, 

[PATCH 08/11] staging: lustre: add in NID range management for libcfs

2015-10-21 Thread James Simmons
From: Joshua Walgenbach 

This is a partial backport of the NID range management
added in for nodemap. We only backport the libcfs related
parts here.

Signed-off-by: Joshua Walgenbach 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3527
Reviewed-on: http://review.whamcloud.com/8057
Reviewed-by: Andreas Dilger 
Reviewed-by: Andrew Perepechko 
Reviewed-by: John L. Hammond 
Reviewed-by: Ken Hornstein 
---
 drivers/staging/lustre/include/linux/lnet/nidstr.h |3 +
 drivers/staging/lustre/lnet/lnet/nidstrings.c  |  365 +++-
 2 files changed, 355 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h 
b/drivers/staging/lustre/include/linux/lnet/nidstr.h
index 1536366..4e7c9a5 100644
--- a/drivers/staging/lustre/include/linux/lnet/nidstr.h
+++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h
@@ -89,6 +89,9 @@ struct netstrfns {
int (*nf_print_addrlist)(char *buffer, int count,
 struct list_head *list);
int (*nf_match_addr)(__u32 addr, struct list_head *list);
+   bool(*nf_is_contiguous)(struct list_head *nidlist);
+   void(*nf_min_max)(struct list_head *nidlist, __u32 *min_nid,
+ __u32 *max_nid);
 };
 
 #endif /* _LNET_NIDSTRINGS_H */
diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index 1874dfe..4402b80 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -46,6 +46,8 @@
 /* max value for numeric network address */
 #define MAX_NUMERIC_VALUE 0x
 
+#define IPSTRING_LENGTH 16
+
 /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
  * consistent in all conversion functions.  Some code fragments are copied
  * around for the sake of clarity...
@@ -456,6 +458,317 @@ int cfs_print_nidlist(char *buffer, int count, struct 
list_head *nidlist)
 }
 EXPORT_SYMBOL(cfs_print_nidlist);
 
+/**
+ * Determines minimum and maximum addresses for a single
+ * numeric address range
+ *
+ * \param  ar
+ * \param  min_nid
+ * \param  max_nid
+ */
+static void cfs_ip_ar_min_max(struct addrrange *ar, __u32 *min_nid,
+ __u32 *max_nid)
+{
+   struct cfs_expr_list *el;
+   struct cfs_range_expr *re;
+   __u32 tmp_ip_addr = 0;
+   unsigned int min_ip[4] = {0};
+   unsigned int max_ip[4] = {0};
+   int re_count = 0;
+
+   list_for_each_entry(el, &ar->ar_numaddr_ranges, el_link) {
+   list_for_each_entry(re, &el->el_exprs, re_link) {
+   min_ip[re_count] = re->re_lo;
+   max_ip[re_count] = re->re_hi;
+   re_count++;
+   }
+   }
+
+   tmp_ip_addr = ((min_ip[0] << 24) | (min_ip[1] << 16) |
+  (min_ip[2] << 8) | min_ip[3]);
+
+   if (min_nid != NULL)
+   *min_nid = tmp_ip_addr;
+
+   tmp_ip_addr = ((max_ip[0] << 24) | (max_ip[1] << 16) |
+  (max_ip[2] << 8) | max_ip[3]);
+
+   if (max_nid != NULL)
+   *max_nid = tmp_ip_addr;
+}
+
+/**
+ * Determines minimum and maximum addresses for a single
+ * numeric address range
+ *
+ * \param  ar
+ * \param  min_nid
+ * \param  max_nid
+ */
+static void cfs_num_ar_min_max(struct addrrange *ar, __u32 *min_nid,
+  __u32 *max_nid)
+{
+   struct cfs_expr_list *el;
+   struct cfs_range_expr *re;
+   unsigned int min_addr = 0;
+   unsigned int max_addr = 0;
+
+   list_for_each_entry(el, &ar->ar_numaddr_ranges, el_link) {
+   list_for_each_entry(re, &el->el_exprs, re_link) {
+   if (re->re_lo < min_addr || min_addr == 0)
+   min_addr = re->re_lo;
+   if (re->re_hi > max_addr)
+   max_addr = re->re_hi;
+   }
+   }
+
+   if (min_nid != NULL)
+   *min_nid = min_addr;
+   if (max_nid != NULL)
+   *max_nid = max_addr;
+}
+
+/**
+ * Determines whether an expression list in an nidrange contains exactly
+ * one contiguous address range. Calls the correct netstrfns for the LND
+ *
+ * \param  *nidlist
+ *
+ * \retval true if contiguous
+ * \retval false if not contiguous
+ */
+bool cfs_nidrange_is_contiguous(struct list_head *nidlist)
+{
+   struct nidrange *nr;
+   struct netstrfns *nf = NULL;
+   char *lndname = NULL;
+   int netnum = -1;
+
+   list_for_each_entry(nr, nidlist, nr_link) {
+   nf = nr->nr_netstrfns;
+   if (lndname == NULL)
+   lndname = nf->nf_name;
+   if (netnum == -1)
+   netnum = nr->nr_netnum;
+
+   if (strcmp(lndname, nf->nf_name) != 0 ||
+   netnum != nr->nr_netnum)
+   return fal

[PATCH 01/11] staging: lustre: add a service that prints a nidlist

2015-10-21 Thread James Simmons
From: Gregoire Pichon 

The libcfs already provides services to parse a string into a nidlist
and to match a nid into a nidlist. This patch implements a service
that prints a nidlist into a buffer.

This is required for instance to print the nosquash_nids parameter
of the MDT procfs component.

Additionally, this patch fixes a bug in return code of
parse_addrange() routine, so that parsing of nids including
a * character works fine ('*@elan' for instance).

Signed-off-by: Gregoire Pichon 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1778
Reviewed-on: http://review.whamcloud.com/9221
Reviewed-by: Andreas Dilger 
Reviewed-by: Liang Zhen 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/include/linux/libcfs/libcfs_string.h|2 +
 drivers/staging/lustre/include/linux/lnet/nidstr.h |2 +
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |   71 +++-
 drivers/staging/lustre/lustre/libcfs/nidstrings.c  |  124 +++-
 4 files changed, 193 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
index 478e958..d178e43 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_string.h
@@ -83,6 +83,8 @@ int cfs_gettok(struct cfs_lstr *next, char delim, struct 
cfs_lstr *res);
 int cfs_str2num_check(char *str, int nob, unsigned *num,
  unsigned min, unsigned max);
 int cfs_expr_list_match(__u32 value, struct cfs_expr_list *expr_list);
+int cfs_expr_list_print(char *buffer, int count,
+   struct cfs_expr_list *expr_list);
 int cfs_expr_list_values(struct cfs_expr_list *expr_list,
 int max, __u32 **values);
 static inline void
diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h 
b/drivers/staging/lustre/include/linux/lnet/nidstr.h
index a627be9..082782b 100644
--- a/drivers/staging/lustre/include/linux/lnet/nidstr.h
+++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h
@@ -69,7 +69,9 @@ int libcfs_str2anynid(lnet_nid_t *nid, const char *str);
 char *libcfs_id2str(lnet_process_id_t id);
 void cfs_free_nidlist(struct list_head *list);
 int cfs_parse_nidlist(char *str, int len, struct list_head *list);
+int cfs_print_nidlist(char *buffer, int count, struct list_head *list);
 int cfs_match_nid(lnet_nid_t nid, struct list_head *list);
+
 bool cfs_nidrange_is_contiguous(struct list_head *nidlist);
 void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
   char *max_nid, size_t nidstr_length);
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index efe5e66..bbfef98 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -321,6 +321,73 @@ cfs_range_expr_parse(struct cfs_lstr *src, unsigned min, 
unsigned max,
 }
 
 /**
+ * Print the range expression \a re into specified \a buffer.
+ * If \a bracketed is true, expression does not need additional
+ * brackets.
+ *
+ * \retval number of characters written
+ */
+static int
+cfs_range_expr_print(char *buffer, int count, struct cfs_range_expr *expr,
+bool bracketed)
+{
+   int i;
+   char s[] = "[";
+   char e[] = "]";
+
+   if (bracketed)
+   s[0] = e[0] = '\0';
+
+   if (expr->re_lo == expr->re_hi)
+   i = scnprintf(buffer, count, "%u", expr->re_lo);
+   else if (expr->re_stride == 1)
+   i = scnprintf(buffer, count, "%s%u-%u%s",
+   s, expr->re_lo, expr->re_hi, e);
+   else
+   i = scnprintf(buffer, count, "%s%u-%u/%u%s",
+   s, expr->re_lo, expr->re_hi,
+   expr->re_stride, e);
+   return i;
+}
+
+/**
+ * Print a list of range expressions (\a expr_list) into specified \a buffer.
+ * If the list contains several expressions, separate them with comma
+ * and surround the list with brackets.
+ *
+ * \retval number of characters written
+ */
+int
+cfs_expr_list_print(char *buffer, int count, struct cfs_expr_list *expr_list)
+{
+   struct cfs_range_expr *expr;
+   int i = 0, j = 0;
+   int numexprs = 0;
+
+   if (count <= 0)
+   return 0;
+
+   list_for_each_entry(expr, &expr_list->el_exprs, re_link)
+   numexprs++;
+
+   if (numexprs > 1)
+   i += scnprintf(buffer + i, count - i, "[");
+
+   list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
+   if (j++ != 0)
+   i += scnprintf(buffer + i, count - i, ",");
+   i += cfs_range_expr_print(buffer + i, count - i, expr,
+ numexprs > 1);
+   }
+
+   if (numexprs > 1)
+   i += scnprint

[PATCH 02/11] staging: lustre: move nidstring handling to LNet layer

2015-10-21 Thread James Simmons
Moved the source file nidstring.c from libcfs to lnet
since that is the only place it is used. With the
move of nidstring to lnet some functions in libcfs
need to be exported. In later patches those functions
that are only used by LNet also will be moved to the
LNet layer. Also add in missing MAX_NUMERIC_VALUE
defination.

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/lnet/Makefile  |2 +-
 .../{lustre/libcfs => lnet/lnet}/nidstrings.c  |   13 +
 drivers/staging/lustre/lustre/libcfs/Makefile  |2 +-
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |4 
 4 files changed, 15 insertions(+), 6 deletions(-)
 rename drivers/staging/lustre/{lustre/libcfs => lnet/lnet}/nidstrings.c (99%)

diff --git a/drivers/staging/lustre/lnet/lnet/Makefile 
b/drivers/staging/lustre/lnet/lnet/Makefile
index 52492fb..e276fe2 100644
--- a/drivers/staging/lustre/lnet/lnet/Makefile
+++ b/drivers/staging/lustre/lnet/lnet/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_LNET) += lnet.o
 
-lnet-y := api-ni.o config.o\
+lnet-y := api-ni.o config.o nidstrings.o   \
  lib-me.o lib-msg.o lib-eq.o lib-md.o lib-ptl.o\
  lib-socket.o lib-move.o module.o lo.o \
  router.o router_proc.o acceptor.o peer.o
diff --git a/drivers/staging/lustre/lustre/libcfs/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
similarity index 99%
rename from drivers/staging/lustre/lustre/libcfs/nidstrings.c
rename to drivers/staging/lustre/lnet/lnet/nidstrings.c
index a54594a..81ec3a8 100644
--- a/drivers/staging/lustre/lustre/libcfs/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -33,7 +33,7 @@
  * This file is part of Lustre, http://www.lustre.org/
  * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * libcfs/libcfs/nidstrings.c
+ * lnet/lnet/nidstrings.c
  *
  * Author: Phil Schwan 
  */
@@ -43,6 +43,9 @@
 #include "../../include/linux/libcfs/libcfs.h"
 #include "../../include/linux/lnet/lnet.h"
 
+/* max value for numeric network address */
+#define MAX_NUMERIC_VALUE 0x
+
 /* CAVEAT VENDITOR! Keep the canonical string representation of nets/nids
  * consistent in all conversion functions.  Some code fragments are copied
  * around for the sake of clarity...
@@ -64,12 +67,13 @@ void libcfs_init_nidstrings(void)
 {
spin_lock_init(&libcfs_nidstring_lock);
 }
+EXPORT_SYMBOL(libcfs_init_nidstrings);
 
-static char *
+char *
 libcfs_next_nidstring(void)
 {
-   char  *str;
-   unsigned long  flags;
+   char *str;
+   unsigned long flags;
 
spin_lock_irqsave(&libcfs_nidstring_lock, flags);
 
@@ -80,6 +84,7 @@ libcfs_next_nidstring(void)
spin_unlock_irqrestore(&libcfs_nidstring_lock, flags);
return str;
 }
+EXPORT_SYMBOL(libcfs_next_nidstring);
 
 static int libcfs_lo_str2addr(const char *str, int nob, __u32 *addr)
 {
diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile 
b/drivers/staging/lustre/lustre/libcfs/Makefile
index ec98f44..03d3f3d 100644
--- a/drivers/staging/lustre/lustre/libcfs/Makefile
+++ b/drivers/staging/lustre/lustre/libcfs/Makefile
@@ -10,7 +10,7 @@ libcfs-linux-objs += linux-mem.o
 
 libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
 
-libcfs-all-objs := debug.o fail.o nidstrings.o module.o tracefile.o \
+libcfs-all-objs := debug.o fail.o module.o tracefile.o \
   libcfs_string.o hash.o kernel_user_comm.o \
   prng.o workitem.o libcfs_cpu.o \
   libcfs_mem.o libcfs_lock.o
diff --git a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c 
b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
index bbfef98..896185f 100644
--- a/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
+++ b/drivers/staging/lustre/lustre/libcfs/libcfs_string.c
@@ -214,6 +214,7 @@ cfs_gettok(struct cfs_lstr *next, char delim, struct 
cfs_lstr *res)
res->ls_len = end - res->ls_str + 1;
return 1;
 }
+EXPORT_SYMBOL(cfs_gettok);
 
 /**
  * Converts string to integer.
@@ -242,6 +243,7 @@ cfs_str2num_check(char *str, int nob, unsigned *num,
 
return (*num >= min && *num <= max);
 }
+EXPORT_SYMBOL(cfs_str2num_check);
 
 /**
  * Parses \ token of the syntax. If \a bracketed is false,
@@ -406,6 +408,7 @@ cfs_expr_list_match(__u32 value, struct cfs_expr_list 
*expr_list)
 
return 0;
 }
+EXPORT_SYMBOL(cfs_expr_list_match);
 
 /**
  * Convert express list (\a expr_list) to an array of all matched values
@@ -558,6 +561,7 @@ cfs_expr_list_free_list(struct list_head *list)
cfs_expr_list_free(el);
}
 }
+EXPORT_SYMBOL(cfs_expr_list_free_list);
 
 int
 cfs_ip_addr_parse(char *str, int len, struct list_head *list)
-- 
1.7.1

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


[PATCH 00/11] staging: lustre: update NID string handling

2015-10-21 Thread James Simmons
Much of the LNet network setup is managed with modprobe configuration
files. Those configurations are parse with the code in nidstring.c
which currently located in the libcfs layer. This patch series moves
nidstring.c to the LNet layer where it belongs and we update the
source with all the changes that have occured on the OpenSFS lustre
development branch.

Gregoire Pichon (1):
  staging: lustre: add a service that prints a nidlist

Joshua Walgenbach (1):
  staging: lustre: add in NID range management for libcfs

Dmitry Eremin (1):
  staging: lustre: provide separate buffers for libcfs_*2str()

Frederic Saunier (1):
  staging: lustre: remove last entry of libcfs_netstrfns[]

James Simmons (7):
  staging: lustre: move nidstring handling to LNet layer
  staging: lustre: remove libcfs_init_string function
  staging: lustre: remove cfs_ip_addr_free wrapper
  staging: lustre: move struct netstrfns to nidstr.h
  staging: lustre: move cfs_ip_addr_* function from kernel libcfs to LNet
  staging: lustre: Avoid nid range related forward declarations in nidstring.c
  staging: lustre: add in NID range management for libcfs
  staging: lustre: Use C99 initializers for struct netstrfns

 .../staging/lustre/include/linux/libcfs/libcfs.h   |2 -
 .../lustre/include/linux/libcfs/libcfs_string.h|5 +-
 drivers/staging/lustre/include/linux/lnet/nidstr.h |   47 +-
 drivers/staging/lustre/lnet/lnet/Makefile  |2 +-
 drivers/staging/lustre/lnet/lnet/api-ni.c  |6 +-
 drivers/staging/lustre/lnet/lnet/config.c  |2 +-
 drivers/staging/lustre/lnet/lnet/nidstrings.c  | 1260 
 drivers/staging/lustre/lnet/lnet/router.c  |2 +-
 drivers/staging/lustre/lustre/libcfs/Makefile  |2 +-
 .../staging/lustre/lustre/libcfs/libcfs_string.c   |  144 ++--
 drivers/staging/lustre/lustre/libcfs/module.c  |2 -
 drivers/staging/lustre/lustre/libcfs/nidstrings.c  |  842 -
 .../lustre/lustre/obdclass/lprocfs_status.c|   11 +-
 .../staging/lustre/lustre/obdclass/obd_config.c|9 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |7 +-
 drivers/staging/lustre/lustre/osc/osc_request.c|8 +-
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|5 +-
 17 files changed, 1408 insertions(+), 948 deletions(-)
 create mode 100644 drivers/staging/lustre/lnet/lnet/nidstrings.c
 delete mode 100644 drivers/staging/lustre/lustre/libcfs/nidstrings.c

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


[PATCH 11/11] staging: lustre: Use C99 initializers for struct netstrfns

2015-10-21 Thread James Simmons
Update struct netstrfns to use C99 initializers.

Remove old LND types from the netstrfns table, as they are
long obsolete and shouldn't be needed even for interop anymore.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6210
Reviewed-on: http://review.whamcloud.com/15088
Reviewed-by: frank zago 
Reviewed-by: Andreas Dilger 
---
 drivers/staging/lustre/lnet/lnet/nidstrings.c |  188 +++--
 1 files changed, 51 insertions(+), 137 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index a5cd0ae..80f585a 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -893,12 +893,6 @@ libcfs_decnum_addr2str(__u32 addr, char *str, size_t size)
snprintf(str, size, "%u", addr);
 }
 
-static void
-libcfs_hexnum_addr2str(__u32 addr, char *str, size_t size)
-{
-   snprintf(str, size, "0x%x", addr);
-}
-
 static int
 libcfs_num_str2addr(const char *str, int nob, __u32 *addr)
 {
@@ -970,137 +964,57 @@ libcfs_num_match(__u32 addr, struct list_head *numaddr)
return cfs_expr_list_match(addr, el);
 }
 
-static struct netstrfns  libcfs_netstrfns[] = {
-   {/* .nf_type  */  LOLND,
-/* .nf_name  */  "lo",
-/* .nf_modname   */  "klolnd",
-/* .nf_addr2str  */  libcfs_decnum_addr2str,
-/* .nf_str2addr  */  libcfs_lo_str2addr,
-/* .nf_parse_addr*/  libcfs_num_parse,
-/* .nf_print_addrlist*/  libcfs_num_addr_range_print,
-/* .nf_match_addr*/  libcfs_num_match,
-/* .nf_is_contiguous */  cfs_num_is_contiguous,
-/* .nf_min_max   */  cfs_num_min_max},
-   {/* .nf_type  */  SOCKLND,
-/* .nf_name  */  "tcp",
-/* .nf_modname   */  "ksocklnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  O2IBLND,
-/* .nf_name  */  "o2ib",
-/* .nf_modname   */  "ko2iblnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  CIBLND,
-/* .nf_name  */  "cib",
-/* .nf_modname   */  "kciblnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  OPENIBLND,
-/* .nf_name  */  "openib",
-/* .nf_modname   */  "kopeniblnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  IIBLND,
-/* .nf_name  */  "iib",
-/* .nf_modname   */  "kiiblnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  VIBLND,
-/* .nf_name  */  "vib",
-/* .nf_modname   */  "kviblnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print,
-/* .nf_match_addr*/  cfs_ip_addr_match,
-/* .nf_is_contiguous */  cfs_ip_is_contiguous,
- /* .nf_min_max   */  cfs_ip_min_max},
-   {/* .nf_type  */  RALND,
-/* .nf_name  */  "ra",
-/* .nf_modname   */  "kralnd",
-/* .nf_addr2str  */  libcfs_ip_addr2str,
-/* .nf_str2addr  */  libcfs_ip_str2addr,
-/* .nf_parse_addrlist*/  cfs_ip_addr_parse,
-/* .nf_print_addrlist*/  libcfs_ip_addr_range_print

[PATCH 10/11] staging: lustre: remove last entry of libcfs_netstrfns[]

2015-10-21 Thread James Simmons
From: Frederic Saunier 

Currently NID string handling test for the last entry,
and last entry has .nf_type == (__u32) -1. If we ask
for a non existent LND we hit the last entry which then
calls a strlen on a NULL which causes a error. We can
avoid this problem if we just remove the last entry
since it is not used for anything except as a last
entry marker.

Signed-off-by: Frederic Saunier 
Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6501
Reviewed-on: http://review.whamcloud.com/15424
Reviewed-by: frank zago 
Reviewed-by: Dmitry Eremin 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/lnet/lnet/nidstrings.c |   11 +++
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index b7a65da..a5cd0ae 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -1101,8 +1101,6 @@ static struct netstrfns  libcfs_netstrfns[] = {
 /* .nf_match_addr*/  libcfs_num_match,
 /* .nf_is_contiguous */  cfs_num_is_contiguous,
 /* .nf_min_max   */  cfs_num_min_max},
-   /* placeholder for net0 alias.  It MUST BE THE LAST ENTRY */
-   {/* .nf_type  */  -1},
 };
 
 static const size_t libcfs_nnetstrfns = ARRAY_SIZE(libcfs_netstrfns);
@@ -1127,8 +1125,7 @@ libcfs_namenum2netstrfns(const char *name)
 
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
-   if (nf->nf_type >= 0 &&
-   !strncmp(name, nf->nf_name, strlen(nf->nf_name)))
+   if (!strncmp(name, nf->nf_name, strlen(nf->nf_name)))
return nf;
}
return NULL;
@@ -1140,8 +1137,7 @@ libcfs_name2netstrfns(const char *name)
inti;
 
for (i = 0; i < libcfs_nnetstrfns; i++)
-   if (libcfs_netstrfns[i].nf_type >= 0 &&
-   !strcmp(libcfs_netstrfns[i].nf_name, name))
+   if (!strcmp(libcfs_netstrfns[i].nf_name, name))
return &libcfs_netstrfns[i];
 
return NULL;
@@ -1254,8 +1250,7 @@ libcfs_str2net_internal(const char *str, __u32 *net)
 
for (i = 0; i < libcfs_nnetstrfns; i++) {
nf = &libcfs_netstrfns[i];
-   if (nf->nf_type >= 0 &&
-   !strncmp(str, nf->nf_name, strlen(nf->nf_name)))
+   if (!strncmp(str, nf->nf_name, strlen(nf->nf_name)))
break;
}
 
-- 
1.7.1

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


[PATCH 05/11] staging: lustre: move struct netstrfns to nidstr.h

2015-10-21 Thread James Simmons
The reason struct netstrfns exist in nidstrings.c
was to avoid forward decleration errors. The best
way to handle this instead is to move this structure
to a header file. Since this structure is used in
the userland utilities as well so we place it in
nidstr.h which is exposed to userland.

Signed-off-by: James Simmons 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/15083
Reviewed-by: Dmitry Eremin 
Reviewed-by: Bob Glossman 
Reviewed-by: Oleg Drokin 
---
 drivers/staging/lustre/include/linux/lnet/nidstr.h |   13 +
 drivers/staging/lustre/lnet/lnet/nidstrings.c  |   13 -
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/lnet/nidstr.h 
b/drivers/staging/lustre/include/linux/lnet/nidstr.h
index 082782b..b32f8cd 100644
--- a/drivers/staging/lustre/include/linux/lnet/nidstr.h
+++ b/drivers/staging/lustre/include/linux/lnet/nidstr.h
@@ -76,4 +76,17 @@ bool cfs_nidrange_is_contiguous(struct list_head *nidlist);
 void cfs_nidrange_find_min_max(struct list_head *nidlist, char *min_nid,
   char *max_nid, size_t nidstr_length);
 
+struct netstrfns {
+   int nf_type;
+   char*nf_name;
+   char*nf_modname;
+   void(*nf_addr2str)(__u32 addr, char *str);
+   int (*nf_str2addr)(const char *str, int nob, __u32 *addr);
+   int (*nf_parse_addrlist)(char *str, int len,
+struct list_head *list);
+   int (*nf_print_addrlist)(char *buffer, int count,
+struct list_head *list);
+   int (*nf_match_addr)(__u32 addr, struct list_head *list);
+};
+
 #endif /* _LNET_NIDSTRINGS_H */
diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index fdbdf06..6a778b9 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -208,19 +208,6 @@ libcfs_num_match(__u32 addr, struct list_head *numaddr)
return cfs_expr_list_match(addr, el);
 }
 
-struct netstrfns {
-   int   nf_type;
-   char*nf_name;
-   char*nf_modname;
-   void   (*nf_addr2str)(__u32 addr, char *str);
-   int (*nf_str2addr)(const char *str, int nob, __u32 *addr);
-   int (*nf_parse_addrlist)(char *str, int len,
-   struct list_head *list);
-   int (*nf_print_addrlist)(char *buffer, int count,
-struct list_head *list);
-   int (*nf_match_addr)(__u32 addr, struct list_head *list);
-};
-
 static struct netstrfns  libcfs_netstrfns[] = {
{/* .nf_type  */  LOLND,
 /* .nf_name  */  "lo",
-- 
1.7.1

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


[PATCH] staging: wilc1000: return -ENOMEM when kmalloc failed

2015-10-21 Thread Luis de Bethencourt
The driver is using -1 instead of the -ENOMEM defined macro to specify that
a buffer allocation failed.

Fixes smatch warning and similars:
drivers/staging/wilc1000/host_interface.c:1782 Handle_Key() warn:
returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/wilc1000/host_interface.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/wilc1000/host_interface.c 
b/drivers/staging/wilc1000/host_interface.c
index 38fead4..ec47a28 100644
--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -1756,7 +1756,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
-   return -1;
+   return -ENOMEM;
}
 
kfree(pstrHostIFkeyAttr->attr.wep.key);
@@ -1779,7 +1779,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kmalloc(pstrHostIFkeyAttr->attr.wep.key_len 
+ 2, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send Key\n");
-   return -1;
+   return -ENOMEM;
}
pu8keybuf[0] = pstrHostIFkeyAttr->attr.wep.index;
memcpy(pu8keybuf + 1, 
&pstrHostIFkeyAttr->attr.wep.key_len, 1);
@@ -1826,7 +1826,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
 
@@ -1861,7 +1861,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
pu8keybuf = kzalloc(RX_MIC_KEY_MSG_LEN, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send RxGTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPARxGtk_end_case_;
}
 
@@ -1890,7 +1890,7 @@ static int Handle_Key(struct host_if_drv *hif_drv,
 _WPARxGtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
kfree(pstrHostIFkeyAttr->attr.wpa.seq);
-   if (ret == -1)
+   if (ret)
return ret;
 
break;
@@ -1905,7 +1905,7 @@ _WPARxGtk_end_case_:
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPAPtk_end_case_;
 
}
@@ -1940,7 +1940,7 @@ _WPARxGtk_end_case_:
 
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PTK Key\n");
-   ret = -1;
+   ret = -ENOMEM;
goto _WPAPtk_end_case_;
 
}
@@ -1963,7 +1963,7 @@ _WPARxGtk_end_case_:
 
 _WPAPtk_end_case_:
kfree(pstrHostIFkeyAttr->attr.wpa.key);
-   if (ret == -1)
+   if (ret)
return ret;
 
break;
@@ -1976,7 +1976,7 @@ _WPAPtk_end_case_:
pu8keybuf = kmalloc((pstrHostIFkeyAttr->attr.pmkid.numpmkid * 
PMKSA_KEY_LEN) + 1, GFP_KERNEL);
if (pu8keybuf == NULL) {
PRINT_ER("No buffer to send PMKSA Key\n");
-   return -1;
+   return -ENOMEM;
}
 
pu8keybuf[0] = pstrHostIFkeyAttr->attr.pmkid.numpmkid;
-- 
2.5.1

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


Re: [PATCH 1/2] staging: fbtft: add support for ST7789V display controller

2015-10-21 Thread Dennis Menschel
Am 11.10.2015 um 16:19 schrieb Noralf Trønnes:
> 
> Den 11.10.2015 09:31, skrev Dennis Menschel:
>> Am 10.10.2015 um 17:36 schrieb Noralf Trønnes:
>>> Den 07.10.2015 22:15, skrev Dennis Menschel:
 This patch adds support for the Sitronix ST7789V display controller.
 The controller is intended for small color displays with a resolution
 of up to 320x240 pixels.

 Signed-off-by: Dennis Menschel 
 ---
> 
> ...
> 
>>> (blank() is used on OLED controllers and set_gamma() will be obsolete
>>> with
>>> display drivers since gamma can be set in init())
> 
> ...
> 
>> Thank you for your detailed explanation about the current state of fbtft
>> and the future plans for a possible successor framework. As suggested by
>> you, I'll make the following changes in the next patch:
>>
>> - Change the st7789v controller driver to a cberry28 display driver.
>> - If applicable, use the default fbtft implementation of set_addr_win().
>> - Remove the blank() function as it is only intended for OLED displays.
> 
> I want to expand a bit on blank(), it can be used by all drivers, but all
> the non-OLED displays I have tried turns off the pixels when it's blanked,
> so the backlight shines through, making it of no use (no power savings to
> speak of either). So these displays need the backlight to be turned off
> during blanking. The main reason blank() isn't implemented in the
> controller drivers, is that if it's used on a display without backlight
> control, the display would turn white during blanking.
> 
> There's a bug in the fbtft backlight implementation that prevents it from
> turning off backlight on the first fb_blank. Subsequent blanks are ok.
> I haven't looked into it, because the fbtft backlight implementation
> should really be handled by the gpio-backlight driver. That's what I've
> done in my new work.
> 
> 
> Noralf.

Hello Noralf,

after having seen that my previous patches have already moved to
staging-next, I've reconsidered your recent suggestions.

If I rewrote the ST7789V display controller driver into a C-Berry28
display driver, the last patches would be effectively reverted,
rendering previous testing efforts in vain (among other things). The
driver would loose much of its current flexibility (i.e. being able to
support similar displays with the same controller but different voltages
or gamma curves) and the meta data concerning the ST7789V would be
thrown away. Furthermore, as the future direction of fbtft development
is uncertain, it makes little sense to optimize the code for an
interface which has not been defined yet. Even if the final interface to
the normal user should provide display drivers instead of display
controller drivers, the abstraction of display controllers as reusable
components for display driver developers would still be a desirable
solution. In addition, the more the available drivers for fbtft diverge
from each other in terms of design and structure, the harder it will
become to convert them to the successor framework in the future.

Therefore, I think it is reasonable to keep the current display
controller driver for the ST7789V.

Best regards,
Dennis Menschel

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


[PATCH 0/4] staging: fbtft: cleanup ST7789V and C-Berry28 drivers

2015-10-21 Thread Dennis Menschel
This set of patches brings some improvements for the ST7789V display
controller driver based on suggestions by Noralf Trønnes.
In addition, the settings for the concrete C-Berry28 display have been
adjusted based on feedback by its vendor admatec.


Dennis Menschel (4):
  staging: fbtft: use MIPI DCS for ST7789V and C-Berry28
  staging: fbtft: remove redundant set_addr_win() function
  staging: fbtft: use init function instead of init sequence
  staging: fbtft: fix voltage settings for C-Berry28

 drivers/staging/fbtft/fb_st7789v.c   | 83 +---
 drivers/staging/fbtft/fbtft_device.c | 15 ---
 2 files changed, 37 insertions(+), 61 deletions(-)

-- 
2.1.4

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


[PATCH 3/4] staging: fbtft: use init function instead of init sequence

2015-10-21 Thread Dennis Menschel
This patch converts the default init sequence of the ST7789V
display controller into an init function, as init sequences
are considered deprecated by the maintainers of fbtft.

Signed-off-by: Dennis Menschel 
---
 drivers/staging/fbtft/fb_st7789v.c | 43 +-
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/fbtft/fb_st7789v.c 
b/drivers/staging/fbtft/fb_st7789v.c
index c0ecf2b..085e987 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -15,6 +15,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -69,63 +70,67 @@ enum st7789v_command {
 #define MADCTL_MY BIT(7) /* bitmask for page address order */
 
 /**
- * default_init_sequence - default initialization sequence for ST7789V
+ * init_display() - initialize the display controller
  *
- * Most of the commands in this init sequence set their parameters to the
+ * @par: FBTFT parameter object
+ *
+ * Most of the commands in this init function set their parameters to the
  * same default values which are already in place after the display has been
  * powered up. (The main exception to this rule is the pixel format which
  * would default to 18 instead of 16 bit per pixel.)
  * Nonetheless, this sequence can be used as a template for concrete
  * displays which usually need some adjustments.
+ *
+ * Return: 0 on success, < 0 if error occurred.
  */
-static int default_init_sequence[] = {
+static int init_display(struct fbtft_par *par)
+{
/* turn off sleep mode */
-   -1, MIPI_DCS_EXIT_SLEEP_MODE,
-   -2, 120,
+   write_reg(par, MIPI_DCS_EXIT_SLEEP_MODE);
+   mdelay(120);
 
/* set pixel format to RGB-565 */
-   -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
+   write_reg(par, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT);
 
-   -1, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22,
+   write_reg(par, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22);
 
/*
 * VGH = 13.26V
 * VGL = -10.43V
 */
-   -1, GCTRL, 0x35,
+   write_reg(par, GCTRL, 0x35);
 
/*
 * VDV and VRH register values come from command write
 * (instead of NVM)
 */
-   -1, VDVVRHEN, 0x01, 0xFF,
+   write_reg(par, VDVVRHEN, 0x01, 0xFF);
 
/*
 * VAP =  4.1V + (VCOM + VCOM offset + 0.5 * VDV)
 * VAN = -4.1V + (VCOM + VCOM offset + 0.5 * VDV)
 */
-   -1, VRHS, 0x0B,
+   write_reg(par, VRHS, 0x0B);
 
/* VDV = 0V */
-   -1, VDVS, 0x20,
+   write_reg(par, VDVS, 0x20);
 
/* VCOM = 0.9V */
-   -1, VCOMS, 0x20,
+   write_reg(par, VCOMS, 0x20);
 
/* VCOM offset = 0V */
-   -1, VCMOFSET, 0x20,
+   write_reg(par, VCMOFSET, 0x20);
 
/*
 * AVDD = 6.8V
 * AVCL = -4.8V
 * VDS = 2.3V
 */
-   -1, PWCTRL1, 0xA4, 0xA1,
+   write_reg(par, PWCTRL1, 0xA4, 0xA1);
 
-   -1, MIPI_DCS_SET_DISPLAY_ON,
-
-   -3,
-};
+   write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
+   return 0;
+}
 
 /**
  * set_var() - apply LCD properties like rotation and BGR mode
@@ -237,11 +242,11 @@ static struct fbtft_display display = {
.regwidth = 8,
.width = 240,
.height = 320,
-   .init_sequence = default_init_sequence,
.gamma_num = 2,
.gamma_len = 14,
.gamma = DEFAULT_GAMMA,
.fbtftops = {
+   .init_display = init_display,
.set_var = set_var,
.set_gamma = set_gamma,
.blank = blank,
-- 
2.1.4

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


[PATCH 1/4] staging: fbtft: use MIPI DCS for ST7789V and C-Berry28

2015-10-21 Thread Dennis Menschel
This patch makes use of the standard MIPI Display Command Set to remove
redundant entries from the command enum of the ST7789V display controller
and also some of the magic constants found in the init sequence of the
C-Berry28 display.

Signed-off-by: Dennis Menschel 
---
 drivers/staging/fbtft/fb_st7789v.c   | 39 +---
 drivers/staging/fbtft/fbtft_device.c |  7 ---
 2 files changed, 18 insertions(+), 28 deletions(-)

diff --git a/drivers/staging/fbtft/fb_st7789v.c 
b/drivers/staging/fbtft/fb_st7789v.c
index dc7d304..22a7b5b 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fbtft.h"
 
@@ -30,14 +31,6 @@
 /**
  * enum st7789v_command - ST7789V display controller commands
  *
- * @SLPOUT: sleep out
- * @DISPOFF: display off
- * @DISPON: display on
- * @CASET: column address set
- * @RASET: row address set
- * @RAMRW: memory write
- * @MADCTL: memory data access control
- * @COLMOD: interface pixel format
  * @PORCTRL: porch setting
  * @GCTRL: gate control
  * @VCOMS: VCOM setting
@@ -54,16 +47,10 @@
  *
  * Note that the ST7789V display controller offers quite a few more commands
  * which have been omitted from this list as they are not used at the moment.
+ * Furthermore, commands that are compliant with the MIPI DCS have been left
+ * out as well to avoid duplicate entries.
  */
 enum st7789v_command {
-   SLPOUT = 0x11,
-   DISPOFF = 0x28,
-   DISPON = 0x29,
-   CASET = 0x2A,
-   RASET = 0x2B,
-   RAMRW = 0x2C,
-   MADCTL = 0x36,
-   COLMOD = 0x3A,
PORCTRL = 0xB2,
GCTRL = 0xB7,
VCOMS = 0xBB,
@@ -93,11 +80,11 @@ enum st7789v_command {
  */
 static int default_init_sequence[] = {
/* turn off sleep mode */
-   -1, SLPOUT,
+   -1, MIPI_DCS_EXIT_SLEEP_MODE,
-2, 120,
 
/* set pixel format to RGB-565 */
-   -1, COLMOD, 0x05,
+   -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
 
-1, PORCTRL, 0x08, 0x08, 0x00, 0x22, 0x22,
 
@@ -135,7 +122,7 @@ static int default_init_sequence[] = {
 */
-1, PWCTRL1, 0xA4, 0xA1,
 
-   -1, DISPON,
+   -1, MIPI_DCS_SET_DISPLAY_ON,
 
-3,
 };
@@ -151,9 +138,11 @@ static int default_init_sequence[] = {
  */
 static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
 {
-   write_reg(par, CASET, xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
-   write_reg(par, RASET, ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
-   write_reg(par, RAMRW);
+   write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
+ xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
+   write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
+ ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
+   write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
 }
 
 /**
@@ -184,7 +173,7 @@ static int set_var(struct fbtft_par *par)
default:
return -EINVAL;
}
-   write_reg(par, MADCTL, madctl_par);
+   write_reg(par, MIPI_DCS_SET_ADDRESS_MODE, madctl_par);
return 0;
 }
 
@@ -256,9 +245,9 @@ static int set_gamma(struct fbtft_par *par, unsigned long 
*curves)
 static int blank(struct fbtft_par *par, bool on)
 {
if (on)
-   write_reg(par, DISPOFF);
+   write_reg(par, MIPI_DCS_SET_DISPLAY_OFF);
else
-   write_reg(par, DISPON);
+   write_reg(par, MIPI_DCS_SET_DISPLAY_ON);
return 0;
 }
 
diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index 0e501d0..d7475d7 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -19,6 +19,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "fbtft.h"
 
@@ -132,11 +133,11 @@ static void adafruit18_green_tab_set_addr_win(struct 
fbtft_par *par,
 
 static int cberry28_init_sequence[] = {
/* turn off sleep mode */
-   -1, 0x11,
+   -1, MIPI_DCS_EXIT_SLEEP_MODE,
-2, 120,
 
/* set pixel format to RGB-565 */
-   -1, 0x3A, 0x05,
+   -1, MIPI_DCS_SET_PIXEL_FORMAT, MIPI_DCS_PIXEL_FMT_16BIT,
 
-1, 0xB2, 0x0C, 0x0C, 0x00, 0x33, 0x33,
 
@@ -174,7 +175,7 @@ static int cberry28_init_sequence[] = {
 */
-1, 0xD0, 0xA4, 0x61,
 
-   -1, 0x29,
+   -1, MIPI_DCS_SET_DISPLAY_ON,
 
-3,
 };
-- 
2.1.4

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


[PATCH 2/4] staging: fbtft: remove redundant set_addr_win() function

2015-10-21 Thread Dennis Menschel
This patch removes the function set_addr_win() from fb_st7789v.c, as its
definition is redundant to the default implementation fbtft_set_addr_win()
which can be found in fbtft-core.c.

Signed-off-by: Dennis Menschel 
---
 drivers/staging/fbtft/fb_st7789v.c | 19 ---
 1 file changed, 19 deletions(-)

diff --git a/drivers/staging/fbtft/fb_st7789v.c 
b/drivers/staging/fbtft/fb_st7789v.c
index 22a7b5b..c0ecf2b 100644
--- a/drivers/staging/fbtft/fb_st7789v.c
+++ b/drivers/staging/fbtft/fb_st7789v.c
@@ -128,24 +128,6 @@ static int default_init_sequence[] = {
 };
 
 /**
- * set_addr_win() - configure display area to use
- *
- * @par: FBTFT parameter object
- * @xs: first active pixel of x-axis
- * @ys: first active pixel of y-axis
- * @xe: last active pixel of x-axis
- * @ye: last active pixel of y-axis
- */
-static void set_addr_win(struct fbtft_par *par, int xs, int ys, int xe, int ye)
-{
-   write_reg(par, MIPI_DCS_SET_COLUMN_ADDRESS,
- xs >> 8, xs & 0xFF, xe >> 8, xe & 0xFF);
-   write_reg(par, MIPI_DCS_SET_PAGE_ADDRESS,
- ys >> 8, ys & 0xFF, ye >> 8, ye & 0xFF);
-   write_reg(par, MIPI_DCS_WRITE_MEMORY_START);
-}
-
-/**
  * set_var() - apply LCD properties like rotation and BGR mode
  *
  * @par: FBTFT parameter object
@@ -260,7 +242,6 @@ static struct fbtft_display display = {
.gamma_len = 14,
.gamma = DEFAULT_GAMMA,
.fbtftops = {
-   .set_addr_win = set_addr_win,
.set_var = set_var,
.set_gamma = set_gamma,
.blank = blank,
-- 
2.1.4

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


[PATCH 4/4] staging: fbtft: fix voltage settings for C-Berry28

2015-10-21 Thread Dennis Menschel
This patch fixes some internal voltage settings for the C-Berry28 display.
The original example source files for the C-Berry28 as provided by
its vendor admatec contained six issues where a command parameter's value
didn't match its corresponding comment.
I've informed admatec about these discrepancies on 2015-08-25. In the
meantime, I've assumed the comments to be more reliable than the code,
and thus have used these values to write the initial C-Berry28 driver.
After having received a reply from admatec on 2015-10-16 that the issues
have been fixed in their example code, it has turned out that for the
voltages VCOM and AVDD, the code was indeed correct, but the comments
were wrong. This patch is meant to fix these two pending mistakes.

Signed-off-by: Dennis Menschel 
---
 drivers/staging/fbtft/fbtft_device.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft_device.c 
b/drivers/staging/fbtft/fbtft_device.c
index d7475d7..071f79b 100644
--- a/drivers/staging/fbtft/fbtft_device.c
+++ b/drivers/staging/fbtft/fbtft_device.c
@@ -162,18 +162,18 @@ static int cberry28_init_sequence[] = {
/* VDV = 0V */
-1, 0xC4, 0x20,
 
-   /* VCOM = 0.875V */
-   -1, 0xBB, 0x1F,
+   /* VCOM = 0.675V */
+   -1, 0xBB, 0x17,
 
/* VCOM offset = 0V */
-1, 0xC5, 0x20,
 
/*
-* AVDD = 6.6V
+* AVDD = 6.8V
 * AVCL = -4.8V
 * VDS = 2.3V
 */
-   -1, 0xD0, 0xA4, 0x61,
+   -1, 0xD0, 0xA4, 0xA1,
 
-1, MIPI_DCS_SET_DISPLAY_ON,
 
-- 
2.1.4

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


[PATCH] staging: lustre: o2iblnd: fix misleading indentation

2015-10-21 Thread Luis de Bethencourt
The code is correct, the indentation is misleading. Only the the return rc
is part of the conditional statement if rc != 0.

Fix a smatch warning:
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c:2157
kiblnd_hdev_setup_mrs() warn: curly braces intended?

Signed-off-by: Luis de Bethencourt 
---

Hi,

This patch gives a warning in checkpatch.pl for the line:
if (hdev->ibh_mrs == NULL)

It would be cleaner if this was 'if (!hdev->ibh_mrs)' instead. I didn't fix
this as well because the file has 41 instances of comparisons with NULL. I
would be happy to do so in a patch in reply to this one if it would be good.

Thanks,
Luis

 .../staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c| 28 +++---
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c 
b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
index c2cc4e4..7c730e3 100644
--- a/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
+++ b/drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd.c
@@ -2154,23 +2154,23 @@ static int kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
if (rc != 0)
return rc;
 
-   LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs));
-   if (hdev->ibh_mrs == NULL) {
-   CERROR("Failed to allocate MRs table\n");
-   return -ENOMEM;
-   }
+   LIBCFS_ALLOC(hdev->ibh_mrs, 1 * sizeof(*hdev->ibh_mrs));
+   if (hdev->ibh_mrs == NULL) {
+   CERROR("Failed to allocate MRs table\n");
+   return -ENOMEM;
+   }
 
-   hdev->ibh_mrs[0] = NULL;
-   hdev->ibh_nmrs   = 1;
+   hdev->ibh_mrs[0] = NULL;
+   hdev->ibh_nmrs   = 1;
 
-   mr = ib_get_dma_mr(hdev->ibh_pd, acflags);
-   if (IS_ERR(mr)) {
-   CERROR("Failed ib_get_dma_mr : %ld\n", PTR_ERR(mr));
-   kiblnd_hdev_cleanup_mrs(hdev);
-   return PTR_ERR(mr);
-   }
+   mr = ib_get_dma_mr(hdev->ibh_pd, acflags);
+   if (IS_ERR(mr)) {
+   CERROR("Failed ib_get_dma_mr : %ld\n", PTR_ERR(mr));
+   kiblnd_hdev_cleanup_mrs(hdev);
+   return PTR_ERR(mr);
+   }
 
-   hdev->ibh_mrs[0] = mr;
+   hdev->ibh_mrs[0] = mr;
 
return 0;
 }
-- 
2.5.1

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


[PATCH] staging: rtl8723au: core: rtw_wlan_util: fix misleading indentation

2015-10-21 Thread Luis de Bethencourt
For loop is outside of the else branch of the above conditional statement.
Fixing misleading indentation.

Fix a smatch warning:
drivers/staging/rtl8723au/core/rtw_wlan_util.c:528
WMMOnAssocRsp23a() warn: curly braces intended?

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/rtl8723au/core/rtw_wlan_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_wlan_util.c 
b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
index 5e87360..cc2b84b 100644
--- a/drivers/staging/rtl8723au/core/rtw_wlan_util.c
+++ b/drivers/staging/rtl8723au/core/rtw_wlan_util.c
@@ -525,7 +525,7 @@ void WMMOnAssocRsp23a(struct rtw_adapter *padapter)
else
aSifsTime = 16;
 
-   for (i = 0; i < 4; i++) {
+   for (i = 0; i < 4; i++) {
ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 5) & 0x03;
ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >> 4) & 0x01;
 
-- 
2.5.1

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


[PATCH] staging: rtl8188eu: fix misleading indentation

2015-10-21 Thread Luis de Bethencourt
Code is correct, i needs to be moved back by 2 to correct for the last
iteration of the while loop, since READ_NEXT_PAIR advances two. Fixing
the misleading indentation.

Fix a smatch warning:
drivers/staging/rtl8188eu/hal/rf_cfg.c:217
rtl88e_phy_config_rf_with_headerfile() warn: curly braces intended?

Signed-off-by: Luis de Bethencourt 
---
 drivers/staging/rtl8188eu/hal/rf_cfg.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/rf_cfg.c 
b/drivers/staging/rtl8188eu/hal/rf_cfg.c
index 067649a..a3f1aba 100644
--- a/drivers/staging/rtl8188eu/hal/rf_cfg.c
+++ b/drivers/staging/rtl8188eu/hal/rf_cfg.c
@@ -214,7 +214,7 @@ static bool rtl88e_phy_config_rf_with_headerfile(struct 
adapter *adapt)
while (v2 != 0xDEAD && v2 != 0xCDEF &&
   v2 != 0xCDCD && i < array_len - 2)
READ_NEXT_PAIR(v1, v2, i);
-   i -= 2;
+   i -= 2;
} else {
READ_NEXT_PAIR(v1, v2, i);
while (v2 != 0xDEAD && v2 != 0xCDEF &&
-- 
2.5.1

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


Re: [PATCH 1/3] staging: comedi: make ni_tio_has_gate2_registers return boolean

2015-10-21 Thread Ian Abbott

On 18/10/15 15:35, Geliang Tang wrote:

This patch makes ni_tio_has_gate2_registers return boolean, since
this function only uses either one or zero as its return value.

Signed-off-by: Geliang Tang 
---
  drivers/staging/comedi/drivers/ni_tio.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_tio.c 
b/drivers/staging/comedi/drivers/ni_tio.c
index c20c51b..b74e44e 100644
--- a/drivers/staging/comedi/drivers/ni_tio.c
+++ b/drivers/staging/comedi/drivers/ni_tio.c
@@ -167,15 +167,15 @@ static inline unsigned GI_HW_ARM_SEL_MASK(enum 
ni_gpct_variant variant)
}
  }

-static int ni_tio_has_gate2_registers(const struct ni_gpct_device *counter_dev)
+static bool ni_tio_has_gate2_registers(const struct ni_gpct_device 
*counter_dev)
  {
switch (counter_dev->variant) {
case ni_gpct_variant_e_series:
default:
-   return 0;
+   return false;
case ni_gpct_variant_m_series:
case ni_gpct_variant_660x:
-   return 1;
+   return true;
}
  }




Looks okay!

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


RE: [PATCH v2 07/22] staging/rdma/hfi1: Fix sparse error in sdma.h file

2015-10-21 Thread Weiny, Ira
> 
> On Mon, Oct 19, 2015 at 10:11:22PM -0400, ira.we...@intel.com wrote:
> > From: Niranjana Vishwanathapura 
> >
> > Use NULL instead of 0 for pointer argument to fix the sparse error.
> >
> > Reviewed-by: Mike Marciniszyn 
> > Reviewed-by: Mitko Haralanov 
> > Reviewed-by: Dennis Dalessandro 
> > Signed-off-by: Niranjana Vishwanathapura
> > 
> > Signed-off-by: Ira Weiny 
> 
> This should have just been folded in with the previous patch.  Don't introduce
> problems and fix them in the patchset.

My bad, I will fix in v3.

Ira

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


[PATCH 11/13] staging: most: use preferred kernel types

2015-10-21 Thread Christian Gromm
This patch makes use of the preferred kernel types such as u16, u32.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-network/networking.c |2 +-
 drivers/staging/most/hdm-i2c/hdm_i2c.c|2 +-
 drivers/staging/most/mostcore/core.c  |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index f268d7d..3c7beb0 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -428,7 +428,7 @@ static int aim_rx_data(struct mbo *mbo)
const u32 zero = 0;
struct net_dev_context *nd;
char *buf = mbo->virt_address;
-   uint32_t len = mbo->processed_length;
+   u32 len = mbo->processed_length;
struct sk_buff *skb;
struct net_device *dev;
 
diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c 
b/drivers/staging/most/hdm-i2c/hdm_i2c.c
index 79448a5..ba0263b 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c
@@ -196,7 +196,7 @@ static void do_rx_work(struct hdm_i2c *dev)
struct mbo *mbo;
unsigned char msg[MAX_BUF_SIZE_CONTROL];
int ret, ch_idx = CH_RX;
-   uint16_t pml, data_size;
+   u16 pml, data_size;
 
/* Read PML (2 bytes) */
ret = i2c_master_recv(dev->client, msg, 2);
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 3e1cc5a..19852ca 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -49,7 +49,7 @@ struct most_c_obj {
struct completion cleanup;
atomic_t mbo_ref;
atomic_t mbo_nq_level;
-   uint16_t channel_id;
+   u16 channel_id;
bool is_poisoned;
struct mutex start_mutex;
int is_starving;
-- 
1.7.9.5

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


[PATCH 13/13] staging: most: remove comparison to NULL

2015-10-21 Thread Christian Gromm

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-usb/hdm_usb.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index 747d22e..b5fb1a7 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -1417,7 +1417,7 @@ static int __init hdm_usb_init(void)
return -EIO;
}
schedule_usb_work = create_workqueue("hdmu_work");
-   if (schedule_usb_work == NULL) {
+   if (!schedule_usb_work) {
pr_err("could not create workqueue\n");
usb_deregister(&hdm_usb);
return -ENOMEM;
-- 
1.7.9.5

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


[PATCH 05/13] staging: most: make alignment match open parenthesis

2015-10-21 Thread Christian Gromm
This patch fixes coding style violations by making alignments match
open parenthesis.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c |2 +-
 drivers/staging/most/hdm-dim2/dim2_hal.c |2 +-
 drivers/staging/most/hdm-dim2/dim2_hdm.c |2 +-
 drivers/staging/most/hdm-i2c/hdm_i2c.c   |7 +++
 drivers/staging/most/mostcore/core.c |4 ++--
 5 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index 93b07661..ade5107 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -100,7 +100,7 @@ static int aim_open(struct inode *inode, struct file *filp)
}
 
ret = most_start_channel(channel->iface, channel->channel_id,
-   &cdev_aim);
+&cdev_aim);
if (ret)
atomic_dec(&channel->access_ref);
return ret;
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 096eb8b..c915c44 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -863,7 +863,7 @@ u8 DIM_ServiceChannel(struct dim_channel *ch)
 }
 
 struct dim_ch_state_t *DIM_GetChannelState(struct dim_channel *ch,
-   struct dim_ch_state_t *state_ptr)
+  struct dim_ch_state_t *state_ptr)
 {
if (!ch || !state_ptr)
return NULL;
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 45878e8..1c4ce82 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -399,7 +399,7 @@ static void service_done_flag(struct dim2_hdm *dev, int 
ch_idx)
 }
 
 static struct dim_channel **get_active_channels(struct dim2_hdm *dev,
-   struct dim_channel **buffer)
+   struct dim_channel **buffer)
 {
int idx = 0;
int ch_idx;
diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c 
b/drivers/staging/most/hdm-i2c/hdm_i2c.c
index 8fe06ac..711fdbc 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c
@@ -92,10 +92,9 @@ static int configure_channel(struct most_interface 
*most_iface,
return -EPERM;
}
 
-   if (channel_config->direction == MOST_CH_RX) {
-   if (dev->polling_mode)
-   schedule_delayed_work(&dev->rx.dwork,
-   msecs_to_jiffies(MSEC_PER_SEC / 4));
+   if ((channel_config->direction == MOST_CH_RX) && (dev->polling_mode)) {
+   schedule_delayed_work(&dev->rx.dwork,
+ msecs_to_jiffies(MSEC_PER_SEC / 4));
}
dev->is_open[ch_idx] = true;
 
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 276ca24..8768475 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -247,8 +247,8 @@ static void most_channel_release(struct kobject *kobj)
 }
 
 static ssize_t show_available_directions(struct most_c_obj *c,
-   struct most_c_attr *attr,
-   char *buf)
+struct most_c_attr *attr,
+char *buf)
 {
unsigned int i = c->channel_id;
 
-- 
1.7.9.5

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


[PATCH 09/13] staging: most: remove unnecessary parentheses

2015-10-21 Thread Christian Gromm
This patch simply removes unnecessary parentheses.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hdm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 968b2a0..c940322 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -428,7 +428,7 @@ static void dim2_tasklet_fn(unsigned long data)
continue;
 
spin_lock_irqsave(&dim_lock, flags);
-   DIM_ServiceChannel(&(dev->hch[ch_idx].ch));
+   DIM_ServiceChannel(&dev->hch[ch_idx].ch);
spin_unlock_irqrestore(&dim_lock, flags);
 
service_done_flag(dev, ch_idx);
-- 
1.7.9.5

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


[PATCH 03/13] staging: most: removed redundant code

2015-10-21 Thread Christian Gromm
This patch removes redundant code.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c|   22 --
 drivers/staging/most/hdm-dim2/dim2_hal.c |   16 
 2 files changed, 38 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 0d75258..228971a 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -239,28 +239,6 @@ static void aim_set_format_struct(struct v4l2_format *f)
 static int aim_set_format(struct most_video_dev *mdev, unsigned int cmd,
  struct v4l2_format *format)
 {
-#if 0
-   u32 const pixfmt = format->fmt.pix.pixelformat;
-   const char *fmt;
-
-   if (pixfmt != V4L2_PIX_FMT_MPEG) {
-   if (cmd == VIDIOC_TRY_FMT)
-   fmt = KERN_ERR "try %c%c%c%c failed\n";
-   else
-   fmt = KERN_ERR "set %c%c%c%c failed\n";
-   } else {
-   if (cmd == VIDIOC_TRY_FMT)
-   fmt = KERN_ERR "try %c%c%c%c\n";
-   else
-   fmt = KERN_ERR "set %c%c%c%c\n";
-   }
-   printk(fmt,
-  (pixfmt) & 255,
-  (pixfmt >> 8) & 255,
-  (pixfmt >> 16) & 255,
-  (pixfmt >> 24) & 255);
-#endif
-
if (format->fmt.pix.pixelformat != V4L2_PIX_FMT_MPEG)
return -EINVAL;
 
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 4c1104d..53b34a7 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -493,22 +493,6 @@ static void dim2_initialize(bool enable_6pin, u8 mlb_clock)
DIMCB_IoWrite(&g.dim2->ACTL,
  ACTL_DMA_MODE_VAL_DMA_MODE_1 << ACTL_DMA_MODE_BIT |
  true << ACTL_SCE_BIT);
-
-#if 0
-   DIMCB_IoWrite(&g.dim2->MIEN,
- bit_mask(MIEN_CTX_BREAK_BIT) |
- bit_mask(MIEN_CTX_PE_BIT) |
- bit_mask(MIEN_CTX_DONE_BIT) |
- bit_mask(MIEN_CRX_BREAK_BIT) |
- bit_mask(MIEN_CRX_PE_BIT) |
- bit_mask(MIEN_CRX_DONE_BIT) |
- bit_mask(MIEN_ATX_BREAK_BIT) |
- bit_mask(MIEN_ATX_PE_BIT) |
- bit_mask(MIEN_ATX_DONE_BIT) |
- bit_mask(MIEN_ARX_BREAK_BIT) |
- bit_mask(MIEN_ARX_PE_BIT) |
- bit_mask(MIEN_ARX_DONE_BIT));
-#endif
 }
 
 static bool dim2_is_mlb_locked(void)
-- 
1.7.9.5

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


[PATCH 08/13] staging: most: remove blank lines

2015-10-21 Thread Christian Gromm
This patch removes blank lines after an open brace as specified in
coding style.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hdm.c |2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 945719f..968b2a0 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -371,7 +371,6 @@ static void service_done_flag(struct dim2_hdm *dev, int 
ch_idx)
if (hdm_ch->data_type == MOST_CH_ASYNC &&
hdm_ch->direction == MOST_CH_RX &&
PACKET_IS_NET_INFO(data)) {
-
retrieve_netinfo(dev, mbo);
 
spin_lock_irqsave(&dim_lock, flags);
@@ -380,7 +379,6 @@ static void service_done_flag(struct dim2_hdm *dev, int 
ch_idx)
} else {
if (hdm_ch->data_type == MOST_CH_CONTROL ||
hdm_ch->data_type == MOST_CH_ASYNC) {
-
u32 data_size =
(u32)data[0] * 256 + data[1] + 2;
 
-- 
1.7.9.5

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


[PATCH 10/13] staging: most: fix logical operator position

2015-10-21 Thread Christian Gromm
This patch puts logical continuations on the previous line to meet
coding style.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c |7 +++
 drivers/staging/most/mostcore/core.c |4 ++--
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index cd122b5..026e1a5 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -88,8 +88,8 @@ static int aim_open(struct inode *inode, struct file *filp)
filp->private_data = channel;
 
if (((channel->cfg->direction == MOST_CH_RX) &&
-((filp->f_flags & O_ACCMODE) != O_RDONLY))
-   || ((channel->cfg->direction == MOST_CH_TX) &&
+((filp->f_flags & O_ACCMODE) != O_RDONLY)) ||
+((channel->cfg->direction == MOST_CH_TX) &&
((filp->f_flags & O_ACCMODE) != O_WRONLY))) {
pr_info("WARN: Access flags mismatch\n");
return -EACCES;
@@ -234,8 +234,7 @@ aim_read(struct file *filp, char __user *buf, size_t count, 
loff_t *offset)
channel->keep_mbo = false;
goto start_copy;
}
-   while ((!kfifo_out(&channel->fifo, &mbo, 1))
-  && (channel->dev)) {
+   while ((!kfifo_out(&channel->fifo, &mbo, 1)) && (channel->dev)) {
if (filp->f_flags & O_NONBLOCK)
return -EAGAIN;
if (wait_event_interruptible(channel->wq,
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index d5e0572..3e1cc5a 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -1184,8 +1184,8 @@ static int hdm_enqueue_thread(void *data)
 
while (likely(!kthread_should_stop())) {
wait_event_interruptible(c->hdm_fifo_wq,
-(mbo = get_hdm_mbo(c))
-|| kthread_should_stop());
+(mbo = get_hdm_mbo(c)) ||
+kthread_should_stop());
 
if (unlikely(!mbo))
continue;
-- 
1.7.9.5

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


[PATCH 06/13] staging: most: use braces on all arms of statement

2015-10-21 Thread Christian Gromm
This patch fixes style issues regarding braces on all arms of a statement.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hdm.c |4 ++--
 drivers/staging/most/hdm-i2c/hdm_i2c.c   |3 ++-
 drivers/staging/most/hdm-usb/hdm_usb.c   |5 +++--
 drivers/staging/most/mostcore/core.c |   16 
 4 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 1c4ce82..945719f 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -202,9 +202,9 @@ static int startup_dim(struct platform_device *pdev)
if (dev->clk_speed == -1) {
pr_info("Bad or missing clock speed parameter, using default 
value: 3072fs\n");
dev->clk_speed = CLK_3072FS;
-   } else
+   } else {
pr_info("Selected clock speed: %s\n", clock_speed);
-
+   }
if (pdata && pdata->init) {
int ret = pdata->init(pdata, dev->io_base, dev->clk_speed);
 
diff --git a/drivers/staging/most/hdm-i2c/hdm_i2c.c 
b/drivers/staging/most/hdm-i2c/hdm_i2c.c
index 711fdbc..79448a5 100644
--- a/drivers/staging/most/hdm-i2c/hdm_i2c.c
+++ b/drivers/staging/most/hdm-i2c/hdm_i2c.c
@@ -268,8 +268,9 @@ static void pending_rx_work(struct work_struct *work)
schedule_delayed_work(&dev->rx.dwork,
  msecs_to_jiffies(MSEC_PER_SEC
   / scan_rate));
-   } else
+   } else {
enable_irq(dev->client->irq);
+   }
 }
 
 /*
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index a56df13..c8a74bc 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -246,10 +246,11 @@ static unsigned int get_stream_frame_size(struct 
most_channel_config *cfg)
if (cfg->packets_per_xact == 0) {
pr_warn("Misconfig: Packets per XACT zero\n");
frame_size = 0;
-   } else if (cfg->packets_per_xact == 0xFF)
+   } else if (cfg->packets_per_xact == 0xFF) {
frame_size = (USB_MTU / sub_size) * sub_size;
-   else
+   } else {
frame_size = cfg->packets_per_xact * sub_size;
+   }
break;
default:
pr_warn("Query frame size of non-streaming channel\n");
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index 8768475..ca0b3b2 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -396,11 +396,11 @@ static ssize_t store_set_direction(struct most_c_obj *c,
   const char *buf,
   size_t count)
 {
-   if (!strcmp(buf, "dir_rx\n"))
+   if (!strcmp(buf, "dir_rx\n")) {
c->cfg.direction = MOST_CH_RX;
-   else if (!strcmp(buf, "dir_tx\n"))
+   } else if (!strcmp(buf, "dir_tx\n")) {
c->cfg.direction = MOST_CH_TX;
-   else {
+   } else {
pr_info("WARN: invalid attribute settings\n");
return -EINVAL;
}
@@ -427,15 +427,15 @@ static ssize_t store_set_datatype(struct most_c_obj *c,
  const char *buf,
  size_t count)
 {
-   if (!strcmp(buf, "control\n"))
+   if (!strcmp(buf, "control\n")) {
c->cfg.data_type = MOST_CH_CONTROL;
-   else if (!strcmp(buf, "async\n"))
+   } else if (!strcmp(buf, "async\n")) {
c->cfg.data_type = MOST_CH_ASYNC;
-   else if (!strcmp(buf, "sync\n"))
+   } else if (!strcmp(buf, "sync\n")) {
c->cfg.data_type = MOST_CH_SYNC;
-   else if (!strcmp(buf, "isoc_avp\n"))
+   } else if (!strcmp(buf, "isoc_avp\n")) {
c->cfg.data_type = MOST_CH_ISOC_AVP;
-   else {
+   } else {
pr_info("WARN: invalid attribute settings\n");
return -EINVAL;
}
-- 
1.7.9.5

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


[PATCH 07/13] staging: most: use blank line after declarations

2015-10-21 Thread Christian Gromm
This patch fixes style violation regarding blank lines after
function/struct/union/enum declarations.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-cdev/cdev.c   |1 +
 drivers/staging/most/hdm-usb/hdm_usb.c |4 
 drivers/staging/most/mostcore/core.c   |6 ++
 3 files changed, 11 insertions(+)

diff --git a/drivers/staging/most/aim-cdev/cdev.c 
b/drivers/staging/most/aim-cdev/cdev.c
index ade5107..cd122b5 100644
--- a/drivers/staging/most/aim-cdev/cdev.c
+++ b/drivers/staging/most/aim-cdev/cdev.c
@@ -47,6 +47,7 @@ struct aim_channel {
atomic_t access_ref;
struct list_head list;
 };
+
 #define to_channel(d) container_of(d, struct aim_channel, cdev)
 static struct list_head channel_list;
 static spinlock_t ch_list_lock;
diff --git a/drivers/staging/most/hdm-usb/hdm_usb.c 
b/drivers/staging/most/hdm-usb/hdm_usb.c
index c8a74bc..747d22e 100644
--- a/drivers/staging/most/hdm-usb/hdm_usb.c
+++ b/drivers/staging/most/hdm-usb/hdm_usb.c
@@ -77,6 +77,7 @@ struct buf_anchor {
struct list_head list;
struct completion urb_compl;
 };
+
 #define to_buf_anchor(w) container_of(w, struct buf_anchor, clear_work_obj)
 
 /**
@@ -88,6 +89,7 @@ struct most_dci_obj {
struct kobject kobj;
struct usb_device *usb_device;
 };
+
 #define to_dci_obj(p) container_of(p, struct most_dci_obj, kobj)
 
 /**
@@ -131,6 +133,7 @@ struct most_dev {
struct timer_list link_stat_timer;
struct work_struct poll_work_obj;
 };
+
 #define to_mdev(d) container_of(d, struct most_dev, iface)
 #define to_mdev_from_work(w) container_of(w, struct most_dev, poll_work_obj)
 
@@ -984,6 +987,7 @@ struct most_dci_attribute {
 const char *buf,
 size_t count);
 };
+
 #define to_dci_attr(a) container_of(a, struct most_dci_attribute, attr)
 
 /**
diff --git a/drivers/staging/most/mostcore/core.c 
b/drivers/staging/most/mostcore/core.c
index ca0b3b2..d5e0572 100644
--- a/drivers/staging/most/mostcore/core.c
+++ b/drivers/staging/most/mostcore/core.c
@@ -69,6 +69,7 @@ struct most_c_obj {
struct mutex stop_task_mutex;
wait_queue_head_t hdm_fifo_wq;
 };
+
 #define to_c_obj(d) container_of(d, struct most_c_obj, kobj)
 
 struct most_inst_obj {
@@ -80,6 +81,7 @@ struct most_inst_obj {
struct kobject kobj;
struct list_head list;
 };
+
 #define to_inst_obj(d) container_of(d, struct most_inst_obj, kobj)
 
 /**
@@ -115,6 +117,7 @@ struct most_c_attr {
 const char *buf,
 size_t count);
 };
+
 #define to_channel_attr(a) container_of(a, struct most_c_attr, attr)
 
 #define MOST_CHNL_ATTR(_name, _mode, _show, _store) \
@@ -596,6 +599,7 @@ struct most_inst_attribute {
 const char *buf,
 size_t count);
 };
+
 #define to_instance_attr(a) \
container_of(a, struct most_inst_attribute, attr)
 
@@ -777,6 +781,7 @@ struct most_aim_obj {
char add_link[STRING_SIZE];
char remove_link[STRING_SIZE];
 };
+
 #define to_aim_obj(d) container_of(d, struct most_aim_obj, kobj)
 
 static struct list_head aim_list;
@@ -797,6 +802,7 @@ struct most_aim_attribute {
 const char *buf,
 size_t count);
 };
+
 #define to_aim_attr(a) container_of(a, struct most_aim_attribute, attr)
 
 /**
-- 
1.7.9.5

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


[PATCH 12/13] staging: most: use preferred kzalloc parameters

2015-10-21 Thread Christian Gromm
This patch uses the preferred call to kzalloc. It replaces
kzalloc(sizeof(struct aim_fh)...) by kzalloc(sizeof(*fh)...).

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 228971a..13abf7c 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -88,7 +88,7 @@ static int aim_vdev_open(struct file *filp)
return -EINVAL;
}
 
-   fh = kzalloc(sizeof(struct aim_fh), GFP_KERNEL);
+   fh = kzalloc(sizeof(*fh), GFP_KERNEL);
if (!fh)
return -ENOMEM;
 
-- 
1.7.9.5

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


[PATCH 00/13] staging: most: remove coding style violations

2015-10-21 Thread Christian Gromm
This patchset removes warnings generated by checkpatch.

Christian Gromm (13):
  staging: most: remove multiple blank lines
  staging: most: put spaces around operator
  staging: most: removed redundant code
  staging: most: remove multiple assignment
  staging: most: make alignment match open parenthesis
  staging: most: use braces on all arms of statement
  staging: most: use blank line after function/struct/union/enum
declarations
  staging: most: remove blank lines
  staging: most: remove unnecessary parentheses
  staging: most: fix logical operator position
  staging: most: use preferred kernel types
  staging: most: use preferred kzalloc parameters
  staging: most: remove comparison to NULL

 drivers/staging/most/aim-cdev/cdev.c  |   10 +++
 drivers/staging/most/aim-network/networking.c |6 +---
 drivers/staging/most/aim-sound/sound.c|1 -
 drivers/staging/most/aim-v4l2/video.c |   30 +--
 drivers/staging/most/hdm-dim2/dim2_hal.c  |   32 +++--
 drivers/staging/most/hdm-dim2/dim2_hdm.c  |   12 
 drivers/staging/most/hdm-i2c/hdm_i2c.c|   13 -
 drivers/staging/most/hdm-usb/hdm_usb.c|   12 +---
 drivers/staging/most/mostcore/core.c  |   38 -
 9 files changed, 49 insertions(+), 105 deletions(-)

-- 
1.7.9.5

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


[PATCH 01/13] staging: most: remove multiple blank lines

2015-10-21 Thread Christian Gromm
This patch removes the usage of multiple blank lines from driver modules.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-network/networking.c |4 
 drivers/staging/most/aim-sound/sound.c|1 -
 drivers/staging/most/aim-v4l2/video.c |6 --
 drivers/staging/most/hdm-dim2/dim2_hal.c  |9 -
 drivers/staging/most/hdm-i2c/hdm_i2c.c|1 -
 drivers/staging/most/hdm-usb/hdm_usb.c|1 -
 drivers/staging/most/mostcore/core.c  |6 --
 7 files changed, 28 deletions(-)

diff --git a/drivers/staging/most/aim-network/networking.c 
b/drivers/staging/most/aim-network/networking.c
index 5f0ea9b..f268d7d 100644
--- a/drivers/staging/most/aim-network/networking.c
+++ b/drivers/staging/most/aim-network/networking.c
@@ -24,7 +24,6 @@
 #include "mostcore.h"
 #include "networking.h"
 
-
 #define MEP_HDR_LEN 8
 #define MDP_HDR_LEN 16
 #define MAMAC_DATA_LEN (1024 - MDP_HDR_LEN)
@@ -47,8 +46,6 @@
 #define HB(value)  ((u8)((u16)(value) >> 8))
 #define LB(value)  ((u8)(value))
 
-
-
 #define EXTRACT_BIT_SET(bitset_name, value) \
(((value) >> bitset_name##_SHIFT) & bitset_name##_MASK)
 
@@ -81,7 +78,6 @@ static struct list_head net_devices = 
LIST_HEAD_INIT(net_devices);
 static struct spinlock list_lock;
 static struct most_aim aim;
 
-
 static int skb_to_mamac(const struct sk_buff *skb, struct mbo *mbo)
 {
u8 *buff = mbo->virt_address;
diff --git a/drivers/staging/most/aim-sound/sound.c 
b/drivers/staging/most/aim-sound/sound.c
index 4d33763..9c64580 100644
--- a/drivers/staging/most/aim-sound/sound.c
+++ b/drivers/staging/most/aim-sound/sound.c
@@ -470,7 +470,6 @@ static struct snd_pcm_ops pcm_ops = {
.mmap   = snd_pcm_lib_mmap_vmalloc,
 };
 
-
 static int split_arg_list(char *buf, char **card_name, char **pcm_format)
 {
*card_name = strsep(&buf, ".");
diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 345a824..0d75258 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -29,7 +29,6 @@
 
 #include "mostcore.h"
 
-
 #define V4L2_AIM_MAX_INPUT  1
 
 static struct most_aim aim_info;
@@ -60,11 +59,9 @@ struct aim_fh {
u32 offs;
 };
 
-
 static struct list_head video_devices = LIST_HEAD_INIT(video_devices);
 static struct spinlock list_lock;
 
-
 static inline bool data_ready(struct most_video_dev *mdev)
 {
return !list_empty(&mdev->pending_mbos);
@@ -75,7 +72,6 @@ static inline struct mbo *get_top_mbo(struct most_video_dev 
*mdev)
return list_first_entry(&mdev->pending_mbos, struct mbo, list);
 }
 
-
 static int aim_vdev_open(struct file *filp)
 {
int ret;
@@ -276,7 +272,6 @@ static int aim_set_format(struct most_video_dev *mdev, 
unsigned int cmd,
return 0;
 }
 
-
 static int vidioc_querycap(struct file *file, void  *priv,
   struct v4l2_capability *cap)
 {
@@ -496,7 +491,6 @@ static void aim_unregister_videodev(struct most_video_dev 
*mdev)
video_unregister_device(mdev->vdev);
 }
 
-
 static void aim_v4l2_dev_release(struct v4l2_device *v4l2_dev)
 {
struct most_video_dev *mdev =
diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 81dd8de..6440d0a 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -19,7 +19,6 @@
 #include "dim2_reg.h"
 #include 
 
-
 /*
  * The number of frames per sub-buffer for synchronous channels.
  * Allowed values: 1, 2, 4, 8, 16, 32, 64.
@@ -51,7 +50,6 @@
  */
 #define DBR_MAP_SIZE 2
 
-
 /* -- 
*/
 /* not configurable area */
 
@@ -63,7 +61,6 @@
 #define DBR_SIZE  (16*1024) /* specified by IP */
 #define DBR_BLOCK_SIZE  (DBR_SIZE / 32 / DBR_MAP_SIZE)
 
-
 /* -- 
*/
 /* generic helper functions and macros */
 
@@ -81,7 +78,6 @@ static inline bool dim_on_error(u8 error_id, const char 
*error_message)
return false;
 }
 
-
 /* -- 
*/
 /* types and local variables */
 
@@ -94,7 +90,6 @@ struct lld_global_vars_t {
 
 static struct lld_global_vars_t g = { false };
 
-
 /* -- 
*/
 
 static int dbr_get_mask_size(u16 size)
@@ -327,7 +322,6 @@ static void dim2_start_isoc_sync(u8 ch_addr, u8 idx, u32 
buf_addr,
dim2_write_ctr_mask(ADT + ch_addr, mask, adt);
 }
 
-
 static void dim2_clear_ctram(void)
 {
u32 ctr_addr;
@@ -530,7 +524,6 @@ static bool dim2_is_mlb_locked(void)
   (DIMCB_IoRead(&g.dim2->MLBC0) & mask0) != 0;
 }
 
-
 /* -- 
*/
 /* channel help routines */
 
@@ -559,7 +552,6 @@ static inline bool se

[PATCH 02/13] staging: most: put spaces around operator

2015-10-21 Thread Christian Gromm
This patch puts spaces around the asterisk operator. It is needed to
prevent checkpatch from reporting an issue.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hal.c |2 +-
 drivers/staging/most/hdm-dim2/dim2_hdm.c |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 6440d0a..4c1104d 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -58,7 +58,7 @@
 #define MLB_CAT 0x80
 #define AHB_CAT 0x88
 
-#define DBR_SIZE  (16*1024) /* specified by IP */
+#define DBR_SIZE  (16 * 1024) /* specified by IP */
 #define DBR_BLOCK_SIZE  (DBR_SIZE / 32 / DBR_MAP_SIZE)
 
 /* -- 
*/
diff --git a/drivers/staging/most/hdm-dim2/dim2_hdm.c 
b/drivers/staging/most/hdm-dim2/dim2_hdm.c
index 855bcd2..45878e8 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hdm.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hdm.c
@@ -37,7 +37,7 @@
 #define MAX_BUFFERS_PACKET  32
 #define MAX_BUFFERS_STREAMING   32
 #define MAX_BUF_SIZE_PACKET 2048
-#define MAX_BUF_SIZE_STREAMING  (8*1024)
+#define MAX_BUF_SIZE_STREAMING  (8 * 1024)
 
 /* command line parameter to select clock speed */
 static char *clock_speed;
-- 
1.7.9.5

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


[PATCH 04/13] staging: most: remove multiple assignment

2015-10-21 Thread Christian Gromm
This patch removes multiple assignments as specified in coding style.

Signed-off-by: Christian Gromm 
---
 drivers/staging/most/hdm-dim2/dim2_hal.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/most/hdm-dim2/dim2_hal.c 
b/drivers/staging/most/hdm-dim2/dim2_hal.c
index 53b34a7..096eb8b 100644
--- a/drivers/staging/most/hdm-dim2/dim2_hal.c
+++ b/drivers/staging/most/hdm-dim2/dim2_hal.c
@@ -663,7 +663,8 @@ u8 DIM_Startup(void *dim_base_address, u32 mlb_clock)
return DIM_INIT_ERR_MLB_CLOCK;
 
g.dim2 = dim_base_address;
-   g.dbr_map[0] = g.dbr_map[1] = 0;
+   g.dbr_map[0] = 0;
+   g.dbr_map[1] = 0;
 
dim2_initialize(mlb_clock >= 3, mlb_clock);
 
-- 
1.7.9.5

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


[PATCH] fixup! staging/wilc1000: split out bus specific modules

2015-10-21 Thread Arnd Bergmann
The patch to split out bus modules causes new valid build warnings without this.

Signed-off-by: Arnd Bergmann 

diff --git a/drivers/staging/wilc1000/linux_wlan.c 
b/drivers/staging/wilc1000/linux_wlan.c
index 8a5f4673c5d0..fe3b464f0d5c 100644
--- a/drivers/staging/wilc1000/linux_wlan.c
+++ b/drivers/staging/wilc1000/linux_wlan.c
@@ -1594,7 +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)
+void wilc1000_init_driver(void)
 {
 #if defined(WILC_DEBUGFS)
if (wilc_debugfs_init() < 0)
@@ -1606,7 +1606,7 @@ void __init wilc1000_init_driver(void)
 }
 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,7 +1653,7 @@ void __exit wilc_netdev_free(struct wilc *wilc1000_dev)
 }
 EXPORT_SYMBOL_GPL(wilc_netdev_free);
 
-void __exit wilc1000_exit_driver(void)
+void wilc1000_exit_driver(void)
 {
kfree(wilc1000_dev);
wilc1000_dev = NULL;
diff --git a/drivers/staging/wilc1000/wilc_wlan.h 
b/drivers/staging/wilc1000/wilc_wlan.h
index f684d5bf465d..b460b7f6971a 100644
--- a/drivers/staging/wilc1000/wilc_wlan.h
+++ b/drivers/staging/wilc1000/wilc_wlan.h
@@ -320,7 +320,7 @@ int wilc1000_wlan_get_num_conn_ifcs(void);
 int wilc1000_mac_xmit(struct sk_buff *skb, struct net_device *dev);
 int wilc_netdev_init(struct device *, const struct wilc1000_ops *ops,
 const struct wilc1000_hif_ops *hif_ops, int gpio);
-void __exit wilc_netdev_free(struct wilc *wilc1000_dev);
+void wilc_netdev_free(struct wilc *wilc1000_dev);
 
 void wilc_handle_isr(void);
 
@@ -340,7 +340,7 @@ extern bool wilc1000_enable_ps;
 int wilc1000_firmware_download(struct wilc *p_nic);
 int wilc1000_start_firmware(struct wilc_per_interface *nic);
 
-void __init wilc1000_init_driver(void);
-void __exit wilc1000_exit_driver(void);
+void wilc1000_init_driver(void);
+void wilc1000_exit_driver(void);
 
 #endif



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


Re: [PATCH v2 07/22] staging/rdma/hfi1: Fix sparse error in sdma.h file

2015-10-21 Thread Dan Carpenter
On Mon, Oct 19, 2015 at 10:11:22PM -0400, ira.we...@intel.com wrote:
> From: Niranjana Vishwanathapura 
> 
> Use NULL instead of 0 for pointer argument to fix the sparse error.
> 
> Reviewed-by: Mike Marciniszyn 
> Reviewed-by: Mitko Haralanov 
> Reviewed-by: Dennis Dalessandro 
> Signed-off-by: Niranjana Vishwanathapura 
> Signed-off-by: Ira Weiny 

This should have just been folded in with the previous patch.  Don't
introduce problems and fix them in the patchset.

regards,
dan carpenter

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


Re: [PATCH v2 01/22] staging/rdma/hfi1: Fix regression in send performance

2015-10-21 Thread Dan Carpenter
On Mon, Oct 19, 2015 at 10:11:16PM -0400, ira.we...@intel.com wrote:
> From: Mike Marciniszyn 
> 
> This additional call is a regression from qib.  For small messages the 
> progress
> routine always builds one and clears out the ahg state when the queue has gone
> to empty which is the predominant case for small messages.
> 
> Inline the routine to mitigate the call and move the routine to qp.h for scope
> reasons.
> 
> Reviewed-by: Dennis Dalessandro 
> Signed-off-by: Mike Marciniszyn 
> Signed-off-by: Ira Weiny 
> ---

The whole point of this patch is to do:

> - if (qp->s_sde)
> + if (qp->s_sde && qp->s_ahgidx >= 0)

It was not at all clear from the changelog and it was difficult to tell
because we moved code around as well.

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


Re: [PATCH] staging: wilc1000: fix the bug on copying bssid

2015-10-21 Thread Dan Carpenter
On Tue, Oct 20, 2015 at 05:10:46PM +0900, Tony Cho wrote:
> This patch reverts the commit, d79fd35b8c5d927695b48fa35aa586919818cce9.
> 
> The WID_JOIN_REQ_EXTENDED among WIDs needs two parameters for the request to
> be sent to the firmware, which are the SA and the BSSID. For this case, both
> is the same bssid in the handle_connect function. So, it's required to be
> copied twice.
> 

I forsaw this, but I should have been more explicit when I complained
about d79fd35b8c5d927695b48fa35aa586919818cce9...

regards,
dan carpenter

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


Re: [PATCH 00/19] staging/wilc1000 cleanups

2015-10-21 Thread Arnd Bergmann
On Wednesday 21 October 2015 19:06:52 glen lee wrote:
> Hi arnd,
> 
> Thanks for the all the patches. 
> About the patch ( use proper naming for global symbols ),
> We are planning to use this driver not only for wilc1000 but also for
> other atmel wireless driver. I'd appreciate if you could use wl instead of 
> wilc1000.

Hmm, while I see that 'wilc1000' is too specific here, using just 'wl' might be
a little too general. The same namespace is used by drivers/mtd/ubi/wl.c,
drivers/net/wireless/brcm80211/brcmfmac/cfg80211.c, and a number of local
identifiers in other drivers.

Would 'wilc' work as a prefix for all devices you are interested in here?

> And the global variable g_linux_wlan will be placed in netdevice private data
> and finally it will be removed. I already posted some of those patches.

Ok, so we need to coordinate a bit here. My patches also go in that direction
and remove the global variables from linux_wlan_sdio.c and linux_wlan_spi.c,
but did not remove the one from linux_wlan.c, because doing that depends on
the last [RFC] patch in my series, and I felt I had spent enough time on it
at that point ;-)

Would you be ok with taking my patches and rebasing them on top of yours
with the changes you want,  or do you need help from me with that?

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


Re: [PATCH 00/19] staging/wilc1000 cleanups

2015-10-21 Thread glen lee

Hi arnd,

Thanks for the all the patches. :)
About the patch ( use proper naming for global symbols ),
We are planning to use this driver not only for wilc1000 but also for
other atmel wireless driver. I'd appreciate if you could use wl instead of 
wilc1000.

And the global variable g_linux_wlan will be placed in netdevice private data
and finally it will be removed. I already posted some of those patches.

Thanks,
Glen.


On 2015년 10월 21일 07:47, Arnd Bergmann wrote:

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



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