[PATCH v3] staging: unisys: Add s-Par visorhba

2015-08-25 Thread Benjamin Romer
From: David Kershner 

This driver create a host bus adapter device when s-Par sends a
device create message to create a storage adapter on the visorbus.
When the message is received by visorbus, the visorhba_probe function
is called and the hba device is created and managed by the visorhba
driver.

Signed-off-by: Erik Arfvidson 
Signed-off-by: Benjamin Romer 
Signed-off-by: David Kershner 

---

v2:
* address comments from Greg, Jes, Dan, and David Milburn

v3:
* address additional issues from Red Hat
---
 drivers/staging/unisys/Kconfig  |1 +
 drivers/staging/unisys/Makefile |1 +
 drivers/staging/unisys/include/iochannel.h  |   26 +-
 drivers/staging/unisys/visorhba/Kconfig |   14 +
 drivers/staging/unisys/visorhba/Makefile|   10 +
 drivers/staging/unisys/visorhba/visorhba_main.c | 1247 +++
 6 files changed, 1286 insertions(+), 13 deletions(-)
 create mode 100644 drivers/staging/unisys/visorhba/Kconfig
 create mode 100644 drivers/staging/unisys/visorhba/Makefile
 create mode 100644 drivers/staging/unisys/visorhba/visorhba_main.c

diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig
index 624abe6..d9172e1 100644
--- a/drivers/staging/unisys/Kconfig
+++ b/drivers/staging/unisys/Kconfig
@@ -13,5 +13,6 @@ if UNISYSSPAR
 
 source "drivers/staging/unisys/visorbus/Kconfig"
 source "drivers/staging/unisys/visornic/Kconfig"
+source "drivers/staging/unisys/visorhba/Kconfig"
 
 endif # UNISYSSPAR
diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile
index a515ebc..ed38807 100644
--- a/drivers/staging/unisys/Makefile
+++ b/drivers/staging/unisys/Makefile
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_UNISYS_VISORBUS)  += visorbus/
 obj-$(CONFIG_UNISYS_VISORNIC)  += visornic/
+obj-$(CONFIG_UNISYS_VISORHBA)  += visorhba/
diff --git a/drivers/staging/unisys/include/iochannel.h 
b/drivers/staging/unisys/include/iochannel.h
index a559812..14e656f 100644
--- a/drivers/staging/unisys/include/iochannel.h
+++ b/drivers/staging/unisys/include/iochannel.h
@@ -147,6 +147,10 @@ struct phys_info {
u16 pi_len;
 } __packed;
 
