Re: [PATCH] staging: greybus: timesync.c: Fixed WARNING for brace issue

2016-10-12 Thread Viresh Kumar
On Thu, Oct 13, 2016 at 1:20 AM, Chase Metzger  wrote:
> Removed a checkpatch warning for braces on single argument if and else
> statement.
>
> Signed-off-by: Chase Metzger 
> ---
>  drivers/staging/greybus/timesync.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/staging/greybus/timesync.c 
> b/drivers/staging/greybus/timesync.c
> index 2e68af7..e586627 100644
> --- a/drivers/staging/greybus/timesync.c
> +++ b/drivers/staging/greybus/timesync.c
> @@ -807,11 +807,11 @@ static int gb_timesync_schedule(struct gb_timesync_svc 
> *timesync_svc, int state)
> return -EINVAL;
>
> mutex_lock(_svc->mutex);
> -   if (timesync_svc->state !=  GB_TIMESYNC_STATE_INVALID) {
> +   if (timesync_svc->state !=  GB_TIMESYNC_STATE_INVALID)
> gb_timesync_set_state_atomic(timesync_svc, state);
> -   } else {
> +   else
> ret = -ENODEV;
> -   }
> +
> mutex_unlock(_svc->mutex);
> return ret;
>  }

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


Re: [PATCH] Staging:greybus:arche-apb-ctrl: fixed some coding style issue

2016-10-12 Thread Alexander Alemayhu
On Wed, Oct 12, 2016 at 04:45:54PM +0200, Greg KH wrote:
> 
> You can subscribe to the driverdev mailing list to see what othes are
> working on, and you can follow my staging-testing kernel branch in the
> staging.git tree.  But sometimes you just get unlucky, lots of people
> are working on cleaning up staging drivers, people do the same work at
> the same time quite often, it's just part of the process.
> 

Is this
(http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel)
the right page for subscribing?

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


[PATCH] staging: i4l: pcbit: replace some include asm/*.h with linux/*.h

2016-10-12 Thread Alexander Alemayhu
Fixes the following checkpatch output:

./pcbit/capi.c:39: WARNING: Use #include  instead of 
./pcbit/capi.c:40: WARNING: Use #include  instead of 

./pcbit/callbacks.c:25: WARNING: Use #include  instead of 
./pcbit/layer2.c:39: WARNING: Use #include  instead of 
./pcbit/drv.c:34: WARNING: Use #include  instead of 

./pcbit/drv.c:35: WARNING: Use #include  instead of 
./pcbit/edss1.c:26: WARNING: Use #include  instead of 

Signed-off-by: Alexander Alemayhu 
---
This is my first patch to the list, hopefully I've done everything correctly.
If not please let me know, thanks.

 drivers/staging/i4l/pcbit/callbacks.c | 2 +-
 drivers/staging/i4l/pcbit/capi.c  | 4 ++--
 drivers/staging/i4l/pcbit/drv.c   | 4 ++--
 drivers/staging/i4l/pcbit/edss1.c | 2 +-
 drivers/staging/i4l/pcbit/layer2.c| 2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/i4l/pcbit/callbacks.c 
b/drivers/staging/i4l/pcbit/callbacks.c
index efb6d6a3639a..212ab0b229d4 100644
--- a/drivers/staging/i4l/pcbit/callbacks.c
+++ b/drivers/staging/i4l/pcbit/callbacks.c
@@ -22,7 +22,7 @@
 #include 
 #include 
 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/staging/i4l/pcbit/capi.c b/drivers/staging/i4l/pcbit/capi.c
index 373f90feda5a..91f299477d43 100644
--- a/drivers/staging/i4l/pcbit/capi.c
+++ b/drivers/staging/i4l/pcbit/capi.c
@@ -36,8 +36,8 @@
 
 #include 
 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 
diff --git a/drivers/staging/i4l/pcbit/drv.c b/drivers/staging/i4l/pcbit/drv.c
index d417df5efb5f..87b852259b89 100644
--- a/drivers/staging/i4l/pcbit/drv.c
+++ b/drivers/staging/i4l/pcbit/drv.c
@@ -31,8 +31,8 @@
 #include 
 
 #include 
-#include 
-#include 
+#include 
+#include 
 #include 
 
 #include "pcbit.h"
diff --git a/drivers/staging/i4l/pcbit/edss1.c 
b/drivers/staging/i4l/pcbit/edss1.c
index 6d291d548423..5980d1b5da95 100644
--- a/drivers/staging/i4l/pcbit/edss1.c
+++ b/drivers/staging/i4l/pcbit/edss1.c
@@ -23,7 +23,7 @@
 #include 
 
 #include 
-#include 
+#include 
 
 #include 
 
diff --git a/drivers/staging/i4l/pcbit/layer2.c 
b/drivers/staging/i4l/pcbit/layer2.c
index a136c72547e5..0592bf6ee9c9 100644
--- a/drivers/staging/i4l/pcbit/layer2.c
+++ b/drivers/staging/i4l/pcbit/layer2.c
@@ -36,7 +36,7 @@
 
 #include 
 
-#include 
+#include 
 
 
 #include "pcbit.h"
-- 
2.10.1

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


Re: [patch] staging: android: ion: Fix error handling in ion_query_heaps()

2016-10-12 Thread Laura Abbott

On 10/12/2016 05:49 AM, Dan Carpenter wrote:

copy_to_user() returns the number of bytes remaining to be copied.  We
want to return -EFAULT here instead.  Also there seems like no point
in continuing the loop if copy_to_user() fails.

Fixes: 02b23803c6af ('staging: android: ion: Add ioctl to query available 
heaps')
Signed-off-by: Dan Carpenter 
---
The error handling still might be wrong here.  Do we really want to
change query->cnt?  Please review.

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 396ded5..4cec0b2 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1187,8 +1187,10 @@ int ion_query_heaps(struct ion_client *client, struct 
ion_heap_query *query)
hdata.type = heap->type;
hdata.heap_id = heap->id;

-   ret = copy_to_user([cnt],
-  , sizeof(hdata));
+   if (copy_to_user([cnt], , sizeof(hdata))) {
+   ret = -EFAULT;
+   break;
+   }

cnt++;
if (cnt >= max_cnt)



Yeah, I really butchered the error handling on this. You are correct,
query->cnt shouldn't be updated. break can be changed to 'goto out'.

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


Re: [PATCH] staging: android: ion: Make ion_free asynchronous more actively.

2016-10-12 Thread Laura Abbott

On 10/10/2016 07:31 PM, ming.ling wrote:

From: Ming Ling 

So far some ion heaps such as carveout_heap, chunk_heap,
system_heap have freed buffers asynchrounously. Freed buffers
are placed on a free list and freed from a low priority background
thread. If allocations from a particular heap fail, the free list
is drained.

But that mechanism does not work well to free those buffers when
cpu is very busy:
1.That low priority background thread has no chance to run.
2.And with helps of kinds of memory reclaim mechanisms,
allocations from a system_heap never fail, so the free list
can't be drained on that condition.
3.Ion_heap_shrink_scan can shrink the free list, but it is
too slow.

Too many freed buffers in heap's free list waiting to be freed will
lead to low memory killer over-killing innocent processes.

For example:
On my Android Mobile phone(arm32, 2G ram)
lowmemorykiller: Killing 'viders.calendar' (2271), adj 15,
to free 45060kB on behalf of 'kswapd0' (60) because
cache 17208kB is below limit 46080kB for oom_score_adj 0.
Free memory is 3424kB above reserved.

Memory footprint is as below:

MemTotal:1972164 kB

Normal free:43624kB min:3228kB low:5308kB high:6116kB active_anon:
656kB inactive_anon:1308kB active_file:10600kB inactive_file:6628kB
HighMem free:13208kB min:512kB low:4720kB high:6352kB active_anon:
126188kB inactive_anon:74364kB active_file:325720kB inactive_file:
585832k

ion system heap:

total orphaned  9961472
total   58986496
deferred free   630575104


There are about 630575104=601MB memory on ion system heap's free
list waiting to be freed. And it kills more processes, until ion low
priority background thread gets a chance to run as below:
lowmemorykiller: Killing 'd.process.media' (1402), adj 11,
lowmemorykiller: Killing 'dsrt.srtmemtest' (2552), adj 9,
lowmemorykiller: Killing 'rd.engineermode' (2167), adj 8,
lowmemorykiller: Killing 'rd.fileexplorer' (2431), adj 7,
lowmemorykiller: Killing 'd.process.acore' (1499), adj 5,
...

Limit ion_heap_deferred_free thread as a low priority thread doesn't
make any sense. Remove that restriction makes ion_free asynchronous
more actively, and more background applications can survive.



I don't have the full history here of why the thread was set to
run at a lower priority. If I had to guess, it's because the
deferred thread was blocking out other higher priority threads
and causing graphics issues, so it's possibly trading one issue
for another.

I'm reluctant to Ack this without some testing from others first.
Any other eager Ion users want to test this on their system?
(Any eager Ion users at all?)

Thanks,
Laura


Signed-off-by: Ming Ling 
---
 drivers/staging/android/ion/ion_heap.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion_heap.c 
b/drivers/staging/android/ion/ion_heap.c
index 4e5c0f1..d68a80c 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -250,8 +250,6 @@ static int ion_heap_deferred_free(void *data)

 int ion_heap_init_deferred_free(struct ion_heap *heap)
 {
-   struct sched_param param = { .sched_priority = 0 };
-
INIT_LIST_HEAD(>free_list);
init_waitqueue_head(>waitqueue);
heap->task = kthread_run(ion_heap_deferred_free, heap,
@@ -261,7 +259,6 @@ int ion_heap_init_deferred_free(struct ion_heap *heap)
   __func__);
return PTR_ERR_OR_ZERO(heap->task);
}
-   sched_setscheduler(heap->task, SCHED_IDLE, );
return 0;
 }




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


Re: [patch] staging: android/ion: testing the wrong variable

2016-10-12 Thread Laura Abbott

On 10/11/2016 11:20 PM, Dan Carpenter wrote:

We're testing "pdev" but we intended to test "heap_pdev".  This is a
static checker fix and it's unlikely that anyone is affected by this
bug.

Fixes: 13439479c7de ('staging: ion: Add files for parsing the devicetree')
Signed-off-by: Dan Carpenter 



Acked-by: Laura Abbott 


diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 15bac92..46b2bb9 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -107,7 +107,7 @@ struct ion_platform_data *ion_parse_dt(struct 
platform_device *pdev,

heap_pdev = of_platform_device_create(node, heaps[i].name,
  >dev);
-   if (!pdev)
+   if (!heap_pdev)
return ERR_PTR(-ENOMEM);
heap_pdev->dev.platform_data = [i];




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


[PATCH] staging: greybus: timesync.c: Fixed WARNING for brace issue

2016-10-12 Thread Chase Metzger
Removed a checkpatch warning for braces on single argument if and else
statement.

Signed-off-by: Chase Metzger 
---
 drivers/staging/greybus/timesync.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/timesync.c 
b/drivers/staging/greybus/timesync.c
index 2e68af7..e586627 100644
--- a/drivers/staging/greybus/timesync.c
+++ b/drivers/staging/greybus/timesync.c
@@ -807,11 +807,11 @@ static int gb_timesync_schedule(struct gb_timesync_svc 
*timesync_svc, int state)
return -EINVAL;
 
mutex_lock(_svc->mutex);
-   if (timesync_svc->state !=  GB_TIMESYNC_STATE_INVALID) {
+   if (timesync_svc->state !=  GB_TIMESYNC_STATE_INVALID)
gb_timesync_set_state_atomic(timesync_svc, state);
-   } else {
+   else
ret = -ENODEV;
-   }
+
mutex_unlock(_svc->mutex);
return ret;
 }
-- 
2.1.4

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


[PATCH V2] rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Larry Finger
In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
the configuration struct for most of the drivers was changed to be
constant. The problem is that five of the modified drivers need to be
able to update the firmware name based on the exact model of the card.
As the file names were stored in one of the members of that struct,
these drivers would fail with a kernel BUG splat when they tried to
update the firmware name.

Rather than reverting the previous commit, I used a suggestion by
Johannes Berg and made the firmware file name pointers be local to
the routines that update the software variables.

The configuration struct of rtl8192cu, which was not touched in the
previous patch, is now constantfied.

Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
Suggested-by: Johannes Berg 
Signed-off-by: Larry Finger 
Cc: Stable 
Cc: Julia Lawall 
---

V2 - Fix warnings that were generated for some compiler versions.
---
 drivers/net/wireless/realtek/rtlwifi/core.c |  2 +-
 drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c |  8 
 drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 13 +
 drivers/net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 12 ++--
 drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c |  6 +++---
 drivers/net/wireless/realtek/rtlwifi/rtl8192ee/sw.c |  8 
 drivers/net/wireless/realtek/rtlwifi/rtl8192se/sw.c |  9 +
 drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 12 +---
 drivers/net/wireless/realtek/rtlwifi/rtl8723be/sw.c |  6 +++---
 drivers/net/wireless/realtek/rtlwifi/rtl8821ae/sw.c | 18 +-
 drivers/net/wireless/realtek/rtlwifi/wifi.h |  2 --
 11 files changed, 45 insertions(+), 51 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtlwifi/core.c 
b/drivers/net/wireless/realtek/rtlwifi/core.c
index f95760c..8e7f23c 100644
--- a/drivers/net/wireless/realtek/rtlwifi/core.c
+++ b/drivers/net/wireless/realtek/rtlwifi/core.c
@@ -111,7 +111,7 @@ static void rtl_fw_do_work(const struct firmware *firmware, 
void *context,
if (!err)
goto found_alt;
}
-   pr_err("Firmware %s not available\n", rtlpriv->cfg->fw_name);
+   pr_err("Selected firmware is not available\n");
rtlpriv->max_fw_size = 0;
return;
}
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
index e7b11b4..f361808 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c
@@ -86,6 +86,7 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
u8 tid;
+   char *fw_name;
 
rtl8188ee_bt_reg_init(hw);
rtlpriv->dm.dm_initialgain_enable = 1;
@@ -169,10 +170,10 @@ int rtl88e_init_sw_vars(struct ieee80211_hw *hw)
return 1;
}
 
-   rtlpriv->cfg->fw_name = "rtlwifi/rtl8188efw.bin";
+   fw_name = "rtlwifi/rtl8188efw.bin";
rtlpriv->max_fw_size = 0x8000;
-   pr_info("Using firmware %s\n", rtlpriv->cfg->fw_name);
-   err = request_firmware_nowait(THIS_MODULE, 1, rtlpriv->cfg->fw_name,
+   pr_info("Using firmware %s\n", fw_name);
+   err = request_firmware_nowait(THIS_MODULE, 1, fw_name,
  rtlpriv->io.dev, GFP_KERNEL, hw,
  rtl_fw_cb);
if (err) {
@@ -284,7 +285,6 @@ static const struct rtl_hal_cfg rtl88ee_hal_cfg = {
.bar_id = 2,
.write_readback = true,
.name = "rtl88e_pci",
-   .fw_name = "rtlwifi/rtl8188efw.bin",
.ops = _hal_ops,
.mod_params = _mod_params,
 
diff --git a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c 
b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
index 5c46a98..691ddef 100644
--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
+++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c
@@ -92,6 +92,7 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
struct rtl_priv *rtlpriv = rtl_priv(hw);
struct rtl_pci *rtlpci = rtl_pcidev(rtl_pcipriv(hw));
struct rtl_hal *rtlhal = rtl_hal(rtl_priv(hw));
+   char *fw_name = "rtlwifi/rtl8192cfwU.bin";
 
rtl8192ce_bt_reg_init(hw);
 
@@ -163,15 +164,12 @@ int rtl92c_init_sw_vars(struct ieee80211_hw *hw)
}
 
/* request fw */
-   if (IS_VENDOR_UMC_A_CUT(rtlhal->version) &&
-   !IS_92C_SERIAL(rtlhal->version))
-   rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU.bin";
-   else if (IS_81XXC_VENDOR_UMC_B_CUT(rtlhal->version))
-   rtlpriv->cfg->fw_name = "rtlwifi/rtl8192cfwU_B.bin";
+   if 

