Re: [PATCH] staging: comedi: amcc_s5933.h: tidy up comment issues

2016-04-12 Thread Ian Abbott

On 11/04/16 19:23, H Hartley Sweeten wrote:

Tidy up the comments to fix the checkpatch.pl isses:
WARNING: Block comments use * on subsequent lines
WARNING: line over 80 characters

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/amcc_s5933.h | 24 +++-
  1 file changed, 11 insertions(+), 13 deletions(-)



Thanks!

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] staging: comedi: plx9080.h: rename CamelCase enum value

2016-04-12 Thread Ian Abbott

On 11/04/16 19:18, H Hartley Sweeten wrote:

Rename the enum value to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: 

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/plx9080.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Thanks!

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] staging: comedi: comedi_8254.h: tidy up the register map defines

2016-04-12 Thread Ian Abbott

On 11/04/16 19:32, H Hartley Sweeten wrote:

Tidy up the defines to fix the checkpatch.pl issues:
CHECK: Prefer using the BIT macro

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
  drivers/staging/comedi/drivers/comedi_8254.h | 14 --
  1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_8254.h 
b/drivers/staging/comedi/drivers/comedi_8254.h
index f4610ea..a12c294 100644
--- a/drivers/staging/comedi/drivers/comedi_8254.h
+++ b/drivers/staging/comedi/drivers/comedi_8254.h
@@ -53,13 +53,15 @@ struct comedi_subdevice;
  #define I8254_COUNTER2_REG0x02
  #define I8254_CTRL_REG0x03
  #define I8254_CTRL_SEL_CTR(x) ((x) << 6)
-#define I8254_CTRL_READBACK_COUNT  ((3 << 6) | (1 << 4))
-#define I8254_CTRL_READBACK_STATUS ((3 << 6) | (1 << 5))
+#define I8254_CTRL_READBACK(x) (I8254_CTRL_SEL_CTR(3) | BIT(x))
+#define I8254_CTRL_READBACK_COUNT  I8254_CTRL_READBACK(4)
+#define I8254_CTRL_READBACK_STATUS I8254_CTRL_READBACK(5)
  #define I8254_CTRL_READBACK_SEL_CTR(x)(2 << (x))
-#define I8254_CTRL_LATCH   (0 << 4)
-#define I8254_CTRL_LSB_ONLY(1 << 4)
-#define I8254_CTRL_MSB_ONLY(2 << 4)
-#define I8254_CTRL_LSB_MSB (3 << 4)
+#define I8254_CTRL_RW(x)   (((x) & 0x3) << 4)
+#define I8254_CTRL_LATCH   I8254_CTRL_RW(0)
+#define I8254_CTRL_LSB_ONLYI8254_CTRL_RW(1)
+#define I8254_CTRL_MSB_ONLYI8254_CTRL_RW(2)
+#define I8254_CTRL_LSB_MSB I8254_CTRL_RW(3)

  /* counter maps zero to 0x1 */
  #define I8254_MAX_COUNT   0x1



Thanks!

It's also possible to latch (for readback) count and status at the same 
time (which requires 3 bytes to be read from the counter channel's data 
port to unlatch them both), although none of the drivers do that, I 
think, and they could just use I8254_CTRL_READBACK_COUNT | 
I8254_CTRL_READBACK_STATUS as the control word value if they wished to 
do so.


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 0/3] staging: comedi: ni_stc.h: fix checkpatch.pl issues

2016-04-12 Thread Ian Abbott

On 11/04/16 19:12, H Hartley Sweeten wrote:

Fix the checkpatch.pl issues in this file.

H Hartley Sweeten (3):
   staging: comedi: ni_stc.h: Prefer 'unsigned int' to bare use of 'unsigned'
   staging: comedi: ni_stc.h: Prefer kernel type 'u8' over 'uint8_t'
   staging: comedi: ni_stc.h: tidy up block comments

  drivers/staging/comedi/drivers/ni_stc.h | 45 -
  1 file changed, 22 insertions(+), 23 deletions(-)




Thanks!

Reviewed-by: Ian Abbott 

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


[PATCH] staging: lustre: libcfs: Fix libcfs_ioctl() prototype.

2016-04-12 Thread Aleksei Fedotov
Fix libcfs_ioctl() prototype according to its definition in
libcfs/module.c.

Signed-off-by: Aleksei Fedotov 
---
 drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h 
b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 9158c61..4141afb 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -106,7 +106,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler 
*hand);
 int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
 const struct libcfs_ioctl_hdr __user *uparam);
 int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
-int libcfs_ioctl(unsigned long cmd, void *arg);
+int libcfs_ioctl(unsigned long cmd, void __user *arg);
 
 /* container_of depends on "likely" which is defined in libcfs_private.h */
 static inline void *__container_of(void *ptr, unsigned long shift)
-- 
2.5.5

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


[PATCH] Staging: rtl8723au: removes void pointer in rtw_security.c

2016-04-12 Thread Ben Marsh
Remove a void pointer in rtw_security.c

Signed-off-by: Ben Marsh 
---
 drivers/staging/rtl8723au/core/rtw_security.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8723au/core/rtw_security.c 
b/drivers/staging/rtl8723au/core/rtw_security.c
index 038b57b..9d2a013 100644
--- a/drivers/staging/rtl8723au/core/rtw_security.c
+++ b/drivers/staging/rtl8723au/core/rtw_security.c
@@ -1619,7 +1619,7 @@ exit:
 
 void rtw_use_tkipkey_handler23a(void *FunctionContext)
 {
-   struct rtw_adapter *padapter = (struct rtw_adapter *)FunctionContext;
+   struct rtw_adapter *padapter = FunctionContext;
 
RT_TRACE(_module_rtl871x_security_c_, _drv_err_,
 "^^^%s ^^^\n", __func__);
-- 
1.9.1

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


Re: [PATCH] Staging: rtl8723au: removes void pointer in rtw_security.c

2016-04-12 Thread Greg KH
On Tue, Apr 12, 2016 at 01:30:55PM +0200, Ben Marsh wrote:
> Remove a void pointer in rtw_security.c

That's not what the patch does :(

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


[PATCH v2 1/2] staging: lustre: selftest: convert lstcon_test_t to proper struct

2016-04-12 Thread James Simmons
Turn typedef lstcon_test_t to proper structure

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/conctl.c  |2 +-
 drivers/staging/lustre/lnet/selftest/conrpc.c  |5 ++-
 drivers/staging/lustre/lnet/selftest/console.c |   26 
 drivers/staging/lustre/lnet/selftest/console.h |7 +++--
 4 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/conctl.c 
b/drivers/staging/lustre/lnet/selftest/conctl.c
index a76f1c3..408c614 100644
--- a/drivers/staging/lustre/lnet/selftest/conctl.c
+++ b/drivers/staging/lustre/lnet/selftest/conctl.c
@@ -743,7 +743,7 @@ static int lst_test_add_ioctl(lstio_test_args_t *args)
if (args->lstio_tes_param &&
(args->lstio_tes_param_len <= 0 ||
 args->lstio_tes_param_len >
-PAGE_SIZE - sizeof(lstcon_test_t)))
+PAGE_SIZE - sizeof(struct lstcon_test)))
return -EINVAL;
 
