Re: [PATCH] Code cleanup - nvec

2016-06-06 Thread Greg KH
On Tue, Jun 07, 2016 at 04:35:18AM +0530, Rithvik Patibandla wrote:
> Signed-off-by: Rithvik Patibandla 
> ---

I can't take patches with no changelog text, sorry.

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


[PATCH] Code cleanup - nvec

2016-06-06 Thread Rithvik Patibandla
Signed-off-by: Rithvik Patibandla 
---
 drivers/staging/nvec/nvec-keytable.h | 3 +--
 drivers/staging/nvec/nvec_power.c| 2 +-
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/nvec/nvec-keytable.h 
b/drivers/staging/nvec/nvec-keytable.h
index 1dc22cb..b51f756 100644
--- a/drivers/staging/nvec/nvec-keytable.h
+++ b/drivers/staging/nvec/nvec-keytable.h
@@ -17,8 +17,7 @@
  * more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ * with this program; if not, it is already included in Linux.
  */
 
 static unsigned short code_tab_102us[] = {
diff --git a/drivers/staging/nvec/nvec_power.c 
b/drivers/staging/nvec/nvec_power.c
index fcbb0fa..09befbb 100644
--- a/drivers/staging/nvec/nvec_power.c
+++ b/drivers/staging/nvec/nvec_power.c
@@ -442,7 +442,7 @@ static struct platform_driver nvec_power_driver = {
.remove = nvec_power_remove,
.driver = {
   .name = "nvec-power",
-  }
+   }
 };
 
 module_platform_driver(nvec_power_driver);
-- 
2.7.4

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


RE: [PATCH 1/6] staging: comedi: addi_apci_1564: clarify change-of-state interrupt support

2016-06-06 Thread Hartley Sweeten
On Monday, June 06, 2016 12:33 PM, Ian Abbott wrote:
> Okay, I think I must have got something inverted in my head at the time 
> I wrote my reply.
>
> Follow-up question: when you do:
>
>   s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG);
>
> should that be ANDed with something (possibly 
> APCI1564_DI_INT_MODE_MASK), or are the other bits (including the new 
> "event" bits) guaranteed to read zero?

I guess it could be ANDed with APCI1564_DI_INT_MODE_MASK for
completeness.

The datasheet from ADDI-DATA shows this information for the register:

Address + 0x10
  Write: Nicht benutzt  (English translation: unused)
  Read: Status Register 4 to 19
Interrupt Status 4 to 19
0: No Interrupt
1: Interrupt generated

>From that I assume that the other bits will always return 0.

Regards,
Hartley

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


Re: [PATCH 1/6] staging: comedi: addi_apci_1564: clarify change-of-state interrupt support

2016-06-06 Thread Ian Abbott

On 06/06/16 19:25, Hartley Sweeten wrote:

On Friday, June 03, 2016 2:58 AM, Ian Abbott wrote:

On 02/06/16 22:58, H Hartley Sweeten wrote:

This board supports change-of-state interrupts on digital inputs 4 to 19
not 0 to 15.

The current code "works" but it could set inappropriate bits in the mode1
and mode2 registers that setup which channels are enabled. It also doesn't
return the status of the upper 4 channels (19 to 16).

Fix the comment and mask the mode1/mode2 values so that only the interrupt
capable channels can be enabled.

Add the SDF_LSAMPL flag to the subdevice so that 32-bit samples are used
instead of 16-bit ones. This allows returning the upper 4 channels. Use
the remaining bits in the sample to return "event" flags to the user.

The timer and counter subdevices can also generate interrupts and are a bit
hacked. They don't currently follow the comedi API and they use send_sig()
to let the task that know that the interrupt occured. The "event" flags will
be used instead when these subdevices are fixed.

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

diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
b/drivers/staging/comedi/drivers/addi_apci_1564.c
index f1ccfbd..37e18b3 100644





+#define APCI1564_DI_INT_MODE_MASK  0x0000 /* chans [19:4] */





+#define APCI1564_EVENT_MASK0xffff /* all but [19:4] */





+   s->state &= ~APCI1564_EVENT_MASK;
+

status = inl(dev->iobase + APCI1564_DI_IRQ_REG);
if (status & APCI1564_DI_IRQ_ENA) {
-   /* disable the interrupt */
+   s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG);
+   s->state |= APCI1564_EVENT_COS;





+   if (s->state & APCI1564_EVENT_MASK) {
+   comedi_buf_write_samples(s, >state, 1);
+   comedi_handle_events(dev, s);
+   }
+
return IRQ_HANDLED;
   }



I'm struggling to see how that works.  It looks like once
APCI1564_EVENT_COS has been set in s->state, it never gets cleared (or
at least it only gets cleared momentarily), and after that, the `if
(s->state & APCI1564_EVENT_MASK)` test will always be true, and so it
will write a sample to the buffer on every interrupt.


Ian,

1) When an interrupt occurs the last "events" are masked off
 (leaving the last state of the digital inputs).
2) If the digital inputs caused the interrupt, the state of the
 digital inputs is read and the event bit APCI1564_EVENT_COS
 is set.


Okay, I think I must have got something inverted in my head at the time 
I wrote my reply.


Follow-up question: when you do:

s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG);

should that be ANDed with something (possibly 
APCI1564_DI_INT_MODE_MASK), or are the other bits (including the new 
"event" bits) guaranteed to read zero?



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


[PATCH] Staging: sm750fb: fix block comment coding style issue in ddk750_chip.c

2016-06-06 Thread Moshe Green
This is a patch to the ddk750_chip.c file that fixes up two block
comment coding style warnings found by the checkpatch.pl tool

Signed-off-by: Moshe Green 
---
 drivers/staging/sm750fb/ddk750_chip.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index f80ee77..3d408d6 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -91,8 +91,10 @@ static void setMemoryClock(unsigned int frequency)
return;
 
if (frequency) {
-   /* Set the frequency to the maximum frequency that the DDR 
Memory can take
-   which is 336MHz. */
+   /*
+* Set the frequency to the maximum frequency that the DDR 
Memory can take
+* which is 336MHz.
+*/
if (frequency > MHz(336))
frequency = MHz(336);
 
-- 
2.7.4

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


[RFC][PATCH 5/6] staging: android: ion: Add an ioctl for ABI checking

2016-06-06 Thread Laura Abbott

The current Ion ioctls lack a good way to tell what ioctls are
available. Introduce an ioctl to give an ABI version. This way when the
ABI inevitably gets screwed up userspace will have a way to tell what
version of the screw up is available.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/ion-ioctl.c |  6 ++
 drivers/staging/android/uapi/ion.h  | 23 +++
 2 files changed, 29 insertions(+)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 341ba7d..45b89e8 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -48,6 +48,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
struct ion_allocation_data allocation;
struct ion_handle_data handle;
struct ion_custom_data custom;
+   struct ion_abi_version abi_version;
} data;
 
dir = ion_ioctl_dir(cmd);
@@ -129,6 +130,11 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
data.custom.arg);
break;
}
+   case ION_IOC_ABI_VERSION:
+   {
+   data.abi_version.abi_version = ION_ABI_VERSION;
+   break;
+   }
default:
return -ENOTTY;
}
diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index a9c4e8b..145005f 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -19,6 +19,7 @@
 
 #include 
 #include 
+#include 
 
 typedef int ion_user_handle_t;
 
@@ -128,6 +129,19 @@ struct ion_custom_data {
unsigned long arg;
 };
 
+/**
+ * struct ion_abi_version
+ *
+ *  @version - current ABI version
+ */
+
+#define ION_ABI_VERSIONKERNEL_VERSION(0, 1, 0)
+
+struct ion_abi_version {
+   __u32 abi_version;
+   __u32 reserved;
+};
+
 #define ION_IOC_MAGIC  'I'
 
 /**
@@ -194,4 +208,13 @@ struct ion_custom_data {
  */
 #define ION_IOC_CUSTOM _IOWR(ION_IOC_MAGIC, 6, struct ion_custom_data)
 
+/**
+ * DOC: ION_IOC_ABI_VERSION - return ABI version
+ *
+ * Returns the ABI version of this driver.
+ */
+#define ION_IOC_ABI_VERSION_IOR(ION_IOC_MAGIC, 8, \
+   struct ion_abi_version)
+
+
 #endif /* _UAPI_LINUX_ION_H */
-- 
2.5.5

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


RE: [PATCH 1/6] staging: comedi: addi_apci_1564: clarify change-of-state interrupt support

2016-06-06 Thread Hartley Sweeten
On Friday, June 03, 2016 2:58 AM, Ian Abbott wrote:
> On 02/06/16 22:58, H Hartley Sweeten wrote:
>> This board supports change-of-state interrupts on digital inputs 4 to 19
>> not 0 to 15.
>>
>> The current code "works" but it could set inappropriate bits in the mode1
>> and mode2 registers that setup which channels are enabled. It also doesn't
>> return the status of the upper 4 channels (19 to 16).
>>
>> Fix the comment and mask the mode1/mode2 values so that only the interrupt
>> capable channels can be enabled.
>>
>> Add the SDF_LSAMPL flag to the subdevice so that 32-bit samples are used
>> instead of 16-bit ones. This allows returning the upper 4 channels. Use
>> the remaining bits in the sample to return "event" flags to the user.
>>
>> The timer and counter subdevices can also generate interrupts and are a bit
>> hacked. They don't currently follow the comedi API and they use send_sig()
>> to let the task that know that the interrupt occured. The "event" flags will
>> be used instead when these subdevices are fixed.
>>
>> Signed-off-by: H Hartley Sweeten 
>> Cc: Ian Abbott 
>> Cc: Greg Kroah-Hartman 
>> ---
>>   drivers/staging/comedi/drivers/addi_apci_1564.c | 37 
>> +
>>   1 file changed, 26 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/addi_apci_1564.c 
>> b/drivers/staging/comedi/drivers/addi_apci_1564.c
>> index f1ccfbd..37e18b3 100644