Re: [PATCH] rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Larry Finger

On 10/12/2016 11:54 AM, Kalle Valo wrote:

Larry Finger  writes:


In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
the configuration struct for most of the drivers was changed to be
constant. The problem is that five of the modified drivers need to be
able to update the firmware name based on the exact model of the card.
As the file names were stored in one of the members of that struct,
these drivers would fail with a kernel BUG splat when they tried to
update the firmware name.

Rather than reverting the previous commit, I used a suggestion by
Johannes Berg and made the firmware file name pointers be local to
the routines that update the software variables.

The configuration struct of rtl8192cu, which was not touched in the
previous patch, is now constantfied.

Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
Suggested-by: Johannes Berg 
Signed-off-by: Larry Finger 
Cc: Stable [4.8+] 
Cc: Julia Lawall 


I got warnings and after a quick look they look valid but not sure:

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c: In function 
'rtl92c_init_sw_vars':
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c:179:6: warning: 'fw_name' 
may be used uninitialized in this function [-Wuninitialized]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c: In function 
'rtl8723e_init_sw_vars':
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c:187:6: warning: 'fw_name' 
may be used uninitialized in this function [-Wuninitialized]

(Sending manually for the second time as I don't see my first mail
anywhere.)


Kalle,

I did receive the first one. My compiler failed to show that warning, but I have 
modified the patch to fix the warnings you see. In fact, the new version is a 
bit cleaner in that "if () ... else if () ..." constructions are replaced by 
simple if statements.


V2 will be sent shortly.

Larry


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


Re: [RFC v3 3/3] phy,leds: add support for led triggers on phy link state change

2016-10-12 Thread Zach Brown
On Mon, Oct 10, 2016 at 02:03:32AM -0700, Florian Fainelli wrote:
> > +
> > +#ifdef CONFIG_LED_TRIGGER_PHY
> > +
> > +#include 
> > +#include 
> > +
> > +#define PHY_LINK_LED_MAX_TRIGGERS  5
> > +#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE  7
> > +#define PHY_MII_BUS_ID_SIZE(20 - 3)
> 
> This particular constant may be something worth moving to
> include/linux/phy.h eventually.
> -- 
> Florian

MII_BUS_ID_SIZE is defined in include/linux/phy.h but it's defined after
phy_led_triggers.h is included so phy_led_triggers.h doesn't have access.
I could move the definition of MII_BUS_ID_SIZE above the include, but that
seemed ugly. Do you have any suggestions?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [RFC 0/6] Module for tracking/accounting shared memory buffers

2016-10-12 Thread Dave Hansen
On 10/11/2016 04:50 PM, Ruchi Kandoi wrote:
> Any process holding a reference to these buffers will keep the kernel from
> reclaiming its backing pages.  mm counters don't provide a complete picture of
> these allocations, since they only account for pages that are mapped into a
> process's address space.  This problem is especially bad for systems like
> Android that use dma-buf fds to share graphics and multimedia buffers between
> processes: these allocations are often large, have complex sharing patterns,
> and are rarely mapped into every process that holds a reference to them.

What do you end up _doing_ with all this new information that you have
here?  You know which processes have "pinned" these shared buffers, and
exported that information in /proc.  But, then what?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Kalle Valo
Larry Finger  writes:

> In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
> the configuration struct for most of the drivers was changed to be
> constant. The problem is that five of the modified drivers need to be
> able to update the firmware name based on the exact model of the card.
> As the file names were stored in one of the members of that struct,
> these drivers would fail with a kernel BUG splat when they tried to
> update the firmware name.
>
> Rather than reverting the previous commit, I used a suggestion by
> Johannes Berg and made the firmware file name pointers be local to
> the routines that update the software variables.
>
> The configuration struct of rtl8192cu, which was not touched in the
> previous patch, is now constantfied.
>
> Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
> Suggested-by: Johannes Berg 
> Signed-off-by: Larry Finger 
> Cc: Stable [4.8+] 
> Cc: Julia Lawall 

I got warnings and after a quick look they look valid but not sure:

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c: In function 
'rtl92c_init_sw_vars':
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c:179:6: warning: 'fw_name' 
may be used uninitialized in this function [-Wuninitialized]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c: In function 
'rtl8723e_init_sw_vars':
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c:187:6: warning: 'fw_name' 
may be used uninitialized in this function [-Wuninitialized]

(Sending manually for the second time as I don't see my first mail
anywhere.)

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


Re: rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Kalle Valo
Larry Finger  wrote:
> In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
> the configuration struct for most of the drivers was changed to be
> constant. The problem is that five of the modified drivers need to be
> able to update the firmware name based on the exact model of the card.
> As the file names were stored in one of the members of that struct,
> these drivers would fail with a kernel BUG splat when they tried to
> update the firmware name.
> 
> Rather than reverting the previous commit, I used a suggestion by
> Johannes Berg and made the firmware file name pointers be local to
> the routines that update the software variables.
> 
> The configuration struct of rtl8192cu, which was not touched in the
> previous patch, is now constantfied.
> 
> Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
> Cc: Stable  # 4.8
> Cc: Julia Lawall 
> Suggested-by: Johannes Berg 
> Signed-off-by: Larry Finger 

I got warnings and after a quick look they look valid but not sure:

drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c: In function 
‘rtl92c_init_sw_vars’:
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c:179:6: warning: ‘fw_name’ 
may be used uninitialized in this function [-Wuninitialized]
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c: In function 
‘rtl8723e_init_sw_vars’:
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c:187:6: warning: ‘fw_name’ 
may be used uninitialized in this function [-Wuninitialized]

-- 
https://patchwork.kernel.org/patch/9370013/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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


Re: [PATCH] rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Larry Finger

On 10/12/2016 02:53 AM, Kalle Valo wrote:

Larry Finger  writes:


In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
the configuration struct for most of the drivers was changed to be
constant. The problem is that five of the modified drivers need to be
able to update the firmware name based on the exact model of the card.
As the file names were stored in one of the members of that struct,
these drivers would fail with a kernel BUG splat when they tried to
update the firmware name.

Rather than reverting the previous commit, I used a suggestion by
Johannes Berg and made the firmware file name pointers be local to
the routines that update the software variables.

The configuration struct of rtl8192cu, which was not touched in the
previous patch, is now constantfied.

Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
Suggested-by: Johannes Berg 
Signed-off-by: Larry Finger 
Cc: Stable [4.8+] 


This should be:

Cc: Stable  # 4.8


I know that info should be at the end of the Cc for Stable; however, versions of 
git since 2.6 are incorrectly mangling the line and producing the following:


Stable 

Of course, the smtp server refuses to send that mail, thus I got creative with 
my formatting.


Thanks for Thorsten's address. I will try to keep him notified of any future 
regressions that I find. Thus far, I have only communicated with him indirectly 
through LKML.


Larry

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


Re: [PATCH v3] Staging: rtl8188eu: fix Block comments warning found by checkpatch.

2016-10-12 Thread Greg KH
On Wed, Oct 12, 2016 at 07:58:18AM -0700, Victor Carvajal wrote:
> On Wed, Oct 12, 2016 at 03:53:18PM +0200, Greg KH wrote:
> > On Mon, Oct 10, 2016 at 11:42:26PM -0700, Victor Carvajal wrote:
> > > Signed-off-by: Victor Carvajal 
> > > ---
> > > Changes in v3:
> > > - Be consistent with spacing before text against previous patch.
> > > Changes in v2:
> > > - Be consistent with spacing before text.
> > > ---
> > >  drivers/staging/rtl8188eu/include/rtw_event.h | 10 +-
> > >  1 file changed, 5 insertions(+), 5 deletions(-)
> > 
> > This patch doesn't apply to my tree at all.  Are you sure you are making
> > it against the staging-testing branch?
> > 
> > thanks,
> > 
> > greg k-h
> There lies my problem then.  I've been using one of the latest branches
> of linux-next.
> I appreciate your patience in all this, this is all part of a eudyptula
> task.  I'll circle back after I create a patch against the appropriate
> branch.

Normally yes, linux-next is the right place to do this work.  But right
now is the merge window, and I can't add new patches to my public tree,
so I'm using staging-testing to keep them in a public location for
people to work against to prevent a 2 week backlog of patches.

Watch out though, it does get rebased at times to deal with some merge
issues, once -rc1 is out, it will be safe and linux-next is good again
to work against.

hope this helps,

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


[PATCH] staging:vt6656:card.c: fix block comments should align the * on each line

2016-10-12 Thread Mikhail Golubev
Block comments should align the * on each line as reported by checkpatch.pl

Signed-off-by: Mikhail Golubev 
---
 drivers/staging/vt6656/card.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c
index 53b469c..807d3f7 100644
--- a/drivers/staging/vt6656/card.c
+++ b/drivers/staging/vt6656/card.c
@@ -610,8 +610,8 @@ u64 vnt_get_next_tbtt(u64 tsf, u16 beacon_interval)
beacon_int = beacon_interval * 1024;
 
/* Next TBTT =
-   *   ((local_current_TSF / beacon_interval) + 1) * beacon_interval
-   */
+*  ((local_current_TSF / beacon_interval) + 1) * beacon_interval
+*/
if (beacon_int) {
do_div(tsf, beacon_int);
tsf += 1;
-- 
2.7.4

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


[PATCH v3] Staging: rtl8188eu: fix Block comments warning found by checkpatch.

2016-10-12 Thread Victor Carvajal
On Wed, Oct 12, 2016 at 03:53:18PM +0200, Greg KH wrote:
> On Mon, Oct 10, 2016 at 11:42:26PM -0700, Victor Carvajal wrote:
> > Signed-off-by: Victor Carvajal 
> > ---
> > Changes in v3:
> > - Be consistent with spacing before text against previous patch.
> > Changes in v2:
> > - Be consistent with spacing before text.
> > ---
> >  drivers/staging/rtl8188eu/include/rtw_event.h | 10 +-
> >  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> This patch doesn't apply to my tree at all.  Are you sure you are making
> it against the staging-testing branch?
> 
> thanks,
> 
> greg k-h
There lies my problem then.  I've been using one of the latest branches
of linux-next.
I appreciate your patience in all this, this is all part of a eudyptula
task.  I'll circle back after I create a patch against the appropriate
branch.
Thanks again,
Victor
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] Staging:greybus:arche-apb-ctrl: fixed some coding style issue

