[PATCH] staging/lustre/obdclass: add missing header dependencies

2016-09-08 Thread Baoyou Xie
We get 1 warning when building kernel with W=1:
drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:157:5: warning: no 
previous prototype for 'obd_sysctl_init' [-Wmissing-prototypes]

In fact, this function is declared in ../../include/obd_class.h,
so this patch add missing header dependencies.

Signed-off-by: Baoyou Xie 
---
 drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
index 8f70dd2..2daa834 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
@@ -45,6 +45,7 @@
 
 #include "../../include/obd_support.h"
 #include "../../include/lprocfs_status.h"
+#include "../../include/obd_class.h"
 
 struct static_lustre_uintvalue_attr {
struct {
-- 
2.7.4

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


[PATCH] staging/lustre/lov: add missing header dependencies

2016-09-08 Thread Baoyou Xie
We get 1 warning when building kernel with W=1:
drivers/staging/lustre/lustre/lov/lov_object.c:956:23: warning: no previous 
prototype for 'lov_lsm_get' [-Wmissing-prototypes]
drivers/staging/lustre/lustre/lov/lov_object.c:972:6: warning: no previous 
prototype for 'lov_lsm_put' [-Wmissing-prototypes]
drivers/staging/lustre/lustre/lov/lov_object.c:979:5: warning: no previous 
prototype for 'lov_read_and_clear_async_rc' [-Wmissing-prototypes]

In fact, these functions are declared in ../llite/vvp_internal.h,
so this patch add missing header dependencies.

Signed-off-by: Baoyou Xie 
---
 drivers/staging/lustre/lustre/lov/lov_object.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c 
b/drivers/staging/lustre/lustre/lov/lov_object.c
index f9621b0..912c416 100644
--- a/drivers/staging/lustre/lustre/lov/lov_object.c
+++ b/drivers/staging/lustre/lustre/lov/lov_object.c
@@ -38,6 +38,7 @@
 #define DEBUG_SUBSYSTEM S_LOV
 
 #include "lov_cl_internal.h"
+#include "../llite/vvp_internal.h"
 
 /** \addtogroup lov
  *  @{
-- 
2.7.4

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


[PATCH 0/3] Drivers: hv: util: Support the latest time synch protocol from the host

2016-09-08 Thread kys
From: K. Y. Srinivasan 

WS2016 has introduced a new protocol for conditioning guest clock.
Support this new protocol.

Alex Ng (3):
  Drivers: hv: utils: Rename version definitions to reflect protocol
version.
  Drivers: hv: utils: Use TimeSync samples to adjust the clock after
boot.
  Drivers: hv: utils: Support TimeSync version 4.0 protocol samples.

 drivers/hv/hv_util.c   |  122 ++--
 include/linux/hyperv.h |9 
 2 files changed, 85 insertions(+), 46 deletions(-)

-- 
1.7.4.1

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


[PATCH 3/3] Drivers: hv: utils: Support TimeSync version 4.0 protocol samples.

2016-09-08 Thread kys
From: Alex Ng 

This enables support for more accurate TimeSync v4 samples when hosted
under Windows Server 2016 and newer hosts.

The new time samples include a "vmreferencetime" field that represents
the guest's TSC value when the host generated its time sample. This value
lets the guest calculate the latency in receiving the time sample. The
latency is added to the sample host time prior to updating the clock.

Signed-off-by: Alex Ng 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv_util.c   |   82 ++-
 include/linux/hyperv.h |9 +
 2 files changed, 68 insertions(+), 23 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 4002b71..6286bdc 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -37,13 +37,16 @@
 #define SD_MAJOR_1 1
 #define SD_VERSION_1   (SD_MAJOR_1 << 16 | SD_MINOR)
 
-#define TS_MAJOR   3
+#define TS_MAJOR   4
 #define TS_MINOR   0
 #define TS_VERSION (TS_MAJOR << 16 | TS_MINOR)
 
 #define TS_MAJOR_1 1
 #define TS_VERSION_1   (TS_MAJOR_1 << 16 | TS_MINOR)
 
+#define TS_MAJOR_3 3
+#define TS_VERSION_3   (TS_MAJOR_3 << 16 | TS_MINOR)
+
 #define HB_MAJOR   3
 #define HB_MINOR   0
 #define HB_VERSION (HB_MAJOR << 16 | HB_MINOR)
@@ -161,34 +164,43 @@ static void shutdown_onchannelcallback(void *context)
 }
 
 /*
- * Set guest time to host UTC time.
- */
-static inline void do_adj_guesttime(u64 hosttime)
-{
-   s64 host_tns;
-   struct timespec host_ts;
-
-   host_tns = (hosttime - WLTIMEDELTA) * 100;
-   host_ts = ns_to_timespec(host_tns);
-
-   do_settimeofday(&host_ts);
-}
-
-/*
  * Set the host time in a process context.
  */
 
 struct adj_time_work {
struct work_struct work;
u64 host_time;
+   u64 ref_time;
+   u8  flags;
 };
 
 static void hv_set_host_time(struct work_struct *work)
 {
struct adj_time_work*wrk;
+   s64 host_tns;
+   u64 newtime;
+   struct timespec host_ts;
 
wrk = container_of(work, struct adj_time_work, work);
-   do_adj_guesttime(wrk->host_time);
+
+   newtime = wrk->host_time;
+   if (ts_srv_version > TS_VERSION_3) {
+   /*
+* Some latency has been introduced since Hyper-V generated
+* its time sample. Take that latency into account before
+* using TSC reference time sample from Hyper-V.
+*
+* This sample is given by TimeSync v4 and above hosts.
+*/
+   u64 current_tick;
+
+   rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
+   newtime += (current_tick - wrk->ref_time);
+   }
+   host_tns = (newtime - WLTIMEDELTA) * 100;
+   host_ts = ns_to_timespec(host_tns);
+
+   do_settimeofday(&host_ts);
kfree(wrk);
 }
 
@@ -205,7 +217,7 @@ static void hv_set_host_time(struct work_struct *work)
  * typically used as a hint to the guest. The guest is under no obligation
  * to discipline the clock.
  */
-static inline void adj_guesttime(u64 hosttime, u8 flags)
+static inline void adj_guesttime(u64 hosttime, u64 reftime, u8 flags)
 {
struct adj_time_work*wrk;
 
@@ -214,6 +226,8 @@ static inline void adj_guesttime(u64 hosttime, u8 flags)
return;
 
wrk->host_time = hosttime;
+   wrk->ref_time = reftime;
+   wrk->flags = flags;
if ((flags & (ICTIMESYNCFLAG_SYNC | ICTIMESYNCFLAG_SAMPLE)) != 0) {
INIT_WORK(&wrk->work, hv_set_host_time);
schedule_work(&wrk->work);
@@ -231,6 +245,7 @@ static void timesync_onchannelcallback(void *context)
u64 requestid;
struct icmsg_hdr *icmsghdrp;
struct ictimesync_data *timedatap;
+   struct ictimesync_ref_data *refdata;
u8 *time_txf_buf = util_timesynch.recv_buffer;
struct icmsg_negotiate *negop = NULL;
 
@@ -246,11 +261,27 @@ static void timesync_onchannelcallback(void *context)
time_txf_buf,
util_fw_version,
ts_srv_version);
+   pr_info("Using TimeSync version %d.%d\n",
+   ts_srv_version >> 16, ts_srv_version & 0x);
} else {
-   timedatap = (struct ictimesync_data *)&time_txf_buf[
-   sizeof(struct vmbuspipe_hdr) +
-   sizeof(struct icmsg_hdr)];
-   adj_guesttime(timedatap->parenttime, timedatap->flags);
+   if (ts_srv_version > TS_VERSION_3) {
+   refdata = (struct ictimesync_ref_data *)
+   &time_txf_buf[
+   sizeof(struct vmbuspipe_hdr) +
+   sizeof(struct icmsg_hdr)];
+
+   

[PATCH 1/3] Drivers: hv: utils: Rename version definitions to reflect protocol version.

2016-09-08 Thread kys
From: Alex Ng 

Different Windows host versions may reuse the same protocol version when
negotiating the TimeSync, Shutdown, and Heartbeat protocols. We should only
refer to the protocol version to avoid conflating the two concepts.

Signed-off-by: Alex Ng 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv_util.c |   20 ++--
 1 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index d5acaa2..b27a8ee 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -34,22 +34,22 @@
 #define SD_MINOR   0
 #define SD_VERSION (SD_MAJOR << 16 | SD_MINOR)
 
-#define SD_WS2008_MAJOR1
-#define SD_WS2008_VERSION  (SD_WS2008_MAJOR << 16 | SD_MINOR)
+#define SD_MAJOR_1 1
+#define SD_VERSION_1   (SD_MAJOR_1 << 16 | SD_MINOR)
 
 #define TS_MAJOR   3
 #define TS_MINOR   0
 #define TS_VERSION (TS_MAJOR << 16 | TS_MINOR)
 
-#define TS_WS2008_MAJOR1
-#define TS_WS2008_VERSION  (TS_WS2008_MAJOR << 16 | TS_MINOR)
+#define TS_MAJOR_1 1
+#define TS_VERSION_1   (TS_MAJOR_1 << 16 | TS_MINOR)
 
 #define HB_MAJOR   3
-#define HB_MINOR 0
+#define HB_MINOR   0
 #define HB_VERSION (HB_MAJOR << 16 | HB_MINOR)
 
-#define HB_WS2008_MAJOR1
-#define HB_WS2008_VERSION  (HB_WS2008_MAJOR << 16 | HB_MINOR)
+#define HB_MAJOR_1 1
+#define HB_VERSION_1   (HB_MAJOR_1 << 16 | HB_MINOR)
 
 static int sd_srv_version;
 static int ts_srv_version;
@@ -350,9 +350,9 @@ static int util_probe(struct hv_device *dev,
switch (vmbus_proto_version) {
case (VERSION_WS2008):
util_fw_version = UTIL_WS2K8_FW_VERSION;
-   sd_srv_version = SD_WS2008_VERSION;
-   ts_srv_version = TS_WS2008_VERSION;
-   hb_srv_version = HB_WS2008_VERSION;
+   sd_srv_version = SD_VERSION_1;
+   ts_srv_version = TS_VERSION_1;
+   hb_srv_version = HB_VERSION_1;
break;
 
default:
-- 
1.7.4.1

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


[PATCH 2/3] Drivers: hv: utils: Use TimeSync samples to adjust the clock after boot.

2016-09-08 Thread kys
From: Alex Ng 

Only the first 50 samples after boot were being used to discipline the
clock. After the first 50 samples, any samples from the host were ignored
and the guest clock would eventually drift from the host clock.

This patch allows TimeSync-enabled guests to continuously synchronize the
clock with the host clock, even after the first 50 samples.

Signed-off-by: Alex Ng 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv_util.c |   20 +++-
 1 files changed, 7 insertions(+), 13 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index b27a8ee..4002b71 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -198,29 +198,23 @@ static void hv_set_host_time(struct work_struct *work)
  * ICTIMESYNCFLAG_SYNC flag bit indicates reboot, restore events of the VM.
  * After reboot the flag ICTIMESYNCFLAG_SYNC is included in the first time
  * message after the timesync channel is opened. Since the hv_utils module is
- * loaded after hv_vmbus, the first message is usually missed. The other
- * thing is, systime is automatically set to emulated hardware clock which may
- * not be UTC time or in the same time zone. So, to override these effects, we
- * use the first 50 time samples for initial system time setting.
+ * loaded after hv_vmbus, the first message is usually missed. This bit is
+ * considered a hard request to discipline the clock.
+ *
+ * ICTIMESYNCFLAG_SAMPLE bit indicates a time sample from host. This is
+ * typically used as a hint to the guest. The guest is under no obligation
+ * to discipline the clock.
  */
 static inline void adj_guesttime(u64 hosttime, u8 flags)
 {
struct adj_time_work*wrk;
-   static s32 scnt = 50;
 
wrk = kmalloc(sizeof(struct adj_time_work), GFP_ATOMIC);
if (wrk == NULL)
return;
 
wrk->host_time = hosttime;
-   if ((flags & ICTIMESYNCFLAG_SYNC) != 0) {
-   INIT_WORK(&wrk->work, hv_set_host_time);
-   schedule_work(&wrk->work);
-   return;
-   }
-
-   if ((flags & ICTIMESYNCFLAG_SAMPLE) != 0 && scnt > 0) {
-   scnt--;
+   if ((flags & (ICTIMESYNCFLAG_SYNC | ICTIMESYNCFLAG_SAMPLE)) != 0) {
INIT_WORK(&wrk->work, hv_set_host_time);
schedule_work(&wrk->work);
} else
-- 
1.7.4.1

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


[PATCH] staging: ks7010: mark symbols static where possible

2016-09-08 Thread Baoyou Xie
We get 3 warnings when building kernel with W=1:
drivers/staging/ks7010/ks7010_sdio.c:90:6: warning: no previous prototype for 
'ks_wlan_hw_sleep_doze_request' [-Wmissing-prototypes]
drivers/staging/ks7010/ks7010_sdio.c:121:6: warning: no previous prototype for 
'ks_wlan_hw_sleep_wakeup_request' [-Wmissing-prototypes]
drivers/staging/ks7010/ks7010_sdio.c:174:5: warning: no previous prototype for 
'_ks_wlan_hw_power_save' [-Wmissing-prototypes]

In fact, these functions are only used in the file in which they are
declared and don't need a declaration, but can be made static.
so this patch marks these functions with 'static'.

Signed-off-by: Baoyou Xie 
---
 drivers/staging/ks7010/ks7010_sdio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c 
b/drivers/staging/ks7010/ks7010_sdio.c
index b7337fd..466ba07 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -87,7 +87,7 @@ static int ks7010_sdio_write(struct ks_wlan_private *priv, 
unsigned int address,
return rc;
 }
 
-void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
+static void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)
 {
unsigned char rw_data;
int retval;
@@ -118,7 +118,7 @@ void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private 
*priv)
return;
 }
 
-void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
+static void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)
 {
unsigned char rw_data;
int retval;
@@ -171,7 +171,7 @@ void ks_wlan_hw_wakeup_request(struct ks_wlan_private *priv)
}
 }
 
-int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
+static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
 {
int rc = 0;
unsigned char rw_data;
-- 
2.7.4

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


[PATCH] [media] cec: fix Kconfig help text

2016-09-08 Thread Jean Delvare
MEDIA_CEC is no longer a tristate option, so the user can't actually
choose M. Whether the code is built-in or built as a module is
decided somewhere else. 

Signed-off-by: Jean Delvare 
Fixes: 5bb2399a4fe4 ("[media] cec: fix Kconfig dependency problems")
Cc: Hans Verkuil 
Cc: Arnd Bergmann 
Cc: Mauro Carvalho Chehab 
---
 drivers/staging/media/cec/Kconfig |3 ---
 1 file changed, 3 deletions(-)

--- linux-4.8-rc5.orig/drivers/staging/media/cec/Kconfig2016-09-04 
23:31:46.0 +0200
+++ linux-4.8-rc5/drivers/staging/media/cec/Kconfig 2016-09-08 
17:20:03.048392694 +0200
@@ -5,9 +5,6 @@ config MEDIA_CEC
---help---
  Enable the CEC API.
 
- To compile this driver as a module, choose M here: the
- module will be called cec.
-
 config MEDIA_CEC_DEBUG
bool "CEC debugfs interface (EXPERIMENTAL)"
depends on MEDIA_CEC && DEBUG_FS


-- 
Jean Delvare
SUSE L3 Support
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] android: binder: Disable preemption while holding the global binder lock

2016-09-08 Thread Todd Kjos
In Android systems, the display pipeline relies on low
latency binder transactions and is therefore sensitive to
delays caused by contention for the global binder lock.
Jank is siginificantly reduced by disabling preemption
while the global binder lock is held.

Originally-from: Riley Andrews 
Signed-off-by: Todd Kjos 
---
 drivers/android/binder.c | 194 +++
 1 file changed, 146 insertions(+), 48 deletions(-)

diff --git a/drivers/android/binder.c b/drivers/android/binder.c
index 16288e7..c36e420 100644
--- a/drivers/android/binder.c
+++ b/drivers/android/binder.c
@@ -379,6 +379,7 @@ static int task_get_unused_fd_flags(struct
binder_proc *proc, int flags)
  struct files_struct *files = proc->files;
  unsigned long rlim_cur;
  unsigned long irqs;
+ int ret;

  if (files == NULL)
  return -ESRCH;
@@ -389,7 +390,11 @@ static int task_get_unused_fd_flags(struct
binder_proc *proc, int flags)
  rlim_cur = task_rlimit(proc->tsk, RLIMIT_NOFILE);
  unlock_task_sighand(proc->tsk, &irqs);

- return __alloc_fd(files, 0, rlim_cur, flags);
+ preempt_enable_no_resched();
+ ret = __alloc_fd(files, 0, rlim_cur, flags);
+ preempt_disable();
+
+ return ret;
 }

 /*
@@ -398,8 +403,11 @@ static int task_get_unused_fd_flags(struct
binder_proc *proc, int flags)
 static void task_fd_install(
  struct binder_proc *proc, unsigned int fd, struct file *file)
 {
- if (proc->files)
+ if (proc->files) {
+ preempt_enable_no_resched();
  __fd_install(proc->files, fd, file);
+ preempt_disable();
+ }
 }

 /*
@@ -427,6 +435,7 @@ static inline void binder_lock(const char *tag)
 {
  trace_binder_lock(tag);
  mutex_lock(&binder_main_lock);
+ preempt_disable();
  trace_binder_locked(tag);
 }

@@ -434,8 +443,65 @@ static inline void binder_unlock(const char *tag)
 {
  trace_binder_unlock(tag);
  mutex_unlock(&binder_main_lock);
+ preempt_enable();
+}
+
+static inline void *kzalloc_nopreempt(size_t size)
+{
+ void *ptr;
+
+ ptr = kzalloc(size, GFP_NOWAIT);
+ if (ptr)
+ return ptr;
+
+ preempt_enable_no_resched();
+ ptr = kzalloc(size, GFP_KERNEL);
+ preempt_disable();
+
+ return ptr;
+}
+
+static inline long copy_to_user_nopreempt(void __user *to,
+  const void *from, long n)
+{
+ long ret;
+
+ preempt_enable_no_resched();
+ ret = copy_to_user(to, from, n);
+ preempt_disable();
+ return ret;
+}
+
+static inline long copy_from_user_nopreempt(void *to,
+const void __user *from,
+long n)
+{
+ long ret;
+
+ preempt_enable_no_resched();
+ ret = copy_from_user(to, from, n);
+ preempt_disable();
+ return ret;
 }

+#define get_user_nopreempt(x, ptr) \
+({ \
+ int __ret; \
+ preempt_enable_no_resched(); \
+ __ret = get_user(x, ptr); \
+ preempt_disable(); \
+ __ret; \
+})
+
+#define put_user_nopreempt(x, ptr) \
+({ \
+ int __ret; \
+ preempt_enable_no_resched(); \
+ __ret = put_user(x, ptr); \
+ preempt_disable(); \
+ __ret; \
+})
+
 static void binder_set_nice(long nice)
 {
  long min_nice;
@@ -568,6 +634,8 @@ static int binder_update_page_range(struct
binder_proc *proc, int allocate,
  else
  mm = get_task_mm(proc->tsk);

+ preempt_enable_no_resched();
+
  if (mm) {
  down_write(&mm->mmap_sem);
  vma = proc->vma;
@@ -622,6 +690,9 @@ static int binder_update_page_range(struct
binder_proc *proc, int allocate,
  up_write(&mm->mmap_sem);
  mmput(mm);
  }
+
+ preempt_disable();
+
  return 0;

 free_range:
@@ -644,6 +715,9 @@ err_no_vma:
  up_write(&mm->mmap_sem);
  mmput(mm);
  }
+
+ preempt_disable();
+
  return -ENOMEM;
 }

@@ -903,7 +977,7 @@ static struct binder_node *binder_new_node(struct
binder_proc *proc,
  return NULL;
  }

- node = kzalloc(sizeof(*node), GFP_KERNEL);
+ node = kzalloc_nopreempt(sizeof(*node));
  if (node == NULL)
  return NULL;
  binder_stats_created(BINDER_STAT_NODE);
@@ -1040,7 +1114,7 @@ static struct binder_ref
*binder_get_ref_for_node(struct binder_proc *proc,
  else
  return ref;
  }
- new_ref = kzalloc(sizeof(*ref), GFP_KERNEL);
+ new_ref = kzalloc_nopreempt(sizeof(*ref));
  if (new_ref == NULL)
  return NULL;
  binder_stats_created(BINDER_STAT_REF);
@@ -1438,14 +1512,14 @@ static void binder_transaction(struct binder_proc *proc,
  e->to_proc = target_proc->pid;

  /* TODO: reuse incoming transaction for reply */
- t = kzalloc(sizeof(*t), GFP_KERNEL);
+ t = kzalloc_nopreempt(sizeof(*t));
  if (t == NULL) {
  return_error = BR_FAILED_REPLY;
  goto err_alloc_t_failed;
  }
  binder_stats_created(BINDER_STAT_TRANSACTION);

- tcomplete = kzalloc(sizeof(*tcomplete), GFP_KERNEL);
+ tcomplete = kzalloc_nopreempt(sizeof(*tcomplete));
  if (tcomplete == NULL) {
  return_error = BR_FAILED_REPLY;
  goto err_alloc_tcomplete_failed;
@@ -1502,15 +1576,16 @@ static void binder_transaction(struct binder_proc *proc,
  offp = (binder_size_t *)(t->buffer->data +
  ALIGN(tr->data_size, sizeof(void *)));

- if (copy_from_user(t->buffer->data, (const void __user *)(uintptr_t)
-   tr->data.ptr.buffer, tr->data_size)) {
+ if (copy_from_user_nopreempt(t->buffer->data,
+ (const void __user *)(uintptr_t

Re: [PATCH] android: binder: Disable preemption while holding the global binder lock

2016-09-08 Thread Greg Kroah-Hartman
On Thu, Sep 08, 2016 at 09:12:50AM -0700, Todd Kjos wrote:
> In Android systems, the display pipeline relies on low
> latency binder transactions and is therefore sensitive to
> delays caused by contention for the global binder lock.
> Jank is siginificantly reduced by disabling preemption
> while the global binder lock is held.
> 
> Originally-from: Riley Andrews 

So should the "From: " line be Riley?  Did Riley sign off on this?

> Signed-off-by: Todd Kjos 
> ---
>  drivers/android/binder.c | 194 
> +++
>  1 file changed, 146 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/android/binder.c b/drivers/android/binder.c
> index 16288e7..c36e420 100644
> --- a/drivers/android/binder.c
> +++ b/drivers/android/binder.c
> @@ -379,6 +379,7 @@ static int task_get_unused_fd_flags(struct
> binder_proc *proc, int flags)
>   struct files_struct *files = proc->files;
>   unsigned long rlim_cur;
>   unsigned long irqs;
> + int ret;
> 
>   if (files == NULL)
>   return -ESRCH;
> @@ -389,7 +390,11 @@ static int task_get_unused_fd_flags(struct
> binder_proc *proc, int flags)
>   rlim_cur = task_rlimit(proc->tsk, RLIMIT_NOFILE);
>   unlock_task_sighand(proc->tsk, &irqs);
> 
> - return __alloc_fd(files, 0, rlim_cur, flags);
> + preempt_enable_no_resched();
> + ret = __alloc_fd(files, 0, rlim_cur, flags);
> + preempt_disable();
> +
> + return ret;
>  }

Your tabs are all eaten and broke the patch, so it can't be applied :(

Can you try again?

thanks,

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


[PATCH] staging: comedi: coding style fixes

2016-09-08 Thread Matias Mucciolo

- Fixed coding style in comedi_fops.c Symbolic to octal permission. 
- Fixed coding style in drivers.c block comment align

Signed-off-by: Matias Mucciolo 
---
 drivers/staging/comedi/comedi_fops.c | 6 +++---
 drivers/staging/comedi/drivers.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 1999eed..bf922ea 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -81,20 +81,20 @@ struct comedi_file {
(COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS)
 
 static int comedi_num_legacy_minors;
-module_param(comedi_num_legacy_minors, int, S_IRUGO);
+module_param(comedi_num_legacy_minors, int, 0444);
 MODULE_PARM_DESC(comedi_num_legacy_minors,
 "number of comedi minor devices to reserve for 
non-auto-configured devices (default 0)"
);
 
 unsigned int comedi_default_buf_size_kb = CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB;
-module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR);
+module_param(comedi_default_buf_size_kb, uint, 0644);
 MODULE_PARM_DESC(comedi_default_buf_size_kb,
 "default asynchronous buffer size in KiB (default "
 __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB) ")");
 
 unsigned int comedi_default_buf_maxsize_kb
= CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB;
-module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR);
+module_param(comedi_default_buf_maxsize_kb, uint, 0644);
 MODULE_PARM_DESC(comedi_default_buf_maxsize_kb,
 "default maximum size of asynchronous buffer in KiB (default "
 __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")");
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 44511d7..a5bf2cc 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -15,7 +15,7 @@
  *  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 
-- 
2.1.4

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


Re: [PATCH] staging/lustre/obdclass: add missing header dependencies

2016-09-08 Thread James Simmons

> We get 1 warning when building kernel with W=1:
> drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c:157:5: warning: 
> no previous prototype for 'obd_sysctl_init' [-Wmissing-prototypes]
> 
> In fact, this function is declared in ../../include/obd_class.h,
> so this patch add missing header dependencies.
> 
> Signed-off-by: Baoyou Xie 

Acked-by: James Simmons 

> ---
>  drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c 
> b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
> index 8f70dd2..2daa834 100644
> --- a/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
> +++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-sysctl.c
> @@ -45,6 +45,7 @@
>  
>  #include "../../include/obd_support.h"
>  #include "../../include/lprocfs_status.h"
> +#include "../../include/obd_class.h"
>  
>  struct static_lustre_uintvalue_attr {
>   struct {
> -- 
> 2.7.4
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: comedi: coding style fixes

2016-09-08 Thread Greg Kroah-Hartman
On Thu, Sep 08, 2016 at 02:40:50PM -0300, Matias Mucciolo wrote:
> 
> - Fixed coding style in comedi_fops.c Symbolic to octal permission. 
> - Fixed coding style in drivers.c block comment align

That's multiple things, please break this up into multiple patches.

thanks,

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


Re: [PATCH] staging/lustre/lov: add missing header dependencies

2016-09-08 Thread James Simmons

> We get 1 warning when building kernel with W=1:
> drivers/staging/lustre/lustre/lov/lov_object.c:956:23: warning: no previous 
> prototype for 'lov_lsm_get' [-Wmissing-prototypes]
> drivers/staging/lustre/lustre/lov/lov_object.c:972:6: warning: no previous 
> prototype for 'lov_lsm_put' [-Wmissing-prototypes]
> drivers/staging/lustre/lustre/lov/lov_object.c:979:5: warning: no previous 
> prototype for 'lov_read_and_clear_async_rc' [-Wmissing-prototypes]
> 
> In fact, these functions are declared in ../llite/vvp_internal.h,
> so this patch add missing header dependencies.
> 
> Signed-off-by: Baoyou Xie 

Nak. The header vvp_internal.h is meant to private to the llite layer.
Looking at the coming patch updates I see lov_lsm_[put|get] will not be
used in the lov later. Now lov_read_and_clear_async is still used in
both layers. The header used for this case is cl_object.h. Might rename 
that function to be consistent with the rest of the header. I will look 
into a cleanup for this.

> ---
>  drivers/staging/lustre/lustre/lov/lov_object.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/staging/lustre/lustre/lov/lov_object.c 
> b/drivers/staging/lustre/lustre/lov/lov_object.c
> index f9621b0..912c416 100644
> --- a/drivers/staging/lustre/lustre/lov/lov_object.c
> +++ b/drivers/staging/lustre/lustre/lov/lov_object.c
> @@ -38,6 +38,7 @@
>  #define DEBUG_SUBSYSTEM S_LOV
>  
>  #include "lov_cl_internal.h"
> +#include "../llite/vvp_internal.h"
>  
>  /** \addtogroup lov
>   *  @{
> -- 
> 2.7.4
> 
> ___
> devel mailing list
> de...@linuxdriverproject.org
> http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: comedi: comedi_fops: coding style fixes

2016-09-08 Thread Matias Mucciolo

- Fixed coding style in comedi_fops.c Symbolic to octal permission.

Signed-off-by: Matias Mucciolo 
---
 drivers/staging/comedi/comedi_fops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/comedi/comedi_fops.c 
b/drivers/staging/comedi/comedi_fops.c
index 1999eed..bf922ea 100644
--- a/drivers/staging/comedi/comedi_fops.c
+++ b/drivers/staging/comedi/comedi_fops.c
@@ -81,20 +81,20 @@ struct comedi_file {
(COMEDI_NUM_MINORS - COMEDI_NUM_BOARD_MINORS)
 
 static int comedi_num_legacy_minors;
-module_param(comedi_num_legacy_minors, int, S_IRUGO);
+module_param(comedi_num_legacy_minors, int, 0444);
 MODULE_PARM_DESC(comedi_num_legacy_minors,
 "number of comedi minor devices to reserve for 
non-auto-configured devices (default 0)"
);
 
 unsigned int comedi_default_buf_size_kb = CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB;
-module_param(comedi_default_buf_size_kb, uint, S_IRUGO | S_IWUSR);
+module_param(comedi_default_buf_size_kb, uint, 0644);
 MODULE_PARM_DESC(comedi_default_buf_size_kb,
 "default asynchronous buffer size in KiB (default "
 __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_SIZE_KB) ")");
 
 unsigned int comedi_default_buf_maxsize_kb
= CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB;
-module_param(comedi_default_buf_maxsize_kb, uint, S_IRUGO | S_IWUSR);
+module_param(comedi_default_buf_maxsize_kb, uint, 0644);
 MODULE_PARM_DESC(comedi_default_buf_maxsize_kb,
 "default maximum size of asynchronous buffer in KiB (default "
 __MODULE_STRING(CONFIG_COMEDI_DEFAULT_BUF_MAXSIZE_KB) ")");
-- 
2.1.4

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


Re: [PATCH] vme: fake: fix build for 64-bit dma_addr_t

2016-09-08 Thread Martyn Welch
On Tue, Sep 06, 2016 at 02:59:41PM +0200, Arnd Bergmann wrote:
> casting between dma_addr_t and a pointer is generally tricky,
> as they might not be the same size and almost never point into
> the same address space. With 32-bit ARM systems and LPAE, we
> get this warning for the vme_fake driver that stores a pointer
> in a dma_addr_t variable:
> 
> drivers/vme/bridges/vme_fake.c: In function 'fake_slave_set':
> drivers/vme/bridges/vme_fake.c:204:29: error: assignment makes pointer from 
> integer without a cast [-Werror=int-conversion]
> 
> To make this clearer while fixing the warning, I'm adding
> a set of helper functions for the type conversion.
> 
> Signed-off-by: Arnd Bergmann 

Acked-by: Martyn Welch 

> ---
>  drivers/vme/bridges/vme_fake.c | 26 ++
>  1 file changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/vme/bridges/vme_fake.c b/drivers/vme/bridges/vme_fake.c
> index 7ef298b289f4..ebf35d305321 100644
> --- a/drivers/vme/bridges/vme_fake.c
> +++ b/drivers/vme/bridges/vme_fake.c
> @@ -48,7 +48,7 @@ struct fake_slave_window {
>   int enabled;
>   unsigned long long vme_base;
>   unsigned long long size;
> - dma_addr_t buf_base;
> + void *buf_base;
>   u32 aspace;
>   u32 cycle;
>  };
> @@ -114,6 +114,16 @@ static void fake_irq_set(struct vme_bridge *fake_bridge, 
> int level,
>   /* Nothing to do */
>  }
>  
> +static void *fake_pci_to_ptr(dma_addr_t addr)
> +{
> + return (void *)(uintptr_t)addr;
> +}
> +
> +static dma_addr_t fake_ptr_to_pci(void *addr)
> +{
> + return (dma_addr_t)(uintptr_t)addr;
> +}
> +
>  /*
>   * Generate a VME bus interrupt at the requested level & vector. Wait for
>   * interrupt to be acked.
> @@ -202,7 +212,7 @@ static int fake_slave_set(struct vme_slave_resource 
> *image, int enabled,
>   bridge->slaves[i].enabled = enabled;
>   bridge->slaves[i].vme_base = vme_base;
>   bridge->slaves[i].size = size;
> - bridge->slaves[i].buf_base = buf_base;
> + bridge->slaves[i].buf_base = fake_pci_to_ptr(buf_base);
>   bridge->slaves[i].aspace = aspace;
>   bridge->slaves[i].cycle = cycle;
>  
> @@ -230,7 +240,7 @@ static int fake_slave_get(struct vme_slave_resource 
> *image, int *enabled,
>   *enabled = bridge->slaves[i].enabled;
>   *vme_base = bridge->slaves[i].vme_base;
>   *size = bridge->slaves[i].size;
> - *buf_base = bridge->slaves[i].buf_base;
> + *buf_base = fake_ptr_to_pci(bridge->slaves[i].buf_base);
>   *aspace = bridge->slaves[i].aspace;
>   *cycle = bridge->slaves[i].cycle;
>  
> @@ -431,7 +441,7 @@ static u8 fake_vmeread8(struct fake_driver *bridge, 
> unsigned long long addr,
>  
>   if ((addr >= start) && (addr < end)) {
>   offset = addr - bridge->slaves[i].vme_base;
> - loc = (u8 *)((void *)bridge->slaves[i].buf_base + 
> offset);
> + loc = (u8 *)(bridge->slaves[i].buf_base + offset);
>   retval = *loc;
>  
>   break;
> @@ -463,7 +473,7 @@ static u16 fake_vmeread16(struct fake_driver *bridge, 
> unsigned long long addr,
>  
>   if ((addr >= start) && ((addr + 1) < end)) {
>   offset = addr - bridge->slaves[i].vme_base;
> - loc = (u16 *)((void *)bridge->slaves[i].buf_base + 
> offset);
> + loc = (u16 *)(bridge->slaves[i].buf_base + offset);
>   retval = *loc;
>  
>   break;
> @@ -495,7 +505,7 @@ static u32 fake_vmeread32(struct fake_driver *bridge, 
> unsigned long long addr,
>  
>   if ((addr >= start) && ((addr + 3) < end)) {
>   offset = addr - bridge->slaves[i].vme_base;
> - loc = (u32 *)((void *)bridge->slaves[i].buf_base + 
> offset);
> + loc = (u32 *)(bridge->slaves[i].buf_base + offset);
>   retval = *loc;
>  
>   break;
> @@ -997,7 +1007,7 @@ static void *fake_alloc_consistent(struct device 
> *parent, size_t size,
>   void *alloc = kmalloc(size, GFP_KERNEL);
>  
>   if (alloc != NULL)
> - *dma = (dma_addr_t)(unsigned long)alloc;
> + *dma = fake_ptr_to_pci(alloc);
>  
>   return alloc;
>  }
> @@ -1031,7 +1041,7 @@ static int fake_crcsr_init(struct vme_bridge 
> *fake_bridge)
>  
>   /* Allocate mem for CR/CSR image */
>   bridge->crcsr_kernel = kzalloc(VME_CRCSR_BUF_SIZE, GFP_KERNEL);
> - bridge->crcsr_bus = (dma_addr_t)bridge->crcsr_kernel;
> + bridge->crcsr_bus = fake_ptr_to_pci(bridge->crcsr_kernel);
>   if (bridge->crcsr_kernel == NULL)
>   return -ENOMEM;
>  
> -- 
> 2.9.0
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: vme_user: return retval in vme_user_ioctl

2016-09-08 Thread Martyn Welch
On Fri, Sep 02, 2016 at 04:16:48PM -0500, Aaron Sierra wrote:
> Update each case to set retval and return that value at the end of the
> function. This also replaces most case statement returns with breaks
> and collapses some whitespace.
> 

Sorry if I'm being dense, but is there an advantage to doing it this way?

This seems to be adding churn for no discernible gain.

> Signed-off-by: Aaron Sierra 
> ---
>  drivers/staging/vme/devices/vme_user.c | 22 ++
>  1 file changed, 10 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/staging/vme/devices/vme_user.c 
> b/drivers/staging/vme/devices/vme_user.c
> index fc660bd..5aa53c4 100644
> --- a/drivers/staging/vme/devices/vme_user.c
> +++ b/drivers/staging/vme/devices/vme_user.c
> @@ -299,7 +299,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   struct vme_irq_id irq_req;
>   unsigned long copied;
>   unsigned int minor = MINOR(inode->i_rdev);
> - int retval;
> + int retval = -EINVAL;
>   dma_addr_t pci_addr;
>   void __user *argp = (void __user *)arg;
>  
> @@ -314,9 +314,10 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   return -EFAULT;
>   }
>  
> - return vme_irq_generate(vme_user_bridge,
> + retval = vme_irq_generate(vme_user_bridge,
> irq_req.level,
> irq_req.statid);
> + break;
>   }
>   break;
>   case MASTER_MINOR:
> @@ -337,13 +338,11 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
> sizeof(master));
>   if (copied) {
>   pr_warn("Partial copy to userspace\n");
> - return -EFAULT;
> + retval = -EFAULT;
>   }
>  
> - return retval;
> -
> + break;
>   case VME_SET_MASTER:
> -
>   if (image[minor].mmap_count != 0) {
>   pr_warn("Can't adjust mapped window\n");
>   return -EPERM;
> @@ -358,7 +357,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - return vme_master_set(image[minor].resource,
> + retval = vme_master_set(image[minor].resource,
>   master.enable, master.vme_addr, master.size,
>   master.aspace, master.cycle, master.dwidth);
>  
> @@ -382,11 +381,10 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
> sizeof(slave));
>   if (copied) {
>   pr_warn("Partial copy to userspace\n");
> - return -EFAULT;
> + retval = -EFAULT;
>   }
>  
> - return retval;
> -
> + break;
>   case VME_SET_SLAVE:
>  
>   copied = copy_from_user(&slave, argp, sizeof(slave));
> @@ -398,7 +396,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - return vme_slave_set(image[minor].resource,
> + retval = vme_slave_set(image[minor].resource,
>   slave.enable, slave.vme_addr, slave.size,
>   image[minor].pci_buf, slave.aspace,
>   slave.cycle);
> @@ -408,7 +406,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   break;
>   }
>  
> - return -EINVAL;
> + return retval;
>  }
>  
>  static long
> -- 
> 1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/3] staging: vme_user: look up image once in ioctl

2016-09-08 Thread Martyn Welch
On Fri, Sep 02, 2016 at 04:16:55PM -0500, Aaron Sierra wrote:
> Assign a pointer to the image descriptor once at the beginning of
> the ioctl to help keep code concise.
> 

Same with this patch. I'm not sure what's gained by doing this.

> Signed-off-by: Aaron Sierra 
> ---
>  drivers/staging/vme/devices/vme_user.c | 13 +++--
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/vme/devices/vme_user.c 
> b/drivers/staging/vme/devices/vme_user.c
> index 5aa53c4..c68e2b8 100644
> --- a/drivers/staging/vme/devices/vme_user.c
> +++ b/drivers/staging/vme/devices/vme_user.c
> @@ -302,6 +302,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   int retval = -EINVAL;
>   dma_addr_t pci_addr;
>   void __user *argp = (void __user *)arg;
> + struct image_desc *img = &image[minor];
>  
>   switch (type[minor]) {
>   case CONTROL_MINOR:
> @@ -328,7 +329,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - retval = vme_master_get(image[minor].resource,
> + retval = vme_master_get(img->resource,
>   &master.enable,
>   &master.vme_addr,
>   &master.size, &master.aspace,
> @@ -343,7 +344,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>  
>   break;
>   case VME_SET_MASTER:
> - if (image[minor].mmap_count != 0) {
> + if (img->mmap_count != 0) {
>   pr_warn("Can't adjust mapped window\n");
>   return -EPERM;
>   }
> @@ -357,7 +358,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - retval = vme_master_set(image[minor].resource,
> + retval = vme_master_set(img->resource,
>   master.enable, master.vme_addr, master.size,
>   master.aspace, master.cycle, master.dwidth);
>  
> @@ -372,7 +373,7 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - retval = vme_slave_get(image[minor].resource,
> + retval = vme_slave_get(img->resource,
>  &slave.enable, &slave.vme_addr,
>  &slave.size, &pci_addr,
>  &slave.aspace, &slave.cycle);
> @@ -396,9 +397,9 @@ static int vme_user_ioctl(struct inode *inode, struct 
> file *file,
>   /* XXX  We do not want to push aspace, cycle and width
>*  to userspace as they are
>*/
> - retval = vme_slave_set(image[minor].resource,
> + retval = vme_slave_set(img->resource,
>   slave.enable, slave.vme_addr, slave.size,
> - image[minor].pci_buf, slave.aspace,
> + img->pci_buf, slave.aspace,
>   slave.cycle);
>  
>   break;
> -- 
> 1.9.1
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: staging: vme_user: accept bus_num of zero

2016-09-08 Thread Martyn Welch
On Fri, Sep 02, 2016 at 03:59:45PM -0500, Aaron Sierra wrote:
> The driver's bus_num parameter is used to select a VME bus during probe.
> This parameter is used both as a boolean to indicate that probing should
> occur as well as which bus should be probed. However, the first bus in
> the system is bus zero, so this method prevents the first bus from being
> accepted during probe.
> 

Umm, no. The array "bus" holds the buses that should be probed, bus_num
holds the length of the array passed.

> This patch changes the default value of bus_num to -1, so that any
> number in the range of 0 to VME_USER_BUS_MAX will be accepted during
> probe.
> 
> Signed-off-by: Aaron Sierra 
> ---
>  drivers/staging/vme/devices/vme_user.c | 9 +
>  1 file changed, 1 insertion(+), 8 deletions(-)
> 
> diff --git a/drivers/staging/vme/devices/vme_user.c 
> b/drivers/staging/vme/devices/vme_user.c
> index b95883b..fc660bd 100644
> --- a/drivers/staging/vme/devices/vme_user.c
> +++ b/drivers/staging/vme/devices/vme_user.c
> @@ -45,7 +45,7 @@
>  static const char driver_name[] = "vme_user";
>  
>  static int bus[VME_USER_BUS_MAX];
> -static unsigned int bus_num;
> +static int bus_num = -1;
>  
>  /* Currently Documentation/devices.txt defines the following for VME:
>   *
> @@ -735,12 +735,6 @@ static int __init vme_user_init(void)
>  
>   pr_info("VME User Space Access Driver\n");
>  
> - if (bus_num == 0) {
> - pr_err("No cards, skipping registration\n");
> - retval = -ENODEV;
> - goto err_nocard;
> - }
> -
>   /* Let's start by supporting one bus, we can support more than one
>* in future revisions if that ever becomes necessary.
>*/
> @@ -763,7 +757,6 @@ static int __init vme_user_init(void)
>   return retval;
>  
>  err_reg:
> -err_nocard:
>   return retval;
>  }
>  
> -- 
> 1.9.1
> 
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 3/3] staging: vme_user: alloc buffer when setting slave

2016-09-08 Thread Martyn Welch
On Fri, Sep 02, 2016 at 04:17:01PM -0500, Aaron Sierra wrote:
> Some bridges support a minimum slave window larger than this driver's
> 128 KB default buffer size. Also bridges typically require the PCI and
> VME bases to be aligned to the size of the window.
> 

Which bridge has a minimum slave window larger than 128KB?
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


STRICTLY CONFIDENTIAL

2016-09-08 Thread Acct. Dept.
I have important transaction for you as next of kin to claim US$18.37m  Mail me 
on my private email:   chimwia...@gmail.com
 so i can send you more details

Thanks

Mr.Chim Wai Kim










===

DISCLAIMER: This email and any files it contains are confidential and intended 
for the use of the recipient(s) only. If you are not the intended recipient you 
should notify the sender immediately and destroy the material from your system. 



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


[PATCH 1/1] Drivers: hv: hv_util: Avoid dynamic allocation in time synch

2016-09-08 Thread kys
From: Vivek yadav 

Under stress, we have seen allocation failure in time synch code. Avoid
this dynamic allocation.

Signed-off-by: Vivek Yadav 
Signed-off-by: K. Y. Srinivasan 
---
 drivers/hv/hv_util.c |   39 ---
 1 files changed, 28 insertions(+), 11 deletions(-)

diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c
index 6286bdc..4aa3cb6 100644
--- a/drivers/hv/hv_util.c
+++ b/drivers/hv/hv_util.c
@@ -64,9 +64,14 @@ static struct hv_util_service util_shutdown = {
.util_cb = shutdown_onchannelcallback,
 };
 
+static int hv_timesync_init(struct hv_util_service *srv);
+static void hv_timesync_deinit(void);
+
 static void timesync_onchannelcallback(void *context);
 static struct hv_util_service util_timesynch = {
.util_cb = timesync_onchannelcallback,
+   .util_init = hv_timesync_init,
+   .util_deinit = hv_timesync_deinit,
 };
 
 static void heartbeat_onchannelcallback(void *context);
@@ -201,7 +206,6 @@ static void hv_set_host_time(struct work_struct *work)
host_ts = ns_to_timespec(host_tns);
 
do_settimeofday(&host_ts);
-   kfree(wrk);
 }
 
 /*
@@ -217,22 +221,24 @@ static void hv_set_host_time(struct work_struct *work)
  * typically used as a hint to the guest. The guest is under no obligation
  * to discipline the clock.
  */
+static struct adj_time_work  wrk;
 static inline void adj_guesttime(u64 hosttime, u64 reftime, u8 flags)
 {
-   struct adj_time_work*wrk;
 
-   wrk = kmalloc(sizeof(struct adj_time_work), GFP_ATOMIC);
-   if (wrk == NULL)
+   /*
+* This check is safe since we are executing in the
+* interrupt context and time synch messages arre always
+* delivered on the same CPU.
+*/
+   if (work_pending(&wrk.work))
return;
 
-   wrk->host_time = hosttime;
-   wrk->ref_time = reftime;
-   wrk->flags = flags;
+   wrk.host_time = hosttime;
+   wrk.ref_time = reftime;
+   wrk.flags = flags;
if ((flags & (ICTIMESYNCFLAG_SYNC | ICTIMESYNCFLAG_SAMPLE)) != 0) {
-   INIT_WORK(&wrk->work, hv_set_host_time);
-   schedule_work(&wrk->work);
-   } else
-   kfree(wrk);
+   schedule_work(&wrk.work);
+   }
 }
 
 /*
@@ -457,6 +463,17 @@ static  struct hv_driver util_drv = {
.remove =  util_remove,
 };
 
+static int hv_timesync_init(struct hv_util_service *srv)
+{
+   INIT_WORK(&wrk.work, hv_set_host_time);
+   return 0;
+}
+
+static void hv_timesync_deinit(void)
+{
+   cancel_work_sync(&wrk.work);
+}
+
 static int __init init_hyperv_utils(void)
 {
pr_info("Registering HyperV Utility Driver\n");
-- 
1.7.4.1

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