LIBCFS_ALLOC(batch_name, args->lstio_tes_bat_nmlen + 1);
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index 31d7b4f..bc96ef8 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -807,7 +807,7 @@ lstcon_bulkrpc_v1_prep(lst_test_bulk_param_t *param, 
srpc_test_reqst_t *req)
 
 int
 lstcon_testrpc_prep(struct lstcon_node *nd, int transop, unsigned feats,
-   lstcon_test_t *test, struct lstcon_rpc **crpc)
+   struct lstcon_test *test, struct lstcon_rpc **crpc)
 {
struct lstcon_group *sgrp = test->tes_src_grp;
struct lstcon_group *dgrp = test->tes_dst_grp;
@@ -1128,7 +1128,8 @@ lstcon_rpc_trans_ndlist(struct list_head *ndlist,
case LST_TRANS_TSBCLIADD:
case LST_TRANS_TSBSRVADD:
rc = lstcon_testrpc_prep(nd, transop, feats,
-(lstcon_test_t *)arg, &rpc);
+(struct lstcon_test *)arg,
+&rpc);
break;
case LST_TRANS_TSBRUN:
case LST_TRANS_TSBSTOP:
diff --git a/drivers/staging/lustre/lnet/selftest/console.c 
b/drivers/staging/lustre/lnet/selftest/console.c
index 03c73b0..6568e8e 100644
--- a/drivers/staging/lustre/lnet/selftest/console.c
+++ b/drivers/staging/lustre/lnet/selftest/console.c
@@ -934,7 +934,7 @@ lstcon_batch_info(char *name, lstcon_test_batch_ent_t 
__user *ent_up,
lstcon_test_batch_ent_t *entp;
struct list_head *clilst;
struct list_head *srvlst;
-   lstcon_test_t *test = NULL;
+   struct lstcon_test *test = NULL;
struct lstcon_batch *bat;
struct lstcon_ndlink*ndl;
int rc;
@@ -1091,14 +1091,14 @@ static void
 lstcon_batch_destroy(struct lstcon_batch *bat)
 {
struct lstcon_ndlink *ndl;
-   lstcon_test_t *test;
+   struct lstcon_test *test;
int i;
 
list_del(&bat->bat_link);
 
while (!list_empty(&bat->bat_test_list)) {
test = list_entry(bat->bat_test_list.next,
- lstcon_test_t, tes_link);
+ struct lstcon_test, tes_link);
LASSERT(list_empty(&test->tes_trans_list));
 
list_del(&test->tes_link);
@@ -1106,7 +1106,7 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
lstcon_group_decref(test->tes_src_grp);
lstcon_group_decref(test->tes_dst_grp);
 
-   LIBCFS_FREE(test, offsetof(lstcon_test_t,
+   LIBCFS_FREE(test, offsetof(struct lstcon_test,
   tes_param[test->tes_paramlen]));
}
 
@@ -1143,13 +1143,13 @@ lstcon_batch_destroy(struct lstcon_batch *bat)
 static int
 lstcon_testrpc_condition(int transop, struct lstcon_node *nd, void *arg)
 {
-   lstcon_test_t *test;
+   struct lstcon_test *test;
struct lstcon_batch *batch;
struct lstcon_ndlink *ndl;
struct list_head *hash;
struct list_head *head;
 
-   test = (lstcon_test_t *)arg;
+   test = (struct lstcon_test *)arg;
LASSERT(test);
 
batch = test->tes_batch;
@@ -1185,7 +1185,7 @@ lstcon_testrpc_condition(int transop, struct lstcon_node 
*nd, void *arg)
 }
 
 static int
-lstcon_test_nodes_add(lstcon_test_t *test, struct list_head __user *result_up)
+lstcon_test_nodes_add(struct lstcon_test *test, struct list_head __user 
*result_up)
 {
struct lstcon_rpc_trans *trans;
struct lstcon_group *grp;
@@ -1283,7 +1283,7 @@ lstcon_test_add(char *batch_name, int type, int loop,
void *param, int paramlen, int *retp,
struct list_head __user *result_up)
 {
-   lstcon_test_t *test = NULL;
+   struct lstcon_test *test = NULL;
int rc;
struct lstcon_group *src_g

[PATCH v2 2/2] staging: lustre: selftest: convert wire protocol to use struct

2016-04-12 Thread James Simmons
Change all the wire protocol typedefs to proper structures

Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lnet/selftest/brw_test.c  |   22 ++--
 drivers/staging/lustre/lnet/selftest/conrpc.c|   44 +++---
 drivers/staging/lustre/lnet/selftest/console.c   |   10 +-
 drivers/staging/lustre/lnet/selftest/framework.c |   54 
 drivers/staging/lustre/lnet/selftest/ping_test.c |   10 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |6 +-
 drivers/staging/lustre/lnet/selftest/rpc.h   |  150 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |   13 +-
 8 files changed, 155 insertions(+), 154 deletions(-)

diff --git a/drivers/staging/lustre/lnet/selftest/brw_test.c 
b/drivers/staging/lustre/lnet/selftest/brw_test.c
index 7f539f9..a63d86c 100644
--- a/drivers/staging/lustre/lnet/selftest/brw_test.c
+++ b/drivers/staging/lustre/lnet/selftest/brw_test.c
@@ -81,7 +81,7 @@ brw_client_init(struct sfw_test_instance *tsi)
LASSERT(tsi->tsi_is_client);
 
if (!(sn->sn_features & LST_FEAT_BULK_LEN)) {
-   test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0;
+   struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0;
 
opc = breq->blk_opc;
flags = breq->blk_flags;
@@ -92,7 +92,7 @@ brw_client_init(struct sfw_test_instance *tsi)
 */
len = npg * PAGE_SIZE;
} else {
-   test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
+   struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1;
 
/*
 * I should never get this step if it's unknown feature
@@ -261,7 +261,7 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu,
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_client_rpc *rpc;
-   srpc_brw_reqst_t *req;
+   struct srpc_brw_reqst *req;
int flags;
int npg;
int len;
@@ -272,14 +272,14 @@ brw_client_prep_rpc(struct sfw_test_unit *tsu,
LASSERT(bulk);
 
if (!(sn->sn_features & LST_FEAT_BULK_LEN)) {
-   test_bulk_req_t *breq = &tsi->tsi_u.bulk_v0;
+   struct test_bulk_req *breq = &tsi->tsi_u.bulk_v0;
 
opc = breq->blk_opc;
flags = breq->blk_flags;
npg = breq->blk_npg;
len = npg * PAGE_SIZE;
} else {
-   test_bulk_req_v1_t *breq = &tsi->tsi_u.bulk_v1;
+   struct test_bulk_req_v1 *breq = &tsi->tsi_u.bulk_v1;
 
/*
 * I should never get this step if it's unknown feature
@@ -319,8 +319,8 @@ brw_client_done_rpc(struct sfw_test_unit *tsu, struct 
srpc_client_rpc *rpc)
struct sfw_test_instance *tsi = tsu->tsu_instance;
struct sfw_session *sn = tsi->tsi_batch->bat_session;
struct srpc_msg *msg = &rpc->crpc_replymsg;
-   srpc_brw_reply_t *reply = &msg->msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
+   struct srpc_brw_reply *reply = &msg->msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst = &rpc->crpc_reqstmsg.msg_body.brw_reqst;
 
LASSERT(sn);
 
@@ -382,8 +382,8 @@ static int
 brw_bulk_ready(struct srpc_server_rpc *rpc, int status)
 {
__u64 magic = BRW_MAGIC;
-   srpc_brw_reply_t *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst;
+   struct srpc_brw_reply *reply = &rpc->srpc_replymsg.msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst;
struct srpc_msg *reqstmsg;
 
LASSERT(rpc->srpc_bulk);
@@ -420,8 +420,8 @@ brw_server_handle(struct srpc_server_rpc *rpc)
struct srpc_service *sv = rpc->srpc_scd->scd_svc;
struct srpc_msg *replymsg = &rpc->srpc_replymsg;
struct srpc_msg *reqstmsg = &rpc->srpc_reqstbuf->buf_msg;
-   srpc_brw_reply_t *reply = &replymsg->msg_body.brw_reply;
-   srpc_brw_reqst_t *reqst = &reqstmsg->msg_body.brw_reqst;
+   struct srpc_brw_reply *reply = &replymsg->msg_body.brw_reply;
+   struct srpc_brw_reqst *reqst = &reqstmsg->msg_body.brw_reqst;
int npg;
int rc;
 
diff --git a/drivers/staging/lustre/lnet/selftest/conrpc.c 
b/drivers/staging/lustre/lnet/selftest/conrpc.c
index bc96ef8..6f68758 100644
--- a/drivers/staging/lustre/lnet/selftest/conrpc.c
+++ b/drivers/staging/lustre/lnet/selftest/conrpc.c
@@ -390,7 +390,7 @@ lstcon_rpc_get_reply(struct lstcon_rpc *crpc, struct 
srpc_msg **msgpp)
 {
struct lstcon_node *nd = crpc->crp_node;
struct srpc_client_rpc *rpc = crpc->crp_rpc;
-   srpc_generic_reply_t *rep;
+   struct srpc_generic_reply *rep;
 
LASSERT(nd && rpc);
LASSERT(crpc->crp_stamp);
@@ -473,7 +473,7 @@ lstcon_rpc_trans_interpreter(struct lstcon_rpc_trans *trans,
struct list_head tmp;
struct list_head __user *next;
lstcon_rpc_ent_t *ent;
-   srpc_generic_reply_t *rep;

[PATCH v2 0/2] staging: lustre: selftest: remove typedefs

2016-04-12 Thread James Simmons
Convert the remaining typedefs into their proper data types.

Changelog:

v1) Based on 4.6-rc1 staging tree. Most patches were merged.

v2) Rebased on 4.6-rc3 due to PAGE_CACHE_* going away.

James Simmons (2):
  staging: lustre: selftest: convert lstcon_test_t to proper struct
  staging: lustre: selftest: convert wire protocol to use struct

 drivers/staging/lustre/lnet/selftest/brw_test.c  |   22 ++--
 drivers/staging/lustre/lnet/selftest/conctl.c|2 +-
 drivers/staging/lustre/lnet/selftest/conrpc.c|   49 
 drivers/staging/lustre/lnet/selftest/console.c   |   36 +++---
 drivers/staging/lustre/lnet/selftest/console.h   |7 +-
 drivers/staging/lustre/lnet/selftest/framework.c |   54 
 drivers/staging/lustre/lnet/selftest/ping_test.c |   10 +-
 drivers/staging/lustre/lnet/selftest/rpc.c   |6 +-
 drivers/staging/lustre/lnet/selftest/rpc.h   |  150 +++---
 drivers/staging/lustre/lnet/selftest/selftest.h  |   13 +-
 10 files changed, 176 insertions(+), 173 deletions(-)

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


Re: [PATCH] staging: lustre: libcfs: Fix libcfs_ioctl() prototype.

2016-04-12 Thread James Simmons

> Fix libcfs_ioctl() prototype according to its definition in
> libcfs/module.c.
> 
> Signed-off-by: Aleksei Fedotov 

Acked-by: James Simmons 

> ---
>  drivers/staging/lustre/include/linux/libcfs/libcfs.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h 
> b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> index 9158c61..4141afb 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> @@ -106,7 +106,7 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler 
> *hand);
>  int libcfs_ioctl_getdata(struct libcfs_ioctl_hdr **hdr_pp,
>const struct libcfs_ioctl_hdr __user *uparam);
>  int libcfs_ioctl_data_adjust(struct libcfs_ioctl_data *data);
> -int libcfs_ioctl(unsigned long cmd, void *arg);
> +int libcfs_ioctl(unsigned long cmd, void __user *arg);
>  
>  /* container_of depends on "likely" which is defined in libcfs_private.h */
>  static inline void *__container_of(void *ptr, unsigned long shift)
> -- 
> 2.5.5
> 
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 18/18] staging: lustre: osc: Lustre returns EINTR from writes when SA_RESTART is set

2016-04-12 Thread James Simmons

> Some of this series didn't apply, due to merge issues with 4.6-rc3.  Can
> you rebase and resend the remaining patches?

This patch conflicts with a patch landed from Oleg which is a better 
solution for this bug. We can drop this patch.

> 
> thanks,
> 
> greg k-h
> 
> On Mon, Apr 04, 2016 at 09:37:03PM -0400, James Simmons wrote:
> > When Lustre is in a read or write system call and receives a
> > SIGALRM, it will return EINTR if interrupted in osc_enter_cache.
> > This prevents the system call from being restarted if
> > SA_RESTART is set in the handler.
> > 
> > This patch changes behavior in this location to return ERESTARTSYS
> > when a signal arrives during the call to l_wait_event.
> > 
> > Signed-off-by: Patrick Farrell 
> > Signed-off-by: James Simmons 
> > ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-3581
> > Reviewed-on: http://review.whamcloud.com/7002
> > Reviewed-by: Rahul Deshmukh 
> > Reviewed-by: Cory Spitz 
> > Reviewed-by: Andreas Dilger 
> > Signed-off-by: James Simmons 
> > ---
> >  drivers/staging/lustre/lustre/osc/osc_cache.c |   13 -
> >  1 files changed, 12 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c 
> > b/drivers/staging/lustre/lustre/osc/osc_cache.c
> > index f09b89d..956d57b 100644
> > --- a/drivers/staging/lustre/lustre/osc/osc_cache.c
> > +++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
> > @@ -1626,11 +1626,22 @@ static int osc_enter_cache(const struct lu_env 
> > *env, struct client_obd *cli,
> >  
> > /* l_wait_event is interrupted by signal, or timed out */
> > if (rc < 0) {
> > -   if (rc == -ETIMEDOUT) {
> > +   switch (rc) {
> > +   case -ETIMEDOUT:
> > OSC_DUMP_GRANT(D_ERROR, cli,
> >"try to reserve %d.\n", bytes);
> > osc_extent_tree_dump(D_ERROR, osc);
> > rc = -EDQUOT;
> > +   break;
> > +   case -EINTR:
> > +   /* Ensures restartability - LU-3581 */
> > +   rc = -ERESTARTSYS;
> > +   break;
> > +   default:
> > +   CDEBUG(D_CACHE, "%s: event for cache space @ %p 
> > never arrived due to %d\n",
> > +  cli->cl_import->imp_obd->obd_name,
> > +  &ocw, rc);
> > +   break;
> > }
> > list_del_init(&ocw.ocw_entry);
> > goto out;
> > -- 
> > 1.7.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2 00/16] staging : lustre : rest of missing patches from 2.5.0 release

2016-04-12 Thread James Simmons
This is the last collection of missing fixes present in the
Lustre 2.5.0 release. Once these are merged the upstream
client will be equal to the pre-2.6 lustre version since the
major of clio cleanups from that time frame have already
landed.

changelog:

v1) Based on 4.6-rc1.

v2) Rebased for 4.6-rc3. Patch for lloop was dropped. Updated
to handle PAGE_CACHE_* changes.

Andrew Perepechko (3):
  staging: lustre: llite: variable rename in namei.c
  staging: lustre: llite: speedup in unlink/rmdir
  staging: lustre: lprocfs: implement log2 using bitops

Andriy Skulysh (1):
  staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY

Bobi Jam (1):
  staging: lustre: obd: MDT mount fails on MDS w/o MGS on it

Bruno Faccini (3):
  staging: lustre: ldlm: Fix a race during FLock handling
  staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance
  staging: lustre: lov: return minimal FIEMAP for released files

Jinshan Xiong (3):
  staging: lustre: llite: error setting max_cache_mb at mount time
  staging: lustre: llite: Truncate to restore file
  staging: lustre: osc: osc_extent_wait() shouldn't be interruptible

John L. Hammond (2):
  staging: lustre: hsm: permission checks for HSM ioctl operations
  staging: lustre: hsm: don't use real suppgid

Niu Yawei (1):
  staging: lustre: clio: incorrect assertions in 'enable-invariants'

Sebastien Buisson (1):
  staging: lustre: osc: fix race issues thanks to oap_lock

Swapnil Pimpale (1):
  staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init()

 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c|   15 +++--
 drivers/staging/lustre/lustre/llite/dir.c  |3 +
 drivers/staging/lustre/lustre/llite/file.c |5 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|   60 +--
 drivers/staging/lustre/lustre/llite/lproc_llite.c  |4 +-
 drivers/staging/lustre/lustre/llite/namei.c|   65 ++--
 drivers/staging/lustre/lustre/llite/vvp_io.c   |5 +-
 drivers/staging/lustre/lustre/lov/lov_obd.c|   21 ++
 drivers/staging/lustre/lustre/lov/lov_request.c|7 ++-
 drivers/staging/lustre/lustre/mdc/mdc_locks.c  |4 +-
 drivers/staging/lustre/lustre/mdc/mdc_request.c|   17 +++--
 drivers/staging/lustre/lustre/mgc/mgc_request.c|5 +-
 drivers/staging/lustre/lustre/obdclass/cl_page.c   |5 +-
 .../lustre/lustre/obdclass/lprocfs_status.c|6 +-
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   13 +++--
 drivers/staging/lustre/lustre/osc/osc_cache.c  |   10 +++-
 drivers/staging/lustre/lustre/osc/osc_io.c |2 +
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c |5 +-
 19 files changed, 155 insertions(+), 99 deletions(-)

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


[PATCH v2 01/16] staging: lustre: osc: fix race issues thanks to oap_lock

2016-04-12 Thread James Simmons
From: Sebastien Buisson 

Fix 'data race condition' defects found by Coverity version 6.5.0:

Data race condition (MISSING_LOCK)

Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

This patch is dedicated to code fragments involving oap_lock.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6572
Reviewed-by: Oleg Drokin 
Reviewed-by: Andreas Dilger 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/osc/osc_cache.c |8 
 drivers/staging/lustre/lustre/osc/osc_io.c|2 ++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c 
b/drivers/staging/lustre/lustre/osc/osc_cache.c
index ef68821..a5743b4 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -1147,7 +1147,9 @@ static int osc_extent_make_ready(const struct lu_env *env,
last->oap_count = osc_refresh_count(env, last, OBD_BRW_WRITE);
LASSERT(last->oap_count > 0);
LASSERT(last->oap_page_off + last->oap_count <= PAGE_SIZE);
+   spin_lock(&last->oap_lock);
last->oap_async_flags |= ASYNC_COUNT_STABLE;
+   spin_unlock(&last->oap_lock);
}
 
/* for the rest of pages, we don't need to call osf_refresh_count()
@@ -1156,7 +1158,9 @@ static int osc_extent_make_ready(const struct lu_env *env,
list_for_each_entry(oap, &ext->oe_pages, oap_pending_item) {
if (!(oap->oap_async_flags & ASYNC_COUNT_STABLE)) {
oap->oap_count = PAGE_SIZE - oap->oap_page_off;
+   spin_lock(&last->oap_lock);
oap->oap_async_flags |= ASYNC_COUNT_STABLE;
+   spin_unlock(&last->oap_lock);
}
}
 
@@ -2328,6 +2332,10 @@ int osc_queue_async_io(const struct lu_env *env, struct 
cl_io *io,
oap->oap_cmd = cmd;
oap->oap_page_off = ops->ops_from;
oap->oap_count = ops->ops_to - ops->ops_from;
+   /*
+* No need to hold a lock here,
+* since this page is not in any list yet.
+*/
oap->oap_async_flags = 0;
oap->oap_brw_flags = brw_flags;
 
diff --git a/drivers/staging/lustre/lustre/osc/osc_io.c 
b/drivers/staging/lustre/lustre/osc/osc_io.c
index c1efcb3..39c3930 100644
--- a/drivers/staging/lustre/lustre/osc/osc_io.c
+++ b/drivers/staging/lustre/lustre/osc/osc_io.c
@@ -168,8 +168,10 @@ static int osc_io_submit(const struct lu_env *env,
}
 
cl_page_list_move(qout, qin, page);
+   spin_lock(&oap->oap_lock);
oap->oap_async_flags = ASYNC_URGENT|ASYNC_READY;
oap->oap_async_flags |= ASYNC_COUNT_STABLE;
+   spin_unlock(&oap->oap_lock);
 
osc_page_submit(env, opg, crt, brw_flags);
list_add_tail(&oap->oap_pending_item, &list);
-- 
1.7.1

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


[PATCH v2 02/16] staging: lustre: clio: incorrect assertions in 'enable-invariants'

2016-04-12 Thread James Simmons
From: Niu Yawei 

Fixed several incorrect assumptions in 'enable-invariants'.

Signed-off-by: Niu Yawei 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3521
Reviewed-on: http://review.whamcloud.com/6832
Reviewed-by: Bobi Jam 
Reviewed-by: Jinshan Xiong 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/obdclass/cl_page.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/cl_page.c 
b/drivers/staging/lustre/lustre/obdclass/cl_page.c
index 39095e7..b754f51 100644
--- a/drivers/staging/lustre/lustre/obdclass/cl_page.c
+++ b/drivers/staging/lustre/lustre/obdclass/cl_page.c
@@ -498,7 +498,7 @@ void cl_page_disown0(const struct lu_env *env,
 
state = pg->cp_state;
PINVRNT(env, pg, state == CPS_OWNED || state == CPS_FREEING);
-   PINVRNT(env, pg, cl_page_invariant(pg));
+   PINVRNT(env, pg, cl_page_invariant(pg) || state == CPS_FREEING);
cl_page_owner_clear(pg);
 
if (state == CPS_OWNED)
@@ -670,7 +670,8 @@ EXPORT_SYMBOL(cl_page_unassume);
 void cl_page_disown(const struct lu_env *env,
struct cl_io *io, struct cl_page *pg)
 {
-   PINVRNT(env, pg, cl_page_is_owned(pg, io));
+   PINVRNT(env, pg, cl_page_is_owned(pg, io) ||
+   pg->cp_state == CPS_FREEING);
 
io = cl_io_top(io);
cl_page_disown0(env, io, pg);
-- 
1.7.1

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


[PATCH v2 11/16] staging: lustre: osc: osc_extent_wait() shouldn't be interruptible

2016-04-12 Thread James Simmons
From: Jinshan Xiong 

Otherwise it will hit the assertion at cl_lock.c:

 cl_lock.c:1967:discard_cb())
  ASSERTION( (!(page->cp_type == CPT_CACHEABLE) ||
  (!PageWriteback(cl_page_vmpage(env, page ) failed:

This is because in osc_lock_flush() we have to make sure the IO
is finished before discarding the pages.

Signed-off-by: Jinshan Xiong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2779
Reviewed-on: http://review.whamcloud.com/5419
Reviewed-by: Bobi Jam 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/osc/osc_cache.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/osc/osc_cache.c 
b/drivers/staging/lustre/lustre/osc/osc_cache.c
index a5743b4..9723197 100644
--- a/drivers/staging/lustre/lustre/osc/osc_cache.c
+++ b/drivers/staging/lustre/lustre/osc/osc_cache.c
@@ -965,7 +965,7 @@ static int osc_extent_wait(const struct lu_env *env, struct 
osc_extent *ext,
"%s: wait ext to %d timedout, recovery in progress?\n",
osc_export(obj)->exp_obd->obd_name, state);
 
-   lwi = LWI_INTR(LWI_ON_SIGNAL_NOOP, NULL);
+   lwi = LWI_INTR(NULL, NULL);
rc = l_wait_event(ext->oe_waitq, extent_wait_cb(ext, state),
  &lwi);
}
-- 
1.7.1

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


[PATCH v2 07/16] staging: lustre: llite: error setting max_cache_mb at mount time

2016-04-12 Thread James Simmons
From: Jinshan Xiong 

The root cause is that when max_cache_mb conf parameter is applied,
the client isn't connected to the OST yet so that sbi->ll_dt_exp is
NULL. However, it's not necessary to shrink the cache memory in this
case so success should be returned.

Signed-off-by: Jinshan Xiong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3676
Reviewed-on: http://review.whamcloud.com/7194
Reviewed-by: Andreas Dilger 
Reviewed-by: Bobi Jam 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/lproc_llite.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/lproc_llite.c 
b/drivers/staging/lustre/lustre/llite/lproc_llite.c
index d99d8c3..b085879 100644
--- a/drivers/staging/lustre/lustre/llite/lproc_llite.c
+++ b/drivers/staging/lustre/lustre/llite/lproc_llite.c
@@ -461,8 +461,8 @@ static ssize_t ll_max_cached_mb_seq_write(struct file *file,
break;
 
if (!sbi->ll_dt_exp) { /* being initialized */
-   rc = -ENODEV;
-   break;
+   rc = 0;
+   goto out;
}
 
/* difficult - have to ask OSCs to drop LRU slots. */
-- 
1.7.1

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


[PATCH v2 06/16] staging: lustre: llite: speedup in unlink/rmdir

2016-04-12 Thread James Simmons
From: Andrew Perepechko 

Assume dchild argument is fully initialized in ->unlink and
->rmdir callbacks, so additional lookup for ELC is not needed.

Signed-off-by: Andrew Perepechko 
Reviewed-by: Alexander Boyko 
Reviewed-by: Vitaly Fertman 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Xyratex-bug-id: MRP-1027
Reviewed-on: http://review.whamcloud.com/6648
Reviewed-by: Fan Yong 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/namei.c |   21 +++--
 1 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 73e61cf..9fa862b 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -847,12 +847,6 @@ static int ll_create_nd(struct inode *dir, struct dentry 
*dentry,
return rc;
 }
 
-static inline void ll_get_child_fid(struct dentry *child, struct lu_fid *fid)
-{
-   if (d_really_is_positive(child))
-   *fid = *ll_inode2fid(d_inode(child));
-}
-
 int ll_objects_destroy(struct ptlrpc_request *request, struct inode *dir)
 {
struct mdt_body *body;
@@ -945,7 +939,9 @@ static int ll_unlink(struct inode *dir, struct dentry 
*dchild)
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(dchild, &op_data->op_fid3);
+   if (dchild && dchild->d_inode)
+   op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
+
op_data->op_fid2 = op_data->op_fid3;
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
@@ -995,7 +991,9 @@ static int ll_rmdir(struct inode *dir, struct dentry 
*dchild)
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(dchild, &op_data->op_fid3);
+   if (dchild && dchild->d_inode)
+   op_data->op_fid3 = *ll_inode2fid(dchild->d_inode);
+
op_data->op_fid2 = op_data->op_fid3;
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
@@ -1076,8 +1074,11 @@ static int ll_rename(struct inode *src, struct dentry 
*src_dchild,
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(src_dchild, &op_data->op_fid3);
-   ll_get_child_fid(tgt_dchild, &op_data->op_fid4);
+   if (src_dchild && src_dchild->d_inode)
+   op_data->op_fid3 = *ll_inode2fid(src_dchild->d_inode);
+   if (tgt_dchild && tgt_dchild->d_inode)
+   op_data->op_fid4 = *ll_inode2fid(tgt_dchild->d_inode);
+
err = md_rename(sbi->ll_md_exp, op_data,
src_dchild->d_name.name,
src_dchild->d_name.len,
-- 
1.7.1

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


[PATCH v2 08/16] staging: lustre: obd: MDT mount fails on MDS w/o MGS on it

2016-04-12 Thread James Simmons
From: Bobi Jam 

If we specify multiple --mgsnode for a MDT, when we start MDS upon
it while MGS is no the other node, the MGC import connection will
always select the local nid (which is one of the candidate mgsnode)
since it think its the closest connection.

This patch treats further --mgsnode nids as failover nids, so that
multiple import connections are added for the MGC import.

Signed-off-by: Bobi Jam 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3829
Reviewed-on: http://review.whamcloud.com/7509
Reviewed-by: Liang Zhen 
Reviewed-by: Lai Siyao 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/obdclass/obd_mount.c |   13 -
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c 
b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
index d3e28a3..9474aa9 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c
@@ -307,7 +307,8 @@ int lustre_start_mgc(struct super_block *sb)
while (class_parse_nid(ptr, &nid, &ptr) == 0) {
rc = do_lcfg(mgcname, nid,
 LCFG_ADD_UUID, niduuid, NULL, NULL, NULL);
-   i++;
+   if (!rc)
+   i++;
/* Stop at the first failover nid */
if (*ptr == ':')
break;
@@ -345,16 +346,18 @@ int lustre_start_mgc(struct super_block *sb)
sprintf(niduuid, "%s_%x", mgcname, i);
j = 0;
while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
-   j++;
-   rc = do_lcfg(mgcname, nid,
-LCFG_ADD_UUID, niduuid, NULL, NULL, NULL);
+   rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID, niduuid,
+NULL, NULL, NULL);
+   if (!rc)
+   ++j;
if (*ptr == ':')
break;
}
if (j > 0) {
rc = do_lcfg(mgcname, 0, LCFG_ADD_CONN,
 niduuid, NULL, NULL, NULL);
-   i++;
+   if (!rc)
+   i++;
} else {
/* at ":/fsname" */
break;
-- 
1.7.1

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


[PATCH v2 14/16] staging: lustre: lov: Don't wait for active target with OBD_STATFS_NODELAY

2016-04-12 Thread James Simmons
From: Andriy Skulysh 

Patch for LU-631 which was landed before the upstream merge broke
OBD_STATFS_NODELAY behaviour. It adds unnecessary delay while
running df command with inactive OSTs. We shouldn't try to recover
connection to OST in this case.

Signed-off-by: Andriy Skulysh 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4010
Reviewed-on: http://review.whamcloud.com/7762
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/lov/lov_request.c |7 +--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
b/drivers/staging/lustre/lustre/lov/lov_request.c
index 7178a02..475ca2f 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -716,12 +716,15 @@ int lov_prep_statfs_set(struct obd_device *obd, struct 
obd_info *oinfo,
struct lov_request *req;
 
if (!lov->lov_tgts[i] ||
-   (!lov_check_and_wait_active(lov, i) &&
-(oinfo->oi_flags & OBD_STATFS_NODELAY))) {
+   (oinfo->oi_flags & OBD_STATFS_NODELAY &&
+!lov->lov_tgts[i]->ltd_active)) {
CDEBUG(D_HA, "lov idx %d inactive\n", i);
continue;
}
 
+   if (!lov->lov_tgts[i]->ltd_active)
+   lov_check_and_wait_active(lov, i);
+
/* skip targets that have been explicitly disabled by the
 * administrator
 */
-- 
1.7.1

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


[PATCH v2 12/16] staging: lustre: lprocfs: implement log2 using bitops

2016-04-12 Thread James Simmons
From: Andrew Perepechko 

This patch implements log2 using fls.

Signed-off-by: Andrew Perepechko 
Reviewed-by: Alexander Boyko 
Reviewed-by: alexander_zarochent...@xyratex.com
Reviewed-by: Vitaly Fertman 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3496
Xyratex-bug-id: MRP-999
Reviewed-on: http://review.whamcloud.com/6757
Reviewed-by: John L. Hammond 
Reviewed-by: Bob Glossman 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 .../lustre/lustre/obdclass/lprocfs_status.c|6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index 9824c88..b2f309d 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -1472,10 +1472,10 @@ EXPORT_SYMBOL(lprocfs_oh_tally);
 
 void lprocfs_oh_tally_log2(struct obd_histogram *oh, unsigned int value)
 {
-   unsigned int val;
+   unsigned int val = 0;
 
-   for (val = 0; ((1 << val) < value) && (val <= OBD_HIST_MAX); val++)
-   ;
+   if (likely(value != 0))
+   val = min(fls(value - 1), OBD_HIST_MAX);
 
lprocfs_oh_tally(oh, val);
 }
-- 
1.7.1

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


[PATCH v2 09/16] staging: lustre: ptlrpc: return a meaningful status from ptlrpcd_init()

2016-04-12 Thread James Simmons
From: Swapnil Pimpale 

This patch has the following:
1) Fix for the return value from ptlrpcd_init(). It will now return a
   correct status instead of returning zero always.
2) ptlrpcd_addref() should not increment ptlrpcd_users on error.
3) Added code in a mdc_setup() and mgc_setup() to test the return
   value of ptlrpcd_addref() and return on error.

Signed-off-by: Swapnil Pimpale 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3808
Reviewed-on: http://review.whamcloud.com/7522
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |9 ++---
 drivers/staging/lustre/lustre/mgc/mgc_request.c |5 -
 drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c  |5 -
 3 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c 
b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 6023c2c..5f1ac58 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -2314,12 +2314,14 @@ static int mdc_setup(struct obd_device *obd, struct 
lustre_cfg *cfg)
return -ENOMEM;
mdc_init_rpc_lock(cli->cl_rpc_lock);
 
-   ptlrpcd_addref();
+   rc = ptlrpcd_addref();
+   if (rc < 0)
+   goto err_rpc_lock;
 
cli->cl_close_lock = kzalloc(sizeof(*cli->cl_close_lock), GFP_NOFS);
if (!cli->cl_close_lock) {
rc = -ENOMEM;
-   goto err_rpc_lock;
+   goto err_ptlrpcd_decref;
}
mdc_init_rpc_lock(cli->cl_close_lock);
 
@@ -2345,9 +2347,10 @@ static int mdc_setup(struct obd_device *obd, struct 
lustre_cfg *cfg)
 
 err_close_lock:
kfree(cli->cl_close_lock);
+err_ptlrpcd_decref:
+   ptlrpcd_decref();
 err_rpc_lock:
kfree(cli->cl_rpc_lock);
-   ptlrpcd_decref();
return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/mgc/mgc_request.c 
b/drivers/staging/lustre/lustre/mgc/mgc_request.c
index 3924b09..0f75040 100644
--- a/drivers/staging/lustre/lustre/mgc/mgc_request.c
+++ b/drivers/staging/lustre/lustre/mgc/mgc_request.c
@@ -734,7 +734,9 @@ static int mgc_setup(struct obd_device *obd, struct 
lustre_cfg *lcfg)
struct task_struct *task;
int rc;
 
-   ptlrpcd_addref();
+   rc = ptlrpcd_addref();
+   if (rc < 0)
+   goto err_noref;
 
rc = client_obd_setup(obd, lcfg);
if (rc)
@@ -773,6 +775,7 @@ err_cleanup:
client_obd_cleanup(obd);
 err_decref:
ptlrpcd_decref();
+err_noref:
return rc;
 }
 
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c 
b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
index dbc3376..76a355a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
@@ -909,8 +909,11 @@ int ptlrpcd_addref(void)
int rc = 0;
 
mutex_lock(&ptlrpcd_mutex);
-   if (++ptlrpcd_users == 1)
+   if (++ptlrpcd_users == 1) {
rc = ptlrpcd_init();
+   if (rc < 0)
+   ptlrpcd_users--;
+   }
mutex_unlock(&ptlrpcd_mutex);
return rc;
 }
-- 
1.7.1

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


[PATCH v2 13/16] staging: lustre: lov: return minimal FIEMAP for released files

2016-04-12 Thread James Simmons
From: Bruno Faccini 

Since st_blocks = NULL is returned for released files, FIEMAP
should at least return a minimal mapping to make users aware
that file contains data but it is not immediately available.
This will make coreutils and tools such tar happy and have
them presume file is sparse.

Also, add a new test_228 in sanity-hsm to verify it works
for "[cp,tar] --sparse" commands.

Also fix a LBUG ("lov_fiemap()) ASSERTION( fm_local ) failed")
likely to occur when no-object/ENOMEM conditions and also now
when released.

Signed-off-by: Bruno Faccini 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3864
Reviewed-on: http://review.whamcloud.com/7584
Reviewed-by: Andreas Dilger 
Reviewed-by: Aurelien Degremont 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/lov/lov_obd.c |   21 +
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c 
b/drivers/staging/lustre/lustre/lov/lov_obd.c
index 1a9e3e8..9b72671 100644
--- a/drivers/staging/lustre/lustre/lov/lov_obd.c
+++ b/drivers/staging/lustre/lustre/lov/lov_obd.c
@@ -1733,6 +1733,27 @@ static int lov_fiemap(struct lov_obd *lov, __u32 keylen, 
void *key,
unsigned int buffer_size = FIEMAP_BUFFER_SIZE;
 
if (!lsm_has_objects(lsm)) {
+   if (lsm && lsm_is_released(lsm) && (fm_key->fiemap.fm_start <
+   fm_key->oa.o_size)) {
+   /*
+* released file, return a minimal FIEMAP if
+* request fits in file-size.
+*/
+   fiemap->fm_mapped_extents = 1;
+   fiemap->fm_extents[0].fe_logical =
+   fm_key->fiemap.fm_start;
+   if (fm_key->fiemap.fm_start + fm_key->fiemap.fm_length <
+   fm_key->oa.o_size) {
+   fiemap->fm_extents[0].fe_length =
+   fm_key->fiemap.fm_length;
+   } else {
+   fiemap->fm_extents[0].fe_length =
+   fm_key->oa.o_size - 
fm_key->fiemap.fm_start;
+   fiemap->fm_extents[0].fe_flags |=
+   (FIEMAP_EXTENT_UNKNOWN |
+FIEMAP_EXTENT_LAST);
+   }
+   }
rc = 0;
goto out;
}
-- 
1.7.1

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


[PATCH v2 15/16] staging: lustre: hsm: permission checks for HSM ioctl operations

2016-04-12 Thread James Simmons
From: John L. Hammond 

In the LL_IOC_HSM_CT_START case of ll_dir_ioctl() require
CAP_SYS_ADMIN, since the local handler for this ioctl may modify the
global KUC table.

Signed-off-by: John L. Hammond 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866
Reviewed-on: http://review.whamcloud.com/7565
Reviewed-by: Aurelien Degremont 
Reviewed-by: Faccini Bruno 
Reviewed-by: Jinshan Xiong 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/dir.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/dir.c 
b/drivers/staging/lustre/lustre/llite/dir.c
index 2f0873e..ca4d5eb 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -1845,6 +1845,9 @@ out_quotactl:
return rc;
}
case LL_IOC_HSM_CT_START:
+   if (!capable(CFS_CAP_SYS_ADMIN))
+   return -EPERM;
+
rc = copy_and_ioctl(cmd, sbi->ll_md_exp, (void __user *)arg,
sizeof(struct lustre_kernelcomm));
return rc;
-- 
1.7.1

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


[PATCH v2 16/16] staging: lustre: hsm: don't use real suppgid

2016-04-12 Thread James Simmons
From: John L. Hammond 

In the MDC HSM handlers that do not pack a real suppgid, use -1 rather
than 0 for the suppgid in mdt_body.

Signed-off-by: John L. Hammond 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3866
Reviewed-on: http://review.whamcloud.com/7565
Reviewed-by: Aurelien Degremont 
Reviewed-by: Faccini Bruno 
Reviewed-by: Jinshan Xiong 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/mdc/mdc_request.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c 
b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 5f1ac58..46e3a75 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -1169,7 +1169,7 @@ static int mdc_ioc_hsm_progress(struct obd_export *exp,
goto out;
}
 
-   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
/* Copy hsm_progress struct */
req_hpk = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_PROGRESS);
@@ -1203,7 +1203,7 @@ static int mdc_ioc_hsm_ct_register(struct obd_import 
*imp, __u32 archives)
goto out;
}
 
-   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
/* Copy hsm_progress struct */
archive_mask = req_capsule_client_get(&req->rq_pill,
@@ -1278,7 +1278,7 @@ static int mdc_ioc_hsm_ct_unregister(struct obd_import 
*imp)
goto out;
}
 
-   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
ptlrpc_request_set_replen(req);
 
@@ -1395,7 +1395,7 @@ static int mdc_ioc_hsm_request(struct obd_export *exp,
return rc;
}
 
-   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, 0, 0);
+   mdc_pack_body(req, NULL, OBD_MD_FLRMTPERM, 0, -1, 0);
 
/* Copy hsm_request struct */
req_hr = req_capsule_client_get(&req->rq_pill, &RMF_MDS_HSM_REQUEST);
-- 
1.7.1

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


[PATCH v2 05/16] staging: lustre: llite: variable rename in namei.c

2016-04-12 Thread James Simmons
From: Andrew Perepechko 

With the patch 6648 a fee variables were renamed. We do these
renames in broken out patch to the fix obvious.

Signed-off-by: Andrew Perepechko 
Reviewed-by: Alexander Boyko 
Reviewed-by: Vitaly Fertman 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3473
Xyratex-bug-id: MRP-1027
Reviewed-on: http://review.whamcloud.com/6648
Reviewed-by: Fan Yong 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/namei.c |   52 +-
 1 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/namei.c 
b/drivers/staging/lustre/lustre/llite/namei.c
index 8561707..73e61cf 100644
--- a/drivers/staging/lustre/lustre/llite/namei.c
+++ b/drivers/staging/lustre/lustre/llite/namei.c
@@ -929,23 +929,23 @@ out:
  * is any lock existing. They will recycle dentries and inodes based upon locks
  * too. b=20433
  */
-static int ll_unlink(struct inode *dir, struct dentry *dentry)
+static int ll_unlink(struct inode *dir, struct dentry *dchild)
 {
struct ptlrpc_request *request = NULL;
struct md_op_data *op_data;
int rc;
 
CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
-  dentry, dir->i_ino, dir->i_generation, dir);
+  dchild, dir->i_ino, dir->i_generation, dir);
 
op_data = ll_prep_md_op_data(NULL, dir, NULL,
-dentry->d_name.name,
-dentry->d_name.len,
+dchild->d_name.name,
+dchild->d_name.len,
 0, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(dentry, &op_data->op_fid3);
+   ll_get_child_fid(dchild, &op_data->op_fid3);
op_data->op_fid2 = op_data->op_fid3;
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
@@ -979,23 +979,23 @@ static int ll_mkdir(struct inode *dir, struct dentry 
*dentry, umode_t mode)
return err;
 }
 
-static int ll_rmdir(struct inode *dir, struct dentry *dentry)
+static int ll_rmdir(struct inode *dir, struct dentry *dchild)
 {
struct ptlrpc_request *request = NULL;
struct md_op_data *op_data;
int rc;
 
CDEBUG(D_VFSTRACE, "VFS Op:name=%pd,dir=%lu/%u(%p)\n",
-  dentry, dir->i_ino, dir->i_generation, dir);
+  dchild, dir->i_ino, dir->i_generation, dir);
 
op_data = ll_prep_md_op_data(NULL, dir, NULL,
-dentry->d_name.name,
-dentry->d_name.len,
+dchild->d_name.name,
+dchild->d_name.len,
 S_IFDIR, LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(dentry, &op_data->op_fid3);
+   ll_get_child_fid(dchild, &op_data->op_fid3);
op_data->op_fid2 = op_data->op_fid3;
rc = md_unlink(ll_i2sbi(dir)->ll_md_exp, op_data, &request);
ll_finish_md_op_data(op_data);
@@ -1058,42 +1058,42 @@ out:
return err;
 }
 
-static int ll_rename(struct inode *old_dir, struct dentry *old_dentry,
-struct inode *new_dir, struct dentry *new_dentry)
+static int ll_rename(struct inode *src, struct dentry *src_dchild,
+struct inode *tgt, struct dentry *tgt_dchild)
 {
struct ptlrpc_request *request = NULL;
-   struct ll_sb_info *sbi = ll_i2sbi(old_dir);
+   struct ll_sb_info *sbi = ll_i2sbi(src);
struct md_op_data *op_data;
int err;
 
CDEBUG(D_VFSTRACE,
   "VFS 
Op:oldname=%pd,src_dir=%lu/%u(%p),newname=%pd,tgt_dir=%lu/%u(%p)\n",
-  old_dentry, old_dir->i_ino, old_dir->i_generation, old_dir,
-  new_dentry, new_dir->i_ino, new_dir->i_generation, new_dir);
+  src_dchild, src->i_ino, src->i_generation, src,
+  tgt_dchild, tgt->i_ino, tgt->i_generation, tgt);
 
-   op_data = ll_prep_md_op_data(NULL, old_dir, new_dir, NULL, 0, 0,
+   op_data = ll_prep_md_op_data(NULL, src, tgt, NULL, 0, 0,
 LUSTRE_OPC_ANY, NULL);
if (IS_ERR(op_data))
return PTR_ERR(op_data);
 
-   ll_get_child_fid(old_dentry, &op_data->op_fid3);
-   ll_get_child_fid(new_dentry, &op_data->op_fid4);
+   ll_get_child_fid(src_dchild, &op_data->op_fid3);
+   ll_get_child_fid(tgt_dchild, &op_data->op_fid4);
err = md_rename(sbi->ll_md_exp, op_data,
-   old_dentry->d_name.name,
-   old_dentry->d_name.len,
-   new_dentry->d_name.name,
-   new_dentry->d_name.len, &request);
+   src_d

[PATCH v2 04/16] staging: lustre: ldlm: refine LU-2665 patch for POSIX compliance

2016-04-12 Thread James Simmons
From: Bruno Faccini 

Follow-on to patch introduced to fix LU-2665 ticket (Gerrit
Change at http://review.whamcloud.com/6415 with Change-Id:
I8faa331712abeadee46eabe111ee1c23a05840d5).
Original patch introduced regressions against POSIX test suite
(fcntl.18/fcntl.35 tests in LSB-VSX POSIX test suite at
http://www.opengroup.org/testing/linux-test/lsb-vsx.html),
so the idea is to only resend F_UNLCKs to have both LU-2665 bug
and POSIX test suite happy.

Signed-off-by: Bruno Faccini 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3701
Reviewed-on: http://review.whamcloud.com/7453
Reviewed-by: Bobi Jam 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/mdc/mdc_locks.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/lustre/mdc/mdc_locks.c 
b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
index 958a164..01b6d77 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_locks.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_locks.c
@@ -869,7 +869,9 @@ resend:
 * (explicits or automatically generated by Kernel to clean
 * current FLocks upon exit) that can't be trashed
 */
-   if ((rc == -EINTR) || (rc == -ETIMEDOUT))
+   if (((rc == -EINTR) || (rc == -ETIMEDOUT)) &&
+   (einfo->ei_type == LDLM_FLOCK) &&
+   (einfo->ei_mode == LCK_NL))
goto resend;
return rc;
}
-- 
1.7.1

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


[PATCH v2 10/16] staging: lustre: llite: Truncate to restore file

2016-04-12 Thread James Simmons
From: Jinshan Xiong 

Truncate up is safe so it won't trigger restore.

Copy optimization for truncate down - only copy the part under
truncate length. If a file is truncated to zero usually it'll be
followed by write so I choose to restore the file and set correct
stripe information.

Signed-off-by: Jinshan Xiong 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3817
Reviewed-on: http://review.whamcloud.com/7505
Reviewed-by: jacques-Charles Lafoucriere 
Reviewed-by: Henri Doreau 
Reviewed-by: Aurelien Degremont 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/file.c |5 +-
 .../staging/lustre/lustre/llite/llite_internal.h   |2 +-
 drivers/staging/lustre/lustre/llite/llite_lib.c|   60 +--
 drivers/staging/lustre/lustre/llite/vvp_io.c   |5 +-
 4 files changed, 35 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/file.c 
b/drivers/staging/lustre/lustre/llite/file.c
index 9b553d2..24fa24b 100644
--- a/drivers/staging/lustre/lustre/llite/file.c
+++ b/drivers/staging/lustre/lustre/llite/file.c
@@ -3621,7 +3621,7 @@ again:
 /**
  *  This function send a restore request to the MDT
  */
-int ll_layout_restore(struct inode *inode)
+int ll_layout_restore(struct inode *inode, loff_t offset, __u64 length)
 {
struct hsm_user_request *hur;
int  len, rc;
@@ -3637,7 +3637,8 @@ int ll_layout_restore(struct inode *inode)
hur->hur_request.hr_flags = 0;
memcpy(&hur->hur_user_item[0].hui_fid, &ll_i2info(inode)->lli_fid,
   sizeof(hur->hur_user_item[0].hui_fid));
-   hur->hur_user_item[0].hui_extent.length = -1;
+   hur->hur_user_item[0].hui_extent.offset = offset;
+   hur->hur_user_item[0].hui_extent.length = length;
hur->hur_request.hr_itemcount = 1;
rc = obd_iocontrol(LL_IOC_HSM_REQUEST, ll_i2sbi(inode)->ll_md_exp,
   len, hur, NULL);
diff --git a/drivers/staging/lustre/lustre/llite/llite_internal.h 
b/drivers/staging/lustre/lustre/llite/llite_internal.h
index 2a11664..22e9989 100644
--- a/drivers/staging/lustre/lustre/llite/llite_internal.h
+++ b/drivers/staging/lustre/lustre/llite/llite_internal.h
@@ -1377,7 +1377,7 @@ enum {
 
 int ll_layout_conf(struct inode *inode, const struct cl_object_conf *conf);
 int ll_layout_refresh(struct inode *inode, __u32 *gen);
-int ll_layout_restore(struct inode *inode);
+int ll_layout_restore(struct inode *inode, loff_t start, __u64 length);
 
 int ll_xattr_init(void);
 void ll_xattr_fini(void);
diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index b0948a7..9f338b1 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -1266,14 +1266,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
   LTIME_S(attr->ia_mtime), LTIME_S(attr->ia_ctime),
   (s64)ktime_get_real_seconds());
 
-   /* If we are changing file size, file content is modified, flag it. */
-   if (attr->ia_valid & ATTR_SIZE) {
-   attr->ia_valid |= MDS_OPEN_OWNEROVERRIDE;
-   spin_lock(&lli->lli_lock);
-   lli->lli_flags |= LLIF_DATA_MODIFIED;
-   spin_unlock(&lli->lli_lock);
-   }
-
/* We always do an MDS RPC, even if we're only changing the size;
 * only the MDS knows whether truncate() should fail with -ETXTBUSY
 */
@@ -1285,13 +1277,6 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
if (!S_ISDIR(inode->i_mode))
inode_unlock(inode);
 
-   memcpy(&op_data->op_attr, attr, sizeof(*attr));
-
-   /* Open epoch for truncate. */
-   if (exp_connect_som(ll_i2mdexp(inode)) &&
-   (attr->ia_valid & (ATTR_SIZE | ATTR_MTIME | ATTR_MTIME_SET)))
-   op_data->op_flags = MF_EPOCH_OPEN;
-
/* truncate on a released file must failed with -ENODATA,
 * so size must not be set on MDS for released file
 * but other attributes must be set
@@ -1305,29 +1290,40 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
if (lsm && lsm->lsm_pattern & LOV_PATTERN_F_RELEASED)
file_is_released = true;
ccc_inode_lsm_put(inode, lsm);
+
+   if (!hsm_import && attr->ia_valid & ATTR_SIZE) {
+   if (file_is_released) {
+   rc = ll_layout_restore(inode, 0, attr->ia_size);
+   if (rc < 0)
+   goto out;
+
+   file_is_released = false;
+   ll_layout_refresh(inode, &gen);
+   }
+
+   /*
+* If we are changing file size, file c

[PATCH v2 03/16] staging: lustre: ldlm: Fix a race during FLock handling

2016-04-12 Thread James Simmons
From: Bruno Faccini 

Protect against race where lock could have been just destroyed
due to overlap, in ldlm_process_flock_lock().
Easy reproducer is BULL's NFS Locktests in pthread mode.
(http://nfsv4.bullopensource.org/tools/tests/locktest.php)

Signed-off-by: Bruno Faccini 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1126
Reviewed-on: http://review.whamcloud.com/7134
Reviewed-by: Oleg Drokin 
Reviewed-by: John L. Hammond 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_flock.c |   15 ++-
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
index 3f97e1c..5102d78 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_flock.c
@@ -520,11 +520,6 @@ ldlm_flock_completion_ast(struct ldlm_lock *lock, __u64 
flags, void *data)
 granted:
OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_CP_CB_WAIT, 10);
 
-   if (lock->l_flags & LDLM_FL_DESTROYED) {
-   LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed");
-   return 0;
-   }
-
if (lock->l_flags & LDLM_FL_FAILED) {
LDLM_DEBUG(lock, "client-side enqueue waking up: failed");
return -EIO;
@@ -534,6 +529,16 @@ granted:
 
lock_res_and_lock(lock);
 
+   /*
+* Protect against race where lock could have been just destroyed
+* due to overlap in ldlm_process_flock_lock().
+*/
+   if (lock->l_flags & LDLM_FL_DESTROYED) {
+   unlock_res_and_lock(lock);
+   LDLM_DEBUG(lock, "client-side enqueue waking up: destroyed");
+   return 0;
+   }
+
/* ldlm_lock_enqueue() has already placed lock on the granted list. */
list_del_init(&lock->l_res_link);
 
-- 
1.7.1

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


Staging: lustre: Make lustre_profile_list static

2016-04-12 Thread Iban Rodriguez
Variable lustre_profile_list is only used inside obd_config.c,
better make it static

Signed-off-by: Iban Rodriguez 
---
 drivers/staging/lustre/lustre/obdclass/obd_config.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index 5395e994deab..8d484633b83a 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -606,7 +606,7 @@ static int class_del_conn(struct obd_device *obd, struct 
lustre_cfg *lcfg)
return rc;
 }
 
-LIST_HEAD(lustre_profile_list);
+static LIST_HEAD(lustre_profile_list);
 
 struct lustre_profile *class_get_profile(const char *prof)
 {
-- 
1.9.1

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


[PATCH 14/19] staging: comedi: ni_mio_common: tidy up ni_gpct_write_register()

2016-04-12 Thread H Hartley Sweeten
The 'bits' value passed to this function is properly set by the callers
so the BUG_ON() can never occur when writing to the NITIO_G[01]_INT_ENA
and NITIO_G01_RESET registers. Remove the BUG_ON() checks.

For aesthetic, also remove the static const variables. They don't add
any additional clarity.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 15 ---
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 3a026cc..0913554 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3993,10 +3993,6 @@ static void ni_gpct_write_register(struct ni_gpct 
*counter, unsigned int bits,
 {
struct comedi_device *dev = counter->counter_dev->dev;
unsigned int stc_register = ni_gpct_to_stc_register(dev, reg);
-   static const unsigned int gpct_interrupt_a_enable_mask =
-   NISTC_INTA_ENA_G0_GATE | NISTC_INTA_ENA_G0_TC;
-   static const unsigned int gpct_interrupt_b_enable_mask =
-   NISTC_INTB_ENA_G1_GATE | NISTC_INTB_ENA_G1_TC;
 
if (stc_register == 0)
return;
@@ -4024,18 +4020,15 @@ static void ni_gpct_write_register(struct ni_gpct 
*counter, unsigned int bits,
 
/* 16 bit registers */
case NITIO_G0_INT_ENA:
-   BUG_ON(bits & ~gpct_interrupt_a_enable_mask);
ni_set_bitfield(dev, stc_register,
-   gpct_interrupt_a_enable_mask, bits);
+   NISTC_INTA_ENA_G0_GATE | NISTC_INTA_ENA_G0_TC,
+   bits);
break;
case NITIO_G1_INT_ENA:
-   BUG_ON(bits & ~gpct_interrupt_b_enable_mask);
ni_set_bitfield(dev, stc_register,
-   gpct_interrupt_b_enable_mask, bits);
+   NISTC_INTB_ENA_G1_GATE | NISTC_INTB_ENA_G1_TC,
+   bits);
break;
-   case NITIO_G01_RESET:
-   BUG_ON(bits & ~(NISTC_RESET_G0 | NISTC_RESET_G1));
-   /* fall-through */
default:
ni_stc_writew(dev, bits, stc_register);
}
-- 
2.6.3

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


[PATCH 16/19] staging: comedi: ni_mio_common: remove 'fudge_factor_80_to_20Mhz'

2016-04-12 Thread H Hartley Sweeten
For aesthetics, remove this local variable to fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: 

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index b343997..dc21931 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -4831,7 +4831,6 @@ static int ni_mseries_get_pll_parameters(unsigned int 
reference_period_ns,
 * divided by 4 to 20 MHz for most timing clocks
 */
static const unsigned int target_picosec = 12500;
-   static const unsigned int fudge_factor_80_to_20Mhz = 4;
int best_period_picosec = 0;
 
for (div = 1; div <= NI_M_PLL_MAX_DIVISOR; ++div) {
@@ -4851,8 +4850,8 @@ static int ni_mseries_get_pll_parameters(unsigned int 
reference_period_ns,
 
*freq_divider = best_div;
*freq_multiplier = best_mult;
-   *actual_period_ns = DIV_ROUND_CLOSEST(best_period_picosec *
- fudge_factor_80_to_20Mhz,
+   /* return the actual period (* fudge factor for 80 to 20 MHz) */
+   *actual_period_ns = DIV_ROUND_CLOSEST(best_period_picosec * 4,
  pico_per_nano);
return 0;
 }
-- 
2.6.3

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


[PATCH 03/19] staging: comedi: ni_mio_common: tidy up mite dma channel releases

2016-04-12 Thread H Hartley Sweeten
Absorb the inline helper functions that call ni_set_bitfield() to clear
the dma channel selection bits.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 35 ++
 1 file changed, 8 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 231cd2c..11a2453 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -584,29 +584,6 @@ static inline unsigned 
ni_stc_dma_channel_select_bitfield(unsigned channel)
return 0;
 }
 
-static inline void ni_set_ai_dma_no_channel(struct comedi_device *dev)
-{
-   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AI_SEL_MASK, 0);
-}
-
-static inline void ni_set_ao_dma_no_channel(struct comedi_device *dev)
-{
-   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AO_SEL_MASK, 0);
-}
-
-static inline void ni_set_gpct_dma_no_channel(struct comedi_device *dev,
- unsigned gpct_index)
-{
-   ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG,
-   NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0);
-}
-
-static inline void ni_set_cdo_dma_no_channel(struct comedi_device *dev)
-{
-   ni_set_bitfield(dev, NI_M_CDIO_DMA_SEL_REG,
-   NI_M_CDIO_DMA_SEL_CDO_MASK, 0);
-}
-
 static int ni_request_ai_mite_channel(struct comedi_device *dev)
 {
struct ni_private *devpriv = dev->private;
@@ -735,7 +712,8 @@ static void ni_release_ai_mite_channel(struct comedi_device 
*dev)
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ai_mite_chan) {
-   ni_set_ai_dma_no_channel(dev);
+   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
+   NI_E_DMA_AI_SEL_MASK, 0);
mite_release_channel(devpriv->ai_mite_chan);
devpriv->ai_mite_chan = NULL;
}
@@ -751,7 +729,8 @@ static void ni_release_ao_mite_channel(struct comedi_device 
*dev)
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->ao_mite_chan) {
-   ni_set_ao_dma_no_channel(dev);
+   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
+   NI_E_DMA_AO_SEL_MASK, 0);
mite_release_channel(devpriv->ao_mite_chan);
devpriv->ao_mite_chan = NULL;
}
@@ -771,7 +750,8 @@ static void ni_release_gpct_mite_channel(struct 
comedi_device *dev,
struct mite_channel *mite_chan =
devpriv->counter_dev->counters[gpct_index].mite_chan;
 
-   ni_set_gpct_dma_no_channel(dev, gpct_index);
+   ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG,
+   NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0);
ni_tio_set_mite_channel(&devpriv->
counter_dev->counters[gpct_index],
NULL);
@@ -789,7 +769,8 @@ static void ni_release_cdo_mite_channel(struct 
comedi_device *dev)
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) {
-   ni_set_cdo_dma_no_channel(dev);
+   ni_set_bitfield(dev, NI_M_CDIO_DMA_SEL_REG,
+   NI_M_CDIO_DMA_SEL_CDO_MASK, 0);
mite_release_channel(devpriv->cdo_mite_chan);
devpriv->cdo_mite_chan = NULL;
}
-- 
2.6.3

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


[PATCH 10/19] staging: comedi: ni_mio_common: fix logical continuations

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues:
CHECK: Logical continuations should be on the previous line

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 17 -
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index d537571..8df6c42 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -925,9 +925,8 @@ static int ni_ai_drain_dma(struct comedi_device *dev)
if (devpriv->ai_mite_chan) {
for (i = 0; i < timeout; i++) {
if ((ni_stc_readw(dev, NISTC_AI_STATUS1_REG) &
-NISTC_AI_STATUS1_FIFO_E)
-   && mite_bytes_in_transit(devpriv->ai_mite_chan) ==
-   0)
+NISTC_AI_STATUS1_FIFO_E) &&
+   mite_bytes_in_transit(devpriv->ai_mite_chan) == 0)
break;
udelay(5);
}
@@ -1809,8 +1808,8 @@ static void ni_load_channelgain_list(struct comedi_device 
*dev,
return;
}
if (n_chan == 1 && !devpriv->is_611x && !devpriv->is_6143) {
-   if (devpriv->changain_state
-   && devpriv->changain_spec == list[0]) {
+   if (devpriv->changain_state &&
+   devpriv->changain_spec == list[0]) {
/*  ready to go. */
return;
}
@@ -1824,8 +1823,8 @@ static void ni_load_channelgain_list(struct comedi_device 
*dev,
 
/*  Set up Calibration mode if required */
if (devpriv->is_6143) {
-   if ((list[0] & CR_ALT_SOURCE)
-   && !devpriv->ai_calib_source_enabled) {
+   if ((list[0] & CR_ALT_SOURCE) &&
+   !devpriv->ai_calib_source_enabled) {
/*  Strobe Relay enable bit */
ni_writew(dev, devpriv->ai_calib_source |
   NI6143_CALIB_CHAN_RELAY_ON,
@@ -1835,8 +1834,8 @@ static void ni_load_channelgain_list(struct comedi_device 
*dev,
devpriv->ai_calib_source_enabled = 1;
/* Allow relays to change */
msleep_interruptible(100);
-   } else if (!(list[0] & CR_ALT_SOURCE)
-  && devpriv->ai_calib_source_enabled) {
+   } else if (!(list[0] & CR_ALT_SOURCE) &&
+  devpriv->ai_calib_source_enabled) {
/*  Strobe Relay disable bit */
ni_writew(dev, devpriv->ai_calib_source |
   NI6143_CALIB_CHAN_RELAY_OFF,
-- 
2.6.3

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


[PATCH 18/19] staging: comedi: mite.h: rename CHSR_LxERR_mask

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: 

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/mite.h  | 2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mite.h 
b/drivers/staging/comedi/drivers/mite.h
index 87534b0..f2099b0 100644
--- a/drivers/staging/comedi/drivers/mite.h
+++ b/drivers/staging/comedi/drivers/mite.h
@@ -329,7 +329,7 @@ enum CHSR_bits {
CHSR_END = (1 << 8),
CHSR_DRQ1 = (1 << 7),
CHSR_DRQ0 = (1 << 6),
-   CHSR_LxERR_mask = (3 << 4),
+   CHSR_LERR_MASK = (3 << 4),
CHSR_LBERR = (1 << 4),
CHSR_LRERR = (2 << 4),
CHSR_LOERR = (3 << 4),
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index c2f67d1..b496ac5 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1327,7 +1327,7 @@ static void handle_a_interrupt(struct comedi_device *dev, 
unsigned short status,
 
if (ai_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
   CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
-  CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
+  CHSR_SABORT | CHSR_XFERR | CHSR_LERR_MASK)) {
dev_err(dev->class_dev,
"unknown mite interrupt (ai_mite_status=%08x)\n",
ai_mite_status);
@@ -1432,7 +1432,7 @@ static void handle_b_interrupt(struct comedi_device *dev,
 
if (ao_mite_status & ~(CHSR_INT | CHSR_LINKC | CHSR_DONE | CHSR_MRDY |
   CHSR_DRDY | CHSR_DRQ1 | CHSR_DRQ0 | CHSR_ERROR |
-  CHSR_SABORT | CHSR_XFERR | CHSR_LxERR_mask)) {
+  CHSR_SABORT | CHSR_XFERR | CHSR_LERR_MASK)) {
dev_err(dev->class_dev,
"unknown mite interrupt (ao_mite_status=%08x)\n",
ao_mite_status);
-- 
2.6.3

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


[PATCH 12/19] staging: comedi: ni_mio_common: tidy up AO trigger selection

2016-04-12 Thread H Hartley Sweeten
The AO subdevice (*cancel), ni_ao_reset(), always sets the private
data 'ao_trigger_select' to 0. So when a command is started the
'trigsel' value in ni_ao_cmd_set_trigger() will always start as 0.
Remove the unnecessary member from the private data.

The (*do_cmdtest) validates that the cmd->start_src will only be
TRIG_INT or TRIG_EXT. Refactor ni_ao_cmd_set_trigger() and remove
the BUG() which can never occur.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 47 --
 drivers/staging/comedi/drivers/ni_stc.h|  1 -
 2 files changed, 14 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 350109a..c033fa7 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -2967,6 +2967,7 @@ static void ni_ao_cmd_set_trigger(struct comedi_device 
*dev,
  const struct comedi_cmd *cmd)
 {
struct ni_private *devpriv = dev->private;
+   unsigned int trigsel;
 
ni_stc_writew(dev, NISTC_RESET_AO_CFG_START, NISTC_RESET_REG);
 
@@ -2980,39 +2981,20 @@ static void ni_ao_cmd_set_trigger(struct comedi_device 
*dev,
}
ni_stc_writew(dev, devpriv->ao_mode1, NISTC_AO_MODE1_REG);
 
-   {
-   unsigned int trigsel = devpriv->ao_trigger_select;
-
-   switch (cmd->start_src) {
-   case TRIG_INT:
-   case TRIG_NOW:
-   trigsel &= ~(NISTC_AO_TRIG_START1_POLARITY |
-NISTC_AO_TRIG_START1_SEL_MASK);
-   trigsel |= NISTC_AO_TRIG_START1_EDGE |
-  NISTC_AO_TRIG_START1_SYNC;
-   break;
-   case TRIG_EXT:
-   trigsel = NISTC_AO_TRIG_START1_SEL(
-   CR_CHAN(cmd->start_arg) + 1);
-   if (cmd->start_arg & CR_INVERT)
-   /*
-* 0=active high, 1=active low.
-* see daq-stc 3-24 (p186)
-*/
-   trigsel |= NISTC_AO_TRIG_START1_POLARITY;
-   if (cmd->start_arg & CR_EDGE)
-   /* 0=edge detection disabled, 1=enabled */
-   trigsel |= NISTC_AO_TRIG_START1_EDGE;
-   break;
-   default:
-   BUG();
-   break;
-   }
-
-   devpriv->ao_trigger_select = trigsel;
-   ni_stc_writew(dev, devpriv->ao_trigger_select,
- NISTC_AO_TRIG_SEL_REG);
+   if (cmd->start_src == TRIG_INT) {
+   trigsel = NISTC_AO_TRIG_START1_EDGE |
+ NISTC_AO_TRIG_START1_SYNC;
+   } else { /* TRIG_EXT */
+   trigsel = NISTC_AO_TRIG_START1_SEL(CR_CHAN(cmd->start_arg) + 1);
+   /* 0=active high, 1=active low. see daq-stc 3-24 (p186) */
+   if (cmd->start_arg & CR_INVERT)
+   trigsel |= NISTC_AO_TRIG_START1_POLARITY;
+   /* 0=edge detection disabled, 1=enabled */
+   if (cmd->start_arg & CR_EDGE)
+   trigsel |= NISTC_AO_TRIG_START1_EDGE;
}
+   ni_stc_writew(dev, trigsel, NISTC_AO_TRIG_SEL_REG);
+
/* AO_Delayed_START1 = 0, we do not support delayed start...yet */
 
/* sync */
@@ -3443,7 +3425,6 @@ static int ni_ao_reset(struct comedi_device *dev, struct 
comedi_subdevice *s)
devpriv->ao_mode3 = NISTC_AO_MODE3_LAST_GATE_DISABLE;
else
devpriv->ao_mode3 = 0;
-   devpriv->ao_trigger_select = 0;
 
ni_stc_writew(dev, 0, NISTC_AO_PERSONAL_REG);
ni_stc_writew(dev, 0, NISTC_AO_CMD1_REG);
diff --git a/drivers/staging/comedi/drivers/ni_stc.h 
b/drivers/staging/comedi/drivers/ni_stc.h
index 896bc02..334a2e1 100644
--- a/drivers/staging/comedi/drivers/ni_stc.h
+++ b/drivers/staging/comedi/drivers/ni_stc.h
@@ -1001,7 +1001,6 @@ struct ni_private {
unsigned short ao_mode3;
unsigned short ao_cmd1;
unsigned short ao_cmd2;
-   unsigned short ao_trigger_select;
 
struct ni_gpct_device *counter_dev;
unsigned short an_trig_etc_reg;
-- 
2.6.3

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


[PATCH 01/19] staging: comedi: ni_mio_common: remove some unnecessary BUG_ON()

2016-04-12 Thread H Hartley Sweeten
The mite dma channels are only requested by a subdevice with a (*do_cmd)
and they are released by a (*cancel). The comedi core will only call the
(*do_cmd) if the subdevice is not already running a command and all
commands are terminated by the core with a (*cancel).

Remove the BUG_ON() checks in the request functions which can never
happen.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 4 
 1 file changed, 4 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 71c8fd2..7a32605 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -665,7 +665,6 @@ static int ni_request_ai_mite_channel(struct comedi_device 
*dev)
unsigned long flags;
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
-   BUG_ON(devpriv->ai_mite_chan);
devpriv->ai_mite_chan =
mite_request_channel(devpriv->mite, devpriv->ai_mite_ring);
if (!devpriv->ai_mite_chan) {
@@ -686,7 +685,6 @@ static int ni_request_ao_mite_channel(struct comedi_device 
*dev)
unsigned long flags;
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
-   BUG_ON(devpriv->ao_mite_chan);
devpriv->ao_mite_chan =
mite_request_channel(devpriv->mite, devpriv->ao_mite_ring);
if (!devpriv->ao_mite_chan) {
@@ -710,7 +708,6 @@ static int ni_request_gpct_mite_channel(struct 
comedi_device *dev,
struct mite_channel *mite_chan;
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
-   BUG_ON(devpriv->counter_dev->counters[gpct_index].mite_chan);
mite_chan =
mite_request_channel(devpriv->mite,
 devpriv->gpct_mite_ring[gpct_index]);
@@ -737,7 +734,6 @@ static int ni_request_cdo_mite_channel(struct comedi_device 
*dev)
unsigned long flags;
 
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
-   BUG_ON(devpriv->cdo_mite_chan);
devpriv->cdo_mite_chan =
mite_request_channel(devpriv->mite, devpriv->cdo_mite_ring);
if (!devpriv->cdo_mite_chan) {
-- 
2.6.3

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


[PATCH 06/19] staging: comedi: ni_mio_common: use 'unsigned int' instead of kernel types

2016-04-12 Thread H Hartley Sweeten
Generally comedi drivers use 'unsigned int' types instead of the kernel type
'u32' for unsigned 32-bit values.

For aesthetics, change all the 'u32' and 'uin32_t' types and fix the
checkpatch.pl issues about:
CHECK: Prefer kernel type 'u32' over 'uint32_t'

The various i/o helpers use for reading and writing the 32/16/8-bit registers
all start with an 'unsigned int' value for writing and finally return an
'unsigned int' value. For aesthetics, change all the 'uint16_t' and 'uint8_t'
types for insigned int and fix the checkpatch.pl issues about:
CHECK: Prefer kernel type 'u16' over 'uint16_t'

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 46 ++
 1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index a0392df..7ce53fd 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -243,7 +243,7 @@ enum timebase_nanoseconds {
 
 static const int num_adc_stages_611x = 3;
 
-static void ni_writel(struct comedi_device *dev, uint32_t data, int reg)
+static void ni_writel(struct comedi_device *dev, unsigned int data, int reg)
 {
if (dev->mmio)
writel(data, dev->mmio + reg);
@@ -251,7 +251,7 @@ static void ni_writel(struct comedi_device *dev, uint32_t 
data, int reg)
outl(data, dev->iobase + reg);
 }
 
-static void ni_writew(struct comedi_device *dev, uint16_t data, int reg)
+static void ni_writew(struct comedi_device *dev, unsigned int data, int reg)
 {
if (dev->mmio)
writew(data, dev->mmio + reg);
@@ -259,7 +259,7 @@ static void ni_writew(struct comedi_device *dev, uint16_t 
data, int reg)
outw(data, dev->iobase + reg);
 }
 
-static void ni_writeb(struct comedi_device *dev, uint8_t data, int reg)
+static void ni_writeb(struct comedi_device *dev, unsigned int data, int reg)
 {
if (dev->mmio)
writeb(data, dev->mmio + reg);
@@ -267,7 +267,7 @@ static void ni_writeb(struct comedi_device *dev, uint8_t 
data, int reg)
outb(data, dev->iobase + reg);
 }
 
-static uint32_t ni_readl(struct comedi_device *dev, int reg)
+static unsigned int ni_readl(struct comedi_device *dev, int reg)
 {
if (dev->mmio)
return readl(dev->mmio + reg);
@@ -275,7 +275,7 @@ static uint32_t ni_readl(struct comedi_device *dev, int reg)
return inl(dev->iobase + reg);
 }
 
-static uint16_t ni_readw(struct comedi_device *dev, int reg)
+static unsigned int ni_readw(struct comedi_device *dev, int reg)
 {
if (dev->mmio)
return readw(dev->mmio + reg);
@@ -283,7 +283,7 @@ static uint16_t ni_readw(struct comedi_device *dev, int reg)
return inw(dev->iobase + reg);
 }
 
-static uint8_t ni_readb(struct comedi_device *dev, int reg)
+static unsigned int ni_readb(struct comedi_device *dev, int reg)
 {
if (dev->mmio)
return readb(dev->mmio + reg);
@@ -458,7 +458,8 @@ static unsigned int m_series_stc_read(struct comedi_device 
*dev,
}
 }
 
-static void ni_stc_writew(struct comedi_device *dev, uint16_t data, int reg)
+static void ni_stc_writew(struct comedi_device *dev,
+ unsigned int data, int reg)
 {
struct ni_private *devpriv = dev->private;
unsigned long flags;
@@ -477,7 +478,8 @@ static void ni_stc_writew(struct comedi_device *dev, 
uint16_t data, int reg)
}
 }
 
-static void ni_stc_writel(struct comedi_device *dev, uint32_t data, int reg)
+static void ni_stc_writel(struct comedi_device *dev,
+ unsigned int data, int reg)
 {
struct ni_private *devpriv = dev->private;
 
@@ -489,11 +491,11 @@ static void ni_stc_writel(struct comedi_device *dev, 
uint32_t data, int reg)
}
 }
 
-static uint16_t ni_stc_readw(struct comedi_device *dev, int reg)
+static unsigned int ni_stc_readw(struct comedi_device *dev, int reg)
 {
struct ni_private *devpriv = dev->private;
unsigned long flags;
-   uint16_t val;
+   unsigned int val;
 
if (devpriv->is_m_series) {
val = m_series_stc_read(dev, reg);
@@ -510,10 +512,10 @@ static uint16_t ni_stc_readw(struct comedi_device *dev, 
int reg)
return val;
 }
 
-static uint32_t ni_stc_readl(struct comedi_device *dev, int reg)
+static unsigned int ni_stc_readl(struct comedi_device *dev, int reg)
 {
struct ni_private *devpriv = dev->private;
-   uint32_t val;
+   unsigned int val;
 
if (devpriv->is_m_series) {
val = m_series_stc_read(dev, reg);
@@ -779,7 +781,7 @@ static void ni_e_series_enable_second_irq(struct 
comedi_device *dev,
  unsigned int gpct_index, short enable)
 {
struct ni_private *devpriv = dev->private;
-   uint16_t val = 0;

[PATCH 02/19] staging: comedi: ni_mio_common: tidy up mite dma channel requests

2016-04-12 Thread H Hartley Sweeten
Tidy up the functions that request the mite dma channels by absorbing the
inline helper functions that call ni_set_bitfield() to set the channel
selection bits.

Add support for the NI_M_CDIO_DMA_SEL_REG register to ni_set_bitfield()
so that all the soft_reg_copy_lock spinlocking is done in one place.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 140 +++--
 1 file changed, 59 insertions(+), 81 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 7a32605..231cd2c 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -556,6 +556,11 @@ static inline void ni_set_bitfield(struct comedi_device 
*dev, int reg,
devpriv->g0_g1_select_reg |= bit_values & bit_mask;
ni_writeb(dev, devpriv->g0_g1_select_reg, reg);
break;
+   case NI_M_CDIO_DMA_SEL_REG:
+   devpriv->cdio_dma_select_reg &= ~bit_mask;
+   devpriv->cdio_dma_select_reg |= bit_values & bit_mask;
+   ni_writeb(dev, devpriv->cdio_dma_select_reg, reg);
+   break;
default:
dev_err(dev->class_dev, "called with invalid register %d\n",
reg);
@@ -579,45 +584,16 @@ static inline unsigned 
ni_stc_dma_channel_select_bitfield(unsigned channel)
return 0;
 }
 
-static inline void ni_set_ai_dma_channel(struct comedi_device *dev,
-unsigned channel)
-{
-   unsigned bits = ni_stc_dma_channel_select_bitfield(channel);
-
-   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
-   NI_E_DMA_AI_SEL_MASK, NI_E_DMA_AI_SEL(bits));
-}
-
 static inline void ni_set_ai_dma_no_channel(struct comedi_device *dev)
 {
ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AI_SEL_MASK, 0);
 }
 
-static inline void ni_set_ao_dma_channel(struct comedi_device *dev,
-unsigned channel)
-{
-   unsigned bits = ni_stc_dma_channel_select_bitfield(channel);
-
-   ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
-   NI_E_DMA_AO_SEL_MASK, NI_E_DMA_AO_SEL(bits));
-}
-
 static inline void ni_set_ao_dma_no_channel(struct comedi_device *dev)
 {
ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG, NI_E_DMA_AO_SEL_MASK, 0);
 }
 
-static inline void ni_set_gpct_dma_channel(struct comedi_device *dev,
-  unsigned gpct_index,
-  unsigned channel)
-{
-   unsigned bits = ni_stc_dma_channel_select_bitfield(channel);
-
-   ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG,
-   NI_E_DMA_G0_G1_SEL_MASK(gpct_index),
-   NI_E_DMA_G0_G1_SEL(gpct_index, bits));
-}
-
 static inline void ni_set_gpct_dma_no_channel(struct comedi_device *dev,
  unsigned gpct_index)
 {
@@ -625,56 +601,34 @@ static inline void ni_set_gpct_dma_no_channel(struct 
comedi_device *dev,
NI_E_DMA_G0_G1_SEL_MASK(gpct_index), 0);
 }
 
-static inline void ni_set_cdo_dma_channel(struct comedi_device *dev,
- unsigned mite_channel)
-{
-   struct ni_private *devpriv = dev->private;
-   unsigned long flags;
-   unsigned bits;
-
-   spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags);
-   devpriv->cdio_dma_select_reg &= ~NI_M_CDIO_DMA_SEL_CDO_MASK;
-   /*
-* XXX just guessing ni_stc_dma_channel_select_bitfield()
-* returns the right bits, under the assumption the cdio dma
-* selection works just like ai/ao/gpct.
-* Definitely works for dma channels 0 and 1.
-*/
-   bits = ni_stc_dma_channel_select_bitfield(mite_channel);
-   devpriv->cdio_dma_select_reg |= NI_M_CDIO_DMA_SEL_CDO(bits);
-   ni_writeb(dev, devpriv->cdio_dma_select_reg, NI_M_CDIO_DMA_SEL_REG);
-   mmiowb();
-   spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags);
-}
-
 static inline void ni_set_cdo_dma_no_channel(struct comedi_device *dev)
 {
-   struct ni_private *devpriv = dev->private;
-   unsigned long flags;
-
-   spin_lock_irqsave(&devpriv->soft_reg_copy_lock, flags);
-   devpriv->cdio_dma_select_reg &= ~NI_M_CDIO_DMA_SEL_CDO_MASK;
-   ni_writeb(dev, devpriv->cdio_dma_select_reg, NI_M_CDIO_DMA_SEL_REG);
-   mmiowb();
-   spin_unlock_irqrestore(&devpriv->soft_reg_copy_lock, flags);
+   ni_set_bitfield(dev, NI_M_CDIO_DMA_SEL_REG,
+   NI_M_CDIO_DMA_SEL_CDO_MASK, 0);
 }
 
 static int ni_request_ai_mite_channel(struct comedi_device *dev)
 {
struct ni_private *devpriv = dev->private;
+   struct mite_channel *mite_chan;
unsigned long flags;
+   unsigned int bits;
 
spin_lock_irqsa

[PATCH 19/19] staging: comedi: ni_mio_common: introduce NI_STC_DMA_CHAN_SEL()

2016-04-12 Thread H Hartley Sweeten
The inline helper ni_stc_dma_channel_select_bitfield() returns the
bits needed to select a MITE channel to use for DMA. The MITE code
is setup to handle up to 8 channels but in reality only channels 0
to 3 are used by most of the drivers. The PCI-6032E and PCI-6033E
boards can also use channels 4 and 5.

For aesthetics, convert this inline function into a macro and
remove the BUG() which will never occur.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 29 ++
 1 file changed, 11 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index b496ac5..646afa4 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -560,20 +560,13 @@ static inline void ni_set_bitfield(struct comedi_device 
*dev, int reg,
 }
 
 #ifdef PCIDMA
-/* DMA channel setup */
-static inline unsigned int
-ni_stc_dma_channel_select_bitfield(unsigned int channel)
-{
-   if (channel < 4)
-   return 1 << channel;
-   if (channel == 4)
-   return 0x3;
-   if (channel == 5)
-   return 0x5;
-   BUG();
-   return 0;
-}
 
+/* selects the MITE channel to use for DMA */
+#define NI_STC_DMA_CHAN_SEL(x) (((x) < 4) ? BIT(x) :   \
+((x) == 4) ? 0x3 : \
+((x) == 5) ? 0x5 : 0x0)
+
+/* DMA channel setup */
 static int ni_request_ai_mite_channel(struct comedi_device *dev)
 {
struct ni_private *devpriv = dev->private;
@@ -592,7 +585,7 @@ static int ni_request_ai_mite_channel(struct comedi_device 
*dev)
mite_chan->dir = COMEDI_INPUT;
devpriv->ai_mite_chan = mite_chan;
 
-   bits = ni_stc_dma_channel_select_bitfield(mite_chan->channel);
+   bits = NI_STC_DMA_CHAN_SEL(mite_chan->channel);
ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
NI_E_DMA_AI_SEL_MASK, NI_E_DMA_AI_SEL(bits));
 
@@ -618,7 +611,7 @@ static int ni_request_ao_mite_channel(struct comedi_device 
*dev)
mite_chan->dir = COMEDI_OUTPUT;
devpriv->ao_mite_chan = mite_chan;
 
-   bits = ni_stc_dma_channel_select_bitfield(mite_chan->channel);
+   bits = NI_STC_DMA_CHAN_SEL(mite_chan->channel);
ni_set_bitfield(dev, NI_E_DMA_AI_AO_SEL_REG,
NI_E_DMA_AO_SEL_MASK, NI_E_DMA_AO_SEL(bits));
 
@@ -648,7 +641,7 @@ static int ni_request_gpct_mite_channel(struct 
comedi_device *dev,
mite_chan->dir = direction;
ni_tio_set_mite_channel(counter, mite_chan);
 
-   bits = ni_stc_dma_channel_select_bitfield(mite_chan->channel);
+   bits = NI_STC_DMA_CHAN_SEL(mite_chan->channel);
ni_set_bitfield(dev, NI_E_DMA_G0_G1_SEL_REG,
NI_E_DMA_G0_G1_SEL_MASK(gpct_index),
NI_E_DMA_G0_G1_SEL(gpct_index, bits));
@@ -676,12 +669,12 @@ static int ni_request_cdo_mite_channel(struct 
comedi_device *dev)
devpriv->cdo_mite_chan = mite_chan;
 
/*
-* XXX just guessing ni_stc_dma_channel_select_bitfield()
+* XXX just guessing NI_STC_DMA_CHAN_SEL()
 * returns the right bits, under the assumption the cdio dma
 * selection works just like ai/ao/gpct.
 * Definitely works for dma channels 0 and 1.
 */
-   bits = ni_stc_dma_channel_select_bitfield(mite_chan->channel);
+   bits = NI_STC_DMA_CHAN_SEL(mite_chan->channel);
ni_set_bitfield(dev, NI_M_CDIO_DMA_SEL_REG,
NI_M_CDIO_DMA_SEL_CDO_MASK,
NI_M_CDIO_DMA_SEL_CDO(bits));
-- 
2.6.3

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


[PATCH 00/19] staging: comedi: ni_mio_common: initial cleanup

2016-04-12 Thread H Hartley Sweeten
This "driver" is is bit of a mess. It's included by the ni_atmio, ni_mio_cs,
and ni_pcimio drivers instead of being a separate module.

Do some cleanup so I can work out what is needed to make it a module.

This fixes all the checkpatch.pl issues except for two:
CHECK: if this code is redundant consider removing it

I left those in until I can figure out if they can be removed.

H Hartley Sweeten (19):
  staging: comedi: ni_mio_common: remove some unnecessary BUG_ON()
  staging: comedi: ni_mio_common: tidy up mite dma channel requests
  staging: comedi: ni_mio_common: tidy up mite dma channel releases
  staging: comedi: ni_mio_common: tidy up DIO subdevice ifdef'ery
  staging: comedi: ni_mio_common: Prefer 'unsigned int' to bare use of 
'unsigned'
  staging: comedi: ni_mio_common: use 'unsigned int' instead of kernel types
  staging: comedi: ni_mio_common: tidy up block comments
  staging: comedi: ni_mio_common: fix lines over 80 characters
  staging: comedi: ni_mio_common: multiple assignments should be avoided
  staging: comedi: ni_mio_common: fix logical continuations
  staging: comedi: ni_mio_common: convert NI_GPCT_SUBDEV to a macro
  staging: comedi: ni_mio_common: tidy up AO trigger selection
  staging: comedi: ni_mio_common: tidy up AO scan begin
  staging: comedi: ni_mio_common: tidy up ni_gpct_write_register()
  staging: comedi: ni_mio_common: usleep_range is preferred over udelay
  staging: comedi: ni_mio_common: remove 'fudge_factor_80_to_20Mhz'
  staging: comedi: ni_mio_common: fix CamelCase in ni_serial_hw_readwrite8()
  staging: comedi: mite.h: rename CHSR_LxERR_mask
  staging: comedi: ni_mio_common: introduce NI_STC_DMA_CHAN_SEL()

 drivers/staging/comedi/drivers/mite.h  |   2 +-
 drivers/staging/comedi/drivers/ni_mio_common.c | 860 -
 drivers/staging/comedi/drivers/ni_stc.h|   1 -
 3 files changed, 402 insertions(+), 461 deletions(-)

-- 
2.6.3

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


[PATCH 17/19] staging: comedi: ni_mio_common: fix CamelCase in ni_serial_hw_readwrite8()

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issue:
CHECK: Avoid CamelCase: 

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index dc21931..c2f67d1 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3747,7 +3747,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device 
*dev,
status1 = ni_stc_readw(dev, NISTC_STATUS1_REG);
if (status1 & NISTC_STATUS1_SERIO_IN_PROG) {
err = -EBUSY;
-   goto Error;
+   goto error;
}
 
devpriv->dio_control |= NISTC_DIO_CTRL_HW_SER_START;
@@ -3763,7 +3763,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device 
*dev,
dev_err(dev->class_dev,
"SPI serial I/O didn't finish in time!\n");
err = -ETIME;
-   goto Error;
+   goto error;
}
}
 
@@ -3776,7 +3776,7 @@ static int ni_serial_hw_readwrite8(struct comedi_device 
*dev,
if (data_in)
*data_in = ni_stc_readw(dev, NISTC_DIO_SERIAL_IN_REG);
 
-Error:
+error:
ni_stc_writew(dev, devpriv->dio_control, NISTC_DIO_CTRL_REG);
 
return err;
-- 
2.6.3

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


[PATCH 15/19] staging: comedi: ni_mio_common: usleep_range is preferred over udelay

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 0913554..b343997 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -962,7 +962,7 @@ static int ni_ao_wait_for_dma_load(struct comedi_device 
*dev)
 * If we poll too often, the pci bus activity seems
 * to slow the dma transfer down.
 */
-   udelay(10);
+   usleep_range(10, 100);
}
if (i == timeout) {
dev_err(dev->class_dev, "timed out waiting for dma load\n");
@@ -3629,7 +3629,7 @@ static int ni_cdo_inttrig(struct comedi_device *dev,
if (ni_readl(dev, NI_M_CDIO_STATUS_REG) &
NI_M_CDIO_STATUS_CDO_FIFO_FULL)
break;
-   udelay(10);
+   usleep_range(10, 100);
}
if (i == timeout) {
dev_err(dev->class_dev, "dma failed to fill cdo fifo!\n");
-- 
2.6.3

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


[PATCH 04/19] staging: comedi: ni_mio_common: tidy up DIO subdevice ifdef'ery

2016-04-12 Thread H Hartley Sweeten
This file is is bit of a mess. It's included by the ni_atmio, ni_mio_cs, and
ni_pcimio drivers. The ni_pcimio driver is the only one that uses DMA. It
defines PCIDMA so that the dma code is compiled it. This causes a bunch
of ifdef'ery in the file.

The DIO subdevice for the ni_pcidio "is_m_series" boards is quite different
from the standard e-series DIO. Mainly it supports async commands that use
DMA.

Tidy up some of the ifdef'ery by adding ifdef to the subdevice init.

Also and ifdef to the interrupt handler and remove the unnecessary if
(!devpriv->is_m_series) check in handle_cdio_interrupt().

Consolidate the other ifdef's to block out the affected code.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 26 --
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 11a2453..8544de1 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -667,11 +667,8 @@ static int ni_request_gpct_mite_channel(struct 
comedi_device *dev,
return 0;
 }
 
-#endif /*  PCIDMA */
-
 static int ni_request_cdo_mite_channel(struct comedi_device *dev)
 {
-#ifdef PCIDMA
struct ni_private *devpriv = dev->private;
struct mite_channel *mite_chan;
unsigned long flags;
@@ -700,9 +697,9 @@ static int ni_request_cdo_mite_channel(struct comedi_device 
*dev)
NI_M_CDIO_DMA_SEL_CDO(bits));
 
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
-#endif /*  PCIDMA */
return 0;
 }
+#endif /*  PCIDMA */
 
 static void ni_release_ai_mite_channel(struct comedi_device *dev)
 {
@@ -759,11 +756,9 @@ static void ni_release_gpct_mite_channel(struct 
comedi_device *dev,
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
 }
-#endif /*  PCIDMA */
 
 static void ni_release_cdo_mite_channel(struct comedi_device *dev)
 {
-#ifdef PCIDMA
struct ni_private *devpriv = dev->private;
unsigned long flags;
 
@@ -775,10 +770,8 @@ static void ni_release_cdo_mite_channel(struct 
comedi_device *dev)
devpriv->cdo_mite_chan = NULL;
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
-#endif /*  PCIDMA */
 }
 
-#ifdef PCIDMA
 static void ni_e_series_enable_second_irq(struct comedi_device *dev,
  unsigned gpct_index, short enable)
 {
@@ -3505,6 +3498,7 @@ static int ni_dio_insn_bits(struct comedi_device *dev,
return insn->n;
 }
 
+#ifdef PCIDMA
 static int ni_m_series_dio_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
@@ -3610,10 +3604,8 @@ static int ni_cdo_inttrig(struct comedi_device *dev,
const unsigned timeout = 1000;
int retval = 0;
unsigned i;
-#ifdef PCIDMA
struct ni_private *devpriv = dev->private;
unsigned long flags;
-#endif
 
if (trig_num != cmd->start_arg)
return -EINVAL;
@@ -3623,7 +3615,6 @@ static int ni_cdo_inttrig(struct comedi_device *dev,
/* read alloc the entire buffer */
comedi_buf_read_alloc(s, s->async->prealloc_bufsz);
 
-#ifdef PCIDMA
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) {
mite_prep_dma(devpriv->cdo_mite_chan, 32, 32);
@@ -3635,7 +3626,7 @@ static int ni_cdo_inttrig(struct comedi_device *dev,
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
if (retval < 0)
return retval;
-#endif
+
/*
 * XXX not sure what interrupt C group does
 * wait for dma to fill output fifo
@@ -3716,13 +3707,8 @@ static void handle_cdio_interrupt(struct comedi_device 
*dev)
struct ni_private *devpriv = dev->private;
unsigned cdio_status;
struct comedi_subdevice *s = &dev->subdevices[NI_DIO_SUBDEV];
-#ifdef PCIDMA
unsigned long flags;
-#endif
 
-   if (!devpriv->is_m_series)
-   return;
-#ifdef PCIDMA
spin_lock_irqsave(&devpriv->mite_channel_lock, flags);
if (devpriv->cdo_mite_chan) {
unsigned cdo_mite_status =
@@ -3735,7 +3721,6 @@ static void handle_cdio_interrupt(struct comedi_device 
*dev)
mite_sync_output_dma(devpriv->cdo_mite_chan, s);
}
spin_unlock_irqrestore(&devpriv->mite_channel_lock, flags);
-#endif
 
cdio_status = ni_readl(dev, NI_M_CDIO_STATUS_REG);
if (cdio_status & NI_M_CDIO_STATUS_CDO_ERROR) {
@@ -3751,6 +3736,7 @@ static void handle_cdio_interrupt(struct comedi_device 
*dev)
}
comedi_handle_events(dev, s);
 }
+#endif /*  PCIDMA */
 
 static int ni_serial_hw_readwrite8(struct comedi_device *dev,
 

[PATCH 13/19] staging: comedi: ni_mio_common: tidy up AO scan begin

2016-04-12 Thread H Hartley Sweeten
The (*do_cmdtest) validates that the cmd->scan_begin_src will only be
TRIG_TIMER or TRIG_EXT. Refactor ni_ao_cmd_set_update() and remove the
BUG() which can never occur.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 39 ++
 1 file changed, 15 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index c033fa7..3a026cc 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -3099,8 +3099,9 @@ static void ni_ao_cmd_set_update(struct comedi_device 
*dev,
  NISTC_AO_MODE1_UPDATE_SRC_POLARITY
);
 
-   switch (cmd->scan_begin_src) {
-   case TRIG_TIMER:
+   if (cmd->scan_begin_src == TRIG_TIMER) {
+   unsigned int trigvar;
+
devpriv->ao_cmd2  &= ~NISTC_AO_CMD2_BC_GATE_ENA;
 
/*
@@ -3131,35 +3132,25 @@ static void ni_ao_cmd_set_update(struct comedi_device 
*dev,
 * eseries/ni67xx and tMSeries.h for mseries.
 */
 
-   {
-   unsigned int trigvar;
-
-   trigvar = ni_ns_to_timer(dev, cmd->scan_begin_arg,
-CMDF_ROUND_NEAREST);
+   trigvar = ni_ns_to_timer(dev, cmd->scan_begin_arg,
+CMDF_ROUND_NEAREST);
 
-   /*
-* Wait N TB3 ticks after the start trigger before
-* clocking(N must be >=2).
-*/
-   /* following line: 2-1 per STC */
-   ni_stc_writel(dev, 1,   NISTC_AO_UI_LOADA_REG);
-   ni_stc_writew(dev, NISTC_AO_CMD1_UI_LOAD,
- NISTC_AO_CMD1_REG);
-   /* following line: N-1 per STC */
-   ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);
-   }
-   break;
-   case TRIG_EXT:
+   /*
+* Wait N TB3 ticks after the start trigger before
+* clocking (N must be >=2).
+*/
+   /* following line: 2-1 per STC */
+   ni_stc_writel(dev, 1, NISTC_AO_UI_LOADA_REG);
+   ni_stc_writew(dev, NISTC_AO_CMD1_UI_LOAD, NISTC_AO_CMD1_REG);
+   /* following line: N-1 per STC */
+   ni_stc_writel(dev, trigvar - 1, NISTC_AO_UI_LOADA_REG);
+   } else { /* TRIG_EXT */
/* FIXME:  assert scan_begin_arg != 0, ret failure otherwise */
devpriv->ao_cmd2  |= NISTC_AO_CMD2_BC_GATE_ENA;
devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC(
CR_CHAN(cmd->scan_begin_arg));
if (cmd->scan_begin_arg & CR_INVERT)
devpriv->ao_mode1 |= NISTC_AO_MODE1_UPDATE_SRC_POLARITY;
-   break;
-   default:
-   BUG();
-   break;
}
 
ni_stc_writew(dev, devpriv->ao_cmd2, NISTC_AO_CMD2_REG);
-- 
2.6.3

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


[PATCH 08/19] staging: comedi: ni_mio_common: fix lines over 80 characters

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 78 --
 1 file changed, 49 insertions(+), 29 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 317b04e..daeadf9 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -877,16 +877,17 @@ static inline unsigned short ni_ao_win_inw(struct 
comedi_device *dev, int addr)
return data;
 }
 
-/* ni_set_bits( ) allows different parts of the ni_mio_common driver to
-* share registers (such as Interrupt_A_Register) without interfering with
-* each other.
-*
-* NOTE: the switch/case statements are optimized out for a constant argument
-* so this is actually quite fast---  If you must wrap another function around 
this
-* make it inline to avoid a large speed penalty.
-*
-* value should only be 1 or 0.
-*/
+/*
+ * ni_set_bits( ) allows different parts of the ni_mio_common driver to
+ * share registers (such as Interrupt_A_Register) without interfering with
+ * each other.
+ *
+ * NOTE: the switch/case statements are optimized out for a constant argument
+ * so this is actually quite fast---  If you must wrap another function around
+ * this make it inline to avoid a large speed penalty.
+ *
+ * value should only be 1 or 0.
+ */
 static inline void ni_set_bits(struct comedi_device *dev, int reg,
   unsigned int bits, unsigned int value)
 {
@@ -1102,7 +1103,10 @@ static void ni_ai_fifo_read(struct comedi_device *dev,
comedi_buf_write_samples(s, &data, 1);
}
} else if (devpriv->is_6143) {
-   /*  This just reads the FIFO assuming the data is present, no 
checks on the FIFO status are performed */
+   /*
+* This just reads the FIFO assuming the data is present,
+* no checks on the FIFO status are performed.
+*/
for (i = 0; i < n / 2; i++) {
dl = ni_readl(dev, NI6143_AI_FIFO_DATA_REG);
 
@@ -1153,7 +1157,6 @@ static void ni_handle_fifo_dregs(struct comedi_device 
*dev)
struct comedi_subdevice *s = dev->read_subdev;
unsigned int dl;
unsigned short data;
-   unsigned short fifo_empty;
int i;
 
if (devpriv->is_611x) {
@@ -1189,15 +1192,16 @@ static void ni_handle_fifo_dregs(struct comedi_device 
*dev)
}
 
} else {
-   fifo_empty = ni_stc_readw(dev, NISTC_AI_STATUS1_REG) &
-NISTC_AI_STATUS1_FIFO_E;
-   while (fifo_empty == 0) {
+   unsigned short fe;  /* fifo empty */
+
+   fe = ni_stc_readw(dev, NISTC_AI_STATUS1_REG) &
+NISTC_AI_STATUS1_FIFO_E;
+   while (fe == 0) {
for (i = 0;
 i < ARRAY_SIZE(devpriv->ai_fifo_buffer); i++) {
-   fifo_empty = ni_stc_readw(dev,
- NISTC_AI_STATUS1_REG) 
&
-   NISTC_AI_STATUS1_FIFO_E;
-   if (fifo_empty)
+   fe = ni_stc_readw(dev, NISTC_AI_STATUS1_REG) &
+NISTC_AI_STATUS1_FIFO_E;
+   if (fe)
break;
devpriv->ai_fifo_buffer[i] =
ni_readw(dev, NI_E_AI_FIFO_DATA_REG);
@@ -1323,7 +1327,10 @@ static void handle_a_interrupt(struct comedi_device 
*dev, unsigned short status,
struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd;
 
-   /* 67xx boards don't have ai subdevice, but their gpct0 might generate 
an a interrupt */
+   /*
+* 67xx boards don't have ai subdevice, but their gpct0 might
+* generate an a interrupt.
+*/
if (s->type == COMEDI_SUBD_UNUSED)
return;
 
@@ -1826,7 +1833,8 @@ static void ni_load_channelgain_list(struct comedi_device 
*dev,
ni_writew(dev, devpriv->ai_calib_source,
  NI6143_CALIB_CHAN_REG);
devpriv->ai_calib_source_enabled = 1;
-   msleep_interruptible(100);  /*  Allow relays to 
change */
+   /* Allow relays to change */
+   msleep_interruptible(100);
} else if (!(list[0] & CR_ALT_SOURCE)
   && devpriv->ai_calib_source_enabled) {
/*  Strobe Relay disable bit */
@@ -1836,7 +1844,8 @@ static void ni_load_channelgain_list(struct comedi_device 
*dev,
ni_writew(dev,

[PATCH 11/19] staging: comedi: ni_mio_common: convert NI_GPCT_SUBDEV to a macro

2016-04-12 Thread H Hartley Sweeten
The 'counter_index' is always in range (0 to < NUM_GPCT, which is 2).

For aesthetics, convert this inline function into a macro and remove
the BUG() which can never occur.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 8df6c42..350109a 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -214,19 +214,7 @@ enum ni_common_subdevices {
NI_NUM_SUBDEVICES
 };
 
-static inline unsigned int NI_GPCT_SUBDEV(unsigned int counter_index)
-{
-   switch (counter_index) {
-   case 0:
-   return NI_GPCT0_SUBDEV;
-   case 1:
-   return NI_GPCT1_SUBDEV;
-   default:
-   break;
-   }
-   BUG();
-   return NI_GPCT0_SUBDEV;
-}
+#define NI_GPCT_SUBDEV(x)  (NI_GPCT0_SUBDEV + (x))
 
 enum timebase_nanoseconds {
TIMEBASE_1_NS = 50,
-- 
2.6.3

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


[PATCH 09/19] staging: comedi: ni_mio_common: multiple assignments should be avoided

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index daeadf9..d537571 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -4478,12 +4478,12 @@ static void caldac_setup(struct comedi_device *dev, 
struct comedi_subdevice *s)
s->n_chan = n_chans;
 
if (diffbits) {
-   unsigned int *maxdata_list;
+   unsigned int *maxdata_list = devpriv->caldac_maxdata_list;
 
if (n_chans > MAX_N_CALDACS)
dev_err(dev->class_dev,
"BUG! MAX_N_CALDACS too small\n");
-   s->maxdata_list = maxdata_list = devpriv->caldac_maxdata_list;
+   s->maxdata_list = maxdata_list;
chan = 0;
for (i = 0; i < n_dacs; i++) {
type = board->caldac[i];
-- 
2.6.3

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


[PATCH 05/19] staging: comedi: ni_mio_common: Prefer 'unsigned int' to bare use of 'unsigned'

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 172 +
 1 file changed, 90 insertions(+), 82 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 8544de1..a0392df 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -216,7 +216,8 @@ enum ni_common_subdevices {
NI_FREQ_OUT_SUBDEV,
NI_NUM_SUBDEVICES
 };
-static inline unsigned NI_GPCT_SUBDEV(unsigned counter_index)
+
+static inline unsigned int NI_GPCT_SUBDEV(unsigned int counter_index)
 {
switch (counter_index) {
case 0:
@@ -524,7 +525,8 @@ static uint32_t ni_stc_readl(struct comedi_device *dev, int 
reg)
 }
 
 static inline void ni_set_bitfield(struct comedi_device *dev, int reg,
-  unsigned bit_mask, unsigned bit_values)
+  unsigned int bit_mask,
+  unsigned int bit_values)
 {
struct ni_private *devpriv = dev->private;
unsigned long flags;
@@ -572,7 +574,8 @@ static inline void ni_set_bitfield(struct comedi_device 
*dev, int reg,
 
 #ifdef PCIDMA
 /* DMA channel setup */
-static inline unsigned ni_stc_dma_channel_select_bitfield(unsigned channel)
+static inline unsigned int
+ni_stc_dma_channel_select_bitfield(unsigned int channel)
 {
if (channel < 4)
return 1 << channel;
@@ -637,7 +640,7 @@ static int ni_request_ao_mite_channel(struct comedi_device 
*dev)
 }
 
 static int ni_request_gpct_mite_channel(struct comedi_device *dev,
-   unsigned gpct_index,
+   unsigned int gpct_index,
enum comedi_io_direction direction)
 {
struct ni_private *devpriv = dev->private;
@@ -737,7 +740,7 @@ static void ni_release_ao_mite_channel(struct comedi_device 
*dev)
 
 #ifdef PCIDMA
 static void ni_release_gpct_mite_channel(struct comedi_device *dev,
-unsigned gpct_index)
+unsigned int gpct_index)
 {
struct ni_private *devpriv = dev->private;
unsigned long flags;
@@ -773,7 +776,7 @@ static void ni_release_cdo_mite_channel(struct 
comedi_device *dev)
 }
 
 static void ni_e_series_enable_second_irq(struct comedi_device *dev,
- unsigned gpct_index, short enable)
+ unsigned int gpct_index, short enable)
 {
struct ni_private *devpriv = dev->private;
uint16_t val = 0;
@@ -884,9 +887,9 @@ static inline unsigned short ni_ao_win_inw(struct 
comedi_device *dev, int addr)
 * value should only be 1 or 0.
 */
 static inline void ni_set_bits(struct comedi_device *dev, int reg,
-  unsigned bits, unsigned value)
+  unsigned int bits, unsigned int value)
 {
-   unsigned bit_values;
+   unsigned int bit_values;
 
if (value)
bit_values = bits;
@@ -1314,7 +1317,7 @@ static void ack_a_interrupt(struct comedi_device *dev, 
unsigned short a_status)
 }
 
 static void handle_a_interrupt(struct comedi_device *dev, unsigned short 
status,
-  unsigned ai_mite_status)
+  unsigned int ai_mite_status)
 {
struct comedi_subdevice *s = dev->read_subdev;
struct comedi_cmd *cmd = &s->async->cmd;
@@ -1413,7 +1416,8 @@ static void ack_b_interrupt(struct comedi_device *dev, 
unsigned short b_status)
 }
 
 static void handle_b_interrupt(struct comedi_device *dev,
-  unsigned short b_status, unsigned ao_mite_status)
+  unsigned short b_status,
+  unsigned int ao_mite_status)
 {
struct comedi_subdevice *s = dev->write_subdev;
/* unsigned short ack=0; */
@@ -1578,8 +1582,8 @@ static int ni_ao_setup_MITE_dma(struct comedi_device *dev)
 static int ni_ai_reset(struct comedi_device *dev, struct comedi_subdevice *s)
 {
struct ni_private *devpriv = dev->private;
-   unsigned ai_personal;
-   unsigned ai_out_ctrl;
+   unsigned int ai_personal;
+   unsigned int ai_out_ctrl;
 
ni_release_ai_mite_channel(dev);
/* ai configuration */
@@ -1684,12 +1688,12 @@ static void ni_m_series_load_channelgain_list(struct 
comedi_device *dev,
unsigned int chan, range, aref;
unsigned int i;
unsigned int dither;
-   unsigned range_code;
+   unsigned int range_code;
 
ni_stc_writew(dev, 1, NISTC_CFG_MEM_CLR_REG);
 
if ((list[0] & CR_ALT_SOURCE)) {
-   unsigned bypass_bits;
+   unsigned int bypass_bits;
 
chan = CR_CHAN(list[

[PATCH 07/19] staging: comedi: ni_mio_common: tidy up block comments

2016-04-12 Thread H Hartley Sweeten
Fix the checkpatch.pl issues.
WARNING: Block comments use * on subsequent lines

Signed-off-by: H Hartley Sweeten 
Cc: Ian Abbott 
Cc: Greg Kroah-Hartman 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 211 ++---
 1 file changed, 117 insertions(+), 94 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 7ce53fd..317b04e 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -1,56 +1,53 @@
 /*
-comedi/drivers/ni_mio_common.c
-Hardware driver for DAQ-STC based boards
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 1997-2001 David A. Schleef 
-Copyright (C) 2002-2006 Frank Mori Hess 
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-*/
+ * Hardware driver for DAQ-STC based boards
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 1997-2001 David A. Schleef 
+ * Copyright (C) 2002-2006 Frank Mori Hess 
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
 
 /*
-   This file is meant to be included by another file, e.g.,
-   ni_atmio.c or ni_pcimio.c.
-
-   Interrupt support originally added by Truxton Fulton
-   
-
-   References (from ftp://ftp.natinst.com/support/manuals):
-
-  340747b.pdf  AT-MIO E series Register Level Programmer Manual
-  341079b.pdf  PCI E Series RLPM
-  340934b.pdf  DAQ-STC reference manual
-   67xx and 611x registers (from 
ftp://ftp.ni.com/support/daq/mhddk/documentation/)
-   release_ni611x.pdf
-   release_ni67xx.pdf
-   Other possibly relevant info:
-
-  320517c.pdf  User manual (obsolete)
-  320517f.pdf  User manual (new)
-  320889a.pdf  delete
-  320906c.pdf  maximum signal ratings
-  321066a.pdf  about 16x
-  321791a.pdf  discontinuation of at-mio-16e-10 rev. c
-  321808a.pdf  about at-mio-16e-10 rev P
-  321837a.pdf  discontinuation of at-mio-16de-10 rev d
-  321838a.pdf  about at-mio-16de-10 rev N
-
-   ISSUES:
-
-- the interrupt routine needs to be cleaned up
-
-   2006-02-07: S-Series PCI-6143: Support has been added but is not
-   fully tested as yet. Terry Barnaby, BEAM Ltd.
-*/
+ * This file is meant to be included by another file, e.g.,
+ * ni_atmio.c or ni_pcimio.c.
+ *
+ * Interrupt support originally added by Truxton Fulton 
+ *
+ * References (ftp://ftp.natinst.com/support/manuals):
+ *   340747b.pdf  AT-MIO E series Register Level Programmer Manual
+ *   341079b.pdf  PCI E Series RLPM
+ *   340934b.pdf  DAQ-STC reference manual
+ *
+ * 67xx and 611x registers (ftp://ftp.ni.com/support/daq/mhddk/documentation/)
+ *   release_ni611x.pdf
+ *   release_ni67xx.pdf
+ *
+ * Other possibly relevant info:
+ *   320517c.pdf  User manual (obsolete)
+ *   320517f.pdf  User manual (new)
+ *   320889a.pdf  delete
+ *   320906c.pdf  maximum signal ratings
+ *   321066a.pdf  about 16x
+ *   321791a.pdf  discontinuation of at-mio-16e-10 rev. c
+ *   321808a.pdf  about at-mio-16e-10 rev P
+ *   321837a.pdf  discontinuation of at-mio-16de-10 rev d
+ *   321838a.pdf  about at-mio-16de-10 rev N
+ *
+ * ISSUES:
+ *   - the interrupt routine needs to be cleaned up
+ *
+ * 2006-02-07: S-Series PCI-6143: Support has been added but is not
+ * fully tested as yet. Terry Barnaby, BEAM Ltd.
+ */
 
 #include 
 #include 
@@ -828,8 +825,10 @@ static void ni_clear_ai_fifo(struct comedi_device *dev)
ni_writeb(dev, 0, NI_M_STATIC_AI_CTRL_REG(0));
ni_writeb(dev, 1, NI_M_STATIC_AI_CTRL_REG(0));
 #if 0
-   /* the NI example code does 3 convert pulses for 625x 
boards,
-  but that appears to be wrong in practice. */
+   /*
+* The NI example code does 3 convert pulses for 625x
+* boards, But that appears to be wrong in practice.
+ 

Re: [PATCH v5 34/50] mtd: nand: gpmi: switch to mtd_ooblayout_ops

2016-04-12 Thread Boris Brezillon
On Tue, 12 Apr 2016 22:27:58 +
Han Xu  wrote:

> 
> I am fine with all gpmi patch set and tested on i.MX6Q, just found another 
> issue in gpmi driver.
> The patch was sent, refer to https://patchwork.ozlabs.org/patch/609755/

Oh, was it related to the changes introduced by this series?

> 
> 
> Acked-by: Han Xu 
> Tested-by: Han Xu 
> --
> 2.5.0
> 



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: Fixed coding style warning

2016-04-12 Thread Panos Vlachos
Fixed coding style warning

Signed-off-by: Panos Vlachos 
---
 drivers/staging/lustre/lnet/lnet/nidstrings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
b/drivers/staging/lustre/lnet/lnet/nidstrings.c
index ebf468f..f532e44 100644
--- a/drivers/staging/lustre/lnet/lnet/nidstrings.c
+++ b/drivers/staging/lustre/lnet/lnet/nidstrings.c
@@ -197,7 +197,7 @@ add_nidrange(const struct cfs_lstr *src,
struct netstrfns *nf;
struct nidrange *nr;
int endlen;
-   unsigned netnum;
+   int netnum;
 
if (src->ls_len >= LNET_NIDSTR_SIZE)
return NULL;
-- 
1.9.1

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


Re: [PATCH] Staging: Fixed coding style warning

2016-04-12 Thread Greg KH
On Wed, Apr 13, 2016 at 03:10:45AM +0300, Panos Vlachos wrote:
> Fixed coding style warning

What warning?

And always put the driver name in the subject so we know where to merge
this to.

And finally, use get_maintainer.pl to determine who to send this to.

thanks,

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


[PATCH 1/2] staging/lustre: Fix blank line after/before {/} style

2016-04-12 Thread green
From: Oleg Drokin 

This patch fixes all checkpatch occurences of
CHECK: Blank lines aren't necessary after an open brace '{'
CHECK: Blank lines aren't necessary before a close brace '}'
in Lustre code.

Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/fld/fld_request.c | 1 -
 drivers/staging/lustre/lustre/include/lu_object.h   | 1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c   | 1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c  | 1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c   | 1 -
 drivers/staging/lustre/lustre/llite/dir.c   | 2 --
 drivers/staging/lustre/lustre/llite/lproc_llite.c   | 1 -
 drivers/staging/lustre/lustre/llite/xattr.c | 1 -
 drivers/staging/lustre/lustre/llite/xattr_cache.c   | 1 -
 drivers/staging/lustre/lustre/lov/lov_io.c  | 1 -
 drivers/staging/lustre/lustre/lov/lov_obd.c | 1 -
 drivers/staging/lustre/lustre/lov/lov_pack.c| 1 -
 drivers/staging/lustre/lustre/lov/lov_request.c | 1 -
 drivers/staging/lustre/lustre/lov/lovsub_object.c   | 1 -
 drivers/staging/lustre/lustre/mdc/mdc_lib.c | 1 -
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   | 1 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c | 1 -
 drivers/staging/lustre/lustre/obdclass/class_obd.c  | 1 -
 drivers/staging/lustre/lustre/obdclass/genops.c | 1 -
 drivers/staging/lustre/lustre/obdclass/llog.c   | 1 -
 drivers/staging/lustre/lustre/obdclass/lu_object.c  | 2 --
 drivers/staging/lustre/lustre/obdclass/obd_config.c | 1 -
 drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 --
 drivers/staging/lustre/lustre/osc/osc_cache.c   | 1 -
 drivers/staging/lustre/lustre/osc/osc_io.c  | 1 -
 drivers/staging/lustre/lustre/osc/osc_page.c| 1 -
 drivers/staging/lustre/lustre/osc/osc_request.c | 1 -
 drivers/staging/lustre/lustre/ptlrpc/client.c   | 1 -
 drivers/staging/lustre/lustre/ptlrpc/events.c   | 1 -
 drivers/staging/lustre/lustre/ptlrpc/import.c   | 3 ---
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c | 1 -
 drivers/staging/lustre/lustre/ptlrpc/nrs.c  | 1 -
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c | 3 ---
 33 files changed, 40 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c 
b/drivers/staging/lustre/lustre/fld/fld_request.c
index 2dfdb51..64c387e 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -95,7 +95,6 @@ static void fld_exit_request(struct client_obd *cli)
spin_lock(&cli->cl_loi_list_lock);
cli->cl_r_in_flight--;
list_for_each_safe(l, tmp, &cli->cl_cache_waiters) {
-
if (cli->cl_r_in_flight >= cli->cl_max_rpcs_in_flight) {
/* No free request slots anymore */
break;
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index 0f70acd..b5b0c81 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -198,7 +198,6 @@ typedef int (*lu_printer_t)(const struct lu_env *env,
  * Operations specific for particular lu_object.
  */
 struct lu_object_operations {
-
/**
 * Allocate lower-layer parts of the object by calling
 * lu_device_operations::ldo_object_alloc() of the corresponding
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 9e58b1c..bc951c0 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -429,7 +429,6 @@ err_ldlm:
ldlm_put_ref();
 err:
return rc;
-
 }
 EXPORT_SYMBOL(client_obd_setup);
 
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 3f9b8526..6c27b23 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -810,7 +810,6 @@ void ldlm_lock_decref_internal(struct ldlm_lock *lock, 
__u32 mode)
} else if (!lock->l_readers && !lock->l_writers &&
   !(lock->l_flags & LDLM_FL_NO_LRU) &&
   !(lock->l_flags & LDLM_FL_BL_AST)) {
-
LDLM_DEBUG(lock, "add lock into lru list");
 
/* If this is a client-side namespace and this was the last
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
index 880efdc..861e4be 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c
@@ -1803,7 +1803,6 @@ static void ldlm_namespace_foreach(struct ldlm_namespace 
*ns,
 
cfs_hash_for_each_nolock(ns->ns_rs_hash,
 ldlm_res_iter_helper, &helper);
-
 }
 
 /* non-blocking function to manipulate a lock whose cb_data is being put away.
diff --git a/drivers/staging/

[PATCH 0/2] Couple of lustre cleanups

2016-04-12 Thread green
From: Oleg Drokin 

These are rebased cleanups from before -
style fixes and suppressign a spurious message.

Bobi Jam (1):
  staging/lustre/llite: suppress non active IO error message

Oleg Drokin (1):
  staging/lustre: Fix blank line after/before {/} style

 drivers/staging/lustre/lustre/fld/fld_request.c |  1 -
 drivers/staging/lustre/lustre/include/lu_object.h   |  1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c   |  1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_lock.c  |  1 -
 drivers/staging/lustre/lustre/ldlm/ldlm_request.c   |  1 -
 drivers/staging/lustre/lustre/llite/dir.c   |  2 --
 drivers/staging/lustre/lustre/llite/lproc_llite.c   |  1 -
 drivers/staging/lustre/lustre/llite/rw.c| 11 ++-
 drivers/staging/lustre/lustre/llite/xattr.c |  1 -
 drivers/staging/lustre/lustre/llite/xattr_cache.c   |  1 -
 drivers/staging/lustre/lustre/lov/lov_io.c  |  1 -
 drivers/staging/lustre/lustre/lov/lov_obd.c |  1 -
 drivers/staging/lustre/lustre/lov/lov_pack.c|  1 -
 drivers/staging/lustre/lustre/lov/lov_request.c |  1 -
 drivers/staging/lustre/lustre/lov/lovsub_object.c   |  1 -
 drivers/staging/lustre/lustre/mdc/mdc_lib.c |  1 -
 drivers/staging/lustre/lustre/mdc/mdc_locks.c   |  1 -
 drivers/staging/lustre/lustre/mgc/mgc_request.c |  1 -
 drivers/staging/lustre/lustre/obdclass/class_obd.c  |  1 -
 drivers/staging/lustre/lustre/obdclass/genops.c |  1 -
 drivers/staging/lustre/lustre/obdclass/llog.c   |  1 -
 drivers/staging/lustre/lustre/obdclass/lu_object.c  |  2 --
 drivers/staging/lustre/lustre/obdclass/obd_config.c |  1 -
 drivers/staging/lustre/lustre/obdecho/echo_client.c |  2 --
 drivers/staging/lustre/lustre/osc/osc_cache.c   |  1 -
 drivers/staging/lustre/lustre/osc/osc_io.c  |  1 -
 drivers/staging/lustre/lustre/osc/osc_page.c|  1 -
 drivers/staging/lustre/lustre/osc/osc_request.c |  1 -
 drivers/staging/lustre/lustre/ptlrpc/client.c   |  1 -
 drivers/staging/lustre/lustre/ptlrpc/events.c   |  1 -
 drivers/staging/lustre/lustre/ptlrpc/import.c   |  3 ---
 drivers/staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c |  1 -
 drivers/staging/lustre/lustre/ptlrpc/nrs.c  |  1 -
 drivers/staging/lustre/lustre/ptlrpc/pack_generic.c |  3 ---
 34 files changed, 2 insertions(+), 49 deletions(-)

-- 
2.1.0

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


[PATCH 2/2] staging/lustre/llite: suppress non active IO error message

2016-04-12 Thread green
From: Bobi Jam 

Current CLIO does not support fadvise, suppress the error message.

Signed-off-by: Bobi Jam 
Reviewed-on: http://review.whamcloud.com/9658
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4717
Reviewed-by: Jinshan Xiong 
Reviewed-by: Andreas Dilger 
Signed-off-by: Oleg Drokin 
---
 drivers/staging/lustre/lustre/llite/rw.c | 11 ++-
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/rw.c 
b/drivers/staging/lustre/lustre/llite/rw.c
index fee319c..4ddf8b3 100644
--- a/drivers/staging/lustre/lustre/llite/rw.c
+++ b/drivers/staging/lustre/lustre/llite/rw.c
@@ -111,16 +111,9 @@ struct ll_cl_context *ll_cl_init(struct file *file, struct 
page *vmpage)
vio = vvp_env_io(env);
io = vio->vui_cl.cis_io;
lcc->lcc_io = io;
-   if (!io) {
-   struct inode *inode = file_inode(file);
-
-   CERROR("%s: " DFID " no active IO, please file a ticket.\n",
-  ll_get_fsname(inode->i_sb, NULL, 0),
-  PFID(ll_inode2fid(inode)));
-   dump_stack();
-
+   if (!io)
result = -EIO;
-   }
+
if (result == 0 && vmpage) {
struct cl_page   *page;
 
-- 
2.1.0

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


Re: [PATCH] Staging: Fixed coding style warning

2016-04-12 Thread Joe Perches
On Wed, 2016-04-13 at 03:10 +0300, Panos Vlachos wrote:
> Fixed coding style warning
[]
> diff --git a/drivers/staging/lustre/lnet/lnet/nidstrings.c 
> b/drivers/staging/lustre/lnet/lnet/nidstrings.c
[]
> @@ -197,7 +197,7 @@ add_nidrange(const struct cfs_lstr *src,
>   struct netstrfns *nf;
>   struct nidrange *nr;
>   int endlen;
> - unsigned netnum;
> + int netnum;

Why change the type from unsigned to signed?

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