2016-10-12 Thread Greg KH
On Wed, Oct 12, 2016 at 07:33:07PM +0530, Nadim Almas wrote:
> >Someone else already sent this same patch in before you, sorry
>  But sir how can i come to know that Someone else already sent
> particular patch  before sending that particular patch

You can subscribe to the driverdev mailing list to see what othes are
working on, and you can follow my staging-testing kernel branch in the
staging.git tree.  But sometimes you just get unlucky, lots of people
are working on cleaning up staging drivers, people do the same work at
the same time quite often, it's just part of the process.

Pick something else to work on, we have lots of things to do :)

thanks,

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


Re: [PATCH] Staging:greybus:arche-apb-ctrl: fixed some coding style issue

2016-10-12 Thread Nadim Almas
>Someone else already sent this same patch in before you, sorry
 But sir how can i come to know that Someone else already sent
particular patch  before sending that particular patch

On Wed, Oct 12, 2016 at 6:55 PM, Greg KH  wrote:
> On Tue, Oct 11, 2016 at 12:49:54PM -0700, Nadim Almas wrote:
>> fixed trailing */ Block comments and 80 character line limit coding style 
>> issue
>>
>> Signed-off-by: Nadim Almas 
>> ---
>
> Someone else already sent this same patch in before you, sorry :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3] Staging: rtl8188eu: fix Block comments warning found by checkpatch.

2016-10-12 Thread Greg KH
On Mon, Oct 10, 2016 at 11:42:26PM -0700, Victor Carvajal wrote:
> Signed-off-by: Victor Carvajal 
> ---
> Changes in v3:
> - Be consistent with spacing before text against previous patch.
> Changes in v2:
> - Be consistent with spacing before text.
> ---
>  drivers/staging/rtl8188eu/include/rtw_event.h | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)

This patch doesn't apply to my tree at all.  Are you sure you are making
it against the staging-testing branch?

thanks,

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


Re: [PATCH] Staging:greybus:arche-apb-ctrl: fixed some coding style issue

2016-10-12 Thread Greg KH
On Tue, Oct 11, 2016 at 12:49:54PM -0700, Nadim Almas wrote:
> fixed trailing */ Block comments and 80 character line limit coding style 
> issue
> 
> Signed-off-by: Nadim Almas 
> ---

Someone else already sent this same patch in before you, sorry :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[patch] staging: android: ion: Fix error handling in ion_query_heaps()

2016-10-12 Thread Dan Carpenter
copy_to_user() returns the number of bytes remaining to be copied.  We
want to return -EFAULT here instead.  Also there seems like no point
in continuing the loop if copy_to_user() fails.

Fixes: 02b23803c6af ('staging: android: ion: Add ioctl to query available 
heaps')
Signed-off-by: Dan Carpenter 
---
The error handling still might be wrong here.  Do we really want to
change query->cnt?  Please review.

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 396ded5..4cec0b2 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1187,8 +1187,10 @@ int ion_query_heaps(struct ion_client *client, struct 
ion_heap_query *query)
hdata.type = heap->type;
hdata.heap_id = heap->id;
 
-   ret = copy_to_user([cnt],
-  , sizeof(hdata));
+   if (copy_to_user([cnt], , sizeof(hdata))) {
+   ret = -EFAULT;
+   break;
+   }
 
cnt++;
if (cnt >= max_cnt)
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[bug report] greybus: audio: Add topology parser for GB codec

2016-10-12 Thread Dan Carpenter
Hello Vaibhav Agarwal,

The patch 6339d2322c47: "greybus: audio: Add topology parser for GB
codec" from Jan 13, 2016, leads to the following static checker
warning:

drivers/staging/greybus/audio_topology.c:374 
gbcodec_mixer_dapm_ctl_info()
warn: unsigned 'info->value.integer.min' is never less than zero.

drivers/staging/greybus/audio_topology.c
   348  static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol,
   349   struct snd_ctl_elem_info *uinfo)
   350  {
   351  int platform_max, platform_min;
   352  struct gbaudio_ctl_pvt *data;
   353  struct gb_audio_ctl_elem_info *info;
   354  struct snd_soc_dapm_widget_list *wlist = 
snd_kcontrol_chip(kcontrol);
   355  struct snd_soc_dapm_widget *widget = wlist->widgets[0];
   356  struct snd_soc_codec *codec = widget->codec;
   357  
   358  dev_dbg(codec->dev, "Entered %s:%s\n", __func__, 
kcontrol->id.name);
   359  data = (struct gbaudio_ctl_pvt *)kcontrol->private_value;
   360  info = (struct gb_audio_ctl_elem_info *)data->info;
   361  
   362  /* update uinfo */
   363  platform_max = info->value.integer.max;
   364  platform_min = info->value.integer.min;
   365  
   366  if (platform_max == 1 &&
   367  !strnstr(kcontrol->id.name, " Volume", NAME_SIZE))
   368  uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
   369  else
   370  uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
   371  
   372  uinfo->count = data->vcount;
   373  uinfo->value.integer.min = 0;
   374  if (info->value.integer.min < 0 &&
  ^
You probably assumed that because the name says "integer" that means it
is an integer.  Surprise!!!  NOPE!  It's an __le32.

   375  (uinfo->type == SNDRV_CTL_ELEM_TYPE_INTEGER))
   376  uinfo->value.integer.max = platform_max - platform_min;
   377  else
   378  uinfo->value.integer.max = platform_max;
   379  
   380  return 0;
   381  }

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


[PATCH 04/15] staging: comedi: ni_routing: add ni routing tables

2016-10-12 Thread Spencer E. Olson
Adds tables of all register values for routing various signals to various
terminals on National Instruments hardware.  This information is directly
compared to and taken from register-level programming documentation and/or
register-level programming examples as provided by National Instruments.

Furthermore, this information was mostly compared (favorably) to the
register values already used in the comedi drivers for NI hardware.

Adds tables of valid routes for many devices.  This information is not
consistent from device to device, nor entirely consistent within device
families.  One additional major challenge is that this information does not
seem to be obtainable in any programmatic fashion, neither through the
proprietary NIDAQmx(-base) c-libraries, nor with register level
programming, _nor_ through any documentation.  In fact, the only consistent
source of this information is through the proprietary NI-MAX software,
which currently only runs on Windows platforms.  A further challenge is
that this information cannot be exported from NI-MAX, except by screenshot.

As described in ni_routing/README and as provided by this commit, the
device route information is primarily stored in a spreadsheet so-as to
enhance the ability to compare to screenshots obtained of NI-MAX.  This
commit provides the ability to parse the spreadsheets and generate
code following kernel conventions.

Signed-off-by: Spencer E. Olson 

*** PLEASE FIND ACTUAL PATCH AT:
http://www.umich.edu/~olsonse/patches/comedi-devglobal-v1/0004-staging-comedi-ni_routing-add-ni-routing-tables.patch

(This patch was over 500kB in size, too large for inline patch submission)
---
 .../staging/comedi/drivers/ni_routing/.gitignore   | 3 +
 drivers/staging/comedi/drivers/ni_routing/Makefile |40 +
 .../comedi/drivers/ni_routing/extract_tables.py|   259 +
 .../comedi/drivers/ni_routing/ni_device_routes.c   | 20251 +++
 .../comedi/drivers/ni_routing/ni_route_values.c|  2724 +++
 5 files changed, 23277 insertions(+)
 create mode 100644 drivers/staging/comedi/drivers/ni_routing/.gitignore
 create mode 100644 drivers/staging/comedi/drivers/ni_routing/Makefile
 create mode 100755 drivers/staging/comedi/drivers/ni_routing/extract_tables.py
 create mode 100644 drivers/staging/comedi/drivers/ni_routing/ni_device_routes.c
 create mode 100644 drivers/staging/comedi/drivers/ni_routing/ni_route_values.c

<... SNIP ...>
-- 
1.9.1

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


[PATCH 05/15] staging: comedi: add new device-global config interface

2016-10-12 Thread Spencer E. Olson
Adds interface for configuring options that are global to all sub-devices.
For now, only options to configure device-globally identified signal routes
have been defined.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/comedi.h  | 49 +
 drivers/staging/comedi/comedi_fops.c | 84 
 drivers/staging/comedi/comedidev.h   | 13 ++
 drivers/staging/comedi/drivers.c | 18 
 4 files changed, 164 insertions(+)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index c80d0d6..a0ff6c1 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -116,6 +116,7 @@
 #define INSN_WRITE (1 | INSN_MASK_WRITE)
 #define INSN_BITS  (2 | INSN_MASK_READ | INSN_MASK_WRITE)
 #define INSN_CONFIG(3 | INSN_MASK_READ | INSN_MASK_WRITE)
+#define INSN_DEVICE_CONFIG (INSN_CONFIG | INSN_MASK_SPECIAL)
 #define INSN_GTOD  (4 | INSN_MASK_READ | INSN_MASK_SPECIAL)
 #define INSN_WAIT  (5 | INSN_MASK_WRITE | INSN_MASK_SPECIAL)
 #define INSN_INTTRIG   (6 | INSN_MASK_WRITE | INSN_MASK_SPECIAL)
@@ -357,6 +358,23 @@ enum configuration_ids {
 };
 
 /**
+ * enum device_configuration_ids - COMEDI configuration instruction codes 
global
+ * to an entire device.
+ * @INSN_DEVICE_CONFIG_TEST_ROUTE: Validate the possibility of a
+ * globally-named route
+ * @INSN_DEVICE_CONFIG_CONNECT_ROUTE:  Connect a globally-named route
+ * @INSN_DEVICE_CONFIG_DISCONNECT_ROUTE:Disconnect a globally-named route
+ * @INSN_DEVICE_CONFIG_GET_ROUTES: Get a list of all globally-named routes
+ * that are valid for a particular device.
+ */
+enum device_config_route_ids {
+   INSN_DEVICE_CONFIG_TEST_ROUTE = 0,
+   INSN_DEVICE_CONFIG_CONNECT_ROUTE = 1,
+   INSN_DEVICE_CONFIG_DISCONNECT_ROUTE = 2,
+   INSN_DEVICE_CONFIG_GET_ROUTES = 3,
+};
+
+/**
  * enum comedi_digital_trig_op - operations for configuring a digital trigger
  * @COMEDI_DIGITAL_TRIG_DISABLE:   Return digital trigger to its default,
  * inactive, unconfigured state.
@@ -886,6 +904,37 @@ struct comedi_bufinfo {
unsigned int unused[4];
 };
 
+/**
+ * Globally-named route pair to contain values returned by comedi_get_routes.
+ * @source:Globally-identified source of route.
+ * @destination:   Globally-identified destination of route.
+ */
+struct comedi_route_pair {
+   unsigned int source;
+   unsigned int destination;
+};
+
+/**
+ * Structure for arguments of INSN_DEVICE_CONFIG_GET_ROUTES.
+ * @config_id: The first element of comedi_insn->data must contain an insn
+ * op-code.
+ * @n: On input, represents the length of the route_list array.
+ * On output, represents the number of route pairs copied to user.
+ * @route_list:Pointer to user array into which to copy route 
information.  If
+ * route_list is NULL, the number of valid routes for the given
+ * device is returned.
+ *
+ * The arguments of INSN commands are actually an array of unsigned int values.
+ * For INSN_DEVICE_CONFIG_GET_ROUTES, the array must actually contain data for
+ * this structure.  In short, a user can define this structure, cast it to the
+ * data component of struct comedi_insn (unsigned int[]).
+ */
+struct comedi_get_routes_data {
+   unsigned int config_id;
+   unsigned int n;
+   struct comedi_route_pair __user *route_list;
+};
+
 /* range stuff */
 
 #define __RANGE(a, b)  a) & 0x) << 16) | ((b) & 0x))
diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 64b3966..d087a61 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -1243,6 +1243,77 @@ static int check_insn_config_length(struct comedi_insn 
*insn,
return -EINVAL;
 }
 