>> +#define APCI1564_DI_INT_MODE_MASK   0x0000 /* chans [19:4] */



>> +#define APCI1564_EVENT_MASK 0xffff /* all but [19:4] */



>> +s->state &= ~APCI1564_EVENT_MASK;
>> +
>   status = inl(dev->iobase + APCI1564_DI_IRQ_REG);
>   if (status & APCI1564_DI_IRQ_ENA) {
> - /* disable the interrupt */
> + s->state = inl(dev->iobase + APCI1564_DI_INT_STATUS_REG);
> + s->state |= APCI1564_EVENT_COS;



> + if (s->state & APCI1564_EVENT_MASK) {
> + comedi_buf_write_samples(s, >state, 1);
> + comedi_handle_events(dev, s);
> + }
> +
>   return IRQ_HANDLED;
>   }

> I'm struggling to see how that works.  It looks like once 
> APCI1564_EVENT_COS has been set in s->state, it never gets cleared (or 
> at least it only gets cleared momentarily), and after that, the `if 
> (s->state & APCI1564_EVENT_MASK)` test will always be true, and so it 
> will write a sample to the buffer on every interrupt.

Ian,

1) When an interrupt occurs the last "events" are masked off
(leaving the last state of the digital inputs).
2) If the digital inputs caused the interrupt, the state of the
digital inputs is read and the event bit APCI1564_EVENT_COS
is set.
3) Similarly, the other patches add support for the timer and
   counter subdevices and set the APCI1564_EVENT_TIMER or
APCI1564_EVENT_COUNTER(chan) bits as appropriate.
4) At the end of the interrupt if any of the event bits are set
the sample will be written to the buffer and the event handled.

This seemed like the best way to handle the timer and counter
interrupts without adding unnecessary async command support.

Regards,
Hartley

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


[RFC][PATCH 6/6] staging: android: ion: Introduce new ioctls for dynamic heaps

2016-06-06 Thread Laura Abbott
From: Laura Abbott 


The Ion ABI for heaps is limiting to work with for more complex systems.
Heaps have to be registered at boot time with known ids available to
userspace. This becomes a tight ABI which is prone to breakage.

Introduce a new mechanism for registering heap ids dynamically. A base
set of heap ids are registered at boot time but there is no knowledge
of fallbacks. Fallback information can be remapped and changed
dynamically. Information about available heaps can also be queried with
an ioctl to avoid the need to have heap ids be an ABI with userspace.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/ion-ioctl.c | 109 +--
 drivers/staging/android/ion/ion.c   | 184 ++--
 drivers/staging/android/ion/ion_priv.h  |  15 +++
 drivers/staging/android/uapi/ion.h  | 135 +++
 4 files changed, 426 insertions(+), 17 deletions(-)

diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
index 45b89e8..169cad8 100644
--- a/drivers/staging/android/ion/ion-ioctl.c
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -22,6 +22,49 @@
 #include "ion_priv.h"
 #include "compat_ion.h"
 