+#define MIN_NUMSIGNALS 64
+
+/* structs with pragma pack  */
+
 struct guest_phys_info {
u64 address;
u64 length;
@@ -183,7 +187,7 @@ struct vhba_config_max {/* 20 bytes */
 } __packed;
 
 struct uiscmdrsp_scsi {
-   void *scsicmd;  /* the handle to the cmd that was received -
+   u64 handle; /* the handle to the cmd that was received -
 * send it back as is in the rsp packet.  */
u8 cmnd[MAX_CMND_SIZE]; /* the cdb for the command */
u32 bufflen;/* length of data to be transferred out or in */
@@ -437,24 +441,22 @@ struct uiscmdrsp_scsitaskmgmt {
struct uisscsi_dest vdest;
 
/* the vdisk for which this task mgmt is generated */
-   void *scsicmd;
+   u64 handle;
 
-   /* This is some handle that the guest has saved off for its own use.
+   /* This is a handle that the guest has saved off for its own use.
 * Its value is preserved by iopart & returned as is in the task
 * mgmt rsp.
 */
-   void *notify;
+   u64 notify_handle;
 
   /* For linux guests, this is a pointer to wait_queue_head that a
* thread is waiting on to see if the taskmgmt command has completed.
-   * For windows guests, this is a pointer to a location that a waiting
-   * thread is testing to see if the taskmgmt command has completed.
* When the rsp is received by guest, the thread receiving the
* response uses this to notify the thread waiting for taskmgmt
* command completion.  Its value is preserved by iopart & returned
* as is in the task mgmt rsp.
*/
-   void *notifyresult;
+   u64 notifyresult_handle;
 
/* this is a handle to location in guest where the result of the
 * taskmgmt command (result field) is to saved off when the response
@@ -486,24 +488,22 @@ struct uiscmdrsp_vdiskmgmt {
struct uisscsi_dest vdest;
 
/* the vdisk for which this task mgmt is generated */
-   void *scsicmd;
+   u64 handle;
 
-   /* This is some handle that the guest has saved off for its own use.
+   /* This is a handle that the guest has saved off for its own use.
 * Its value is preserved by iopart & returned as is in the task
 * mgmt rsp.
 */
-   void *notify;
+   u64 notify_handle;
 
/* For linux guests, this is a pointer to wait_queue_head that a
 * thread is waiting on to see if the tskmgmt command has completed.
-* For win32 guests, this is a pointer to a location that a waiting
-* thread is testing to see if the taskmgmt command has completed.
 

[PATCH 8/8] fix staging:android style issue:Please don't use multiple blank lines

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/timed_gpio.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 5c55463..33acbbe 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -25,7 +25,6 @@
 #include "timed_output.h"
 #include "timed_gpio.h"
 
-
 struct timed_gpio_data {
struct timed_output_dev dev;
struct hrtimer timer;
-- 
1.9.1

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


[PATCH 7/8] fix staging:android style issue:definition without comment

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/sync.h   | 2 +-
 drivers/staging/android/timed_gpio.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 18a94ed..bb42923 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -94,11 +94,11 @@ struct sync_timeline {
const struct sync_timeline_ops  *ops;
charname[32];
 
-   /* protected by child_list_lock */
booldestroyed;
int context, value;
 
struct list_headchild_list_head;
+   /* protect field destroyed */
spinlock_t  child_list_lock;
 
struct list_headactive_list_head;
diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index 5407257..5c55463 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -29,7 +29,7 @@
 struct timed_gpio_data {
struct timed_output_dev dev;
struct hrtimer timer;
-   spinlock_t lock;
+   spinlock_t lock; /* protect structure fields */
unsigned gpio;
int max_timeout;
u8 active_low;
-- 
1.9.1

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


[PATCH 4/8] fix staging:android style issue:Prefer kernel type 'u32' over 'uint32_t'

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/lowmemorykiller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 61937ab..78e1281 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -42,7 +42,7 @@
 #include 
 #include 
 
-static uint32_t lowmem_debug_level = 1;
+static u32 lowmem_debug_level = 1;
 static short lowmem_adj[6] = {
0,
1,
-- 
1.9.1

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


[PATCH 6/8] fix staging:android style issue:Comparison to NULL could be written

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/sw_sync.c |  6 +++---
 drivers/staging/android/sync.c| 18 +-
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/android/sw_sync.c 
b/drivers/staging/android/sw_sync.c
index c90838d..29b5c35 100644
--- a/drivers/staging/android/sw_sync.c
+++ b/drivers/staging/android/sw_sync.c
@@ -145,7 +145,7 @@ static int sw_sync_open(struct inode *inode, struct file 
*file)
get_task_comm(task_comm, current);
 
obj = sw_sync_timeline_create(task_comm);
-   if (obj == NULL)
+   if (!obj)
return -ENOMEM;
 
file->private_data = obj;
@@ -179,14 +179,14 @@ static long sw_sync_ioctl_create_fence(struct 
sw_sync_timeline *obj,
}
 
pt = sw_sync_pt_create(obj, data.value);
-   if (pt == NULL) {
+   if (!pt) {
err = -ENOMEM;
goto err;
}
 
data.name[sizeof(data.name) - 1] = '\0';
fence = sync_fence_create(data.name, pt);
-   if (fence == NULL) {
+   if (!fence) {
sync_pt_free(pt);
err = -ENOMEM;
goto err;
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 9a67d23..e0c1acb 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -43,7 +43,7 @@ struct sync_timeline *sync_timeline_create(const struct 
sync_timeline_ops *ops,
return NULL;
 
obj = kzalloc(size, GFP_KERNEL);
-   if (obj == NULL)
+   if (!obj)
return NULL;
 
kref_init(&obj->kref);
@@ -130,7 +130,7 @@ struct sync_pt *sync_pt_create(struct sync_timeline *obj, 
int size)
return NULL;
 
pt = kzalloc(size, GFP_KERNEL);
-   if (pt == NULL)
+   if (!pt)
return NULL;
 
spin_lock_irqsave(&obj->child_list_lock, flags);
@@ -155,7 +155,7 @@ static struct sync_fence *sync_fence_alloc(int size, const 
char *name)
struct sync_fence *fence;
 
fence = kzalloc(size, GFP_KERNEL);
-   if (fence == NULL)
+   if (!fence)
return NULL;
 
fence->file = anon_inode_getfile("sync_fence", &sync_fence_fops,
@@ -193,7 +193,7 @@ struct sync_fence *sync_fence_create(const char *name, 
struct sync_pt *pt)
struct sync_fence *fence;
 
fence = sync_fence_alloc(offsetof(struct sync_fence, cbs[1]), name);
-   if (fence == NULL)
+   if (!fence)
return NULL;
 
fence->num_fences = 1;
@@ -215,7 +215,7 @@ struct sync_fence *sync_fence_fdget(int fd)
 {
struct file *file = fget(fd);
 
-   if (file == NULL)
+   if (!file)
return NULL;
 
if (file->f_op != &sync_fence_fops)
@@ -262,7 +262,7 @@ struct sync_fence *sync_fence_merge(const char *name,
unsigned long size = offsetof(struct sync_fence, cbs[num_fences]);
 
fence = sync_fence_alloc(size, name);
-   if (fence == NULL)
+   if (!fence)
return NULL;
 
atomic_set(&fence->status, num_fences);
@@ -583,14 +583,14 @@ static long sync_fence_ioctl_merge(struct sync_fence 
*fence, unsigned long arg)
}
 
fence2 = sync_fence_fdget(data.fd2);
-   if (fence2 == NULL) {
+   if (!fence2) {
err = -ENOENT;
goto err_put_fd;
}
 
data.name[sizeof(data.name) - 1] = '\0';
fence3 = sync_fence_merge(data.name, fence, fence2);
-   if (fence3 == NULL) {
+   if (!fence3) {
err = -ENOMEM;
goto err_put_fence2;
}
@@ -666,7 +666,7 @@ static long sync_fence_ioctl_fence_info(struct sync_fence 
*fence,
size = 4096;
 
data = kzalloc(size, GFP_KERNEL);
-   if (data == NULL)
+   if (!data)
return -ENOMEM;
 
strlcpy(data->name, fence->name, sizeof(data->name));
-- 
1.9.1

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


[PATCH 1/8] fix staging:android style issue:spaces preferred around that '-'

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/ashmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 60200a3..b340ddc 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -618,7 +618,8 @@ static int ashmem_pin(struct ashmem_area *asma, size_t 
pgstart, size_t pgend)
 
/* Case #3: We overlap from the rear, so adjust it */
if (range->pgend <= pgend) {
-   range_shrink(range, range->pgstart, pgstart-1);
+   range_shrink(range, range->pgstart,
+pgstart - 1);
continue;
}
 
-- 
1.9.1

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


[PATCH 5/8] fix staging:android style issue:Please use a blank line after function/struct/union/enum declarations

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/lowmemorykiller.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 78e1281..3f1311f 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -49,6 +49,7 @@ static short lowmem_adj[6] = {
6,
12,
 };
+
 static int lowmem_adj_size = 4;
 static int lowmem_minfree[6] = {
3 * 512,/* 6MB */
@@ -56,8 +57,8 @@ static int lowmem_minfree[6] = {
4 * 1024,   /* 16MB */
16 * 1024,  /* 64MB */
 };
-static int lowmem_minfree_size = 4;
 
+static int lowmem_minfree_size = 4;
 static unsigned long lowmem_deathpending_timeout;
 
 #define lowmem_print(level, x...)  \
-- 
1.9.1

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


[PATCH 2/8] fix staging:android style issue:No space is necessary after a cast

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/ashmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index b340ddc..1312600 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -716,7 +716,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, 
unsigned long cmd,
if (unlikely((pin.offset | pin.len) & ~PAGE_MASK))
return -EINVAL;
 
-   if (unlikely(((__u32) -1) - pin.offset < pin.len))
+   if (unlikely(((__u32)-1) - pin.offset < pin.len))
return -EINVAL;
 
if (unlikely(PAGE_ALIGN(asma->size) < pin.offset + pin.len))
@@ -760,7 +760,7 @@ static long ashmem_ioctl(struct file *file, unsigned int 
cmd, unsigned long arg)
ret = -EINVAL;
if (!asma->file) {
ret = 0;
-   asma->size = (size_t) arg;
+   asma->size = (size_t)arg;
}
break;
case ASHMEM_GET_SIZE:
-- 
1.9.1

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


[PATCH 0/8] fix drivers/staging/android several coding style issues

2015-08-25 Thread Peng Sun
patches based on linux-next next-20150825
Corrections based on checkpatch.pl with --strict

Peng Sun (8):
  fix staging:android style issue:spaces preferred around that '-'
  fix staging:android style issue:No space is necessary after a cast
  fix staging:android style issue:Alignment should match open
parenthesis
  fix staging:android style issue:Prefer kernel type 'u32' over
'uint32_t'
  fix staging:android style issue:Please use a blank line after
function/struct/union/enum declarations
  fix staging:android style issue:Comparison to NULL could be written
  fix staging:android style issue:definition without comment
  fix staging:android style issue:Please don't use multiple blank lines

 drivers/staging/android/ashmem.c  | 15 ---
 drivers/staging/android/lowmemorykiller.c |  9 +
 drivers/staging/android/sw_sync.c |  6 +++---
 drivers/staging/android/sync.c| 22 +++---
 drivers/staging/android/sync.h|  4 ++--
 drivers/staging/android/timed_gpio.c  | 15 ---
 6 files changed, 37 insertions(+), 34 deletions(-)

--
1.9.1

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


[PATCH 3/8] fix staging:android style issue:Alignment should match open parenthesis

2015-08-25 Thread Peng Sun
Signed-off-by: Peng Sun 
---
 drivers/staging/android/ashmem.c  |  8 
 drivers/staging/android/lowmemorykiller.c |  4 ++--
 drivers/staging/android/sync.c|  4 ++--
 drivers/staging/android/sync.h|  2 +-
 drivers/staging/android/timed_gpio.c  | 12 +++-
 5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
index 1312600..d786ec1 100644
--- a/drivers/staging/android/ashmem.c
+++ b/drivers/staging/android/ashmem.c
@@ -834,16 +834,16 @@ static int __init ashmem_init(void)
int ret;
 
ashmem_area_cachep = kmem_cache_create("ashmem_area_cache",
- sizeof(struct ashmem_area),
- 0, 0, NULL);
+  sizeof(struct ashmem_area),
+  0, 0, NULL);
if (unlikely(!ashmem_area_cachep)) {
pr_err("failed to create slab cache\n");
return -ENOMEM;
}
 
ashmem_range_cachep = kmem_cache_create("ashmem_range_cache",
- sizeof(struct ashmem_range),
- 0, 0, NULL);
+   sizeof(struct ashmem_range),
+   0, 0, NULL);
if (unlikely(!ashmem_range_cachep)) {
pr_err("failed to create slab cache\n");
return -ENOMEM;
diff --git a/drivers/staging/android/lowmemorykiller.c 
b/drivers/staging/android/lowmemorykiller.c
index 872bd60..61937ab 100644
--- a/drivers/staging/android/lowmemorykiller.c
+++ b/drivers/staging/android/lowmemorykiller.c
@@ -104,8 +104,8 @@ static unsigned long lowmem_scan(struct shrinker *s, struct 
shrink_control *sc)
}
 
lowmem_print(3, "lowmem_scan %lu, %x, ofree %d %d, ma %hd\n",
-   sc->nr_to_scan, sc->gfp_mask, other_free,
-   other_file, min_score_adj);
+sc->nr_to_scan, sc->gfp_mask, other_free,
+other_file, min_score_adj);
 
if (min_score_adj == OOM_SCORE_ADJ_MAX + 1) {
lowmem_print(5, "lowmem_scan %lu, %x, return 0\n",
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f83e00c..9a67d23 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -313,7 +313,7 @@ struct sync_fence *sync_fence_merge(const char *name,
 EXPORT_SYMBOL(sync_fence_merge);
 
 int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode,
-int wake_flags, void *key)
+ int wake_flags, void *key)
 {
struct sync_fence_waiter *wait;
 
@@ -353,7 +353,7 @@ int sync_fence_wait_async(struct sync_fence *fence,
 EXPORT_SYMBOL(sync_fence_wait_async);
 
 int sync_fence_cancel_async(struct sync_fence *fence,
-struct sync_fence_waiter *waiter)
+   struct sync_fence_waiter *waiter)
 {
unsigned long flags;
int ret = 0;
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 61f8a3a..18a94ed 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -351,6 +351,6 @@ void sync_dump(void);
 # define sync_dump()
 #endif
 int sync_fence_wake_up_wq(wait_queue_t *curr, unsigned mode,
-int wake_flags, void *key);
+ int wake_flags, void *key);
 
 #endif /* _LINUX_SYNC_H */
diff --git a/drivers/staging/android/timed_gpio.c 
b/drivers/staging/android/timed_gpio.c
index ce11726..5407257 100644
--- a/drivers/staging/android/timed_gpio.c
+++ b/drivers/staging/android/timed_gpio.c
@@ -76,8 +76,9 @@ static void gpio_enable(struct timed_output_dev *dev, int 
value)
value = data->max_timeout;
 
hrtimer_start(&data->timer,
-   ktime_set(value / 1000, (value % 1000) * 100),
-   HRTIMER_MODE_REL);
+ ktime_set(value / 1000, (value % 1000) *
+   100),
+ HRTIMER_MODE_REL);
}
 
spin_unlock_irqrestore(&data->lock, flags);
@@ -94,8 +95,9 @@ static int timed_gpio_probe(struct platform_device *pdev)
return -EBUSY;
 
gpio_data = devm_kzalloc(&pdev->dev,
-   sizeof(struct timed_gpio_data) * pdata->num_gpios,
-   GFP_KERNEL);
+sizeof(struct timed_gpio_data) *
+pdata->num_gpios,
+GFP_KERNEL);
if (!gpio_data)
return -ENOMEM;
 
@@ -104,7 +106,7 @@ static int timed_gpio_probe(struct platform_device *pdev)
gpio_dat = &gpio_data[i];
 
  

Re: [PATCH 1/2] staging: fbtft: fix 9-bit SPI support detection

2015-08-25 Thread Noralf Trønnes


Den 25.08.2015 23:04, skrev Stefan Wahren:

Since the result of the setup function isn't adequate to check
9-bit SPI support, we better check bits_per_word_mask. Btw this
change avoids a NULL pointer dereference with master drivers
without a separate setup function.

Signed-off-by: Stefan Wahren 
---
  drivers/staging/fbtft/fbtft-core.c |   10 +++---
  drivers/staging/fbtft/flexfb.c |   11 ---
  2 files changed, 7 insertions(+), 14 deletions(-)


Thanks Stefan.

Both patches:
Acked-by: Noralf Trønnes 

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


[PATCH v3] staging: unisys: add visorhid driver

2015-08-25 Thread Benjamin Romer
From: Erik Arfvidson 

This driver provides mouse and keyboard input to Unisys s-Par
Partition Desktop application. This device is created by the
visorbus device.

Signed-off-by: Erik Arfvidson 
Signed-off-by: Benjamin Romer 
Signed-off-by: Tim Sell 

---

v2:
* address visorhid issues indicated by Greg KH on 7/14/2015
* address visorhid issues indicated by Jes Sorensen on 7/16/2015
* address visorhid issues indicated by Don Zickus on 7/17/2015

V3:
* address additional fixes from Red Hat
---
 drivers/staging/unisys/Kconfig |   1 +
 drivers/staging/unisys/Makefile|   1 +
 drivers/staging/unisys/visorhid/Kconfig|  10 +
 drivers/staging/unisys/visorhid/Makefile   |   7 +
 drivers/staging/unisys/visorhid/keyboardchannel.h  |  32 +
 drivers/staging/unisys/visorhid/mousechannel.h |  33 +
 drivers/staging/unisys/visorhid/ultrainputreport.h |  74 +++
 drivers/staging/unisys/visorhid/visorhid.c | 668 +
 8 files changed, 826 insertions(+)
 create mode 100644 drivers/staging/unisys/visorhid/Kconfig
 create mode 100644 drivers/staging/unisys/visorhid/Makefile
 create mode 100644 drivers/staging/unisys/visorhid/keyboardchannel.h
 create mode 100644 drivers/staging/unisys/visorhid/mousechannel.h
 create mode 100644 drivers/staging/unisys/visorhid/ultrainputreport.h
 create mode 100644 drivers/staging/unisys/visorhid/visorhid.c

diff --git a/drivers/staging/unisys/Kconfig b/drivers/staging/unisys/Kconfig
index 624abe6..ca850a8 100644
--- a/drivers/staging/unisys/Kconfig
+++ b/drivers/staging/unisys/Kconfig
@@ -13,5 +13,6 @@ if UNISYSSPAR
 
 source "drivers/staging/unisys/visorbus/Kconfig"
 source "drivers/staging/unisys/visornic/Kconfig"
+source "drivers/staging/unisys/visorhid/Kconfig"
 
 endif # UNISYSSPAR
diff --git a/drivers/staging/unisys/Makefile b/drivers/staging/unisys/Makefile
index a515ebc..d071094 100644
--- a/drivers/staging/unisys/Makefile
+++ b/drivers/staging/unisys/Makefile
@@ -3,3 +3,4 @@
 #
 obj-$(CONFIG_UNISYS_VISORBUS)  += visorbus/
 obj-$(CONFIG_UNISYS_VISORNIC)  += visornic/
+obj-$(CONFIG_UNISYS_VISORHID)  += visorhid/
diff --git a/drivers/staging/unisys/visorhid/Kconfig 
b/drivers/staging/unisys/visorhid/Kconfig
new file mode 100644
index 000..3b83e2c
--- /dev/null
+++ b/drivers/staging/unisys/visorhid/Kconfig
@@ -0,0 +1,10 @@
+#
+# Unisys visorhid configuration
+#
+
+config UNISYS_VISORHID
+   tristate "Unisys visorhid driver"
+   depends on UNISYSSPAR && UNISYS_VISORBUS && FB
+   ---help---
+   If you say Y here, you will enable the Unisys visorhid driver.
+
diff --git a/drivers/staging/unisys/visorhid/Makefile 
b/drivers/staging/unisys/visorhid/Makefile
new file mode 100644
index 000..e457bd1
--- /dev/null
+++ b/drivers/staging/unisys/visorhid/Makefile
@@ -0,0 +1,7 @@
+#
+# Makefile for Unisys visorhid
+#
+
+obj-$(CONFIG_UNISYS_VISORHID)  += visorhid.o
+
+ccflags-y += -Idrivers/staging/unisys/include
diff --git a/drivers/staging/unisys/visorhid/keyboardchannel.h 
b/drivers/staging/unisys/visorhid/keyboardchannel.h
new file mode 100644
index 000..2ed2602
--- /dev/null
+++ b/drivers/staging/unisys/visorhid/keyboardchannel.h
@@ -0,0 +1,32 @@
+/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * 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, GOOD TITLE or
+ * NON INFRINGEMENT.  See the GNU General Public License for more
+ * details.
+ */
+
+#ifndef __SPAR_KEYBOARDCHANNEL_H__
+#define __SPAR_KEYBOARDCHANNEL_H__
+
+#include 
+#include 
+
+#include "channel.h"
+#include "ultrainputreport.h"
+
+/* {c73416d0-b0b8-44af-b304-9d2ae99f1b3d} */
+#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID\
+   UUID_LE(0xc73416d0, 0xb0b8, 0x44af, \
+   0xb3, 0x4, 0x9d, 0x2a, 0xe9, 0x9f, 0x1b, 0x3d)
+#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_UUID_STR 
"c73416d0-b0b8-44af-b304-9d2ae99f1b3d"
+#define SPAR_KEYBOARD_CHANNEL_PROTOCOL_VERSIONID 1
+#define KEYBOARD_MAXINPUTREPORTS 50
+
+#endif
diff --git a/drivers/staging/unisys/visorhid/mousechannel.h 
b/drivers/staging/unisys/visorhid/mousechannel.h
new file mode 100644
index 000..256477a
--- /dev/null
+++ b/drivers/staging/unisys/visorhid/mousechannel.h
@@ -0,0 +1,33 @@
+/* Copyright (C) 2010 - 2015 UNISYS CORPORATION
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the ho

[PATCH 2/2] staging: fbtft: replace master->setup() with spi_setup()

2015-08-25 Thread Stefan Wahren
Calling the setup of the SPI master directly causes a NULL pointer
dereference with master drivers without a separate setup function.
This problem is reproduceable on ARM MXS platform.

So fix this issue by using spi_setup() instead.

Signed-off-by: Stefan Wahren 
---
 drivers/staging/fbtft/fb_uc1611.c|2 +-
 drivers/staging/fbtft/fb_watterott.c |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/fbtft/fb_uc1611.c 
b/drivers/staging/fbtft/fb_uc1611.c
index 32f3a9d..5cafa50 100644
--- a/drivers/staging/fbtft/fb_uc1611.c
+++ b/drivers/staging/fbtft/fb_uc1611.c
@@ -76,7 +76,7 @@ static int init_display(struct fbtft_par *par)
 
/* Set CS active high */
par->spi->mode |= SPI_CS_HIGH;
-   ret = par->spi->master->setup(par->spi);
+   ret = spi_setup(par->spi);
if (ret) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret;
diff --git a/drivers/staging/fbtft/fb_watterott.c 
b/drivers/staging/fbtft/fb_watterott.c
index 88fb2c0..8eae6ef 100644
--- a/drivers/staging/fbtft/fb_watterott.c
+++ b/drivers/staging/fbtft/fb_watterott.c
@@ -169,7 +169,7 @@ static int init_display(struct fbtft_par *par)
/* enable SPI interface by having CS and MOSI low during reset */
save_mode = par->spi->mode;
par->spi->mode |= SPI_CS_HIGH;
-   ret = par->spi->master->setup(par->spi); /* set CS inactive low */
+   ret = spi_setup(par->spi); /* set CS inactive low */
if (ret) {
dev_err(par->info->device, "Could not set SPI_CS_HIGH\n");
return ret;
@@ -180,7 +180,7 @@ static int init_display(struct fbtft_par *par)
par->fbtftops.reset(par);
mdelay(1000);
par->spi->mode = save_mode;
-   ret = par->spi->master->setup(par->spi);
+   ret = spi_setup(par->spi);
if (ret) {
dev_err(par->info->device, "Could not restore SPI mode\n");
return ret;
-- 
1.7.9.5

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


[PATCH 1/2] staging: fbtft: fix 9-bit SPI support detection

2015-08-25 Thread Stefan Wahren
Since the result of the setup function isn't adequate to check
9-bit SPI support, we better check bits_per_word_mask. Btw this
change avoids a NULL pointer dereference with master drivers
without a separate setup function.

Signed-off-by: Stefan Wahren 
---
 drivers/staging/fbtft/fbtft-core.c |   10 +++---
 drivers/staging/fbtft/flexfb.c |   11 ---
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/fbtft/fbtft-core.c 
b/drivers/staging/fbtft/fbtft-core.c
index 23392eb..7f5fa3d 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1436,15 +1436,11 @@ int fbtft_probe_common(struct fbtft_display *display,
 
/* 9-bit SPI setup */
if (par->spi && display->buswidth == 9) {
-   par->spi->bits_per_word = 9;
-   ret = par->spi->master->setup(par->spi);
-   if (ret) {
+   if (par->spi->master->bits_per_word_mask & SPI_BPW_MASK(9)) {
+   par->spi->bits_per_word = 9;
+   } else {
dev_warn(&par->spi->dev,
"9-bit SPI not available, emulating using 
8-bit.\n");
-   par->spi->bits_per_word = 8;
-   ret = par->spi->master->setup(par->spi);
-   if (ret)
-   goto out_release;
/* allocate buffer with room for dc bits */
par->extra = devm_kzalloc(par->info->device,
par->txbuf.len + (par->txbuf.len / 8) + 8,
diff --git a/drivers/staging/fbtft/flexfb.c b/drivers/staging/fbtft/flexfb.c
index c763efc..3f380a0 100644
--- a/drivers/staging/fbtft/flexfb.c
+++ b/drivers/staging/fbtft/flexfb.c
@@ -463,15 +463,12 @@ static int flexfb_probe_common(struct spi_device *sdev,
}
par->fbtftops.write_register = fbtft_write_reg8_bus9;
par->fbtftops.write_vmem = fbtft_write_vmem16_bus9;
-   sdev->bits_per_word = 9;
-   ret = sdev->master->setup(sdev);
-   if (ret) {
+   if (par->spi->master->bits_per_word_mask
+   & SPI_BPW_MASK(9)) {
+   par->spi->bits_per_word = 9;
+   } else {
dev_warn(dev,
"9-bit SPI not available, emulating 
using 8-bit.\n");
-   sdev->bits_per_word = 8;
-   ret = sdev->master->setup(sdev);
-   if (ret)
-   goto out_release;
/* allocate buffer with room for dc bits */
par->extra = devm_kzalloc(par->info->device,
par->txbuf.len + 
(par->txbuf.len / 8) + 8,
-- 
1.7.9.5

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


[PATCH 0/2] staging: fbtft: Avoid calling SPI master setup directly

2015-08-25 Thread Stefan Wahren
This patch series fixes issues caused by calling SPI master setup function
directly.

Changes since RFC:
  * use only bits_per_word_mask for 9-bit support detection 
(suggested by Noralf Trønnes)
  * change patch order

Stefan Wahren (2):
  staging: fbtft: fix 9-bit SPI support detection
  staging: fbtft: replace master->setup() with spi_setup()

 drivers/staging/fbtft/fb_uc1611.c|2 +-
 drivers/staging/fbtft/fb_watterott.c |4 ++--
 drivers/staging/fbtft/fbtft-core.c   |   10 +++---
 drivers/staging/fbtft/flexfb.c   |   11 ---
 4 files changed, 10 insertions(+), 17 deletions(-)

-- 
1.7.9.5

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


Re: [PATCH v7 11/44] [media] media: use entity.graph_obj.mdev instead of .parent

2015-08-25 Thread Shuah Khan
On Tue, Aug 25, 2015 at 12:36 AM, Hans Verkuil  wrote:
> On 08/23/2015 10:17 PM, Mauro Carvalho Chehab wrote:
>> From: Javier Martinez Canillas 
>>
>> The struct media_entity has a .parent field that stores a pointer
>> to the parent struct media_device. But recently a media_gobj was
>> embedded into the entities and since struct media_gojb already has
>> a pointer to a struct media_device in the .mdev field, the .parent
>> field becomes redundant and can be removed.
>>
>> This patch replaces all the usage of .parent by .graph_obj.mdev so
>> that field will become unused and can be removed on a later patch.
>>
>> No functional changes.
>>
>> The transformation was made using the following coccinelle spatch:
>>
>> @@
>> struct media_entity *me;
>> @@
>>
>> - me->parent
>> + me->graph_obj.mdev
>>
>> @@
>> struct media_entity *link;
>> @@
>>
>> - link->source->entity->parent
>> + link->source->entity->graph_obj.mdev
>>
>> @@
>> struct exynos_video_entity *ve;
>> @@
>>
>> - ve->vdev.entity.parent
>> + ve->vdev.entity.graph_obj.mdev
>>
>> Suggested-by: Mauro Carvalho Chehab 
>>
>> Signed-off-by: Javier Martinez Canillas 
>> Signed-off-by: Mauro Carvalho Chehab 
>
> Acked-by: Hans Verkuil 

The change looks good to me. I would really like to see a before and after
media graph with these changes, this patch and series in general.

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


[PATCH v3] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-08-25 Thread Salah Triki
poll_tick is declared global, so dgnc_driver_pollrate_store needs to take
the lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock the
appropriate lock, since it is intended for poll scheduling and dgnc_poll_tick
contains the poll rate. dgnc_poll_lock needs to be declared not static and
extern in order to be visible for dgnc_driver_pollrate_store.

Signed-off-by: Salah Triki 
---
 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 drivers/staging/dgnc/dgnc_driver.h | 1 +
 drivers/staging/dgnc/dgnc_sysfs.c  | 9 -
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c 
b/drivers/staging/dgnc/dgnc_driver.c
index 7546aff..f03e8b3 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -64,6 +64,7 @@ static const struct file_operations dgnc_BoardFops = {
 uint   dgnc_NumBoards;
 struct dgnc_board  *dgnc_Board[MAXBOARDS];
 DEFINE_SPINLOCK(dgnc_global_lock);
+DEFINE_SPINLOCK(dgnc_poll_lock);
 uint   dgnc_Major;
 intdgnc_poll_tick = 20;/* Poll interval - 20 ms */
 
@@ -75,7 +76,6 @@ static struct class *dgnc_class;
 /*
  * Poller stuff
  */
-static DEFINE_SPINLOCK(dgnc_poll_lock); /* Poll scheduling lock */
 static ulong   dgnc_poll_time; /* Time of next poll */
 static uintdgnc_poll_stop; /* Used to tell poller to stop */
 static struct timer_list dgnc_poll_timer;
diff --git a/drivers/staging/dgnc/dgnc_driver.h 
b/drivers/staging/dgnc/dgnc_driver.h
index 06ece51..6784d81 100644
--- a/drivers/staging/dgnc/dgnc_driver.h
+++ b/drivers/staging/dgnc/dgnc_driver.h
@@ -389,6 +389,7 @@ struct channel_t {
  */
 extern uintdgnc_Major; /* Our driver/mgmt major */
 extern int dgnc_poll_tick; /* Poll interval - 20 ms */
+extern spinlock_t  dgnc_poll_lock; /* Poll scheduling lock */
 extern spinlock_t  dgnc_global_lock;   /* Driver global spinlock */
 extern uintdgnc_NumBoards; /* Total number of boards */
 extern struct dgnc_board   *dgnc_Board[MAXBOARDS]; /* Array of board 
structs */
diff --git a/drivers/staging/dgnc/dgnc_sysfs.c 
b/drivers/staging/dgnc/dgnc_sysfs.c
index 44db870..48b6056 100644
--- a/drivers/staging/dgnc/dgnc_sysfs.c
+++ b/drivers/staging/dgnc/dgnc_sysfs.c
@@ -56,11 +56,18 @@ static ssize_t dgnc_driver_pollrate_show(struct 
device_driver *ddp, char *buf)
 static ssize_t dgnc_driver_pollrate_store(struct device_driver *ddp,
  const char *buf, size_t count)
 {
+   unsigned long flags;
+   int tick;
int ret;
 
-   ret = sscanf(buf, "%d\n", &dgnc_poll_tick);
+   ret = sscanf(buf, "%d\n", &tick);
if (ret != 1)
return -EINVAL;
+
+   spin_lock_irqsave(&dgnc_poll_lock, flags);
+   dgnc_poll_tick = tick;
+   spin_unlock_irqrestore(&dgnc_poll_lock, flags);
+
return count;
 }
 static DRIVER_ATTR(pollrate, (S_IRUSR | S_IWUSR), dgnc_driver_pollrate_show,
-- 
1.9.1

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


Re: [PATCH v7 10/44] [media] media: rename the function that create pad links

2015-08-25 Thread Shuah Khan
On 08/23/2015 02:17 PM, Mauro Carvalho Chehab wrote:
> Now that a link can be either between two different graph
> objects, we'll need to add more functions to create links.

Is this an incomplete sentence. Should it read: "either between
two different graph objects or two pads" ?

> So, rename the existing one that create links only between
> two pads as media_create_pad_link().

> 
> No functional changes.
> 
> This patch was created via this shell script:
>   for i in $(find drivers/media -name '*.[ch]' -type f) $(find 
> drivers/staging/media -name '*.[ch]' -type f) $(find include/ -name '*.h' 
> -type f) ; do sed s,media_entity_create_link,media_create_pad_link,g <$i >a 
> && mv a $i; done
> 

Didn't want to experiment with Coccinelle?? :)

> Signed-off-by: Mauro Carvalho Chehab 
> Acked-by: Hans Verkuil 
> Signed-off-by: Mauro Carvalho Chehab 
> 

Changes look good to me. After fixing the commit log:

Acked-by: Shuah Khan 

thanks,
-- Shuah


-- 
Shuah Khan
Sr. Linux Kernel Developer
Open Source Innovation Group
Samsung Research America (Silicon Valley)
shua...@osg.samsung.com | (970) 217-8978
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH V2] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-08-25 Thread Salah Triki
On Tue, Aug 25, 2015 at 08:44:39AM +0100, Salah Triki wrote:
> On Mon, Aug 24, 2015 at 06:16:21PM +0530, Sudip Mukherjee wrote:
> > On Wed, Aug 19, 2015 at 07:11:55PM +0100, Salah Triki wrote:
> > > poll_tick is declared global, so dgnc_driver_pollrate_store needs to take
> > > the lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock is
> > > the appropriate lock, since it is intended for poll scheduling and
> > > dgnc_poll_tick contains the poll rate. dgnc_poll_lock needs to be declared
> > > not static and extern in order to be visible for 
> > > dgnc_driver_pollrate_store.
> > > 
> > > Signed-off-by: Salah Triki 
> > > ---
> > 
> > > +
> > > + spin_lock_irqsave(&dgnc_poll_lock, flags);
> > > + dgnc_poll_tick = tick;
> > > + spin_unlock_irqstore(&dgnc_poll_lock, flags);
> > Have you build tested it?
> > 
> > regards
> > sudip
> 
> no
> 
> regards
> --
> salah triki

The patch failed to build. I will send the new version soon.

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


RE: [PATCH] staging: fsl-mc: Upgraded MC flibs used in MC bus driver

2015-08-25 Thread Jose Rivera
> -Original Message-
> From: Dan Carpenter [mailto:dan.carpen...@oracle.com]
> Sent: Thursday, August 20, 2015 2:35 AM
> To: Rivera Jose-B46482
> Cc: gre...@linuxfoundation.org; a...@arndb.de;
> de...@driverdev.osuosl.org; linux-ker...@vger.kernel.org; Yoder Stuart-
> B08248; katz Itai-RM05202; Wood Scott-B07421; ag...@suse.de; Hamciuc
> Bogdan-BHAMCIU1; Marginean Alexandru-R89243; Sharma Bhupesh-B45370; Erez
> Nir-RM30794; Schmitt Richard-B43082
> Subject: Re: [PATCH] staging: fsl-mc: Upgraded MC flibs used in MC bus
> driver
> 
> On Wed, Aug 19, 2015 at 11:52:40AM -0500, J. German Rivera wrote:
> > Since signatures of flib functions have changed, we had to change all
> > the corresponding calls in the MC bus driver
> >
> 
> What does upgrade mean here?  I feel like this is the kind of patch we
> reject without reading the patch because the description is too vague and
> you can tell from the diff stats that it is going to be too huge to
> review.
We will do some refactoring to make this easier to review.

Thanks,

german
> 
> I looked at the first few lines and we are making a ball of changes.
> Copyright notices, adding function parameters, renaming functions.  This
> needs to be explained a lot better and probably split into multiple
> patches.
> 
> Btw, the trees are closed for the next 3-4 weeks until after 4.3-rc2 is
> released.
> 
> regards,
> dan carpenter

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


Re: [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection

2015-08-25 Thread Noralf Trønnes


Den 25.08.2015 19:34, skrev Stefan Wahren:

Noralf Trønnes  hat am 25. August 2015 um 00:00
geschrieben:



Den 24.08.2015 20:33, skrev Stefan Wahren:

Since bits_per_word isn't usually checked during SPI setup the 9-bit
support must be checked manually.

Signed-off-by: Stefan Wahren 
---
drivers/staging/fbtft/fbtft-core.c | 7 +++
drivers/staging/fbtft/flexfb.c | 7 +++
2 files changed, 14 insertions(+)

diff --git a/drivers/staging/fbtft/fbtft-core.c
b/drivers/staging/fbtft/fbtft-core.c
index 3638554..bd71487 100644
--- a/drivers/staging/fbtft/fbtft-core.c
+++ b/drivers/staging/fbtft/fbtft-core.c
@@ -1438,6 +1438,13 @@ int fbtft_probe_common(struct fbtft_display *display,
if (par->spi && display->buswidth == 9) {
par->spi->bits_per_word = 9;
ret = spi_setup(par->spi);
+ if (!ret) {
+ struct spi_master *ma = par->spi->master;
+
+ if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
+ ret = -EINVAL;
+ }
+
if (ret) {

There's no point in calling spi_setup() when it doesn't check bits_per_word.

If checking of bits_per_word is the only intention of the setup call, then i
agree.
But i'm not sure it is safe to remove the setup call complete.

Couldn't this cause regressions since there is no common spi setup call for all
drivers?


spi_add_device() calls spi_setup() for all spi devices so it's already done.
If spi_setup() did something with bits_per_word, then I agree that we should
call it in the 9-bit case. But this is not the case, and it's possible to
change bits_per_word per transfer later, so I can't see that this is needed.


Apparently this changed with the commit:
spi: convert drivers to use bits_per_word_mask.
This has not been detected earlier, because FBTFT was previously mostly
used on the Raspberry Pi which had a downstream SPI driver that did this
check.

How about this:

- par->spi->bits_per_word = 9;
- ret = par->spi->master->setup(par->spi);
+ if (par->spi->master->bits_per_word_mask &
SPI_BPW_MASK(9)) {
+ par->spi->bits_per_word = 9;
- if (ret) {
+ } else {
dev_warn(&par->spi->dev,
"9-bit SPI not available, emulating
using 8-bit.\n");
- par->spi->bits_per_word = 8;

I think this assignment should stay.


Not needed since we haven't changed the default set by spi_setup():
if (!spi->bits_per_word)
spi->bits_per_word = 8;

Callchain for DT registered spi devices:
spi_register_master->of_register_spi_devices->of_register_spi_device->
spi_add_device->spi_setup

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


Re: [PATCH RFC 2/2] staging: fbtft: fix 9-bit SPI support detection

2015-08-25 Thread Stefan Wahren

> Noralf Trønnes  hat am 25. August 2015 um 00:00
> geschrieben:
>
>
>
> Den 24.08.2015 20:33, skrev Stefan Wahren:
> > Since bits_per_word isn't usually checked during SPI setup the 9-bit
> > support must be checked manually.
> >
> > Signed-off-by: Stefan Wahren 
> > ---
> > drivers/staging/fbtft/fbtft-core.c | 7 +++
> > drivers/staging/fbtft/flexfb.c | 7 +++
> > 2 files changed, 14 insertions(+)
> >
> > diff --git a/drivers/staging/fbtft/fbtft-core.c
> > b/drivers/staging/fbtft/fbtft-core.c
> > index 3638554..bd71487 100644
> > --- a/drivers/staging/fbtft/fbtft-core.c
> > +++ b/drivers/staging/fbtft/fbtft-core.c
> > @@ -1438,6 +1438,13 @@ int fbtft_probe_common(struct fbtft_display *display,
> > if (par->spi && display->buswidth == 9) {
> > par->spi->bits_per_word = 9;
> > ret = spi_setup(par->spi);
> > + if (!ret) {
> > + struct spi_master *ma = par->spi->master;
> > +
> > + if (!(ma->bits_per_word_mask & SPI_BPW_MASK(9)))
> > + ret = -EINVAL;
> > + }
> > +
> > if (ret) {
>
> There's no point in calling spi_setup() when it doesn't check bits_per_word.

If checking of bits_per_word is the only intention of the setup call, then i
agree.
But i'm not sure it is safe to remove the setup call complete.

Couldn't this cause regressions since there is no common spi setup call for all
drivers?

> Apparently this changed with the commit:
> spi: convert drivers to use bits_per_word_mask.
> This has not been detected earlier, because FBTFT was previously mostly
> used on the Raspberry Pi which had a downstream SPI driver that did this
> check.
>
> How about this:
>
> - par->spi->bits_per_word = 9;
> - ret = par->spi->master->setup(par->spi);
> + if (par->spi->master->bits_per_word_mask &
> SPI_BPW_MASK(9)) {
> + par->spi->bits_per_word = 9;
> - if (ret) {
> + } else {
> dev_warn(&par->spi->dev,
> "9-bit SPI not available, emulating
> using 8-bit.\n");
> - par->spi->bits_per_word = 8;

I think this assignment should stay.

> - ret = par->spi->master->setup(par->spi);
> - if (ret)
> - goto out_release;
> /* allocate buffer with room for dc bits */
> par->extra = devm_kzalloc(par->info->device,
>
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/6] fix drivers/staging/android several coding issues

2015-08-25 Thread Joe Perches
On Tue, 2015-08-25 at 14:53 +0800, Peng Sun wrote:
> patches based on linux-next next-20150824
> Corrections based on checkpatch.pl with --strict
> 
> Peng Sun (6):
>   fix android/ashmem.c several coding style issues
>   fix android/lowmemorykiller.c several coding style issues
>   fix android/sw_sync.c several coding style issues
>   fix android/sync.c several coding style issues
>   fix android/sync.h several coding style issues
>   fix android/timed_gpio.c several coding style issues

Most here would rather you submit multiple
patches by fix type rather than sending
patches with multiple fix types per file.


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


Re: [PATCH 7/8] staging: unisys: stop device registration before visorbus registration

2015-08-25 Thread Jes Sorensen
Sudip Mukherjee  writes:
> On Tue, Aug 18, 2015 at 03:14:02PM -0400, Benjamin Romer wrote:
>> In cases where visorbus is compiled directly into the kernel, if
>> visorbus registration fails for any reason, it is still possible for
>> other drivers to call visorbus_register_visor_driver(), which could
>> cause an oops. Prevent this by returning an error code when the bus
>> hasn't been registered.
>> 
>> Signed-off-by: Benjamin Romer 
>> ---
>>  drivers/staging/unisys/visorbus/visorbus_main.c | 3 +++
>>  1 file changed, 3 insertions(+)
>> 
>> diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
>> b/drivers/staging/unisys/visorbus/visorbus_main.c
>> index 7905ea9..ad2b1ac 100644
>> --- a/drivers/staging/unisys/visorbus/visorbus_main.c
>> +++ b/drivers/staging/unisys/visorbus/visorbus_main.c
>> @@ -863,6 +863,9 @@ int visorbus_register_visor_driver(struct visor_driver 
>> *drv)
>>  {
>>  int rc = 0;
>>  
>> +if (!visorbus_type.p)
>> +return -ENODEV; /*can't register on a nonexistent bus*/
>> +
> IIRC, Greg once told that we should not be working with the internal
> data structures of struct bus_type.

If you looked at the code you would have noticed this is in fact the bus
driver, and visorbus_type is defined in this file. I guess we could tell
visorbus_main.c to not touch visorbus_type by deleting the file
completely .
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH v3 00/13] staging: comedi: usbduxfast: tidy up

2015-08-25 Thread Ian Abbott

On 24/08/15 18:13, H Hartley Sweeten wrote:

Fix a couple minor checkpatch.pl issues.

Tidy up the ai (*do_cmdtest) and (*do_cmd) a bit.

v3: modify patch 10
 According to the driver author, Bernd Porr, the hardware can produce
 an anaog input value of 0x1000. The analog inputs are 12-bits (0x0fff)
 and the extra bit indicates an overflow from the ADC.

v2: Address some issues pointed out by Ian Abbott and add a couple
 more patches to remove some cruft.

 1) Move the test in patch 6 to Step 3 as requested by Ian Abbott.
 2) Add new patch 7 to simplify the TRIG_EXT trigger.
 3) Merge old patches 7 and 8 into new patch 8. Cleanup the timing
validation.
 4) Add new patches 10-13.

H Hartley Sweeten (13):
   staging: comedi: usbduxfast: chanlist check is Step 5 of (*do_cmdtest)
   staging: comedi: usbduxfast: only chanlist of 1,2,3, or 16 are supported
   staging: comedi: usbduxfast: remove impossible 'if (!devpriv)' checks
   staging: comedi: usbduxfast: use preferred kernel types
   staging: comedi: usbduxfast: fix multi-line comment
   staging: comedi: usbduxfast: TRIG_EXT only works for 1 or 16 channels
   staging: comedi: usbduxfast: TRIG_EXT is only valid for cmd->start_src
   staging: comedi: usbduxfast: tidy up the conversion timing validation
   staging: comedi: usbduxfast: use a common exit path in ai (*do_cmd)
   staging: comedi: usbduxfast: document strange ai maxdata
   staging: comedi: usbduxfast: remove unnecessary semaphore down/up
   staging: comedi: usbduxfast: absorb usbduxfast_attach_common()
   staging: comedi: usbduxfast: remove unnecessary clearing of private data

  drivers/staging/comedi/drivers/usbduxfast.c | 274 +++-
  1 file changed, 104 insertions(+), 170 deletions(-)


Looks good.  Note that this driver will also require some le16_to_cpu() 
conversions on the data read from the USB transfer buffer in 
usbduxfast_ai_handle_urb() and usbduxfast_ai_insn_read().


Reviewed-by: Ian Abbott 

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


Re: [PATCH V2] staging: dgnc: take lock when storing value in dgnc_poll_tick

2015-08-25 Thread Salah Triki
On Mon, Aug 24, 2015 at 06:16:21PM +0530, Sudip Mukherjee wrote:
> On Wed, Aug 19, 2015 at 07:11:55PM +0100, Salah Triki wrote:
> > poll_tick is declared global, so dgnc_driver_pollrate_store needs to take
> > the lock dgnc_poll_lock before modifying this variable. dgnc_poll_lock is
> > the appropriate lock, since it is intended for poll scheduling and
> > dgnc_poll_tick contains the poll rate. dgnc_poll_lock needs to be declared
> > not static and extern in order to be visible for dgnc_driver_pollrate_store.
> > 
> > Signed-off-by: Salah Triki 
> > ---
> 
> > +
> > +   spin_lock_irqsave(&dgnc_poll_lock, flags);
> > +   dgnc_poll_tick = tick;
> > +   spin_unlock_irqstore(&dgnc_poll_lock, flags);
> Have you build tested it?
> 
> regards
> sudip

no

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