+static int check_insn_device_config_length(struct comedi_insn *insn,
+  unsigned int *data)
+{
+   if (insn->n < 1)
+   return -EINVAL;
+
+   switch (data[0]) {
+   case INSN_DEVICE_CONFIG_TEST_ROUTE:
+   case INSN_DEVICE_CONFIG_CONNECT_ROUTE:
+   case INSN_DEVICE_CONFIG_DISCONNECT_ROUTE:
+   if (insn->n == 3)
+   return 0;
+   break;
+   case INSN_DEVICE_CONFIG_GET_ROUTES:
+   /*
+* big enough for config_id, a pointer to routelist userland
+* memory, and the length of the userland memory buffer.
+*/
+   if (insn->n == (sizeof(struct comedi_get_routes_data) /
+   sizeof(unsigned int)))
+   return 0;
+   break;
+   }
+   return -EINVAL;
+}
+
+/*
+ * Calls low-level driver get_valid_routes 

[PATCH 14/15] staging: comedi: ni_660x: add device-global routing

2016-10-12 Thread Spencer E. Olson
Provides the device-global routing interface for ni_660x devices.  Using
the device-global names in comedi_cmd structures for commands was already
supported through the ni_tio module.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_660x.c | 260 +++
 1 file changed, 260 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 41c4960..bd1c9c1 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -572,6 +572,10 @@ static void ni_660x_select_pfi_output(struct comedi_device 
*dev,
unsigned int idle_chip = 0;
unsigned int bits;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
if (board->n_chips > 1) {
if (out_sel == NI_660X_PFI_OUTPUT_COUNTER &&
chan >= 8 && chan <= 23) {
@@ -607,6 +611,10 @@ static void ni_660x_set_pfi_direction(struct comedi_device 
*dev,
struct ni_660x_private *devpriv = dev->private;
u64 bit;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
bit = 1ULL << chan;
 
if (direction == COMEDI_OUTPUT) {
@@ -626,6 +634,10 @@ static unsigned int ni_660x_get_pfi_direction(struct 
comedi_device *dev,
struct ni_660x_private *devpriv = dev->private;
u64 bit;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
bit = 1ULL << chan;
 
return (devpriv->io_dir & bit) ? COMEDI_OUTPUT : COMEDI_INPUT;
@@ -636,6 +648,10 @@ static int ni_660x_set_pfi_routing(struct comedi_device 
*dev,
 {
struct ni_660x_private *devpriv = dev->private;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
switch (source) {
case NI_660X_PFI_OUTPUT_COUNTER:
if (chan < 8)
@@ -658,6 +674,10 @@ static int ni_660x_get_pfi_routing(struct comedi_device 
*dev, unsigned int chan)
 {
struct ni_660x_private *devpriv = dev->private;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
return devpriv->io_cfg[chan];
 }
 
@@ -666,6 +686,10 @@ static void ni_660x_set_pfi_filter(struct comedi_device 
*dev,
 {
unsigned int val;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
val = ni_660x_read(dev, 0, NI660X_IO_CFG(chan));
val &= ~NI660X_IO_CFG_IN_SEL_MASK(chan);
val |= NI660X_IO_CFG_IN_SEL(chan, value);
@@ -714,6 +738,235 @@ static int ni_660x_dio_insn_config(struct comedi_device 
*dev,
return insn->n;
 }
 
+static unsigned int _ni_get_valid_routes(struct comedi_device *dev,
+struct comedi_route_pair **pptr) {
+   struct ni_660x_private *devpriv = dev->private;
+
+   return ni_get_valid_routes(>routing_tables, pptr);
+}
+
+/*
+ * Retrieves the current source of the output selector for the given
+ * destination.  If the terminal for the destination is not already configured
+ * as an output, this function returns -EINVAL as error.
+ *
+ * Return: The register value of the destination output selector;
+ *-EINVAL if terminal is not configured for output.
+ */
+static inline int get_output_select_source(int dest, struct comedi_device *dev)
+{
+   struct ni_660x_private *devpriv = dev->private;
+   int reg = -1;
+
+   if (channel_is_pfi(dest)) {
+   if (ni_660x_get_pfi_direction(dev, dest) == COMEDI_OUTPUT)
+   reg = ni_660x_get_pfi_routing(dev, dest);
+   } else if (channel_is_rtsi(dest)) {
+   dev_dbg(dev->class_dev,
+   "%s: unhandled rtsi destination (%d) queried \n",
+   __func__, dest);
+   /*
+* The following can be enabled when RTSI routing info is
+* determined (not currently documented):
+* if (ni_get_rtsi_direction(dev, dest) == COMEDI_OUTPUT) {
+*  reg = ni_get_rtsi_routing(dev, dest);
+
+*  if (reg == NI_RTSI_OUTPUT_RGOUT0) {
+*  dest = NI_RGOUT0; ** prepare for lookup below **
+*  reg = get_rgout0_reg(dev);
+*  } else if (reg >= NI_RTSI_OUTPUT_RTSI_BRD(0) &&
+* reg <= NI_RTSI_OUTPUT_RTSI_BRD(3)) {
+*  const int i = reg - NI_RTSI_OUTPUT_RTSI_BRD(0);
+
+*  dest = NI_RTSI_BRD(i); ** prepare for lookup **

[PATCH 15/15] staging: comedi: ni_routes: update notes for valid routes

2016-10-12 Thread Spencer E. Olson
Update references and notes for the routes that have been implemented.
This includes a guess as two what might be valid for CtrAux and
CtrArmStartTrigger, using mild heuristic evidence from other users.

*** PLEASE FIND ACTUAL PATCH AT:
http://www.umich.edu/~olsonse/patches/comedi-devglobal-v1/0015-staging-comedi-ni_routes-update-notes-for-valid-rout.patch

(This patch included some lines that were too long for email)
---
 .../comedi/drivers/ni_routing/ni_route_values.c|  66 +++-
 .../drivers/ni_routing/ni_route_values/ni_660x.csv |   2 +-
 .../ni_routing/ni_route_values/ni_eseries.csv  | 156 +-
 .../ni_routing/ni_route_values/ni_mseries.csv  | 180 ++---
 4 files changed, 233 insertions(+), 171 deletions(-)

<... SNIP ...>
-- 
1.9.1

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


[PATCH 13/15] staging: comedi: ni_660x: clean up pfi routing

2016-10-12 Thread Spencer E. Olson
Cleans up the pfi routing code to make it easier to follow, read, and also
to prepare to use this cleaned up code for enabling the device-global
routing interface for ni_660x devices.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_660x.c | 72 +---
 1 file changed, 56 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index deddae2..41c4960 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -600,6 +600,37 @@ static void ni_660x_select_pfi_output(struct comedi_device 
*dev,
ni_660x_write(dev, active_chip, bits, NI660X_IO_CFG(chan));
 }
 
+static void ni_660x_set_pfi_direction(struct comedi_device *dev,
+ unsigned int chan,
+ unsigned int direction)
+{
+   struct ni_660x_private *devpriv = dev->private;
+   u64 bit;
+
+   bit = 1ULL << chan;
+
+   if (direction == COMEDI_OUTPUT) {
+   devpriv->io_dir |= bit;
+   /* reset the output to currently assigned output value */
+   ni_660x_select_pfi_output(dev, chan, devpriv->io_cfg[chan]);
+   } else {
+   devpriv->io_dir &= ~bit;
+   /* set pin to high-z; do not change currently assigned route */
+   ni_660x_select_pfi_output(dev, chan, 0);
+   }
+}
+
+static unsigned int ni_660x_get_pfi_direction(struct comedi_device *dev,
+ unsigned int chan)
+{
+   struct ni_660x_private *devpriv = dev->private;
+   u64 bit;
+
+   bit = 1ULL << chan;
+
+   return (devpriv->io_dir & bit) ? COMEDI_OUTPUT : COMEDI_INPUT;
+}
+
 static int ni_660x_set_pfi_routing(struct comedi_device *dev,
   unsigned int chan, unsigned int source)
 {
@@ -618,36 +649,48 @@ static int ni_660x_set_pfi_routing(struct comedi_device 
*dev,
}
 
devpriv->io_cfg[chan] = source;
-   if (devpriv->io_dir & (1ULL << chan))
+   if (ni_660x_get_pfi_direction(dev, chan) == COMEDI_OUTPUT)
ni_660x_select_pfi_output(dev, chan, devpriv->io_cfg[chan]);
return 0;
 }
 