+union ion_ioctl_arg {
+   struct ion_fd_data fd;
+   struct ion_allocation_data allocation;
+   struct ion_handle_data handle;
+   struct ion_custom_data custom;
+   struct ion_abi_version abi_version;
+   struct ion_new_alloc_data allocation2;
+   struct ion_usage_id_map id_map;
+   struct ion_usage_cnt usage_cnt;
+   struct ion_heap_query query;
+};
+
+static int validate_ioctl_arg(unsigned int cmd, union ion_ioctl_arg *arg)
+{
+   int ret = 0;
+
+   switch (cmd) {
+   case ION_IOC_ABI_VERSION:
+   ret =  arg->abi_version.reserved != 0;
+   break;
+   case ION_IOC_ALLOC2:
+   ret = arg->allocation2.reserved0 != 0;
+   ret |= arg->allocation2.reserved1 != 0;
+   ret |= arg->allocation2.reserved2 != 0;
+   break;
+   case ION_IOC_ID_MAP:
+   ret = arg->id_map.reserved0 != 0;
+   ret |= arg->id_map.reserved1 != 0;
+   break;
+   case ION_IOC_USAGE_CNT:
+   ret = arg->usage_cnt.reserved != 0;
+   break;
+   case ION_IOC_HEAP_QUERY:
+   ret = arg->query.reserved0 != 0;
+   ret |= arg->query.reserved1 != 0;
+   ret |= arg->query.reserved2 != 0;
+   break;
+   default:
+   break;
+   }
+   return ret ? -EINVAL : 0;
+}
+
 /* fix up the cases where the ioctl direction bits are incorrect */
 static unsigned int ion_ioctl_dir(unsigned int cmd)
 {
@@ -42,14 +85,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
struct ion_handle *cleanup_handle = NULL;
int ret = 0;
unsigned int dir;
-
-   union {
-   struct ion_fd_data fd;
-   struct ion_allocation_data allocation;
-   struct ion_handle_data handle;
-   struct ion_custom_data custom;
-   struct ion_abi_version abi_version;
-   } data;
+   union ion_ioctl_arg data;
 
dir = ion_ioctl_dir(cmd);
 
@@ -60,7 +96,12 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
if (copy_from_user(, (void __user *)arg, _IOC_SIZE(cmd)))
return -EFAULT;
 
+   ret = validate_ioctl_arg(cmd, );
+   if (ret)
+   return ret;
+
switch (cmd) {
+   /* Old ioctl */
case ION_IOC_ALLOC:
{
struct ion_handle *handle;
@@ -77,6 +118,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
cleanup_handle = handle;
break;
}
+   /* Old ioctl */
case ION_IOC_FREE:
{
struct ion_handle *handle;
@@ -92,6 +134,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, unsigned 
long arg)
mutex_unlock(>lock);
break;
}
+   /* Old ioctl */
case ION_IOC_SHARE:
case ION_IOC_MAP:
{
@@ -106,6 +149,7 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
ret = data.fd.fd;
break;
}
+   /* Old ioctl */
case ION_IOC_IMPORT:
{
struct ion_handle *handle;
@@ -117,11 +161,13 @@ long ion_ioctl(struct file *filp, unsigned int cmd, 
unsigned long arg)
data.handle.handle = handle->id;
break;
}
+   /* Old ioctl */
case ION_IOC_SYNC:
{
ret = ion_sync_for_device(client, data.fd.fd);
break;
}
+   /* Old ioctl */
case ION_IOC_CUSTOM:
{
if (!dev->custom_ioctl)
@@ -135,6 

[RFC][PATCH 4/6] staging: android: ion: Pull out ion ioctls to a separate file

2016-06-06 Thread Laura Abbott

The number of Ion ioctls may continue to grow along with necessary
validation. Pull it out into a separate file for easier management
and review.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/Makefile|   3 +-
 drivers/staging/android/ion/ion-ioctl.c | 144 ++
 drivers/staging/android/ion/ion.c   | 208 +---
 drivers/staging/android/ion/ion_priv.h  |  92 ++
 4 files changed, 244 insertions(+), 203 deletions(-)
 create mode 100644 drivers/staging/android/ion/ion-ioctl.c

diff --git a/drivers/staging/android/ion/Makefile 
b/drivers/staging/android/ion/Makefile
index 18cc2aa..376c2b2 100644
--- a/drivers/staging/android/ion/Makefile
+++ b/drivers/staging/android/ion/Makefile
@@ -1,4 +1,5 @@
-obj-$(CONFIG_ION) +=   ion.o ion_heap.o ion_page_pool.o ion_system_heap.o \
+obj-$(CONFIG_ION) +=   ion.o ion-ioctl.o ion_heap.o \
+   ion_page_pool.o ion_system_heap.o \
ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o
 obj-$(CONFIG_ION_TEST) += ion_test.o
 ifdef CONFIG_COMPAT
diff --git a/drivers/staging/android/ion/ion-ioctl.c 
b/drivers/staging/android/ion/ion-ioctl.c
new file mode 100644
index 000..341ba7d
--- /dev/null
+++ b/drivers/staging/android/ion/ion-ioctl.c
@@ -0,0 +1,144 @@
+/*
+ *
+ * Copyright (C) 2011 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * 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 
+
+#include "ion.h"
+#include "ion_priv.h"
+#include "compat_ion.h"
+
+/* fix up the cases where the ioctl direction bits are incorrect */
+static unsigned int ion_ioctl_dir(unsigned int cmd)
+{
+   switch (cmd) {
+   case ION_IOC_SYNC:
+   case ION_IOC_FREE:
+   case ION_IOC_CUSTOM:
+   return _IOC_WRITE;
+   default:
+   return _IOC_DIR(cmd);
+   }
+}
+
+long ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
+{
+   struct ion_client *client = filp->private_data;
+   struct ion_device *dev = client->dev;
+   struct ion_handle *cleanup_handle = NULL;
+   int ret = 0;
+   unsigned int dir;
+
+   union {
+   struct ion_fd_data fd;
+   struct ion_allocation_data allocation;
+   struct ion_handle_data handle;
+   struct ion_custom_data custom;
+   } data;
+
+   dir = ion_ioctl_dir(cmd);
+
+   if (_IOC_SIZE(cmd) > sizeof(data))
+   return -EINVAL;
+
+   if (dir & _IOC_WRITE)
+   if (copy_from_user(, (void __user *)arg, _IOC_SIZE(cmd)))
+   return -EFAULT;
+
+   switch (cmd) {
+   case ION_IOC_ALLOC:
+   {
+   struct ion_handle *handle;
+
+   handle = ion_alloc(client, data.allocation.len,
+   data.allocation.align,
+   data.allocation.heap_id_mask,
+   data.allocation.flags);
+   if (IS_ERR(handle))
+   return PTR_ERR(handle);
+
+   data.allocation.handle = handle->id;
+
+   cleanup_handle = handle;
+   break;
+   }
+   case ION_IOC_FREE:
+   {
+   struct ion_handle *handle;
+
+   mutex_lock(>lock);
+   handle = ion_handle_get_by_id_nolock(client, 
data.handle.handle);
+   if (IS_ERR(handle)) {
+   mutex_unlock(>lock);
+   return PTR_ERR(handle);
+   }
+   ion_free_nolock(client, handle);
+   ion_handle_put_nolock(handle);
+   mutex_unlock(>lock);
+   break;
+   }
+   case ION_IOC_SHARE:
+   case ION_IOC_MAP:
+   {
+   struct ion_handle *handle;
+
+   handle = ion_handle_get_by_id(client, data.handle.handle);
+   if (IS_ERR(handle))
+   return PTR_ERR(handle);
+   data.fd.fd = ion_share_dma_buf_fd(client, handle);
+   ion_handle_put(handle);
+   if (data.fd.fd < 0)
+   ret = data.fd.fd;
+   break;
+   }
+   case ION_IOC_IMPORT:
+   {
+   struct ion_handle *handle;
+
+   handle = ion_import_dma_buf_fd(client, data.fd.fd);
+   if (IS_ERR(handle))
+   ret = PTR_ERR(handle);
+   else
+   data.handle.handle = handle->id;
+

[RFC][PATCH 3/6] staging: android: ion: Drop heap type masks

2016-06-06 Thread Laura Abbott
From: Laura Abbott 


There is no advantage to having heap types be a mask. The ion client has
long since dropped the mask. Drop the notion of heap type masks as well.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/uapi/ion.h | 6 --
 1 file changed, 6 deletions(-)

diff --git a/drivers/staging/android/uapi/ion.h 
b/drivers/staging/android/uapi/ion.h
index 0a8e40f..a9c4e8b 100644
--- a/drivers/staging/android/uapi/ion.h
+++ b/drivers/staging/android/uapi/ion.h
@@ -44,14 +44,8 @@ enum ion_heap_type {
   * must be last so device specific heaps always
   * are at the end of this enum
   */
-   ION_NUM_HEAPS = 16,
 };
 
-#define ION_HEAP_SYSTEM_MASK   (1 << ION_HEAP_TYPE_SYSTEM)
-#define ION_HEAP_SYSTEM_CONTIG_MASK(1 << ION_HEAP_TYPE_SYSTEM_CONTIG)
-#define ION_HEAP_CARVEOUT_MASK (1 << ION_HEAP_TYPE_CARVEOUT)
-#define ION_HEAP_TYPE_DMA_MASK (1 << ION_HEAP_TYPE_DMA)
-
 #define ION_NUM_HEAP_IDS   (sizeof(unsigned int) * 8)
 
 /**
-- 
2.5.5

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


[RFC][PATCH 2/6] staging: android: ion: Switch to using an idr to manage heaps

2016-06-06 Thread Laura Abbott
From: Laura Abbott 


In anticipation of dynamic registration of heaps, switch to using
an idr for heaps. The idr makes it easier to control the assignment
and management + lookup of heap numbers.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/ion.c | 83 +--
 1 file changed, 53 insertions(+), 30 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index 306340a..739060f 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -55,13 +55,14 @@ struct ion_device {
struct rb_root buffers;
struct mutex buffer_lock;
struct rw_semaphore lock;
-   struct plist_head heaps;
long (*custom_ioctl)(struct ion_client *client, unsigned int cmd,
 unsigned long arg);
struct rb_root clients;
struct dentry *debug_root;
struct dentry *heaps_debug_root;
struct dentry *clients_debug_root;
+   struct idr idr;
+   int heap_cnt;
 };
 
 /**
@@ -488,39 +489,22 @@ static int ion_handle_add(struct ion_client *client, 
struct ion_handle *handle)
return 0;
 }
 
-struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
-size_t align, unsigned int heap_id_mask,
+static struct ion_handle *__ion_alloc(struct ion_client *client, size_t len,
+size_t align, struct ion_heap *heap,
 unsigned int flags)
 {
struct ion_handle *handle;
struct ion_device *dev = client->dev;
struct ion_buffer *buffer = NULL;
-   struct ion_heap *heap;
int ret;
 
-   pr_debug("%s: len %zu align %zu heap_id_mask %u flags %x\n", __func__,
-len, align, heap_id_mask, flags);
-   /*
-* traverse the list of heaps available in this system in priority
-* order.  If the heap type is supported by the client, and matches the
-* request of the caller allocate from it.  Repeat until allocate has
-* succeeded or all heaps have been tried
-*/
+
len = PAGE_ALIGN(len);
 
if (!len)
return ERR_PTR(-EINVAL);
 
-   down_read(>lock);
-   plist_for_each_entry(heap, >heaps, node) {
-   /* if the caller didn't specify this heap id */
-   if (!((1 << heap->id) & heap_id_mask))
-   continue;
-   buffer = ion_buffer_create(heap, dev, len, align, flags);
-   if (!IS_ERR(buffer))
-   break;
-   }
-   up_read(>lock);
+   buffer = ion_buffer_create(heap, dev, len, align, flags);
 
if (buffer == NULL)
return ERR_PTR(-ENODEV);
@@ -549,6 +533,41 @@ struct ion_handle *ion_alloc(struct ion_client *client, 
size_t len,
 
return handle;
 }
+
+struct ion_handle *ion_alloc(struct ion_client *client, size_t len,
+   size_t align, unsigned int heap_mask,
+   unsigned int flags)
+{
+   int bit;
+   struct ion_handle *handle = ERR_PTR(-ENODEV);
+
+   pr_debug("%s: len %zu align %zu heap_id_mask %u flags %x\n", __func__,
+len, align, heap_mask, flags);
+
+   down_read(>dev->lock);
+   /*
+* traverse the list of heaps available in this system in priority
+* order.  If the heap type is supported by the client, and matches the
+* request of the caller allocate from it.  Repeat until allocate has
+* succeeded or all heaps have been tried
+*/
+   for_each_set_bit(bit, (unsigned long *)_mask, 32) {
+   struct ion_heap *heap;
+
+   heap = idr_find(>dev->idr, bit);
+   if (!heap)
+   continue;
+
+   handle = __ion_alloc(client, len, align, heap, flags);
+   if (IS_ERR(handle))
+   continue;
+   else
+   break;
+   }
+
+   up_read(>dev->lock);
+   return handle;
+}
 EXPORT_SYMBOL(ion_alloc);
 
 static void ion_free_nolock(struct ion_client *client, struct ion_handle 
*handle)
@@ -1587,6 +1606,7 @@ DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, 
debug_shrink_get,
 int ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
 {
struct dentry *debug_file;
+   int ret;
 
if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
!heap->ops->unmap_dma) {
@@ -1606,12 +1626,15 @@ int ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
 
heap->dev = dev;
down_write(>lock);
-   /*
-* use negative heap->id to reverse the priority -- when traversing
-* the list later attempt higher id numbers first
-*/
-   plist_node_init(>node, -heap->id);
-   plist_add(>node, >heaps);
+
+   ret = 

[RFC][PATCH 1/6] staging: android: ion: return error value for ion_device_add_heap

2016-06-06 Thread Laura Abbott
From: Laura Abbott 


ion_device_add_heap doesn't return an error value. Change it to return
information to callers.

Signed-off-by: Laura Abbott 
---
 drivers/staging/android/ion/ion.c  | 7 +--
 drivers/staging/android/ion/ion_priv.h | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c 
b/drivers/staging/android/ion/ion.c
index a2cf93b..306340a 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1584,14 +1584,16 @@ static int debug_shrink_get(void *data, u64 *val)
 DEFINE_SIMPLE_ATTRIBUTE(debug_shrink_fops, debug_shrink_get,
debug_shrink_set, "%llu\n");
 
-void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
+int ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap)
 {
struct dentry *debug_file;
 
if (!heap->ops->allocate || !heap->ops->free || !heap->ops->map_dma ||
-   !heap->ops->unmap_dma)
+   !heap->ops->unmap_dma) {
pr_err("%s: can not add heap with invalid ops struct.\n",
   __func__);
+   return -EINVAL;
+   }
 
spin_lock_init(>free_lock);
heap->free_list_size = 0;
@@ -1639,6 +1641,7 @@ void ion_device_add_heap(struct ion_device *dev, struct 
ion_heap *heap)
}
 
up_write(>lock);
+   return 0;
 }
 EXPORT_SYMBOL(ion_device_add_heap);
 
diff --git a/drivers/staging/android/ion/ion_priv.h 
b/drivers/staging/android/ion/ion_priv.h
index 0239883..35726ae 100644
--- a/drivers/staging/android/ion/ion_priv.h
+++ b/drivers/staging/android/ion/ion_priv.h
@@ -221,7 +221,7 @@ void ion_device_destroy(struct ion_device *dev);
  * @dev:   the device
  * @heap:  the heap to add
  */
-void ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap);
+int ion_device_add_heap(struct ion_device *dev, struct ion_heap *heap);
 
 /**
  * some helpers for common operations on buffers using the sg_table
-- 
2.5.5

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


[RFC][PATCH 0/6] ion: improved ABI

2016-06-06 Thread Laura Abbott

The ABI for Ion's ioctl interface are a pain to work with. The heap IDs
are a 32-bit non-discoverable namespace that form part of the ABI. There's
no way to determine what ABI version is in use which leads to problems
if the ABI changes or needs to be updated.

This series is a first approach to give a better ABI for Ion. This includes:

- Following the advice in botching-up-ioctls.txt
- Ioctl for ABI version
- Dynamic assignment of heap ids
- queryable heap ids
- Runtime mapping of heap ids, including fallbacks. This avoids the need to
  encode the fallbacks as an ABI.

I'm most interested in feedback if this ABI is actually an improvement and
usable. The heap id map/query interface seems error prone but I didn't have
a cleaner solution. There aren't any kernel APIs for the new features as the
focus was on a userspace API but I anticipate that following easily once
the userspace API is established.


Thanks,
Laura

P.S. Not to turn this into a bike shedding session but if you have suggestions
for a name for this framework other than Ion I would be interested to hear
them. Too many other things are already named Ion.

Laura Abbott (6):
  staging: android: ion: return error value for ion_device_add_heap
  staging: android: ion: Switch to using an idr to manage heaps
  staging: android: ion: Drop heap type masks
  staging: android: ion: Pull out ion ioctls to a separate file
  staging: android: ion: Add an ioctl for ABI checking
  staging: android: ion: Introduce new ioctls for dynamic heaps

 drivers/staging/android/ion/Makefile|   3 +-
 drivers/staging/android/ion/ion-ioctl.c | 243 ++
 drivers/staging/android/ion/ion.c   | 438 
 drivers/staging/android/ion/ion_priv.h  | 109 +++-
 drivers/staging/android/uapi/ion.h  | 164 +++-
 5 files changed, 728 insertions(+), 229 deletions(-)
 create mode 100644 drivers/staging/android/ion/ion-ioctl.c

-- 
2.5.5

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


[PATCH] Staging: android: ion_cma_heap: Fixed a extra blank line coding style issue

2016-06-06 Thread Akshay Shipurkar
Fixed a coding style issue.

Signed-off-by: Akshay Shipurkar 
---
 drivers/staging/android/ion/ion_cma_heap.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index a3446da..68b909a 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -39,7 +39,6 @@ struct ion_cma_buffer_info {
struct sg_table *table;
 };
 
-
 /* ION CMA heap operations functions */
 static int ion_cma_allocate(struct ion_heap *heap, struct ion_buffer *buffer,
unsigned long len, unsigned long align,
-- 
2.7.4

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


[PATCH 1/7] staging: most: v4l2-aim: fix interrupt unsafe spinlocks

2016-06-06 Thread Christian Gromm
The functions get_aim_dev() and aim_rx_data() are using interrupt unsafe
spinlocks even though they may be called from an interrupt context.

This patch fixes the described problem.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 42 ++-
 1 file changed, 22 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 13abf7c..1fea839 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -139,15 +139,15 @@ static int aim_vdev_close(struct file *filp)
 * This must be implemented in core.
 */
 
-   spin_lock(>list_lock);
+   spin_lock_irq(>list_lock);
mdev->mute = true;
list_for_each_entry_safe(mbo, tmp, >pending_mbos, list) {
list_del(>list);
-   spin_unlock(>list_lock);
+   spin_unlock_irq(>list_lock);
most_put_mbo(mbo);
-   spin_lock(>list_lock);
+   spin_lock_irq(>list_lock);
}
-   spin_unlock(>list_lock);
+   spin_unlock_irq(>list_lock);
most_stop_channel(mdev->iface, mdev->ch_idx, _info);
mdev->mute = false;
 
@@ -200,9 +200,9 @@ static ssize_t aim_vdev_read(struct file *filp, char __user 
*buf,
 
if (cnt >= rem) {
fh->offs = 0;
-   spin_lock(>list_lock);
+   spin_lock_irq(>list_lock);
list_del(>list);
-   spin_unlock(>list_lock);
+   spin_unlock_irq(>list_lock);
most_put_mbo(mbo);
}
}
@@ -394,34 +394,36 @@ static struct most_video_dev *get_aim_dev(
struct most_interface *iface, int channel_idx)
 {
struct most_video_dev *mdev, *tmp;
+   unsigned long flags;
 
-   spin_lock(_lock);
+   spin_lock_irqsave(_lock, flags);
list_for_each_entry_safe(mdev, tmp, _devices, list) {
if (mdev->iface == iface && mdev->ch_idx == channel_idx) {
-   spin_unlock(_lock);
+   spin_unlock_irqrestore(_lock, flags);
return mdev;
}
}
-   spin_unlock(_lock);
+   spin_unlock_irqrestore(_lock, flags);
return NULL;
 }
 
 static int aim_rx_data(struct mbo *mbo)
 {
+   unsigned long flags;
struct most_video_dev *mdev =
get_aim_dev(mbo->ifp, mbo->hdm_channel_id);
 
if (!mdev)
return -EIO;
 
-   spin_lock(>list_lock);
+   spin_lock_irqsave(>list_lock, flags);
if (unlikely(mdev->mute)) {
-   spin_unlock(>list_lock);
+   spin_unlock_irqrestore(>list_lock, flags);
return -EIO;
}
 
list_add_tail(>list, >pending_mbos);
-   spin_unlock(>list_lock);
+   spin_unlock_irqrestore(>list_lock, flags);
wake_up_interruptible(>wait_data);
return 0;
 }
@@ -529,9 +531,9 @@ static int aim_probe_channel(struct most_interface *iface, 
int channel_idx,
if (ret)
goto err_unreg;
 
-   spin_lock(_lock);
+   spin_lock_irq(_lock);
list_add(>list, _devices);
-   spin_unlock(_lock);
+   spin_unlock_irq(_lock);
return 0;
 
 err_unreg:
@@ -552,9 +554,9 @@ static int aim_disconnect_channel(struct most_interface 
*iface,
return -ENOENT;
}
 
-   spin_lock(_lock);
+   spin_lock_irq(_lock);
list_del(>list);
-   spin_unlock(_lock);
+   spin_unlock_irq(_lock);
 
aim_unregister_videodev(mdev);
v4l2_device_disconnect(>v4l2_dev);
@@ -585,17 +587,17 @@ static void __exit aim_exit(void)
 * we simulate this call here.
 * This must be fixed in core.
 */
-   spin_lock(_lock);
+   spin_lock_irq(_lock);
list_for_each_entry_safe(mdev, tmp, _devices, list) {
list_del(>list);
-   spin_unlock(_lock);
+   spin_unlock_irq(_lock);
 
aim_unregister_videodev(mdev);
v4l2_device_disconnect(>v4l2_dev);
v4l2_device_put(>v4l2_dev);
-   spin_lock(_lock);
+   spin_lock_irq(_lock);
}
-   spin_unlock(_lock);
+   spin_unlock_irq(_lock);
 
most_deregister_aim(_info);
BUG_ON(!list_empty(_devices));
-- 
1.9.1

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


[PATCH 4/7] staging: most: v4l2-aim: replace pr_xx calls by v4l2_xx calls

2016-06-06 Thread Christian Gromm
This patch replaces pr_info, pr_err, etc. function calls by the
v4l2_... ones to get the device dependent logs.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 43 ++-
 1 file changed, 27 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 9a383e0..b55ab62 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -79,7 +79,7 @@ static int aim_vdev_open(struct file *filp)
struct most_video_dev *mdev = video_drvdata(filp);
struct aim_fh *fh;
 
-   pr_info("aim_vdev_open()\n");
+   v4l2_info(>v4l2_dev, "aim_vdev_open()\n");
 
switch (vdev->vfl_type) {
case VFL_TYPE_GRABBER:
@@ -93,7 +93,7 @@ static int aim_vdev_open(struct file *filp)
return -ENOMEM;
 
if (!atomic_inc_and_test(>access_ref)) {
-   pr_err("too many clients\n");
+   v4l2_err(>v4l2_dev, "too many clients\n");
ret = -EBUSY;
goto err_dec;
}
@@ -106,7 +106,7 @@ static int aim_vdev_open(struct file *filp)
 
ret = most_start_channel(mdev->iface, mdev->ch_idx, _info);
if (ret) {
-   pr_err("most_start_channel() failed\n");
+   v4l2_err(>v4l2_dev, "most_start_channel() failed\n");
goto err_rm;
}
 
@@ -128,7 +128,7 @@ static int aim_vdev_close(struct file *filp)
struct most_video_dev *mdev = fh->mdev;
struct mbo *mbo, *tmp;
 
-   pr_info("aim_vdev_close()\n");
+   v4l2_info(>v4l2_dev, "aim_vdev_close()\n");
 
/*
 * We need to put MBOs back before we call most_stop_channel()
@@ -187,7 +187,7 @@ static ssize_t aim_vdev_read(struct file *filp, char __user 
*buf,
int const cnt = rem < count ? rem : count;
 
if (copy_to_user(buf, mbo->virt_address + fh->offs, cnt)) {
-   pr_err("read: copy_to_user failed\n");
+   v4l2_err(>v4l2_dev, "read: copy_to_user 
failed\n");
if (!ret)
ret = -EFAULT;
return ret;
@@ -256,7 +256,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
struct aim_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   pr_info("vidioc_querycap()\n");
+   v4l2_info(>v4l2_dev, "vidioc_querycap()\n");
 
strlcpy(cap->driver, "v4l2_most_aim", sizeof(cap->driver));
strlcpy(cap->card, "MOST", sizeof(cap->card));
@@ -273,7 +273,10 @@ static int vidioc_querycap(struct file *file, void  *priv,
 static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
   struct v4l2_fmtdesc *f)
 {
-   pr_info("vidioc_enum_fmt_vid_cap() %d\n", f->index);
+   struct aim_fh *fh = priv;
+   struct most_video_dev *mdev = fh->mdev;
+
+   v4l2_info(>v4l2_dev, "vidioc_enum_fmt_vid_cap() %d\n", f->index);
 
if (f->index)
return -EINVAL;
@@ -289,7 +292,10 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void 
 *priv,
 static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   pr_info("vidioc_g_fmt_vid_cap()\n");
+   struct aim_fh *fh = priv;
+   struct most_video_dev *mdev = fh->mdev;
+
+   v4l2_info(>v4l2_dev, "vidioc_g_fmt_vid_cap()\n");
 
aim_set_format_struct(f);
return 0;
@@ -315,7 +321,10 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void 
*priv,
 
 static int vidioc_g_std(struct file *file, void *priv, v4l2_std_id *norm)
 {
-   pr_info("vidioc_g_std()\n");
+   struct aim_fh *fh = priv;
+   struct most_video_dev *mdev = fh->mdev;
+
+   v4l2_info(>v4l2_dev, "vidioc_g_std()\n");
 
*norm = V4L2_STD_UNKNOWN;
return 0;
@@ -352,7 +361,7 @@ static int vidioc_s_input(struct file *file, void *priv, 
unsigned int index)
struct aim_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
-   pr_info("vidioc_s_input(%d)\n", index);
+   v4l2_info(>v4l2_dev, "vidioc_s_input(%d)\n", index);
 
if (index >= V4L2_AIM_MAX_INPUT)
return -EINVAL;
@@ -433,7 +442,7 @@ static int aim_register_videodev(struct most_video_dev 
*mdev)
int retval = -ENOMEM;
int ret;
 
-   pr_info("aim_register_videodev()\n");
+   v4l2_info(>v4l2_dev, "aim_register_videodev()\n");
 
init_waitqueue_head(>wait_data);
 
@@ -453,7 +462,8 @@ static int aim_register_videodev(struct most_video_dev 
*mdev)
video_set_drvdata(mdev->vdev, mdev);
retval = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1);
if (retval != 0) {
-   pr_err("video_register_device failed (%d)\n", retval);
+   

[PATCH 7/7] staging: most: v4l2-aim: remove unnecessary spaces

2016-06-06 Thread Christian Gromm
This patch removes the unnecessary spaces.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 0cca9ce..150dc89 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -250,7 +250,7 @@ static int aim_set_format(struct most_video_dev *mdev, 
unsigned int cmd,
return 0;
 }
 
-static int vidioc_querycap(struct file *file, void  *priv,
+static int vidioc_querycap(struct file *file, void *priv,
   struct v4l2_capability *cap)
 {
struct aim_fh *fh = priv;
@@ -270,7 +270,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
return 0;
 }
 
-static int vidioc_enum_fmt_vid_cap(struct file *file, void  *priv,
+static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
   struct v4l2_fmtdesc *f)
 {
struct aim_fh *fh = priv;
@@ -304,7 +304,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void 
*priv,
 static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
  struct v4l2_format *f)
 {
-   struct aim_fh *fh  = priv;
+   struct aim_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
return aim_set_format(mdev, VIDIOC_TRY_FMT, f);
@@ -313,7 +313,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void 
*priv,
 static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
 {
-   struct aim_fh *fh  = priv;
+   struct aim_fh *fh = priv;
struct most_video_dev *mdev = fh->mdev;
 
return aim_set_format(mdev, VIDIOC_S_FMT, f);
-- 
1.9.1

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


[PATCH 3/7] staging: most: v4l2-aim: assign unique names to devices

2016-06-06 Thread Christian Gromm
The current V4L2 AIM implementation assigns to all video devices and to
all V4L devices the same names.

This patch makes use of hardware dependent names for the video devices and
allows the user to choose the names for the V4L devices.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 6b7e220..9a383e0 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -259,7 +259,7 @@ static int vidioc_querycap(struct file *file, void  *priv,
pr_info("vidioc_querycap()\n");
 
strlcpy(cap->driver, "v4l2_most_aim", sizeof(cap->driver));
-   strlcpy(cap->card, "my_card", sizeof(cap->card));
+   strlcpy(cap->card, "MOST", sizeof(cap->card));
snprintf(cap->bus_info, sizeof(cap->bus_info),
 "%s", mdev->iface->description);
 
@@ -446,7 +446,8 @@ static int aim_register_videodev(struct most_video_dev 
*mdev)
*mdev->vdev = aim_videodev_template;
mdev->vdev->v4l2_dev = >v4l2_dev;
mdev->vdev->lock = >lock;
-   strcpy(mdev->vdev->name, "most v4l2 aim video");
+   snprintf(mdev->vdev->name, sizeof(mdev->vdev->name), "MOST: %s",
+mdev->v4l2_dev.name);
 
/* Register the v4l2 device */
video_set_drvdata(mdev->vdev, mdev);
@@ -518,8 +519,7 @@ static int aim_probe_channel(struct most_interface *iface, 
int channel_idx,
mdev->v4l2_dev.release = aim_v4l2_dev_release;
 
/* Create the v4l2_device */
-   strlcpy(mdev->v4l2_dev.name, "most_video_device",
-   sizeof(mdev->v4l2_dev.name));
+   strlcpy(mdev->v4l2_dev.name, name, sizeof(mdev->v4l2_dev.name));
ret = v4l2_device_register(NULL, >v4l2_dev);
if (ret) {
pr_err("v4l2_device_register() failed\n");
-- 
1.9.1

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


[PATCH 6/7] staging: most: v4l2-aim: remove unnecessary label err_vbi_dev

2016-06-06 Thread Christian Gromm
For optimization purposes this patch removes the label err_vbi_dev.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index e0fee88..0cca9ce 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -463,13 +463,9 @@ static int aim_register_videodev(struct most_video_dev 
*mdev)
if (ret) {
v4l2_err(>v4l2_dev, "video_register_device failed (%d)\n",
 ret);
-   goto err_vbi_dev;
+   video_device_release(mdev->vdev);
}
 
-   return 0;
-
-err_vbi_dev:
-   video_device_release(mdev->vdev);
return ret;
 }
 
-- 
1.9.1

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


[PATCH 5/7] staging: most: v4l2-aim: remove unnecessary retval

2016-06-06 Thread Christian Gromm
The function aim_register_videodev() uses the variables 'ret' and
'retval' to represent the same value.

This patch removes 'retval' and replaces it with 'ret'. Further, it
replaces the constant return value '-ENODEV' with the result returned by
function video_register_device() in the event something went wrong.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index b55ab62..e0fee88 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -439,7 +439,6 @@ static int aim_rx_data(struct mbo *mbo)
 
 static int aim_register_videodev(struct most_video_dev *mdev)
 {
-   int retval = -ENOMEM;
int ret;
 
v4l2_info(>v4l2_dev, "aim_register_videodev()\n");
@@ -460,11 +459,10 @@ static int aim_register_videodev(struct most_video_dev 
*mdev)
 
/* Register the v4l2 device */
video_set_drvdata(mdev->vdev, mdev);
-   retval = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1);
-   if (retval != 0) {
+   ret = video_register_device(mdev->vdev, VFL_TYPE_GRABBER, -1);
+   if (ret) {
v4l2_err(>v4l2_dev, "video_register_device failed (%d)\n",
-retval);
-   ret = -ENODEV;
+ret);
goto err_vbi_dev;
}
 
-- 
1.9.1

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


[PATCH 0/7] staging: most: fix issues of v4l2-aim

2016-06-06 Thread Christian Gromm
This patch set is needed to fix issues inside the video-4-linux AIM of
MOST driver.

Andrey Shvetsov (7):
  v4l2-aim: fix interrupt unsafe spinlocks
  v4l2-aim: optimize list_for_each_entry_safe
  v4l2-aim: assign unique names to devices
  v4l2-aim: replace pr_xx calls by v4l2_xx calls
  v4l2-aim: remove unnecessary retval
  v4l2-aim: remove unnecessary label err_vbi_dev
  v4l2-aim: remove unnecessary spaces

 drivers/staging/most/aim-v4l2/video.c | 117 ++
 1 file changed, 62 insertions(+), 55 deletions(-)

-- 
1.9.1

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


[PATCH 2/7] staging: most: v4l2-aim: optimize list_for_each_entry_safe

2016-06-06 Thread Christian Gromm
As the function get_aim_dev() does not delete elements of the list, the
use of macro list_for_each_entry_safe is not necessary.

This patch replaces the macro list_for_each_entry_safe with the macro
list_for_each_entry.

Signed-off-by: Andrey Shvetsov 
Signed-off-by: Christian Gromm 
---
 drivers/staging/most/aim-v4l2/video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/most/aim-v4l2/video.c 
b/drivers/staging/most/aim-v4l2/video.c
index 1fea839..6b7e220 100644
--- a/drivers/staging/most/aim-v4l2/video.c
+++ b/drivers/staging/most/aim-v4l2/video.c
@@ -393,11 +393,11 @@ static const struct video_device aim_videodev_template = {
 static struct most_video_dev *get_aim_dev(
struct most_interface *iface, int channel_idx)
 {
-   struct most_video_dev *mdev, *tmp;
+   struct most_video_dev *mdev;
unsigned long flags;
 
spin_lock_irqsave(_lock, flags);
-   list_for_each_entry_safe(mdev, tmp, _devices, list) {
+   list_for_each_entry(mdev, _devices, list) {
if (mdev->iface == iface && mdev->ch_idx == channel_idx) {
spin_unlock_irqrestore(_lock, flags);
return mdev;
-- 
1.9.1

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


[PATCH v2] Drivers: hv: get rid of timeout in vmbus_open()

2016-06-06 Thread Vitaly Kuznetsov
vmbus_teardown_gpadl() can result in infinite wait when it is called
on 5 second timeout in vmbus_open(). The issue is caused by the fact
that gpadl teardown operation won't ever succeed for an opened channel
and the timeout isn't always enough. As a guest, we can always trust
the host to respond to our request (and there is nothing we can do if
it doesn't).

Signed-off-by: Vitaly Kuznetsov 
---
- The patch is the successor of previously sent '[PATCH] Drivers: hv: fix
 infinite wait when channel open timeouts, thus v2.
- Remove the timeout completely [K. Y. Srinivasan]
---
 drivers/hv/channel.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c
index 6a8660d..e47d37d 100644
--- a/drivers/hv/channel.c
+++ b/drivers/hv/channel.c
@@ -73,7 +73,6 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
void *in, *out;
unsigned long flags;
int ret, err = 0;
-   unsigned long t;
struct page *page;
 
spin_lock_irqsave(>lock, flags);
@@ -183,11 +182,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 
send_ringbuffer_size,
goto error1;
}
 
-   t = wait_for_completion_timeout(_info->waitevent, 5*HZ);
-   if (t == 0) {
-   err = -ETIMEDOUT;
-   goto error1;
-   }
+   wait_for_completion(_info->waitevent);
 
spin_lock_irqsave(_connection.channelmsg_lock, flags);
list_del(_info->msglistentry);
-- 
2.5.5

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


[PATCH v1 10/10] Staging: comedi: Used unsigned int instead of unsigned issue in jr3_pci.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the jr3_pci.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/jr3_pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c 
b/drivers/staging/comedi/drivers/jr3_pci.c
index fa0d4b1..6c4ff02 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -231,7 +231,7 @@ static unsigned int jr3_pci_ai_read_chan(struct 
comedi_device *dev,
 
if (chan < 56) {
unsigned int axis = chan % 8;
-   unsigned filter = chan / 8;
+   unsigned int filter = chan / 8;
 
switch (axis) {
case 0:
@@ -690,7 +690,7 @@ static int jr3_pci_auto_attach(struct comedi_device *dev,
if (sizeof(struct jr3_channel) != 0xc00) {
dev_err(dev->class_dev,
"sizeof(struct jr3_channel) = %x [expected %x]\n",
-   (unsigned)sizeof(struct jr3_channel), 0xc00);
+   (unsigned int)sizeof(struct jr3_channel), 0xc00);
return -EINVAL;
}
 
-- 
1.9.1

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


[PATCH v1 04/10] Staging: comedi:Fix a warning issues in me_daq.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the me_daq.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/me_daq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/me_daq.c 
b/drivers/staging/comedi/drivers/me_daq.c
index 3bf0caa..c0b7a30 100644
--- a/drivers/staging/comedi/drivers/me_daq.c
+++ b/drivers/staging/comedi/drivers/me_daq.c
@@ -150,7 +150,7 @@ struct me_private_data {
unsigned short dac_ctrl;/* Mirror of the DAC_CONTROL register */
 };
 
-static inline void sleep(unsigned sec)
+static inline void sleep(unsigned int sec)
 {
schedule_timeout_interruptible(sec * HZ);
 }
-- 
1.9.1

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


[PATCH v1 06/10] Staging: comedi: Prefer using the BIT macro issue in das16.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This patch Replace all occurences of (1<
---
 drivers/staging/comedi/drivers/das16.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index fd8e0b7..69133e3 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -92,37 +92,37 @@
 #define DAS16_AO_LSB_REG(x)((x) ? 0x06 : 0x04)
 #define DAS16_AO_MSB_REG(x)((x) ? 0x07 : 0x05)
 #define DAS16_STATUS_REG   0x08
-#define DAS16_STATUS_BUSY  (1 << 7)
-#define DAS16_STATUS_UNIPOLAR  (1 << 6)
-#define DAS16_STATUS_MUXBIT(1 << 5)
-#define DAS16_STATUS_INT   (1 << 4)
+#define DAS16_STATUS_BUSY  BIT(7)
+#define DAS16_STATUS_UNIPOLAR  BIT(6)
+#define DAS16_STATUS_MUXBITBIT(5)
+#define DAS16_STATUS_INT   BIT(4)
 #define DAS16_CTRL_REG 0x09
-#define DAS16_CTRL_INTE(1 << 7)
+#define DAS16_CTRL_INTEBIT(7)
 #define DAS16_CTRL_IRQ(x)  (((x) & 0x7) << 4)
-#define DAS16_CTRL_DMAE(1 << 2)
+#define DAS16_CTRL_DMAEBIT(2)
 #define DAS16_CTRL_PACING_MASK (3 << 0)
 #define DAS16_CTRL_INT_PACER   (3 << 0)
 #define DAS16_CTRL_EXT_PACER   (2 << 0)
 #define DAS16_CTRL_SOFT_PACER  (0 << 0)
 #define DAS16_PACER_REG0x0a
 #define DAS16_PACER_BURST_LEN(x)   (((x) & 0xf) << 4)
-#define DAS16_PACER_CTR0   (1 << 1)
-#define DAS16_PACER_TRIG0  (1 << 0)
+#define DAS16_PACER_CTR0   BIT(1)
+#define DAS16_PACER_TRIG0  BIT(0)
 #define DAS16_GAIN_REG 0x0b
 #define DAS16_TIMER_BASE_REG   0x0c/* to 0x0f */
 
 #define DAS1600_CONV_REG   0x404
-#define DAS1600_CONV_DISABLE   (1 << 6)
+#define DAS1600_CONV_DISABLE   BIT(6)
 #define DAS1600_BURST_REG  0x405
-#define DAS1600_BURST_VAL  (1 << 6)
+#define DAS1600_BURST_VAL  BIT(6)
 #define DAS1600_ENABLE_REG 0x406
-#define DAS1600_ENABLE_VAL (1 << 6)
+#define DAS1600_ENABLE_VAL BIT(6)
 #define DAS1600_STATUS_REG 0x407
-#define DAS1600_STATUS_BME (1 << 6)
-#define DAS1600_STATUS_ME  (1 << 5)
-#define DAS1600_STATUS_CD  (1 << 4)
-#define DAS1600_STATUS_WS  (1 << 1)
-#define DAS1600_STATUS_CLK_10MHZ   (1 << 0)
+#define DAS1600_STATUS_BME BIT(6)
+#define DAS1600_STATUS_ME  BIT(5)
+#define DAS1600_STATUS_CD  BIT(4)
+#define DAS1600_STATUS_WS  BIT(1)
+#define DAS1600_STATUS_CLK_10MHZ   BIT(0)
 
 static const struct comedi_lrange range_das1x01_bip = {
4, {
-- 
1.9.1

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


[PATCH v1 05/10] Staging: comedi: Fix comment issues in jr3_pci.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the jr3_pci.c file that fixes up a
WARNING: 'Block comments use a trailing */ on a separate line'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/jr3_pci.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/jr3_pci.c 
b/drivers/staging/comedi/drivers/jr3_pci.c
index b87192e..fa0d4b1 100644
--- a/drivers/staging/comedi/drivers/jr3_pci.c
+++ b/drivers/staging/comedi/drivers/jr3_pci.c
@@ -1,20 +1,20 @@
 /*
-  comedi/drivers/jr3_pci.c
-  hardware driver for JR3/PCI force sensor board
-
-  COMEDI - Linux Control and Measurement Device Interface
-  Copyright (C) 2007 Anders Blomdell 
-
-  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.
-*/
+ * comedi/drivers/jr3_pci.c
+ * hardware driver for JR3/PCI force sensor board
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2007 Anders Blomdell 
+ *
+ * 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.
+ */
 /*
  * Driver: jr3_pci
  * Description: JR3/PCI force sensor board
-- 
1.9.1

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


[PATCH v1 06/10] Staging: comedi: Prefer using the BIT macro issue in das16.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This patch Replace all occurences of (1<
---
 drivers/staging/comedi/drivers/das16.c | 32 
 1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16.c 
b/drivers/staging/comedi/drivers/das16.c
index fd8e0b7..69133e3 100644
--- a/drivers/staging/comedi/drivers/das16.c
+++ b/drivers/staging/comedi/drivers/das16.c
@@ -92,37 +92,37 @@
 #define DAS16_AO_LSB_REG(x)((x) ? 0x06 : 0x04)
 #define DAS16_AO_MSB_REG(x)((x) ? 0x07 : 0x05)
 #define DAS16_STATUS_REG   0x08
-#define DAS16_STATUS_BUSY  (1 << 7)
-#define DAS16_STATUS_UNIPOLAR  (1 << 6)
-#define DAS16_STATUS_MUXBIT(1 << 5)
-#define DAS16_STATUS_INT   (1 << 4)
+#define DAS16_STATUS_BUSY  BIT(7)
+#define DAS16_STATUS_UNIPOLAR  BIT(6)
+#define DAS16_STATUS_MUXBITBIT(5)
+#define DAS16_STATUS_INT   BIT(4)
 #define DAS16_CTRL_REG 0x09
-#define DAS16_CTRL_INTE(1 << 7)
+#define DAS16_CTRL_INTEBIT(7)
 #define DAS16_CTRL_IRQ(x)  (((x) & 0x7) << 4)
-#define DAS16_CTRL_DMAE(1 << 2)
+#define DAS16_CTRL_DMAEBIT(2)
 #define DAS16_CTRL_PACING_MASK (3 << 0)
 #define DAS16_CTRL_INT_PACER   (3 << 0)
 #define DAS16_CTRL_EXT_PACER   (2 << 0)
 #define DAS16_CTRL_SOFT_PACER  (0 << 0)
 #define DAS16_PACER_REG0x0a
 #define DAS16_PACER_BURST_LEN(x)   (((x) & 0xf) << 4)
-#define DAS16_PACER_CTR0   (1 << 1)
-#define DAS16_PACER_TRIG0  (1 << 0)
+#define DAS16_PACER_CTR0   BIT(1)
+#define DAS16_PACER_TRIG0  BIT(0)
 #define DAS16_GAIN_REG 0x0b
 #define DAS16_TIMER_BASE_REG   0x0c/* to 0x0f */
 
 #define DAS1600_CONV_REG   0x404
-#define DAS1600_CONV_DISABLE   (1 << 6)
+#define DAS1600_CONV_DISABLE   BIT(6)
 #define DAS1600_BURST_REG  0x405
-#define DAS1600_BURST_VAL  (1 << 6)
+#define DAS1600_BURST_VAL  BIT(6)
 #define DAS1600_ENABLE_REG 0x406
-#define DAS1600_ENABLE_VAL (1 << 6)
+#define DAS1600_ENABLE_VAL BIT(6)
 #define DAS1600_STATUS_REG 0x407
-#define DAS1600_STATUS_BME (1 << 6)
-#define DAS1600_STATUS_ME  (1 << 5)
-#define DAS1600_STATUS_CD  (1 << 4)
-#define DAS1600_STATUS_WS  (1 << 1)
-#define DAS1600_STATUS_CLK_10MHZ   (1 << 0)
+#define DAS1600_STATUS_BME BIT(6)
+#define DAS1600_STATUS_ME  BIT(5)
+#define DAS1600_STATUS_CD  BIT(4)
+#define DAS1600_STATUS_WS  BIT(1)
+#define DAS1600_STATUS_CLK_10MHZ   BIT(0)
 
 static const struct comedi_lrange range_das1x01_bip = {
4, {
-- 
1.9.1

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


[PATCH v1 07/10] Staging: comedi: fix BIT macro issue in das6402.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This patch Replace all occurences of (1<
---
 drivers/staging/comedi/drivers/das6402.c | 74 
 1 file changed, 38 insertions(+), 36 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das6402.c 
b/drivers/staging/comedi/drivers/das6402.c
index 1701294..0fdf5e0 100644
--- a/drivers/staging/comedi/drivers/das6402.c
+++ b/drivers/staging/comedi/drivers/das6402.c
@@ -50,48 +50,50 @@
 #define DAS6402_AO_LSB_REG(x)  (0x04 + ((x) * 2))
 #define DAS6402_AO_MSB_REG(x)  (0x05 + ((x) * 2))
 #define DAS6402_STATUS_REG 0x08
-#define DAS6402_STATUS_FFNE(1 << 0)
-#define DAS6402_STATUS_FHALF   (1 << 1)
-#define DAS6402_STATUS_FFULL   (1 << 2)
-#define DAS6402_STATUS_XINT(1 << 3)
-#define DAS6402_STATUS_INT (1 << 4)
-#define DAS6402_STATUS_XTRIG   (1 << 5)
-#define DAS6402_STATUS_INDGT   (1 << 6)
-#define DAS6402_STATUS_10MHZ   (1 << 7)
-#define DAS6402_STATUS_W_CLRINT(1 << 0)
-#define DAS6402_STATUS_W_CLRXTR(1 << 1)
-#define DAS6402_STATUS_W_CLRXIN(1 << 2)
-#define DAS6402_STATUS_W_EXTEND(1 << 4)
-#define DAS6402_STATUS_W_ARMED (1 << 5)
-#define DAS6402_STATUS_W_POSTMODE  (1 << 6)
-#define DAS6402_STATUS_W_10MHZ (1 << 7)
+#define DAS6402_STATUS_FFNEBIT(0)
+#define DAS6402_STATUS_FHALF   BIT(1)
+#define DAS6402_STATUS_FFULL   BIT(2)
+#define DAS6402_STATUS_XINTBIT(3)
+#define DAS6402_STATUS_INT BIT(4)
+#define DAS6402_STATUS_XTRIG   BIT(5)
+#define DAS6402_STATUS_INDGT   BIT(6)
+#define DAS6402_STATUS_10MHZ   BIT(7)
+#define DAS6402_STATUS_W_CLRINTBIT(0)
+#define DAS6402_STATUS_W_CLRXTRBIT(1)
+#define DAS6402_STATUS_W_CLRXINBIT(2)
+#define DAS6402_STATUS_W_EXTENDBIT(4)
+#define DAS6402_STATUS_W_ARMED BIT(5)
+#define DAS6402_STATUS_W_POSTMODE  BIT(6)
+#define DAS6402_STATUS_W_10MHZ BIT(7)
 #define DAS6402_CTRL_REG   0x09
-#define DAS6402_CTRL_SOFT_TRIG (0 << 0)
-#define DAS6402_CTRL_EXT_FALL_TRIG (1 << 0)
-#define DAS6402_CTRL_EXT_RISE_TRIG (2 << 0)
-#define DAS6402_CTRL_PACER_TRIG(3 << 0)
-#define DAS6402_CTRL_BURSTEN   (1 << 2)
-#define DAS6402_CTRL_XINTE (1 << 3)
+#define DAS6402_CTRL_TRIG(x)   ((x) << 0)
+#define DAS6402_CTRL_SOFT_TRIG DAS6402_CTRL_TRIG(0)
+#define DAS6402_CTRL_EXT_FALL_TRIG DAS6402_CTRL_TRIG(1)
+#define DAS6402_CTRL_EXT_RISE_TRIG DAS6402_CTRL_TRIG(2)
+#define DAS6402_CTRL_PACER_TRIGDAS6402_CTRL_TRIG(3)
+#define DAS6402_CTRL_BURSTEN   BIT(2)
+#define DAS6402_CTRL_XINTE BIT(3)
 #define DAS6402_CTRL_IRQ(x)((x) << 4)
-#define DAS6402_CTRL_INTE  (1 << 7)
+#define DAS6402_CTRL_INTE  BIT(7)
 #define DAS6402_TRIG_REG   0x0a
-#define DAS6402_TRIG_TGEN  (1 << 0)
-#define DAS6402_TRIG_TGSEL (1 << 1)
-#define DAS6402_TRIG_TGPOL (1 << 2)
-#define DAS6402_TRIG_PRETRIG   (1 << 3)
+#define DAS6402_TRIG_TGEN  BIT(0)
+#define DAS6402_TRIG_TGSEL BIT(1)
+#define DAS6402_TRIG_TGPOL BIT(2)
+#define DAS6402_TRIG_PRETRIG   BIT(3)
 #define DAS6402_AO_RANGE(_chan, _range)((_range) << ((_chan) ? 6 : 4))
 #define DAS6402_AO_RANGE_MASK(_chan)   (3 << ((_chan) ? 6 : 4))
 #define DAS6402_MODE_REG   0x0b
-#define DAS6402_MODE_RANGE(x)  ((x) << 0)
-#define DAS6402_MODE_POLLED(0 << 2)
-#define DAS6402_MODE_FIFONEPTY (1 << 2)
-#define DAS6402_MODE_FIFOHFULL (2 << 2)
-#define DAS6402_MODE_EOB   (3 << 2)
-#define DAS6402_MODE_ENHANCED  (1 << 4)
-#define DAS6402_MODE_SE(1 << 5)
-#define DAS6402_MODE_UNI   (1 << 6)
-#define DAS6402_MODE_DMA1  (0 << 7)
-#define DAS6402_MODE_DMA3  (1 << 7)
+#define DAS6402_MODE_RANGE(x)  ((x) << 2)
+#define DAS6402_MODE_POLLEDDAS6402_MODE_RANGE(0)
+#define DAS6402_MODE_FIFONEPTY DAS6402_MODE_RANGE(1)
+#define DAS6402_MODE_FIFOHFULL DAS6402_MODE_RANGE(2)
+#define DAS6402_MODE_EOB   DAS6402_MODE_RANGE(3)
+#define DAS6402_MODE_ENHANCED  BIT(4)
+#define DAS6402_MODE_SEBIT(5)
+#define DAS6402_MODE_UNI   BIT(6)
+#define DAS6402_MODE_DMA(x)((x) << 7)
+#define DAS6402_MODE_DMA1  DAS6402_MODE_DMA(0)
+#define DAS6402_MODE_DMA3  DAS6402_MODE_DMA(1)
 #define 

[PATCH v1 09/10] Staging: comedi: Block comment issue fixed for das16m1.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the das16m1.c file that fixes up a
WARNING: 'Block comments use a trailing */ on a separate line'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/das16m1.c | 168 ---
 1 file changed, 89 insertions(+), 79 deletions(-)

diff --git a/drivers/staging/comedi/drivers/das16m1.c 
b/drivers/staging/comedi/drivers/das16m1.c
index 3a37373..212125f 100644
--- a/drivers/staging/comedi/drivers/das16m1.c
+++ b/drivers/staging/comedi/drivers/das16m1.c
@@ -1,56 +1,56 @@
 /*
-comedi/drivers/das16m1.c
-CIO-DAS16/M1 driver
-Author: Frank Mori Hess, based on code from the das16
-  driver.
-Copyright (C) 2001 Frank Mori Hess 
-
-COMEDI - Linux Control and Measurement Device Interface
-Copyright (C) 2000 David A. Schleef 
-
-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.
-*/
+ * comedi/drivers/das16m1.c
+ * CIO-DAS16/M1 driver
+ * Author: Frank Mori Hess, based on code from the das16
+ * driver.
+ * Copyright (C) 2001 Frank Mori Hess 
+ *
+ * COMEDI - Linux Control and Measurement Device Interface
+ * Copyright (C) 2000 David A. Schleef 
+ *
+ * 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.
+ */
 /*
-Driver: das16m1
-Description: CIO-DAS16/M1
-Author: Frank Mori Hess 
-Devices: [Measurement Computing] CIO-DAS16/M1 (das16m1)
-Status: works
-
-This driver supports a single board - the CIO-DAS16/M1.
-As far as I know, there are no other boards that have
-the same register layout.  Even the CIO-DAS16/M1/16 is
-significantly different.
-
-I was _barely_ able to reach the full 1 MHz capability
-of this board, using a hard real-time interrupt
-(set the TRIG_RT flag in your struct comedi_cmd and use
-rtlinux or RTAI).  The board can't do dma, so the bottleneck is
-pulling the data across the ISA bus.  I timed the interrupt
-handler, and it took my computer ~470 microseconds to pull 512
-samples from the board.  So at 1 Mhz sampling rate,
-expect your CPU to be spending almost all of its
-time in the interrupt handler.
-
-This board has some unusual restrictions for its channel/gain list.  If the
-list has 2 or more channels in it, then two conditions must be satisfied:
-(1) - even/odd channels must appear at even/odd indices in the list
-(2) - the list must have an even number of entries.
-
-Options:
-   [0] - base io address
-   [1] - irq (optional, but you probably want it)
-
-irq can be omitted, although the cmd interface will not work without it.
-*/
+ * Driver: das16m1
+ * Description: CIO-DAS16/M1
+ * Author: Frank Mori Hess 
+ * Devices: [Measurement Computing] CIO-DAS16/M1 (das16m1)
+ * Status: works
+ *
+ * This driver supports a single board - the CIO-DAS16/M1.
+ * As far as I know, there are no other boards that have
+ * the same register layout.  Even the CIO-DAS16/M1/16 is
+ * significantly different.
+ *
+ * I was _barely_ able to reach the full 1 MHz capability
+ * of this board, using a hard real-time interrupt
+ * (set the TRIG_RT flag in your struct comedi_cmd and use
+ * rtlinux or RTAI).  The board can't do dma, so the bottleneck is
+ * pulling the data across the ISA bus.  I timed the interrupt
+ * handler, and it took my computer ~470 microseconds to pull 512
+ * samples from the board.  So at 1 Mhz sampling rate,
+ * expect your CPU to be spending almost all of its
+ * time in the interrupt handler.
+ *
+ * This board has some unusual restrictions for its channel/gain list.  If the
+ * list has 2 or more channels in it, then two conditions must be satisfied:
+ * (1) - even/odd channels must appear at even/odd indices in the list
+ * (2) - the list must have an even number of entries.
+ *
+ * Options:
+ * [0] - base io address
+ * [1] - irq (optional, but you probably want it)
+ *
+ * irq can be omitted, although the cmd interface will not work without it.
+ */
 

[PATCH v1 02/10] Staging: comedi: fix bare use of unsigned issue in ni_65xx.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the ni_65xx.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/ni_65xx.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/comedi/drivers/ni_65xx.c 
b/drivers/staging/comedi/drivers/ni_65xx.c
index 251117b..07f38e3 100644
--- a/drivers/staging/comedi/drivers/ni_65xx.c
+++ b/drivers/staging/comedi/drivers/ni_65xx.c
@@ -151,10 +151,10 @@ enum ni_65xx_boardid {
 
 struct ni_65xx_board {
const char *name;
-   unsigned num_dio_ports;
-   unsigned num_di_ports;
-   unsigned num_do_ports;
-   unsigned legacy_invert:1;
+   unsigned int num_dio_ports;
+   unsigned int num_di_ports;
+   unsigned int num_do_ports;
+   unsigned int legacy_invert:1;
 };
 
 static const struct ni_65xx_board ni_65xx_boards[] = {
@@ -360,7 +360,7 @@ static int ni_65xx_dio_insn_config(struct comedi_device 
*dev,
unsigned long base_port = (unsigned long)s->private;
unsigned int chan = CR_CHAN(insn->chanspec);
unsigned int chan_mask = NI_65XX_CHAN_TO_MASK(chan);
-   unsigned port = base_port + NI_65XX_CHAN_TO_PORT(chan);
+   unsigned int port = base_port + NI_65XX_CHAN_TO_PORT(chan);
unsigned int interval;
unsigned int val;
 
@@ -428,14 +428,14 @@ static int ni_65xx_dio_insn_bits(struct comedi_device 
*dev,
unsigned long base_port = (unsigned long)s->private;
unsigned int base_chan = CR_CHAN(insn->chanspec);
int last_port_offset = NI_65XX_CHAN_TO_PORT(s->n_chan - 1);
-   unsigned read_bits = 0;
+   unsigned int read_bits = 0;
int port_offset;
 
for (port_offset = NI_65XX_CHAN_TO_PORT(base_chan);
 port_offset <= last_port_offset; port_offset++) {
-   unsigned port = base_port + port_offset;
+   unsigned int port = base_port + port_offset;
int base_port_channel = NI_65XX_PORT_TO_CHAN(port_offset);
-   unsigned port_mask, port_data, bits;
+   unsigned int port_mask, port_data, bits;
int bitshift = base_port_channel - base_chan;
 
if (bitshift >= 32)
@@ -640,7 +640,7 @@ static int ni_65xx_auto_attach(struct comedi_device *dev,
struct pci_dev *pcidev = comedi_to_pci_dev(dev);
const struct ni_65xx_board *board = NULL;
struct comedi_subdevice *s;
-   unsigned i;
+   unsigned int i;
int ret;
 
if (context < ARRAY_SIZE(ni_65xx_boards))
-- 
1.9.1

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


[PATCH v1 08/10] Staging: comedi: Prefer unsigned int instead of unsigned in comedi_bond.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the comedi_bond.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/comedi_bond.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/comedi/drivers/comedi_bond.c 
b/drivers/staging/comedi/drivers/comedi_bond.c
index 50b76ec..64a5ea3 100644
--- a/drivers/staging/comedi/drivers/comedi_bond.c
+++ b/drivers/staging/comedi/drivers/comedi_bond.c
@@ -55,16 +55,16 @@
 
 struct bonded_device {
struct comedi_device *dev;
-   unsigned minor;
-   unsigned subdev;
-   unsigned nchans;
+   unsigned int minor;
+   unsigned int subdev;
+   unsigned int nchans;
 };
 
 struct comedi_bond_private {
char name[256];
struct bonded_device **devs;
-   unsigned ndevs;
-   unsigned nchans;
+   unsigned int ndevs;
+   unsigned int nchans;
 };
 
 static int bonding_dio_insn_bits(struct comedi_device *dev,
-- 
1.9.1

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


[PATCH v1 03/10] Staging: comedi: Indentation issue in mpc624.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the mpc624.c file that fixes up a
WARNING: 'Statements should start on a tabstop' found by
the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/mpc624.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/mpc624.c 
b/drivers/staging/comedi/drivers/mpc624.c
index 826e439..9bda761 100644
--- a/drivers/staging/comedi/drivers/mpc624.c
+++ b/drivers/staging/comedi/drivers/mpc624.c
@@ -103,7 +103,7 @@ static const struct comedi_lrange range_mpc624_bipolar1 = {
 /* BIP_RANGE(1.01)  this is correct, */
 /*  but my MPC-624 actually seems to have a range of 2.02 */
 BIP_RANGE(2.02)
-}
+   }
 };
 
 static const struct comedi_lrange range_mpc624_bipolar10 = {
@@ -112,7 +112,7 @@ static const struct comedi_lrange range_mpc624_bipolar10 = {
 /* BIP_RANGE(10.1)   this is correct, */
 /*  but my MPC-624 actually seems to have a range of 20.2 */
 BIP_RANGE(20.2)
-}
+   }
 };
 
 static unsigned int mpc624_ai_get_sample(struct comedi_device *dev,
-- 
1.9.1

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


[PATCH v1 01/10] Staging: comedi: Use unsigned int instead of unsigned issue in pcmuio.c

2016-06-06 Thread Ravishankar Karkala Mallikarjunayya
This is a patch to the pcmuio.c file that fixes up a
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
found by the checkpatch.pl tool.

Signed-off-by: Ravishankar Karkala Mallikarjunayya 
---
 drivers/staging/comedi/drivers/pcmuio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/pcmuio.c 
b/drivers/staging/comedi/drivers/pcmuio.c
index 7ea8130..8ad64f2 100644
--- a/drivers/staging/comedi/drivers/pcmuio.c
+++ b/drivers/staging/comedi/drivers/pcmuio.c
@@ -307,7 +307,7 @@ static void pcmuio_stop_intr(struct comedi_device *dev,
 
 static void pcmuio_handle_intr_subdev(struct comedi_device *dev,
  struct comedi_subdevice *s,
- unsigned triggered)
+ unsigned int triggered)
 {
struct pcmuio_private *devpriv = dev->private;
int asic = pcmuio_subdevice_to_asic(s);
-- 
1.9.1

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


Re: Personal Assistant and Administrative officer needed^

2016-06-06 Thread Walter
Hello,

I'm looking for someone who can handle my business & personal errands at 
his/her spare time as I keep traveling a lot. Someone who can offer me these 

services mentioned below:

* Mail services (Receive my mails and drop them off at UPS or USPS)
* Shop for Gifts
* Bill payment (pay my bills on my behalf, access to the funds would be 
provided by me)
* Sit for delivery (at your home) or pick items up at nearby post office at 
your convenience.

Let me know if you will be able to offer me any or all of these services and 
10% of my income weekly would be your weekly payment. If you will be available 
for this job position ,send me a confirmation e-mail and send me your details 
like complete name/address/country/state/ city/zip/phone or you could even 
attach your resume.I do have a pile up of work and a number of unattended 
duties which you can assist me with soon.



Please note that this job DOES NOT require any financial obligation of any sort 
from you as I would be catering for all expenses.

I look forward to hearing from you.

Sincerely,

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