+static int ni_660x_get_pfi_routing(struct comedi_device *dev, unsigned int 
chan)
+{
+   struct ni_660x_private *devpriv = dev->private;
+
+   return devpriv->io_cfg[chan];
+}
+
+static void ni_660x_set_pfi_filter(struct comedi_device *dev,
+  unsigned int chan, unsigned int value)
+{
+   unsigned int val;
+
+   val = ni_660x_read(dev, 0, NI660X_IO_CFG(chan));
+   val &= ~NI660X_IO_CFG_IN_SEL_MASK(chan);
+   val |= NI660X_IO_CFG_IN_SEL(chan, value);
+   ni_660x_write(dev, 0, val, NI660X_IO_CFG(chan));
+}
+
 static int ni_660x_dio_insn_config(struct comedi_device *dev,
   struct comedi_subdevice *s,
   struct comedi_insn *insn,
   unsigned int *data)
 {
-   struct ni_660x_private *devpriv = dev->private;
unsigned int chan = CR_CHAN(insn->chanspec);
-   u64 bit = 1ULL << chan;
-   unsigned int val;
int ret;
 
switch (data[0]) {
case INSN_CONFIG_DIO_OUTPUT:
-   devpriv->io_dir |= bit;
-   ni_660x_select_pfi_output(dev, chan, devpriv->io_cfg[chan]);
+   ni_660x_set_pfi_direction(dev, chan, COMEDI_OUTPUT);
break;
 
case INSN_CONFIG_DIO_INPUT:
-   devpriv->io_dir &= ~bit;
-   ni_660x_select_pfi_output(dev, chan, 0);/* high-z */
+   ni_660x_set_pfi_direction(dev, chan, COMEDI_INPUT);
break;
 
case INSN_CONFIG_DIO_QUERY:
-   data[1] = (devpriv->io_dir & bit) ? COMEDI_OUTPUT
- : COMEDI_INPUT;
+   data[1] = ni_660x_get_pfi_direction(dev, chan);
break;
 
case INSN_CONFIG_SET_ROUTING:
@@ -657,14 +700,11 @@ static int ni_660x_dio_insn_config(struct comedi_device 
*dev,
break;
 
case INSN_CONFIG_GET_ROUTING:
-   data[1] = devpriv->io_cfg[chan];
+   data[1] = ni_660x_get_pfi_routing(dev, chan);
break;
 
case INSN_CONFIG_FILTER:
-   val = ni_660x_read(dev, 0, NI660X_IO_CFG(chan));
-   val &= ~NI660X_IO_CFG_IN_SEL_MASK(chan);
-   val |= NI660X_IO_CFG_IN_SEL(chan, data[1]);
-   ni_660x_write(dev, 0, val, NI660X_IO_CFG(chan));
+   ni_660x_set_pfi_filter(dev, chan, data[1]);
break;
 
default:
@@ -844,7 +884,7 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
  : NI_660X_PFI_OUTPUT_COUNTER;
 
ni_660x_set_pfi_routing(dev, i, 

[PATCH 12/15] staging: comedi: ni_660x: Add NI PCI-6608 to list of supported devices

2016-10-12 Thread Spencer E. Olson
Previously, only the PXI version of the NI-6608 board was supported.  This
change adds support for the PCI version as well.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_660x.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index bd7f6cd..deddae2 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -16,7 +16,7 @@
  * Driver: ni_660x
  * Description: National Instruments 660x counter/timer boards
  * Devices: [National Instruments] PCI-6601 (ni_660x), PCI-6602, PXI-6602,
- *   PXI-6608, PXI-6624
+ *   PCI-6608, PXI-6608, PXI-6624
  * Author: J.P. Mellor ,
  *   herman.bruynin...@mech.kuleuven.ac.be,
  *   wim.meeus...@mech.kuleuven.ac.be,
@@ -211,6 +211,7 @@ enum ni_660x_boardid {
BOARD_PCI6601,
BOARD_PCI6602,
BOARD_PXI6602,
+   BOARD_PCI6608,
BOARD_PXI6608,
BOARD_PXI6624
 };
@@ -233,6 +234,10 @@ static const struct ni_660x_board ni_660x_boards[] = {
.name   = "PXI-6602",
.n_chips= 2,
},
+   [BOARD_PCI6608] = {
+   .name   = "PCI-6608",
+   .n_chips= 2,
+   },
[BOARD_PXI6608] = {
.name   = "PXI-6608",
.n_chips= 2,
@@ -929,6 +934,7 @@ static const struct pci_device_id ni_660x_pci_table[] = {
{ PCI_VDEVICE(NI, 0x1310), BOARD_PCI6602 },
{ PCI_VDEVICE(NI, 0x1360), BOARD_PXI6602 },
{ PCI_VDEVICE(NI, 0x2c60), BOARD_PCI6601 },
+   { PCI_VDEVICE(NI, 0x2db0), BOARD_PCI6608 },
{ PCI_VDEVICE(NI, 0x2cc0), BOARD_PXI6608 },
{ PCI_VDEVICE(NI, 0x1e40), BOARD_PXI6624 },
{ 0 }
-- 
1.9.1

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


[PATCH 06/15] staging: comedi: add interface to ni routing table information

2016-10-12 Thread Spencer E. Olson
Adds interface and associated unittests for accessing/looking-up/validating
the new ni routing table information.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/Kconfig |   4 +
 drivers/staging/comedi/drivers/Makefile|   1 +
 drivers/staging/comedi/drivers/ni_routes.c | 321 +++
 drivers/staging/comedi/drivers/ni_routes.h | 315 +++
 drivers/staging/comedi/drivers/ni_stc.h|   4 +
 drivers/staging/comedi/drivers/tests/Makefile  |   3 +-
 .../staging/comedi/drivers/tests/ni_routes_test.c  | 596 +
 7 files changed, 1243 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/comedi/drivers/ni_routes.c
 create mode 100644 drivers/staging/comedi/drivers/ni_routes.h
 create mode 100644 drivers/staging/comedi/drivers/tests/ni_routes_test.c

diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig
index e7255f8..7d614f4 100644
--- a/drivers/staging/comedi/Kconfig
+++ b/drivers/staging/comedi/Kconfig
@@ -1105,6 +1105,7 @@ config COMEDI_NI_TIOCMD
depends on HAS_DMA
select COMEDI_NI_TIO
select COMEDI_MITE
+   select COMEDI_NI_ROUTES
 
 endif # COMEDI_PCI_DRIVERS
 
@@ -1319,4 +1320,7 @@ config COMEDI_NI_LABPC_ISADMA
 config COMEDI_NI_TIO
tristate
 
+config COMEDI_NI_ROUTES
+   tristate
+
 endif # COMEDI
diff --git a/drivers/staging/comedi/drivers/Makefile 
b/drivers/staging/comedi/drivers/Makefile
index ff4fb78..f374739 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -137,6 +137,7 @@ obj-$(CONFIG_COMEDI_VMK80XX)+= vmk80xx.o
 obj-$(CONFIG_COMEDI_MITE)  += mite.o
 obj-$(CONFIG_COMEDI_NI_TIO)+= ni_tio.o
 obj-$(CONFIG_COMEDI_NI_TIOCMD) += ni_tiocmd.o
+obj-$(CONFIG_COMEDI_NI_ROUTES) += ni_routes.o
 obj-$(CONFIG_COMEDI_NI_LABPC)  += ni_labpc_common.o
 obj-$(CONFIG_COMEDI_NI_LABPC_ISADMA)   += ni_labpc_isadma.o
 
diff --git a/drivers/staging/comedi/drivers/ni_routes.c 
b/drivers/staging/comedi/drivers/ni_routes.c
new file mode 100644
index 000..3f3c3db
--- /dev/null
+++ b/drivers/staging/comedi/drivers/ni_routes.c
@@ -0,0 +1,321 @@
+/* vim: set ts=8 sw=8 noet tw=80 nowrap: */
+/*
+ *  comedi/drivers/ni_routes.c
+ *  Route information for NI boards.
+ *
+ *  COMEDI - Linux Control and Measurement Device Interface
+ *  Copyright (C) 2016 Spencer E. Olson 
+ *
+ *  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.
+ */
+
+#include 
+#include 
+#include 
+
+#include "../comedi.h"
+
+#include "ni_routes.h"
+#include "ni_routing/ni_route_values.c"
+#include "ni_routing/ni_device_routes.c"
+
+/*
+ * This is defined in ni_routing/ni_route_values.c:
+ * #define B(x)((x) - NI_NAMES_BASE)
+ */
+
+/*
+ * This is defined in ni_routing/ni_route_values.c to identify clearly elements
+ * of the table that were set.  In other words, entries that are zero are
+ * invalid.  To get the value to use for the register, one must mask out the
+ * high bit.
+ *
+ * #define V(x)((x) | 0x80)
+ */
+
+/* Mask out the valid-value marking bit. */
+#define UnV(x) ((x) & (~(0x80)))
+
+#define RVi(table, src, dest)  (table)[(src) * NI_NUM_NAMES + (dest)]
+
+static const size_t route_table_size = NI_NUM_NAMES * NI_NUM_NAMES;
+
+/*
+ * Find the proper route_values and ni_device_routes tables for this particular
+ * device.
+ *
+ * Return: -ENODATA if either was not found; 0 if both were found.
+ */
+static inline int ni_find_device_routes(const char *device_family,
+   const char *board_name,
+   struct ni_route_tables *tables)
+{
+   const struct ni_device_routes *dr = NULL;
+   const u8 *rv = NULL;
+   int i;
+
+   /* First, find the register_values table for this device family */
+   for (i = 0; i < ARRAY_SIZE(all_route_values); ++i) {
+   if (memcmp(all_route_values[i].family, device_family,
+  strnlen(device_family, 30)) == 0) {
+   rv = _route_values[i].register_values[0][0];
+   break;
+   }
+   }
+
+   if (!rv)
+   return -ENODATA;
+
+   /* Second, find the set of routes valid for this device. */
+   for (i = 0; i < ARRAY_SIZE(device_routes_list); ++i) {
+   if (memcmp(device_routes_list[i].device, board_name,
+ 

[PATCH 08/15] staging: comedi: ni_mio_common: implement global pfi, rtsi routing

2016-10-12 Thread Spencer E. Olson
Implement device-global config interface for ni_mio devices.  In
particular, this patch implements:
INSN_DEVICE_CONFIG_TEST_ROUTE,
INSN_DEVICE_CONFIG_CONNECT_ROUTE,
INSN_DEVICE_CONFIG_DISCONNECT_ROUTE,
INSN_DEVICE_CONFIG_GET_ROUTES
for the ni mio devices.  This means that the new abstracted signal/terminal
names can be used to define signal routing with regards to the PFI
terminals and RTSI trigger bus lines.

This also adds ability to identify PFI and RTSI channels on the PFI and
RTSI subdevices using the new device-global names.  This does not change
the values that are set for channel output selections using the subdevice
interfaces--these still require direct register values.

Annotates and updates tables of register values to reflect this new
implementation status.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 680 ++---
 drivers/staging/comedi/drivers/ni_stc.h|  68 +++
 2 files changed, 676 insertions(+), 72 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 49236a2..ea4845d 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -360,7 +360,8 @@ static const struct mio_regmap m_series_stc_write_regmap[] 
= {
[NISTC_AO_PERSONAL_REG] = { 0x19c, 2 },
[NISTC_RTSI_TRIGA_OUT_REG]  = { 0x19e, 2 },
[NISTC_RTSI_TRIGB_OUT_REG]  = { 0x1a0, 2 },
-   [NISTC_RTSI_BOARD_REG]  = { 0, 0 }, /* Unknown */
+   /* doc for following line: mhddk/nimseries/ChipObjects/tMSeries.h */
+   [NISTC_RTSI_BOARD_REG]  = { 0x1a2, 2 },
[NISTC_CFG_MEM_CLR_REG] = { 0x1a4, 2 },
[NISTC_ADC_FIFO_CLR_REG]= { 0x1a6, 2 },
[NISTC_DAC_FIFO_CLR_REG]= { 0x1a8, 2 },
@@ -4573,24 +4574,31 @@ static unsigned int ni_get_pfi_routing(struct 
comedi_device *dev,
 {
struct ni_private *devpriv = dev->private;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
return (devpriv->is_m_series)
? ni_m_series_get_pfi_routing(dev, chan)
: ni_old_get_pfi_routing(dev, chan);
 }
 
+/* Sets the output mux for the specified PFI channel. */
 static int ni_set_pfi_routing(struct comedi_device *dev,
  unsigned int chan, unsigned int source)
 {
struct ni_private *devpriv = dev->private;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
return (devpriv->is_m_series)
? ni_m_series_set_pfi_routing(dev, chan, source)
: ni_old_set_pfi_routing(dev, chan, source);
 }
 
-static int ni_config_filter(struct comedi_device *dev,
-   unsigned int pfi_channel,
-   enum ni_pfi_filter_select filter)
+static int ni_config_pfi_filter(struct comedi_device *dev,
+   unsigned int chan,
+   enum ni_pfi_filter_select filter)
 {
struct ni_private *devpriv = dev->private;
unsigned int bits;
@@ -4598,19 +4606,43 @@ static int ni_config_filter(struct comedi_device *dev,
if (!devpriv->is_m_series)
return -ENOTSUPP;
 
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+
bits = ni_readl(dev, NI_M_PFI_FILTER_REG);
-   bits &= ~NI_M_PFI_FILTER_SEL_MASK(pfi_channel);
-   bits |= NI_M_PFI_FILTER_SEL(pfi_channel, filter);
+   bits &= ~NI_M_PFI_FILTER_SEL_MASK(chan);
+   bits |= NI_M_PFI_FILTER_SEL(chan, filter);
ni_writel(dev, bits, NI_M_PFI_FILTER_REG);
return 0;
 }
 
+static inline void ni_set_pfi_direction(struct comedi_device *dev, int chan,
+   unsigned int direction)
+{
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+   direction = (direction == COMEDI_OUTPUT) ? 1u : 0u;
+   ni_set_bits(dev, NISTC_IO_BIDIR_PIN_REG, 1 << chan, direction);
+}
+
+static inline int ni_get_pfi_direction(struct comedi_device *dev, int chan)
+{
+   struct ni_private *devpriv = dev->private;
+
+   if (chan >= NI_PFI(0))
+   /* allow new and old names of pfi channels to work. */
+   chan -= NI_PFI(0);
+   return devpriv->io_bidirection_pin_reg & (1 << chan) ?
+  COMEDI_OUTPUT : COMEDI_INPUT;
+}
+
 static int ni_pfi_insn_config(struct comedi_device *dev,
  struct comedi_subdevice *s,
  struct comedi_insn *insn,
  unsigned int *data)
 {
- 

[PATCH 10/15] staging: comedi: tio: implement global tio/ctr routing

2016-10-12 Thread Spencer E. Olson
Adds ability to use device-global names in command args, in particular
cmd->start_arg (for NI_CtrArmStartTrigger), and cmd->scan_begin_arg or
cmd->convert_arg (either is used to specify NI_CtrGate, with preference
given to cmd->scan_begin_arg, if it is set).

The actual arguments of cmd->start_arg are not fully checked against known
register values for the particular devices because these are not documented
or currently known.  This follows the precedence of prior versions of the
tio driver.  Should these become known, they should be annotated in the
route_values tables and the set of lines in ni_tio_cmdtest should be
uncommented to allow the tests to be made.

This patch also adds interface functions that allow routes for particular
counter route destinations to be made/queried/unmade.  This allows overseer
modules to implement test_route, connect_route, and disconnect_route.  As a
part of these changes, various functions were cleaned up and clarified.

These new interface functions allow direct writing/reading of register
values.  This is an example of exactly what the new device-global access
was intended to solve:  the old interface was not consistent with other
portions of the ni_* drivers--it did not allow full register values to be
given for various MUXes.  Instead, the old interface _did_ abstract away
some of the actual hardware from the underlying devices, but it was not
consistent with any other NI hardware.  Allowing the device-global
identifiers to be used, the new patch provides for consistency across all
ni_* drivers.  One final note:  these changes provide for backwards
compatibility by allowing the older values to still be used in through the
pre-existing kernel interfaces--though not in the new device-global
test/dis/connect/route interfaces.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_660x.c |  18 +-
 drivers/staging/comedi/drivers/ni_mio_common.c   |   6 +-
 drivers/staging/comedi/drivers/ni_tio.c  | 428 +--
 drivers/staging/comedi/drivers/ni_tio.h  |  42 ++-
 drivers/staging/comedi/drivers/ni_tio_internal.h |   1 +
 drivers/staging/comedi/drivers/ni_tiocmd.c   |  66 +++-
 6 files changed, 446 insertions(+), 115 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_660x.c 
b/drivers/staging/comedi/drivers/ni_660x.c
index 0dcb826..bd7f6cd 100644
--- a/drivers/staging/comedi/drivers/ni_660x.c
+++ b/drivers/staging/comedi/drivers/ni_660x.c
@@ -40,6 +40,7 @@
 
 #include "mite.h"
 #include "ni_tio.h"
+#include "ni_routes.h"
 
 /* See Register-Level Programmer Manual page 3.1 */
 enum ni_660x_register {
@@ -263,6 +264,7 @@ struct ni_660x_private {
unsigned int dma_cfg[NI660X_MAX_CHIPS];
unsigned int io_cfg[NI660X_NUM_PFI_CHANNELS];
u64 io_dir;
+   struct ni_route_tables routing_tables;
 };
 
 static void ni_660x_write(struct comedi_device *dev, unsigned int chip,
@@ -734,12 +736,23 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
 
ni_660x_init_tio_chips(dev, board->n_chips);
 
+   /* prepare the device for globally-named routes. */
+   if (ni_assign_device_routes("ni_660x", board->name,
+   >routing_tables) < 0) {
+   dev_warn(dev->class_dev, "%s: %s device has no signal routing 
table.\n",
+__func__, board->name);
+   dev_warn(dev->class_dev, "%s: High level NI signal names will 
not be available for this %s board.\n",
+__func__, board->name);
+   }
+
n_counters = board->n_chips * NI660X_COUNTERS_PER_CHIP;
gpct_dev = ni_gpct_device_construct(dev,
ni_660x_gpct_write,
ni_660x_gpct_read,
ni_gpct_variant_660x,
-   n_counters);
+   n_counters,
+   NI660X_COUNTERS_PER_CHIP,
+   >routing_tables);
if (!gpct_dev)
return -ENOMEM;
devpriv->counter_dev = gpct_dev;
@@ -835,9 +848,6 @@ static int ni_660x_auto_attach(struct comedi_device *dev,
if (i < n_counters) {
struct ni_gpct *counter = _dev->counters[i];
 
-   counter->chip_index = i / NI660X_COUNTERS_PER_CHIP;
-   counter->counter_index = i % NI660X_COUNTERS_PER_CHIP;
-
s->type = COMEDI_SUBD_COUNTER;
s->subdev_flags = SDF_READABLE | SDF_WRITABLE |
  SDF_LSAMPL | SDF_CMD_READ;
diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 76e2e77..7903938 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ 

[PATCH 09/15] staging: comedi: ni_mio_common: implement output selection of GPFO_{0, 1}

2016-10-12 Thread Spencer E. Olson
Implement the ability to route various signals to NI_CtrOut(x) pin.  This
pin is also known as GPFO_{0,1} in the DAQ STC.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 101 +
 drivers/staging/comedi/drivers/ni_stc.h|   6 +-
 2 files changed, 106 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index ea4845d..76e2e77 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5511,6 +5511,71 @@ static void ni_rtsi_init(struct comedi_device *dev)
set_rgout0_reg(0, dev);
 }
 
+/* Get route of GPFO_i/CtrOut pins */
+static inline int ni_get_gout_routing(unsigned int dest,
+ struct comedi_device *dev)
+{
+   struct ni_private *devpriv = dev->private;
+   unsigned int reg = devpriv->an_trig_etc_reg;
+
+   switch(dest) {
+   case 0:
+   if (reg & NISTC_ATRIG_ETC_GPFO_0_ENA)
+   return NISTC_ATRIG_ETC_GPFO_0_SEL_TO_SRC(reg);
+   case 1:
+   if (reg & NISTC_ATRIG_ETC_GPFO_1_ENA)
+   return NISTC_ATRIG_ETC_GPFO_1_SEL_TO_SRC(reg);
+   }
+
+   return -EINVAL;
+}
+
+/* Set route of GPFO_i/CtrOut pins */
+static inline int ni_disable_gout_routing(unsigned int dest,
+ struct comedi_device *dev)
+{
+   struct ni_private *devpriv = dev->private;
+
+   switch(dest) {
+   case 0:
+   devpriv->an_trig_etc_reg &= ~NISTC_ATRIG_ETC_GPFO_0_ENA;
+   case 1:
+   devpriv->an_trig_etc_reg &= ~NISTC_ATRIG_ETC_GPFO_1_ENA;
+   default:
+   return -EINVAL;
+   }
+
+   ni_stc_writew(dev, devpriv->an_trig_etc_reg, NISTC_ATRIG_ETC_REG);
+   return 0;
+}
+
+/* Set route of GPFO_i/CtrOut pins */
+static inline int ni_set_gout_routing(unsigned int src, unsigned int dest,
+ struct comedi_device *dev)
+{
+   struct ni_private *devpriv = dev->private;
+
+   switch(dest) {
+   case 0:
+   /* clear reg */
+   devpriv->an_trig_etc_reg &= ~NISTC_ATRIG_ETC_GPFO_0_SEL(-1);
+   /* set reg */
+   devpriv->an_trig_etc_reg |= NISTC_ATRIG_ETC_GPFO_0_ENA
+|  NISTC_ATRIG_ETC_GPFO_0_SEL(src);
+   case 1:
+   /* clear reg */
+   devpriv->an_trig_etc_reg &= ~NISTC_ATRIG_ETC_GPFO_1_SEL;
+   src = src ? NISTC_ATRIG_ETC_GPFO_1_SEL : 0;
+   /* set reg */
+   devpriv->an_trig_etc_reg |= NISTC_ATRIG_ETC_GPFO_1_ENA | src;
+   default:
+   return -EINVAL;
+   }
+
+   ni_stc_writew(dev, devpriv->an_trig_etc_reg, NISTC_ATRIG_ETC_REG);
+   return 0;
+}
+
 /*
  * Retrieves the current source of the output selector for the given
  * destination.  If the terminal for the destination is not already configured
@@ -5542,6 +5607,16 @@ static inline int get_output_select_source(int dest, 
struct comedi_device *dev)
reg = get_ith_rtsi_brd_reg(i, dev);
}
}
+   } else if (dest >= NI_CtrOut(0) && dest <= NI_CtrOut(-1)) {
+   /*
+* not handled by ni_tio.  Only available for GPFO registers in
+* e/m series.
+*/
+   dest -= NI_CtrOut(0);
+   if (dest > 1)
+   /* there are only two g_out outputs. */
+   return -EINVAL;
+   reg = ni_get_gout_routing(dest, dev);
} else {
dev_dbg(dev->class_dev, "%s: unhandled destination (%d) 
queried\n",
__func__, dest);
@@ -5619,6 +5694,17 @@ static inline int connect_route(unsigned int src, 
unsigned int dest,
 
ni_set_rtsi_direction(dev, dest, COMEDI_OUTPUT);
ni_set_rtsi_routing(dev, dest, reg);
+   } else if (dest >= NI_CtrOut(0) && dest <= NI_CtrOut(-1)) {
+   /*
+* not handled by ni_tio.  Only available for GPFO registers in
+* e/m series.
+*/
+   dest -= NI_CtrOut(0);
+   if (dest > 1)
+   /* there are only two g_out outputs. */
+   return -EINVAL;
+   if (ni_set_gout_routing(src, dest, dev))
+   return -EINVAL;
} else {
return -EINVAL;
}
@@ -5667,6 +5753,16 @@ static inline int disconnect_route(unsigned int src, 
unsigned int dest,
reg = default_rtsi_routing[dest - TRIGGER_LINE(0)];
ni_set_rtsi_direction(dev, dest, COMEDI_INPUT);
ni_set_rtsi_routing(dev, dest, reg);
+   } else if (dest >= NI_CtrOut(0) && dest <= 

[PATCH 03/15] staging: comedi: ni_routing: Add NI signal routing info

2016-10-12 Thread Spencer E. Olson
See README for a thorough discussion of this content.

Adds two different collections of CSV files that:
1) summarize the various register values for creating routes
   for a particular family of NI hardware devices;
2) summarize all possible (direct) routes that a particular device can
   make--in this case, one file per device (this data is currently only
   known to be found by examining a screenshot of the "Available Routes"
   tab of NI MAX control panel, which is only found on Windows
   installations of the NI driver).

The collection and maintenance of this information is somewhat tedious and
requires frequent re-examination and comparison of NI-MAX and/or the NI-MHDDK
documentation (register programming information) and NI-MHDDK examples.
These CSV files are constructed so-as to allow near direct comparison
to NI-MAX and NI-MHDDK.  As such, these serve to ease the task of
maintaining this knowledge and more quickly enables addition of new NI
devices.

Signed-off-by: Spencer E. Olson 

*** PLEASE FIND ACTUAL PATCH AT:
http://www.umich.edu/~olsonse/patches/comedi-devglobal-v1/0003-staging-comedi-ni_routing-Add-NI-signal-routing-info.patch

(This patch included some lines that were too long for email)
---
 drivers/staging/comedi/drivers/ni_routing/README   | 110 +
 .../ni_routing/ni_device_routes/PCI-6070E.csv  |  40 
 .../ni_routing/ni_device_routes/PCI-6220.csv   |  46 +
 .../ni_routing/ni_device_routes/PCI-6221.csv   |  50 ++
 .../ni_routing/ni_device_routes/PCI-6251.csv   |  51 ++
 .../ni_routing/ni_device_routes/PCI-6254.csv   |  47 +
 .../ni_routing/ni_device_routes/PCI-6259.csv   |  51 ++
 .../ni_routing/ni_device_routes/PCI-6534.csv   |  29 ++
 .../ni_routing/ni_device_routes/PCI-6602.csv   |  78 +++
 .../ni_routing/ni_device_routes/PCI-6713.csv   |  32 ++
 .../ni_routing/ni_device_routes/PCI-6723.csv   |  32 ++
 .../ni_routing/ni_device_routes/PCI-6733.csv   |  34 +++
 .../ni_routing/ni_device_routes/PXI-6030E.csv  |  39 
 .../ni_routing/ni_device_routes/PXI-6224.csv   |  46 +
 .../ni_routing/ni_device_routes/PXI-6225.csv   |  49 +
 .../ni_routing/ni_device_routes/PXI-6251.csv   |  50 ++
 .../ni_routing/ni_device_routes/PXI-6733.csv   |  35 +++
 .../ni_routing/ni_device_routes/PXIe-6251.csv  |  52 ++
 .../drivers/ni_routing/ni_route_values/ni_660x.csv | 100 +++
 .../ni_routing/ni_route_values/ni_eseries.csv  |  78 +++
 .../ni_routing/ni_route_values/ni_mseries.csv  |  90 +
 21 files changed, 1139 insertions(+)
 create mode 100644 drivers/staging/comedi/drivers/ni_routing/README
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6070E.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6220.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6221.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6251.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6254.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6259.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6534.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6602.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6713.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6723.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PCI-6733.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXI-6030E.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXI-6224.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXI-6225.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXI-6251.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXI-6733.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_device_routes/PXIe-6251.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_route_values/ni_660x.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_route_values/ni_eseries.csv
 create mode 100644 
drivers/staging/comedi/drivers/ni_routing/ni_route_values/ni_mseries.csv

<... SNIP ...>
-- 
1.9.1

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


[PATCH 11/15] staging: comedi: ni_mio_common: create device-global access to tio

2016-10-12 Thread Spencer E. Olson
Adds tio sub-devices of ni_mio_common supported hardware to the
implementation of test_route, connect_route, disconnect_route.  This change
delegates the actual functionality to the ni_tio module.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 7903938..6c8d507 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -5617,6 +5617,8 @@ static inline int get_output_select_source(int dest, 
struct comedi_device *dev)
/* there are only two g_out outputs. */
return -EINVAL;
reg = ni_get_gout_routing(dest, dev);
+   } else if (channel_is_ctr(dest)) {
+   reg = ni_tio_get_routing(devpriv->counter_dev, dest);
} else {
dev_dbg(dev->class_dev, "%s: unhandled destination (%d) 
queried\n",
__func__, dest);
@@ -5705,6 +5707,13 @@ static inline int connect_route(unsigned int src, 
unsigned int dest,
return -EINVAL;
if (ni_set_gout_routing(src, dest, dev))
return -EINVAL;
+   } else if (channel_is_ctr(dest)) {
+   /*
+* we are adding back the channel modifier info to set
+* invert/edge info passed by the user
+*/
+   ni_tio_set_routing(devpriv->counter_dev, dest,
+  reg | (src & ~CR_CHAN(-1)));
} else {
return -EINVAL;
}
@@ -5763,6 +5772,8 @@ static inline int disconnect_route(unsigned int src, 
unsigned int dest,
/* there are only two g_out outputs. */
return -EINVAL;
reg = ni_disable_gout_routing(dest, dev);
+   } else if (channel_is_ctr(dest)) {
+   ni_tio_unset_routing(devpriv->counter_dev, dest);
} else {
return -EINVAL;
}
-- 
1.9.1

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


[PATCH 07/15] staging: comedi: ni_mio_common: implement new routing for TRIG_EXT

2016-10-12 Thread Spencer E. Olson
Use new signal routing capability for all comedi command *_src == TRIG_EXT
options.  This new interface allows the user specify signals and terminals
as TRIG_EXT sources using a very consistent naming convention. Furthermore,
the interface allows backwards compatibility to prior behavior of
specifying register-level (or near register-level) values as *_arg options
when *_src == TRIG_EXT.

Annotates and updates tables of register values to reflect this new
implementation status.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/ni_mio_common.c | 106 +++--
 1 file changed, 66 insertions(+), 40 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c 
b/drivers/staging/comedi/drivers/ni_mio_common.c
index 32ca4ca..49236a2 100644
--- a/drivers/staging/comedi/drivers/ni_mio_common.c
+++ b/drivers/staging/comedi/drivers/ni_mio_common.c
@@ -2012,7 +2012,6 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
const struct ni_board_struct *board = dev->board_ptr;
struct ni_private *devpriv = dev->private;
int err = 0;
-   unsigned int tmp;
unsigned int sources;
 
/* Step 1 : check if triggers are trivially valid */
@@ -2053,12 +2052,9 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
err |= comedi_check_trigger_arg_is(>start_arg, 0);
break;
case TRIG_EXT:
-   tmp = CR_CHAN(cmd->start_arg);
-
-   if (tmp > 16)
-   tmp = 16;
-   tmp |= (cmd->start_arg & (CR_INVERT | CR_EDGE));
-   err |= comedi_check_trigger_arg_is(>start_arg, tmp);
+   err |= ni_check_trigger_arg_roffs(CR_CHAN(cmd->start_arg),
+ NI_AI_StartTrigger,
+ >routing_tables, 1);
break;
}
 
@@ -2070,12 +2066,9 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
0xff);
} else if (cmd->scan_begin_src == TRIG_EXT) {
/* external trigger */
-   unsigned int tmp = CR_CHAN(cmd->scan_begin_arg);
-
-   if (tmp > 16)
-   tmp = 16;
-   tmp |= (cmd->scan_begin_arg & (CR_INVERT | CR_EDGE));
-   err |= comedi_check_trigger_arg_is(>scan_begin_arg, tmp);
+   err |= ni_check_trigger_arg_roffs(CR_CHAN(cmd->scan_begin_arg),
+ NI_AI_SampleClock,
+ >routing_tables, 1);
} else {/* TRIG_OTHER */
err |= comedi_check_trigger_arg_is(>scan_begin_arg, 0);
}
@@ -2093,12 +2086,9 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
}
} else if (cmd->convert_src == TRIG_EXT) {
/* external trigger */
-   unsigned int tmp = CR_CHAN(cmd->convert_arg);
-
-   if (tmp > 16)
-   tmp = 16;
-   tmp |= (cmd->convert_arg & (CR_ALT_FILTER | CR_INVERT));
-   err |= comedi_check_trigger_arg_is(>convert_arg, tmp);
+   err |= ni_check_trigger_arg_roffs(CR_CHAN(cmd->convert_arg),
+ NI_AI_ConvertClock,
+ >routing_tables, 1);
} else if (cmd->convert_src == TRIG_NOW) {
err |= comedi_check_trigger_arg_is(>convert_arg, 0);
}
@@ -2124,7 +2114,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
/* step 4: fix up any arguments */
 
if (cmd->scan_begin_src == TRIG_TIMER) {
-   tmp = cmd->scan_begin_arg;
+   unsigned int tmp = cmd->scan_begin_arg;
cmd->scan_begin_arg =
ni_timer_to_ns(dev, ni_ns_to_timer(dev,
   cmd->scan_begin_arg,
@@ -2134,7 +2124,7 @@ static int ni_ai_cmdtest(struct comedi_device *dev, 
struct comedi_subdevice *s,
}
if (cmd->convert_src == TRIG_TIMER) {
if (!devpriv->is_611x && !devpriv->is_6143) {
-   tmp = cmd->convert_arg;
+   unsigned int tmp = cmd->convert_arg;
cmd->convert_arg =
ni_timer_to_ns(dev, ni_ns_to_timer(dev,
   cmd->convert_arg,
@@ -2212,8 +2202,10 @@ static int ni_ai_cmd(struct comedi_device *dev, struct 
comedi_subdevice *s)
   NISTC_AI_TRIG_START1_SEL(0);
break;
case TRIG_EXT:
-   ai_trig |= NISTC_AI_TRIG_START1_SEL(CR_CHAN(cmd->start_arg) +
-   

[PATCH 02/15] staging: comedi: add abstracted NI signal/terminal named constants

2016-10-12 Thread Spencer E. Olson
This change adds abstracted constants for National Instruments
terminal/signal names.

Some background:
  There have been significant confusions over the past many years for users
  when trying to understand how to connect to/from signals and terminals on
  NI hardware using comedi.  The major reason for this is that the actual
  register values were exposed and required to be used by users.  Several
  major reasons exist why this caused major confusion for users:

  1) The register values are _NOT_ in user documentation, but rather in
arcane locations, such as a few register programming manuals that are
increasingly hard to find and the NI-MHDDK (comments in in example
code).  There is no one place to find the various valid values of the
registers.

  2) The register values are _NOT_ completely consistent.  There is no way
to gain any sense of intuition of which values, or even enums one
should use for various registers.  There was some attempt in prior use
of comedi to name enums such that a user might know which enums should
be used for varying purposes, but the end-user had to gain a knowledge
of register values to correctly wield this approach.

  3) The names for signals and registers found in the various register
level programming manuals and vendor-provided documentation are _not_
even close to the same names that are in the end-user documentation.

Similar confusion, albeit less, plagued NI's previous version of their own
proprietary drivers.  Earlier than 2003, NI greatly simplified the
situation for users by releasing a new API that abstracted the names of
signals/terminals to a common and intuitive set of names.  In addition,
this new API provided a much more common interface to use for most of NI
hardware.

The names added here mirror the names chosen and well documented by NI.
These names are exposed to the user via the comedilib user library.  By
keeping the names in this format, in spite of the use of CamelScript,
maintenance will be greatly eased and confusion for users _and_ comedi
developers will be greatly reduced.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/comedi.h | 128 
 1 file changed, 128 insertions(+)

diff --git a/drivers/staging/comedi/comedi.h b/drivers/staging/comedi/comedi.h
index a1c1081..c80d0d6 100644
--- a/drivers/staging/comedi/comedi.h
+++ b/drivers/staging/comedi/comedi.h
@@ -937,6 +937,134 @@ enum i8254_mode {
I8254_BINARY = 0
 };
 
+/* *** BEGIN GLOBALLY-NAMED NI TERMINALS/SIGNALS *** */
+
+/* Common National Instruments Terminal/Signal names.
+ * Some of these have no NI_ prefix as they are useful for non-NI hardware, 
such
+ * as those that utilize the PXI/RTSI trigger lines.
+ *
+ * NOTE ABOUT THE CHOICE OF NAMES HERE AND THE CAMELSCRIPT:
+ *   The choice to use CamelScript and the exact names below is for
+ *   maintainability, clarity, similarity to manufacturer's documentation,
+ *   _and_ a mitigation for confusion that has plagued the use of these drivers
+ *   for years!
+ *
+ *   More detail:
+ *   There have been significant confusions over the past many years for users
+ *   when trying to understand how to connect to/from signals and terminals on
+ *   NI hardware using comedi.  The major reason for this is that the actual
+ *   register values were exposed and required to be used by users.  Several
+ *   major reasons exist why this caused major confusion for users:
+ *   1) The register values are _NOT_ in user documentation, but rather in
+ * arcane locations, such as a few register programming manuals that are
+ * increasingly hard to find and the NI MHDDK (comments in in example 
code).
+ * There is no one place to find the various valid values of the registers.
+ *   2) The register values are _NOT_ completely consistent.  There is no way 
to
+ * gain any sense of intuition of which values, or even enums one should 
use
+ * for various registers.  There was some attempt in prior use of comedi to
+ * name enums such that a user might know which enums should be used for
+ * varying purposes, but the end-user had to gain a knowledge of register
+ * values to correctly wield this approach.
+ *   3) The names for signals and registers found in the various register level
+ * programming manuals and vendor-provided documentation are _not_ even
+ * close to the same names that are in the end-user documentation.
+ *
+ *   Similar, albeit less, confusion plagued NI's previous version of their own
+ *   drivers.  Earlier than 2003, NI greatly simplified the situation for users
+ *   by releasing a new API that abstracted the names of signals/terminals to a
+ *   common and intuitive set of names.
+ *
+ *   The names below mirror the names chosen and well documented by NI.  These
+ *   names are exposed to the user via the comedilib user library.  By keeping
+ *   the names below, in spite of 

[PATCH 01/15] staging: comedi: tests: add unittest framework for comedi

2016-10-12 Thread Spencer E. Olson
Adds a framework for unittests for comedi drivers.  It was certainly
possible to write some unit tests before and test various aspects of a
particular driver, but this framework makes this a bit easier and hopefully
inspires more unittest modules to be written.

Signed-off-by: Spencer E. Olson 
---
 drivers/staging/comedi/drivers/Makefile|  1 +
 drivers/staging/comedi/drivers/tests/Makefile  |  5 ++
 .../staging/comedi/drivers/tests/example_test.c| 71 ++
 drivers/staging/comedi/drivers/tests/unittest.h| 62 +++
 4 files changed, 139 insertions(+)
 create mode 100644 drivers/staging/comedi/drivers/tests/Makefile
 create mode 100644 drivers/staging/comedi/drivers/tests/example_test.c
 create mode 100644 drivers/staging/comedi/drivers/tests/unittest.h

diff --git a/drivers/staging/comedi/drivers/Makefile 
b/drivers/staging/comedi/drivers/Makefile
index 0c8cfa7..ff4fb78 100644
--- a/drivers/staging/comedi/drivers/Makefile
+++ b/drivers/staging/comedi/drivers/Makefile
@@ -145,3 +145,4 @@ obj-$(CONFIG_COMEDI_8255_SA)+= 8255.o
 obj-$(CONFIG_COMEDI_AMPLC_DIO200)  += amplc_dio200_common.o
 obj-$(CONFIG_COMEDI_AMPLC_PC236)   += amplc_pc236_common.o
 obj-$(CONFIG_COMEDI_DAS08) += das08.o
+obj-$(CONFIG_COMEDI_TESTS) += tests/
diff --git a/drivers/staging/comedi/drivers/tests/Makefile 
b/drivers/staging/comedi/drivers/tests/Makefile
new file mode 100644
index 000..67281af
--- /dev/null
+++ b/drivers/staging/comedi/drivers/tests/Makefile
@@ -0,0 +1,5 @@
+# Makefile for comedi drivers unit tests
+#
+ccflags-$(CONFIG_COMEDI_DEBUG) := -DDEBUG
+
+obj-$(CONFIG_COMEDI_TESTS) += example_test.o
diff --git a/drivers/staging/comedi/drivers/tests/example_test.c 
b/drivers/staging/comedi/drivers/tests/example_test.c
new file mode 100644
index 000..0bfac7a
--- /dev/null
+++ b/drivers/staging/comedi/drivers/tests/example_test.c
@@ -0,0 +1,71 @@
+/* vim: set ts=8 sw=8 noet tw=80 nowrap: */
+/*
+ *  comedi/drivers/tests/example.c
+ *  Example set of unit tests.
+
+ *  COMEDI - Linux Control and Measurement Device Interface
+ *  Copyright (C) 2016 Spencer E. Olson 
+
+ *  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.
+*/
+
+#include 
+
+#include "unittest.h"
+
+/* *** BEGIN fake board data *** */
+struct comedi_device {
+   const char *board_name;
+   int item;
+};
+
+static struct comedi_device dev = {
+   .board_name = "fake_device",
+};
+
+/* *** END fake board data *** */
+
+/* *** BEGIN fake data init *** */
+void init_fake(void)
+{
+   dev.item = 10;
+}
+
+/* *** END fake data init *** */
+
+void test0(void)
+{
+   init_fake();
+   unittest(dev.item != 11, "negative result\n");
+   unittest(dev.item == 10, "positive result\n");
+}
+
+/*  BEGIN simple module entry/exit functions  */
+static int unittest_enter(void)
+{
+   const unittest_fptr unit_tests[] = {
+   (unittest_fptr)test0,
+   NULL,
+   };
+
+   exec_unittests("example", unit_tests);
+   return 0;
+}
+
+static void __exit unittest_exit(void) { }
+
+module_init(unittest_enter);
+module_exit(unittest_exit);
+
+MODULE_AUTHOR("Spencer Olson ");
+MODULE_DESCRIPTION("Comedi unit-tests example");
+MODULE_LICENSE("GPL");
+/*  END simple module entry/exit functions  */
diff --git a/drivers/staging/comedi/drivers/tests/unittest.h 
b/drivers/staging/comedi/drivers/tests/unittest.h
new file mode 100644
index 000..f8e75dbf
--- /dev/null
+++ b/drivers/staging/comedi/drivers/tests/unittest.h
@@ -0,0 +1,62 @@
+/* vim: set ts=8 sw=8 noet tw=80 nowrap: */
+/*
+ *  comedi/drivers/ni_routes.c
+ *  Route information for NI boards.
+
+ *  COMEDI - Linux Control and Measurement Device Interface
+ *  Copyright (C) ?whoever wrote parts of the drivers/of/unittest.c?
+ *  Copyright (C) 2016 Spencer E. Olson 
+
+ *  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.
+*/
+
+#ifndef 

[PATCH 00/15] device-global identifiers and routes introduced

2016-10-12 Thread Spencer E. Olson
This patchset introduces a new framework for providing and maintaining a
consistent namespace to define terminal/signal names for a set of comedi
devices.  This effort was primarily focused on supporting NI hardware, but the
interfaces introduced here can be implemented by all other hardware drivers, if
desired.  Otherwise, these new interfaces do not effect any interfaces
previously defined or prior use cases (i.e. backwards compatibility).

Some background:
  There have been significant confusions over the past many years for users
  when trying to understand how to connect to/from signals and terminals on
  NI hardware using comedi.  The major reason for this is that the actual
  register values were exposed and required to be used by end users.  Several
  major reasons exist why this caused major confusion for users:

  1) The register values are _NOT_ in user documentation, but rather in
arcane locations, such as a few register programming manuals that are
increasingly hard to find.  Some information is found in the register level
programming libraries provided by National Instruments (NI-MHDDK), but
many items are only vaguely found/mentioned in the comments of the NI-MHDDK
example code.  There is no one place to find the various valid values of the
registers.

  2) The register values are _NOT_ completely consistent.  There is no way to
gain any sense of intuition of which values, or even enums one should use
for various registers.  There was some attempt in prior use of comedi to
name enums such that a user might know which enums should be used for
varying purposes, but the end-user had to gain a knowledge of register
values to correctly wield this approach.

  3) The names for signals and registers found in the various register level
programming manuals and vendor-provided documentation are _not_ even
close to the same names that are in the end-user documentation.

  4) The sets of routes that are valid are not consistent from device to device.
One additional major challenge is that this information is not documented
and does not seem to be obtainable in any programmatic fashion, neither
through the proprietary NIDAQmx(-base) c-libraries, nor with register level
programming.  In fact, the only consistent source of this information is
through the proprietary NI-MAX software, which currently only runs on
Windows platforms.  A further challenge is that this information cannot be
exported from NI-MAX, except by screenshot.

Similar confusion, albeit less, plagued NI's previous version of their own
proprietary drivers.  Earlier than 2003, NI greatly simplified the situation for
users by releasing a new API that abstracted the names of signals/terminals to a
common and intuitive set of names.  In addition, this new API provided a much
more common interface to use for most of NI hardware.

Comedi already provides such a common interface for data-acquisition and control
hardware.  This effort complements comedi's abstraction layers by further
abstracting much more of the use cases for NI hardware, but allowing users _and_
developers to directly refer to NI documentation (user-level, register-level,
and the register-level examples of the NI-MHDDK).

The goal of these patches are:
  0) Allow current code to function as is, providing backwards compatibility to
the current interface, following a suggestion by Eric Piel.
  1) Provide an interface to connect routes or identify signal sources and
destinations using a consistent naming scheme, global to a driver family.
  2) For NI devices, use terminal/signal naming that is consistent with (a) the
NI's user level documentation, (b) NI's user-level code, (c) the information
as provided by the proprietary NI-MAX software, and (d) the user interface
code provided by the user-land comedilib library.
  3) Make for easy maintenance of register level values that are to be used for
any particular NI device of any particular NI device family.
  4) Provide a means whereby the user can query the set of signal routes that is
valid for a particular device.
  5) Provide an interface whereby the user can query the status and capability
of any signal route.  The driver can provide information on whether the
route is valid for the device and whether the route is already connected.

This patch set implements various changes that keep the goals set forth here.
This patch set is in nowise complete with respect to the various NI hardware
options supported by comedi, though a large selection should be supported--all
e/m-series (ni_mio_common.c hardware) boards and 660x boards are the target of
this patch set, including the tio devices (counter/timers) used by these boards.

A copy of these patches can be found at:
http://www.umich.edu/~olsonse/patches/comedi-devglobal-v1/

Cc: Eric Piel 

Spencer E. Olson (15):
  staging: comedi: tests: add unittest 

Re: [bug report] staging: lustre: create striped directory

2016-10-12 Thread Dan Carpenter
On Tue, Oct 11, 2016 at 04:14:11PM +, Wang, Di wrote:
> Hello,
> 
> On 10/11/16, 4:37 AM, "Dan Carpenter"  wrote:
> 
> >Hello wang di,
> >
> >The patch 2de353860782: "staging: lustre: create striped directory"
> >from Aug 16, 2016, leads to the following static checker warning:
> >
> > drivers/staging/lustre/lustre/llite/namei.c:294 ll_md_blocking_ast()
> > warn: 'master_inode' isn't an ERR_PTR
> >
> >drivers/staging/lustre/lustre/llite/namei.c
> >   287  
> >   288  hash =
> >cl_fid_build_ino(>lli_pfid,
> >   289
> >ll_need_32bit_api(ll_i2sbi(inode)));
> >   290  
> >   291  master_inode =
> >ilookup5(inode->i_sb, hash,
> >   292
> >ll_test_inode_by_fid,
> >   293  (void
> >*)>lli_pfid);
> >   294  if (master_inode &&
> >!IS_ERR(master_inode)) {
> >  
> >
> >ilookup5() never returns ERR_PTRs.
> 
> Yes, only master_inode != NULL should be enough here.

Please send a patch to remove the other check?

regards,
dan carpenter

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


Re: [RFC 0/6] Module for tracking/accounting shared memory buffers

2016-10-12 Thread Christian König

Am 12.10.2016 um 01:50 schrieb Ruchi Kandoi:

This patchstack adds memtrack hooks into dma-buf and ion.  If there's upstream
interest in memtrack, it can be extended to other memory allocators as well,
such as GEM implementations.
We have run into similar problems before. Because of this I already 
proposed a solution for this quite a while ago, but never pushed on 
upstreaming this since it was only done for a special use case.


Instead of keeping track of how much memory a process has bound (which 
is very fragile) my solution  only added some more debugging info on a 
per fd basis (e.g. how much memory is bound to this fd).


This information was then used by the OOM killer (for example) to make a 
better decision on which process to reap.


Shouldn't be to hard to expose this through debugfs or maybe a new fcntl 
to userspace for debugging.


I haven't looked at the code in detail, but messing with the per process 
memory accounting like you did in this proposal is clearly not a good 
idea if you ask me.


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


Re: Revert "rtlwifi: rtl818x: constify local structures"

2016-10-12 Thread Kalle Valo
Larry Finger  wrote:
> This reverts commit d86e64768859fca82c78e52877ceeba04e25d27a.
> 
> For drivers rtl8188ee, rtl8192ce, rtl8192ee, rtl8723ae, and rtl8821ae,
> the Coccinelle script missed the fact that the code changes the firmware
> name. When that happens, the kernel issues a BUG splat because
> it is unable to overwrite the old name.
> 
> Although this bug only affects 5 of the 8 drivers it touched, I decided to
> revert the entire patch. Continuing to constantify the other three could
> too easily lead to introduction of future bugs.
> 
> Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
> Signed-off-by: Larry Finger 
> Cc: Stable  
> Cc: Julia Lawall 

Dropping as requested.

Patch set to Superseded.

-- 
https://patchwork.kernel.org/patch/9369621/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

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


Re: [PATCH] rtlwifi: Fix regression caused by commit d86e64768859

2016-10-12 Thread Kalle Valo
Larry Finger  writes:

> In commit d86e64768859 ("rtlwifi: rtl818x: constify local structures"),
> the configuration struct for most of the drivers was changed to be
> constant. The problem is that five of the modified drivers need to be
> able to update the firmware name based on the exact model of the card.
> As the file names were stored in one of the members of that struct,
> these drivers would fail with a kernel BUG splat when they tried to
> update the firmware name.
>
> Rather than reverting the previous commit, I used a suggestion by
> Johannes Berg and made the firmware file name pointers be local to
> the routines that update the software variables.
>
> The configuration struct of rtl8192cu, which was not touched in the
> previous patch, is now constantfied.
>
> Fixes: d86e64768859 ("rtlwifi: rtl818x: constify local structures")
> Suggested-by: Johannes Berg 
> Signed-off-by: Larry Finger 
> Cc: Stable [4.8+] 

This should be:

Cc: Stable  # 4.8

And the plus sign isn't needed as I'll push this to 4.9.

> Cc: Julia Lawall 
> ---
> Kalle,
>
> My apologies for letting these bugs to get by my review and testing.

No worries, this is business as usual :) Excellent that you noticed this
so early.

And this again shows that simple cleanup patches are not without cost,
there is a clear risk. Has anyone done any statistics how much cleanup
patches cause regressions? My guess is that in a 5% ballpark of the
cleanup patches have some sort of issues. Of course in this case the
cleanup patch revealed a design flaw in the driver, so in this case it
was very useful.

> As they affect kernel 4.8, please push this patch as soon as possible.
> To reiterate, this patch replaces the one entitled 'Revert "rtlwifi:
> rtl818x: constify local structures"'

Ok, understood. Many thanks for making this super clear for me, makes my
life a lot easier. I'm hoping that this will make it to 4.9-rc2.

CCing Thorsten to get this regression to his radar.

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


[patch] staging: android/ion: testing the wrong variable

2016-10-12 Thread Dan Carpenter
We're testing "pdev" but we intended to test "heap_pdev".  This is a
static checker fix and it's unlikely that anyone is affected by this
bug.

Fixes: 13439479c7de ('staging: ion: Add files for parsing the devicetree')
Signed-off-by: Dan Carpenter 

diff --git a/drivers/staging/android/ion/ion_of.c 
b/drivers/staging/android/ion/ion_of.c
index 15bac92..46b2bb9 100644
--- a/drivers/staging/android/ion/ion_of.c
+++ b/drivers/staging/android/ion/ion_of.c
@@ -107,7 +107,7 @@ struct ion_platform_data *ion_parse_dt(struct 
platform_device *pdev,
 
heap_pdev = of_platform_device_create(node, heaps[i].name,
  >dev);
-   if (!pdev)
+   if (!heap_pdev)
return ERR_PTR(-ENOMEM);
heap_pdev->dev.platform_data = [i];
 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 32/41] staging: lustre: llite: restart short read/write for normal IO

2016-10-12 Thread Greg Kroah-Hartman
On Wed, Oct 12, 2016 at 12:22:35AM +0100, James Simmons wrote:
> 
> > On Sun, Oct 02, 2016 at 10:28:28PM -0400, James Simmons wrote:
> > > From: Bobi Jam 
> > > 
> > > If normal IO got short read/write, we'd restart the IO from where
> > > we've accomplished until we meet EOF or error happens.
> > > 
> > > Signed-off-by: Bobi Jam 
> > > Signed-off-by: Jinshan Xiong 
> > > Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6389
> > > Reviewed-on: http://review.whamcloud.com/14123
> > > Reviewed-by: Andreas Dilger 
> > > Reviewed-by: Oleg Drokin 
> > > Signed-off-by: James Simmons 
> > > ---
> > >  drivers/staging/lustre/lnet/libcfs/fail.c  |1 +
> > >  .../staging/lustre/lustre/include/obd_support.h|2 +
> > >  drivers/staging/lustre/lustre/llite/file.c |   41 
> > > 
> > >  drivers/staging/lustre/lustre/llite/vvp_io.c   |   19 -
> > >  4 files changed, 45 insertions(+), 18 deletions(-)
> > 
> > Due to other changes in the filesystem tree, this patch no longer
> > applies :(
> > 
> > Can you rebase it and resend?
> 
> How long will you be accepting patches to merge for? If its going
> to be a few weeks like to just include the missing two patches with
> the next batch.

I don't understand the question.  I always accept patches, no need to
not send them, I'll queue them up to the proper branches as needed.  So
what do you mean here?

> Another issue I need to look at is the IB changes. That's going to
> require some heavy surgery to the ko2iblnd driver so its going to
> take time for me to port this to the new RDMA RW api. That will
> need to be push to linus so ko2iblnd can work with the 4.9 tree
> if that is okay with you.

Sure, send the patches, but maybe it is a 4.10 thing if it's too much
work?

thanks,

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


Re: [PATCH] drivers: staging: greybus: audio_topology.c: Fixed CHECKS for brace issues

2016-10-12 Thread Vaibhav Agarwal
On Wed, Oct 12, 2016 at 5:19 AM, Chase Metzger  wrote:
> Added braces for else and else if statements where checkpatch complained.
>
> Signed-off-by: Chase Metzger 
> ---
>  drivers/staging/greybus/audio_topology.c | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_topology.c 
> b/drivers/staging/greybus/audio_topology.c
> index b625169..3a2678e 100644
> --- a/drivers/staging/greybus/audio_topology.c
> +++ b/drivers/staging/greybus/audio_topology.c
> @@ -1044,8 +1044,10 @@ static int gbaudio_tplg_create_widget(struct 
> gbaudio_module_info *module,
> control->texts = (const char * const *)
> gb_generate_enum_strings(module, gbenum);
> control->items = gbenum->items;
> -   } else
> +   } else {
> csize = sizeof(struct gb_audio_control);
> +   }
> +
> *w_size += csize;
> curr = (void *)curr + csize;
> list_add(>list, >widget_ctl_list);
> @@ -1190,8 +1192,9 @@ static int gbaudio_tplg_process_kcontrols(struct 
> gbaudio_module_info *module,
> control->texts = (const char * const *)
> gb_generate_enum_strings(module, gbenum);
> control->items = gbenum->items;
> -   } else
> +   } else {
> csize = sizeof(struct gb_audio_control);
> +   }
>
> list_add(>list, >ctl_list);
> dev_dbg(module->dev, "%d:%s created of type %d\n", curr->id,
> --
> 2.1.4
>
You have already submitted a similar patch available on staging-testing branch:
commit b7e0c9eca426 ("drivers: staging: greybus: Fixed CHECKS for brace issues")

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


Re: [PATCH] drivers: staging: greybus: audio_manager_sysfs.c: Fixed CHECK for brace issue

2016-10-12 Thread Vaibhav Agarwal
On Wed, Oct 12, 2016 at 4:52 AM, Chase Metzger  wrote:
> Added braces to else and else if statements where checkpatch complained.
>
> Signed-off-by: Chase Metzger 
> ---
>  drivers/staging/greybus/audio_manager_sysfs.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/greybus/audio_manager_sysfs.c 
> b/drivers/staging/greybus/audio_manager_sysfs.c
> index d8bf859..376e17c 100644
> --- a/drivers/staging/greybus/audio_manager_sysfs.c
> +++ b/drivers/staging/greybus/audio_manager_sysfs.c
> @@ -71,10 +71,11 @@ static ssize_t manager_sysfs_dump_store(
> num = gb_audio_manager_dump_module(id);
> if (num)
> return num;
> -   } else if (!strncmp("all", buf, 3))
> +   } else if (!strncmp("all", buf, 3)) {
> gb_audio_manager_dump_all();
> -   else
> +   } else {
> return -EINVAL;
> +   }
>
> return count;
>  }
> --
> 2.1.4
>
Reviewed-by: Vaibhav Agarwal 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel