Re: [PATCH 05/15] staging: lustre: ldlm: use accessor macros for l_flags

2016-04-28 Thread Dan Carpenter
On Wed, Apr 27, 2016 at 03:51:09PM -0700, Bruce Korb wrote:
> Wow!  I remember this stuff, even if from 3 years ago.  Feels like a
> lifetime.  Is this patch being applied to official Linux, hence this
> message?  Xyratex collapsed, shed a mess of employees and sold the
> remnant to Seagate.  Consequently, I don't really follow Lustre any
> more.  Sorry.

Hi Bruce,  o/

Yeah.  James is pushing all that stuff to the vanilla kernel.

regards,
dan carpenter

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


Re: Staging: VME Framework for the Linux Kernel

2016-04-28 Thread Martyn Welch



On 14/04/16 10:42, Dan Carpenter wrote:

Hello Martyn Welch,

The patch a17a75e2666f: "Staging: VME Framework for the Linux Kernel"
from Jul 31, 2009, leads to the following static checker warning:

drivers/vme/vme.c:161 vme_get_size()
error: uninitialized variable 'size'.

drivers/vme/vme.c
149  size_t vme_get_size(struct vme_resource *resource)
150  {
151  int enabled, retval;
152  unsigned long long base, size;
153  dma_addr_t buf_base;
154  u32 aspace, cycle, dwidth;
155
156  switch (resource->type) {
157  case VME_MASTER:
158  retval = vme_master_get(resource, &enabled, &base, 
&size,
159  &aspace, &cycle, &dwidth);
160
161  return size;

Probably we should say something like:

if (retval)
return 0;
return size;


Definitely. Will get a patch together.

Thanks,

Martyn


162  break;
163  case VME_SLAVE:
164  retval = vme_slave_get(resource, &enabled, &base, 
&size,
165  &buf_base, &aspace, &cycle);
166
167  return size;

Same here.

168  break;
169  case VME_DMA:
170  return 0;
171  break;
172  default:
173  printk(KERN_ERR "Unknown resource type\n");
174  return 0;
175  break;
176  }
177  }
178  EXPORT_SYMBOL(vme_get_size);


regards,
dan carpenter
___
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 00/12] De-stage Sync File Framework

2016-04-28 Thread Gustavo Padovan
2016-04-27 Daniel Vetter :

> On Wed, Apr 27, 2016 at 01:27:07PM -0300, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Hi,
> > 
> > This patchset sits on top of Sync ABI Rework v13:
> > 
> > https://www.spinics.net/lists/dri-devel/msg105667.html
> > 
> > The first eight clean up and prepare sync_file for de-staging. The last four
> > patches do the de-staging, moving files to drivers/dma-buf/ and 
> > include/linux/
> > plus adding Documentation.
> > 
> > As the de-stage depends upon many changes on the staging tree it would
> > be good to get all the patches merged through the staging tree if Sumit
> > agrees with that.
> > 
> > The next step on the Sync de-stage is clean up the remaining bits 
> > of the Sync Framework, mainly SW_SYNC, which is only used for testing.
> 
> Ok I looked once more at all this stuff, and there's some nitpicks I
> discussed with Gustavo on irc. But really their small, and I think
> perfectly ok to address them once sync_file is destaged. Especially since
> there's a lot more work pending on top of this, so we really want to get
> sync_file.[hc] destaged in 4.7. It'll take us a few iterations and a few
> drivers using this in anger in upstream to perfect the internal interfaces
> anyway, but let's get this started.
> 
> Had some real nitpicks on the docs patch, but that can also be merged
> later on imo. Except for that patch, on the series:
> 
> Reviewed-by: Daniel Vetter 
> 

Thanks for the review, I'm sending v2 fixing the nitpicks you pointed
out.

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


[PATCH v2 04/13] staging/android: make sync_file_merge() static

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

There is no plan in the near future to use this function outside of this
file so keep it as static.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.c | 5 ++---
 drivers/staging/android/sync.h | 2 --
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index a89ded0..e9bf251 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -253,8 +253,8 @@ static void sync_file_add_pt(struct sync_file *sync_file, 
int *i,
  * @a and @b.  @a and @b remain valid, independent sync_file. Returns the
  * new merged sync_file or NULL in case of error.
  */
-struct sync_file *sync_file_merge(const char *name,
- struct sync_file *a, struct sync_file *b)
+static struct sync_file *sync_file_merge(const char *name, struct sync_file *a,
+struct sync_file *b)
 {
int num_fences = a->num_fences + b->num_fences;
struct sync_file *sync_file;
@@ -310,7 +310,6 @@ struct sync_file *sync_file_merge(const char *name,
sync_file_debug_add(sync_file);
return sync_file;
 }
-EXPORT_SYMBOL(sync_file_merge);
 
 static const char *android_fence_get_driver_name(struct fence *fence)
 {
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 925fba5..ffc6df6 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -168,8 +168,6 @@ void sync_timeline_signal(struct sync_timeline *obj);
 struct fence *sync_pt_create(struct sync_timeline *parent, int size);
 
 struct sync_file *sync_file_create(const char *name, struct fence *fence);
-struct sync_file *sync_file_merge(const char *name,
-   struct sync_file *a, struct sync_file *b);
 struct sync_file *sync_file_fdget(int fd);
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.5.5

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


[PATCH v2 03/13] staging/android: move sync_file functions comments to sync.c

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

To keep comments in line with drivers/dma-buf/ move all sync_file comments
to sync.c.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.c | 26 +-
 drivers/staging/android/sync.h | 31 ---
 2 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index b965e2a..a89ded0 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -173,7 +173,14 @@ static void fence_check_cb_func(struct fence *f, struct 
fence_cb *cb)
wake_up_all(&sync_file->wq);
 }
 
-/* TODO: implement a create which takes more that one fence */
+/**
+ * sync_fence_create() - creates a sync fence
+ * @name:  name of fence to create
+ * @fence: fence to add to the sync_fence
+ *
+ * Creates a sync_file containg @fence. Once this is called, the sync_file
+ * takes ownership of @fence.
+ */
 struct sync_file *sync_file_create(const char *name, struct fence *fence)
 {
struct sync_file *sync_file;
@@ -198,6 +205,13 @@ struct sync_file *sync_file_create(const char *name, 
struct fence *fence)
 }
 EXPORT_SYMBOL(sync_file_create);
 
+/**
+ * sync_file_fdget() - get a sync_file from an fd
+ * @fd:fd referencing a fence
+ *
+ * Ensures @fd references a valid sync_file, increments the refcount of the
+ * backing file. Returns the sync_file or NULL in case of error.
+ */
 struct sync_file *sync_file_fdget(int fd)
 {
struct file *file = fget(fd);
@@ -229,6 +243,16 @@ static void sync_file_add_pt(struct sync_file *sync_file, 
int *i,
}
 }
 
+/**
+ * sync_file_merge() - merge two sync_files
+ * @name:  name of new fence
+ * @a: sync_file a
+ * @b: sync_file b
+ *
+ * Creates a new sync_file which contains copies of all the fences in both
+ * @a and @b.  @a and @b remain valid, independent sync_file. Returns the
+ * new merged sync_file or NULL in case of error.
+ */
 struct sync_file *sync_file_merge(const char *name,
  struct sync_file *a, struct sync_file *b)
 {
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index c45cc7b..925fba5 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -167,40 +167,9 @@ void sync_timeline_signal(struct sync_timeline *obj);
  */
 struct fence *sync_pt_create(struct sync_timeline *parent, int size);
 
-/**
- * sync_fence_create() - creates a sync fence
- * @name:  name of fence to create
- * @fence: fence to add to the sync_fence
- *
- * Creates a sync_file containg @fence. Once this is called, the sync_file
- * takes ownership of @fence.
- */
 struct sync_file *sync_file_create(const char *name, struct fence *fence);
-
-/*
- * API for sync_file consumers
- */
-
-/**
- * sync_file_merge() - merge two sync_files
- * @name:  name of new fence
- * @a: sync_file a
- * @b: sync_file b
- *
- * Creates a new sync_file which contains copies of all the fences in both
- * @a and @b.  @a and @b remain valid, independent sync_file. Returns the
- * new merged sync_file or NULL in case of error.
- */
 struct sync_file *sync_file_merge(const char *name,
struct sync_file *a, struct sync_file *b);
-
-/**
- * sync_file_fdget() - get a sync_file from an fd
- * @fd:fd referencing a fence
- *
- * Ensures @fd references a valid sync_file, increments the refcount of the
- * backing file. Returns the sync_file or NULL in case of error.
- */
 struct sync_file *sync_file_fdget(int fd);
 
 #ifdef CONFIG_DEBUG_FS
-- 
2.5.5

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


[PATCH v2 01/13] staging/android: remove redundant comments on sync_merge_data

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

struct sync_merge_data already have documentation on top of the
struct definition. No need to duplicate it.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Maarten Lankhorst 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/uapi/sync.h | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/android/uapi/sync.h 
b/drivers/staging/android/uapi/sync.h
index 7de5d6a..413303d 100644
--- a/drivers/staging/android/uapi/sync.h
+++ b/drivers/staging/android/uapi/sync.h
@@ -23,9 +23,9 @@
  * @pad:   padding for 64-bit alignment, should always be zero
  */
 struct sync_merge_data {
-   charname[32]; /* name of new fence */
-   __s32   fd2; /* fd of second fence */
-   __s32   fence; /* fd on newly created fence */
+   charname[32];
+   __s32   fd2;
+   __s32   fence;
__u32   flags;
__u32   pad;
 };
@@ -33,8 +33,8 @@ struct sync_merge_data {
 /**
  * struct sync_fence_info - detailed fence information
  * @obj_name:  name of parent sync_timeline
- * @driver_name:   name of driver implementing the parent
- * @status:status of the fence 0:active 1:signaled <0:error
+* @driver_name:name of driver implementing the parent
+* @status: status of the fence 0:active 1:signaled <0:error
  * @flags: fence_info flags
  * @timestamp_ns:  timestamp of status change in nanoseconds
  */
-- 
2.5.5

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


[PATCH v2 06/13] staging/android: remove name arg from sync_file_create()

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Simplifies the API to only receive the fence it needs to add to the
sync and create a name for the sync_file based on the fence context and
seqno.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.c   | 16 +---
 drivers/staging/android/sync.h   |  2 +-
 drivers/staging/android/sync_debug.c |  3 +--
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 7e0fa20..5470ae9 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -136,7 +136,7 @@ struct fence *sync_pt_create(struct sync_timeline *obj, int 
size)
 }
 EXPORT_SYMBOL(sync_pt_create);
 
-static struct sync_file *sync_file_alloc(int size, const char *name)
+static struct sync_file *sync_file_alloc(int size)
 {
struct sync_file *sync_file;
 
@@ -150,7 +150,6 @@ static struct sync_file *sync_file_alloc(int size, const 
char *name)
goto err;
 
kref_init(&sync_file->kref);
-   strlcpy(sync_file->name, name, sizeof(sync_file->name));
 
init_waitqueue_head(&sync_file->wq);
 
@@ -175,23 +174,25 @@ static void fence_check_cb_func(struct fence *f, struct 
fence_cb *cb)
 
 /**
  * sync_fence_create() - creates a sync fence
- * @name:  name of fence to create
  * @fence: fence to add to the sync_fence
  *
  * Creates a sync_file containg @fence. Once this is called, the sync_file
  * takes ownership of @fence.
  */
-struct sync_file *sync_file_create(const char *name, struct fence *fence)
+struct sync_file *sync_file_create(struct fence *fence)
 {
struct sync_file *sync_file;
 
-   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]),
-   name);
+   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]));
if (!sync_file)
return NULL;
 
sync_file->num_fences = 1;
atomic_set(&sync_file->status, 1);
+   snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%d-%d",
+fence->ops->get_driver_name(fence),
+fence->ops->get_timeline_name(fence), fence->context,
+fence->seqno);
 
sync_file->cbs[0].fence = fence;
sync_file->cbs[0].sync_file = sync_file;
@@ -260,7 +261,7 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
int i, i_a, i_b;
unsigned long size = offsetof(struct sync_file, cbs[num_fences]);
 
-   sync_file = sync_file_alloc(size, name);
+   sync_file = sync_file_alloc(size);
if (!sync_file)
return NULL;
 
@@ -306,6 +307,7 @@ static struct sync_file *sync_file_merge(const char *name, 
struct sync_file *a,
atomic_sub(num_fences - i, &sync_file->status);
sync_file->num_fences = i;
 
+   strlcpy(sync_file->name, name, sizeof(sync_file->name));
sync_file_debug_add(sync_file);
return sync_file;
 }
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index 1f164df..7dee444 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -167,7 +167,7 @@ void sync_timeline_signal(struct sync_timeline *obj);
  */
 struct fence *sync_pt_create(struct sync_timeline *parent, int size);
 
-struct sync_file *sync_file_create(const char *name, struct fence *fence);
+struct sync_file *sync_file_create(struct fence *fence);
 
 #ifdef CONFIG_DEBUG_FS
 
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index e4b0e41..2cab40d 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -262,8 +262,7 @@ static long sw_sync_ioctl_create_fence(struct 
sw_sync_timeline *obj,
goto err;
}
 
-   data.name[sizeof(data.name) - 1] = '\0';
-   sync_file = sync_file_create(data.name, fence);
+   sync_file = sync_file_create(fence);
if (!sync_file) {
fence_put(fence);
err = -ENOMEM;
-- 
2.5.5

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


[PATCH v2 02/13] staging/android: drop sync_file_install() and sync_file_put()

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

These two functions are just wrappers for one line functions, they
call fd_install() and fput() respectively, so just get rid of them
and use fd_install() and fput() directly for more simplicity.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.c   | 20 
 drivers/staging/android/sync.h   | 19 ---
 drivers/staging/android/sync_debug.c |  4 ++--
 3 files changed, 6 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index f9c6094..b965e2a 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -216,18 +216,6 @@ err:
 }
 EXPORT_SYMBOL(sync_file_fdget);
 
-void sync_file_put(struct sync_file *sync_file)
-{
-   fput(sync_file->file);
-}
-EXPORT_SYMBOL(sync_file_put);
-
-void sync_file_install(struct sync_file *sync_file, int fd)
-{
-   fd_install(fd, sync_file->file);
-}
-EXPORT_SYMBOL(sync_file_install);
-
 static void sync_file_add_pt(struct sync_file *sync_file, int *i,
 struct fence *fence)
 {
@@ -469,15 +457,15 @@ static long sync_file_ioctl_merge(struct sync_file 
*sync_file,
goto err_put_fence3;
}
 
-   sync_file_install(fence3, fd);
-   sync_file_put(fence2);
+   fd_install(fd, fence3->file);
+   fput(fence2->file);
return 0;
 
 err_put_fence3:
-   sync_file_put(fence3);
+   fput(fence3->file);
 
 err_put_fence2:
-   sync_file_put(fence2);
+   fput(fence2->file);
 
 err_put_fd:
put_unused_fd(fd);
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index d2a1734..c45cc7b 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -203,25 +203,6 @@ struct sync_file *sync_file_merge(const char *name,
  */
 struct sync_file *sync_file_fdget(int fd);
 
-/**
- * sync_file_put() - puts a reference of a sync_file
- * @sync_file: sync_file to put
- *
- * Puts a reference on @sync_fence.  If this is the last reference, the
- * sync_fil and all it's sync_pts will be freed
- */
-void sync_file_put(struct sync_file *sync_file);
-
-/**
- * sync_file_install() - installs a sync_file into a file descriptor
- * @sync_file: sync_file to install
- * @fd:file descriptor in which to install the fence
- *
- * Installs @sync_file into @fd.  @fd's should be acquired through
- * get_unused_fd_flags(O_CLOEXEC).
- */
-void sync_file_install(struct sync_file *sync_file, int fd);
-
 #ifdef CONFIG_DEBUG_FS
 
 void sync_timeline_debug_add(struct sync_timeline *obj);
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index 5a7ec58..e4b0e41 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -272,12 +272,12 @@ static long sw_sync_ioctl_create_fence(struct 
sw_sync_timeline *obj,
 
data.fence = fd;
if (copy_to_user((void __user *)arg, &data, sizeof(data))) {
-   sync_file_put(sync_file);
+   fput(sync_file->file);
err = -EFAULT;
goto err;
}
 
-   sync_file_install(sync_file, fd);
+   fd_install(fd, sync_file->file);
 
return 0;
 
-- 
2.5.5

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


[PATCH v2 00/13] De-stage Sync File Framework

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Hi,

This patchset sits on top of Sync ABI Rework v13:

https://www.spinics.net/lists/dri-devel/msg105667.html

The first eight clean up and prepare sync_file for de-staging. The last four
patches do the de-staging, moving files to drivers/dma-buf/ and include/linux/
plus adding Documentation.

As the de-stage depends upon many changes on the staging tree it would
be good to get all the patches merged through the staging tree if Sumit
agrees with that.

The next step on the Sync de-stage is clean up the remaining bits
of the Sync Framework, mainly SW_SYNC, which is only used for testing.

v2: - Add Reviewed-by: tag from Daniel Vetter to all patches.
- Take in sugestions for the Sync File Documentation (Daniel)
- Remove name arg from sync_file_crate() (Daniel)
- Revome leftover EXPORT_SYMBOL(sync_file_merge) (Daniel)

Thanks,

Gustavo

Gustavo Padovan (13):
  staging/android: remove redundant comments on sync_merge_data
  staging/android: drop sync_file_install() and sync_file_put()
  staging/android: move sync_file functions comments to sync.c
  staging/android: make sync_file_merge() static
  staging/android: make sync_file_fdget() static
  staging/android: remove name arg from sync_file_create()
  staging/android: prepare sync_file for de-staging
  staging/android: improve documentation for sync_file
  staging/android: style fix: alignment to match the open parenthesis
  dma-buf/sync_file: de-stage sync_file headers
  dma-buf/sync_file: de-stage sync_file
  Documentation: include sync_file into DocBook
  Documentation: add Sync File doc

 Documentation/DocBook/device-drivers.tmpl |   2 +
 Documentation/sync_file.txt   |  69 ++
 drivers/Kconfig   |   2 +
 drivers/dma-buf/Kconfig   |  11 +
 drivers/dma-buf/Makefile  |   1 +
 drivers/dma-buf/sync_file.c   | 395 ++
 drivers/staging/android/Kconfig   |   1 +
 drivers/staging/android/sync.c| 362 ---
 drivers/staging/android/sync.h|  91 +--
 drivers/staging/android/sync_debug.c  |   8 +-
 drivers/staging/android/uapi/sync.h   | 100 
 include/linux/sync_file.h |  57 +
 include/uapi/linux/sync_file.h| 100 
 13 files changed, 644 insertions(+), 555 deletions(-)
 create mode 100644 Documentation/sync_file.txt
 create mode 100644 drivers/dma-buf/Kconfig
 create mode 100644 drivers/dma-buf/sync_file.c
 delete mode 100644 drivers/staging/android/uapi/sync.h
 create mode 100644 include/linux/sync_file.h
 create mode 100644 include/uapi/linux/sync_file.h

-- 
2.5.5

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


[PATCH v2 07/13] staging/android: prepare sync_file for de-staging

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Move its functions and structs to their own file. Also moves function's
docs to the .c file.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/Makefile   |   2 +-
 drivers/staging/android/sync.c | 374 ---
 drivers/staging/android/sync.h |  38 +-
 drivers/staging/android/sync_debug.c   |   1 +
 drivers/staging/android/sync_file.c| 394 +
 drivers/staging/android/sync_file.h|  57 +++
 .../staging/android/uapi/{sync.h => sync_file.h}   |   0
 7 files changed, 455 insertions(+), 411 deletions(-)
 create mode 100644 drivers/staging/android/sync_file.c
 create mode 100644 drivers/staging/android/sync_file.h
 rename drivers/staging/android/uapi/{sync.h => sync_file.h} (100%)

diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index 980d6dc..ebc2df1 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -4,5 +4,5 @@ obj-y   += ion/
 
 obj-$(CONFIG_ASHMEM)   += ashmem.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o
-obj-$(CONFIG_SYNC) += sync.o sync_debug.o
+obj-$(CONFIG_SYNC) += sync_file.o sync.o sync_debug.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index 5470ae9..1d14c83 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -16,10 +16,7 @@
 
 #include 
 #include 
-#include 
-#include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -32,7 +29,6 @@
 #include "trace/sync.h"
 
 static const struct fence_ops android_fence_ops;
-static const struct file_operations sync_file_fops;
 
 struct sync_timeline *sync_timeline_create(const struct sync_timeline_ops *ops,
   int size, const char *name)
@@ -136,182 +132,6 @@ struct fence *sync_pt_create(struct sync_timeline *obj, 
int size)
 }
 EXPORT_SYMBOL(sync_pt_create);
 
-static struct sync_file *sync_file_alloc(int size)
-{
-   struct sync_file *sync_file;
-
-   sync_file = kzalloc(size, GFP_KERNEL);
-   if (!sync_file)
-   return NULL;
-
-   sync_file->file = anon_inode_getfile("sync_file", &sync_file_fops,
-sync_file, 0);
-   if (IS_ERR(sync_file->file))
-   goto err;
-
-   kref_init(&sync_file->kref);
-
-   init_waitqueue_head(&sync_file->wq);
-
-   return sync_file;
-
-err:
-   kfree(sync_file);
-   return NULL;
-}
-
-static void fence_check_cb_func(struct fence *f, struct fence_cb *cb)
-{
-   struct sync_file_cb *check;
-   struct sync_file *sync_file;
-
-   check = container_of(cb, struct sync_file_cb, cb);
-   sync_file = check->sync_file;
-
-   if (atomic_dec_and_test(&sync_file->status))
-   wake_up_all(&sync_file->wq);
-}
-
-/**
- * sync_fence_create() - creates a sync fence
- * @fence: fence to add to the sync_fence
- *
- * Creates a sync_file containg @fence. Once this is called, the sync_file
- * takes ownership of @fence.
- */
-struct sync_file *sync_file_create(struct fence *fence)
-{
-   struct sync_file *sync_file;
-
-   sync_file = sync_file_alloc(offsetof(struct sync_file, cbs[1]));
-   if (!sync_file)
-   return NULL;
-
-   sync_file->num_fences = 1;
-   atomic_set(&sync_file->status, 1);
-   snprintf(sync_file->name, sizeof(sync_file->name), "%s-%s%d-%d",
-fence->ops->get_driver_name(fence),
-fence->ops->get_timeline_name(fence), fence->context,
-fence->seqno);
-
-   sync_file->cbs[0].fence = fence;
-   sync_file->cbs[0].sync_file = sync_file;
-   if (fence_add_callback(fence, &sync_file->cbs[0].cb,
-  fence_check_cb_func))
-   atomic_dec(&sync_file->status);
-
-   sync_file_debug_add(sync_file);
-
-   return sync_file;
-}
-EXPORT_SYMBOL(sync_file_create);
-
-/**
- * sync_file_fdget() - get a sync_file from an fd
- * @fd:fd referencing a fence
- *
- * Ensures @fd references a valid sync_file, increments the refcount of the
- * backing file. Returns the sync_file or NULL in case of error.
- */
-static struct sync_file *sync_file_fdget(int fd)
-{
-   struct file *file = fget(fd);
-
-   if (!file)
-   return NULL;
-
-   if (file->f_op != &sync_file_fops)
-   goto err;
-
-   return file->private_data;
-
-err:
-   fput(file);
-   return NULL;
-}
-
-static void sync_file_add_pt(struct sync_file *sync_file, int *i,
-struct fence *fence)
-{
-   sync_file->cbs[*i].fence = fence;
-   sync_file->cbs[*i].sync_file = sync_file;
-
-   if (!fence_add_

[PATCH v2 05/13] staging/android: make sync_file_fdget() static

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

There is no plan in the near future to use this function outside of this
file so keep it as static.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.c | 3 +--
 drivers/staging/android/sync.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c
index e9bf251..7e0fa20 100644
--- a/drivers/staging/android/sync.c
+++ b/drivers/staging/android/sync.c
@@ -212,7 +212,7 @@ EXPORT_SYMBOL(sync_file_create);
  * Ensures @fd references a valid sync_file, increments the refcount of the
  * backing file. Returns the sync_file or NULL in case of error.
  */
-struct sync_file *sync_file_fdget(int fd)
+static struct sync_file *sync_file_fdget(int fd)
 {
struct file *file = fget(fd);
 
@@ -228,7 +228,6 @@ err:
fput(file);
return NULL;
 }
-EXPORT_SYMBOL(sync_file_fdget);
 
 static void sync_file_add_pt(struct sync_file *sync_file, int *i,
 struct fence *fence)
diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index ffc6df6..1f164df 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -168,7 +168,6 @@ void sync_timeline_signal(struct sync_timeline *obj);
 struct fence *sync_pt_create(struct sync_timeline *parent, int size);
 
 struct sync_file *sync_file_create(const char *name, struct fence *fence);
-struct sync_file *sync_file_fdget(int fd);
 
 #ifdef CONFIG_DEBUG_FS
 
-- 
2.5.5

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


[PATCH v2 11/13] dma-buf/sync_file: de-stage sync_file

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

sync_file is useful to connect one or more fences to the file. The file is
used by userspace to track fences between drivers that share DMA bufs.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/Kconfig  |  2 ++
 drivers/dma-buf/Kconfig  | 11 +++
 drivers/dma-buf/Makefile |  1 +
 drivers/{staging/android => dma-buf}/sync_file.c |  0
 drivers/staging/android/Kconfig  |  1 +
 drivers/staging/android/Makefile |  2 +-
 6 files changed, 16 insertions(+), 1 deletion(-)
 create mode 100644 drivers/dma-buf/Kconfig
 rename drivers/{staging/android => dma-buf}/sync_file.c (100%)

diff --git a/drivers/Kconfig b/drivers/Kconfig
index d2ac339..430f761 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -114,6 +114,8 @@ source "drivers/rtc/Kconfig"
 
 source "drivers/dma/Kconfig"
 
+source "drivers/dma-buf/Kconfig"
+
 source "drivers/dca/Kconfig"
 
 source "drivers/auxdisplay/Kconfig"
diff --git a/drivers/dma-buf/Kconfig b/drivers/dma-buf/Kconfig
new file mode 100644
index 000..9824bc4
--- /dev/null
+++ b/drivers/dma-buf/Kconfig
@@ -0,0 +1,11 @@
+menu "DMABUF options"
+
+config SYNC_FILE
+   bool "sync_file support for fences"
+   default n
+   select ANON_INODES
+   select DMA_SHARED_BUFFER
+   ---help---
+ This option enables the fence framework synchronization to export
+ sync_files to userspace that can represent one or more fences.
+endmenu
diff --git a/drivers/dma-buf/Makefile b/drivers/dma-buf/Makefile
index 57a675f..4a424ec 100644
--- a/drivers/dma-buf/Makefile
+++ b/drivers/dma-buf/Makefile
@@ -1 +1,2 @@
 obj-y := dma-buf.o fence.o reservation.o seqno-fence.o
+obj-$(CONFIG_SYNC_FILE)+= sync_file.o
diff --git a/drivers/staging/android/sync_file.c b/drivers/dma-buf/sync_file.c
similarity index 100%
rename from drivers/staging/android/sync_file.c
rename to drivers/dma-buf/sync_file.c
diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig
index 4244821..7a3a77e 100644
--- a/drivers/staging/android/Kconfig
+++ b/drivers/staging/android/Kconfig
@@ -38,6 +38,7 @@ config SW_SYNC
bool "Software synchronization objects"
default n
depends on SYNC
+   depends on SYNC_FILE
---help---
  A sync object driver that uses a 32bit counter to coordinate
  synchronization.  Useful when there is no hardware primitive backing
diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile
index ebc2df1..980d6dc 100644
--- a/drivers/staging/android/Makefile
+++ b/drivers/staging/android/Makefile
@@ -4,5 +4,5 @@ obj-y   += ion/
 
 obj-$(CONFIG_ASHMEM)   += ashmem.o
 obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o
-obj-$(CONFIG_SYNC) += sync_file.o sync.o sync_debug.o
+obj-$(CONFIG_SYNC) += sync.o sync_debug.o
 obj-$(CONFIG_SW_SYNC)  += sw_sync.o
-- 
2.5.5

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


[PATCH v2 13/13] Documentation: add Sync File doc

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Add sync_file documentation on dma-buf-sync_file.txt
Reviewed-by: Daniel Vetter 
---
 Documentation/sync_file.txt | 69 +
 1 file changed, 69 insertions(+)
 create mode 100644 Documentation/sync_file.txt

diff --git a/Documentation/sync_file.txt b/Documentation/sync_file.txt
new file mode 100644
index 000..eaf8297
--- /dev/null
+++ b/Documentation/sync_file.txt
@@ -0,0 +1,69 @@
+ Sync File API Guide
+ ~~~
+
+   Gustavo Padovan
+ 
+
+This document serves as a guide for device drivers writers on what the
+sync_file API is, and how drivers can support it. Sync file is the carrier of
+the fences(struct fence) that needs to synchronized between drivers or across
+process boundaries.
+
+The sync_file API is meant to be used to send and receive fence information
+to/from userspace. It enables userspace to do explicit fencing, where instead
+of attaching a fence to the buffer a producer driver (such as a GPU or V4L
+driver) sends the fence related to the buffer to userspace via a sync_file.
+
+The sync_file then can be sent to the consumer (DRM driver for example), that
+will not use the buffer for anything before the fence(s) signals, i.e., the
+driver that issued the fence is not using/processing the buffer anymore, so it
+signals that the buffer is ready to use. And vice-versa for the consumer ->
+producer part of the cycle.
+
+Sync files allows userspace awareness on buffer sharing synchronization between
+drivers.
+
+Sync file was originally added in the Android kernel but current Linux Desktop
+can benefit a lot from it.
+
+in-fences and out-fences
+
+
+Sync files can go either to or from userspace. When a sync_file is sent from
+the driver to userspace we call the fences it contains 'out-fences'. They are
+related to a buffer that the driver is processing or is going to process, so
+the driver an create out-fence to be able to notify, through fence_signal(),
+when it has finished using (or processing) that buffer. Out-fences are fences
+that the driver creates.
+
+On the other hand if the driver receives fence(s) through a sync_file from
+userspace we call these fence(s) 'in-fences'. Receiveing in-fences means that
+we need to wait for the fence(s) to signal before using any buffer related to
+the in-fences.
+
+Creating Sync Files
+---
+
+When a driver needs to send an out-fence userspace it creates a sync_file.
+
+Interface:
+   struct sync_file *sync_file_create(struct fence *fence);
+
+The caller pass the out-fence and gets back the sync_file. That is just the
+first step, next it needs to install an fd on sync_file->file. So it gets an
+fd:
+
+   fd = get_unused_fd_flags(O_CLOEXEC);
+
+and installs it on sync_file->file:
+
+   fd_install(fd, sync_file->file);
+
+The sync_file fd now can be sent to userspace.
+
+If the creation process fail, or the sync_file needs to be released by any
+other reason fput(sync_file->file) should be used.
+
+References:
+[1] struct sync_file in include/linux/sync_file.h
+[2] All interfaces mentioned above defined in include/linux/sync_file.h
-- 
2.5.5

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


[PATCH v2 10/13] dma-buf/sync_file: de-stage sync_file headers

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Move sync_file headers file to include/ dir.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync.h   | 4 ++--
 drivers/staging/android/sync_debug.c | 2 +-
 drivers/staging/android/sync_file.c  | 4 ++--
 {drivers/staging/android => include/linux}/sync_file.h   | 0
 {drivers/staging/android/uapi => include/uapi/linux}/sync_file.h | 0
 5 files changed, 5 insertions(+), 5 deletions(-)
 rename {drivers/staging/android => include/linux}/sync_file.h (100%)
 rename {drivers/staging/android/uapi => include/uapi/linux}/sync_file.h (100%)

diff --git a/drivers/staging/android/sync.h b/drivers/staging/android/sync.h
index df44abb..b56885c 100644
--- a/drivers/staging/android/sync.h
+++ b/drivers/staging/android/sync.h
@@ -20,8 +20,8 @@
 #include 
 #include 
 
-#include "sync_file.h"
-#include "uapi/sync_file.h"
+#include 
+#include 
 
 struct sync_timeline;
 
diff --git a/drivers/staging/android/sync_debug.c 
b/drivers/staging/android/sync_debug.c
index 8b55218..5f57499 100644
--- a/drivers/staging/android/sync_debug.c
+++ b/drivers/staging/android/sync_debug.c
@@ -26,7 +26,7 @@
 #include 
 #include 
 #include 
-#include "sync_file.h"
+#include 
 #include "sw_sync.h"
 
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/staging/android/sync_file.c 
b/drivers/staging/android/sync_file.c
index eabf90d..f08cf2d 100644
--- a/drivers/staging/android/sync_file.c
+++ b/drivers/staging/android/sync_file.c
@@ -23,8 +23,8 @@
 #include 
 #include 
 #include 
-#include "sync_file.h"
-#include "uapi/sync_file.h"
+#include 
+#include 
 
 static const struct file_operations sync_file_fops;
 
diff --git a/drivers/staging/android/sync_file.h b/include/linux/sync_file.h
similarity index 100%
rename from drivers/staging/android/sync_file.h
rename to include/linux/sync_file.h
diff --git a/drivers/staging/android/uapi/sync_file.h 
b/include/uapi/linux/sync_file.h
similarity index 100%
rename from drivers/staging/android/uapi/sync_file.h
rename to include/uapi/linux/sync_file.h
-- 
2.5.5

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


[PATCH v2 09/13] staging/android: style fix: alignment to match the open parenthesis

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Fix checks reported by checkpatch.pl.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync_file.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/android/sync_file.c 
b/drivers/staging/android/sync_file.c
index d9da3a4..eabf90d 100644
--- a/drivers/staging/android/sync_file.c
+++ b/drivers/staging/android/sync_file.c
@@ -242,7 +242,7 @@ static unsigned int sync_file_poll(struct file *file, 
poll_table *wait)
 }
 
 static long sync_file_ioctl_merge(struct sync_file *sync_file,
-  unsigned long arg)
+ unsigned long arg)
 {
int fd = get_unused_fd_flags(O_CLOEXEC);
int err;
@@ -297,7 +297,7 @@ err_put_fd:
 }
 
 static void sync_fill_fence_info(struct fence *fence,
-   struct sync_fence_info *info)
+struct sync_fence_info *info)
 {
strlcpy(info->obj_name, fence->ops->get_timeline_name(fence),
sizeof(info->obj_name));
@@ -311,7 +311,7 @@ static void sync_fill_fence_info(struct fence *fence,
 }
 
 static long sync_file_ioctl_fence_info(struct sync_file *sync_file,
-   unsigned long arg)
+  unsigned long arg)
 {
struct sync_file_info info;
struct sync_fence_info *fence_info = NULL;
@@ -370,7 +370,7 @@ out:
 }
 
 static long sync_file_ioctl(struct file *file, unsigned int cmd,
-unsigned long arg)
+   unsigned long arg)
 {
struct sync_file *sync_file = file->private_data;
 
-- 
2.5.5

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


[PATCH v2 08/13] staging/android: improve documentation for sync_file

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

num_fences was missing a colon mark and sync_file_create() now have
better description.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 drivers/staging/android/sync_file.c | 5 +++--
 drivers/staging/android/sync_file.h | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/android/sync_file.c 
b/drivers/staging/android/sync_file.c
index 2c724ec..d9da3a4 100644
--- a/drivers/staging/android/sync_file.c
+++ b/drivers/staging/android/sync_file.c
@@ -65,11 +65,12 @@ static void fence_check_cb_func(struct fence *f, struct 
fence_cb *cb)
 }
 
 /**
- * sync_fence_create() - creates a sync fence
+ * sync_file_create() - creates a sync file
  * @fence: fence to add to the sync_fence
  *
  * Creates a sync_file containg @fence. Once this is called, the sync_file
- * takes ownership of @fence.
+ * takes ownership of @fence. The sync_file can be released with
+ * fput(sync_file->file). Returns the sync_file or NULL in case of error.
  */
 struct sync_file *sync_file_create(struct fence *fence)
 {
diff --git a/drivers/staging/android/sync_file.h 
b/drivers/staging/android/sync_file.h
index 8a1b546..c6ffe8b 100644
--- a/drivers/staging/android/sync_file.h
+++ b/drivers/staging/android/sync_file.h
@@ -32,7 +32,7 @@ struct sync_file_cb {
  * @kref:  reference count on fence.
  * @name:  name of sync_file.  Useful for debugging
  * @sync_file_list:membership in global file list
- * @num_fences number of sync_pts in the fence
+ * @num_fences:number of sync_pts in the fence
  * @wq:wait queue for fence signaling
  * @status:0: signaled, >0:active, <0: error
  * @cbs:   sync_pts callback information
-- 
2.5.5

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


[PATCH v2 12/13] Documentation: include sync_file into DocBook

2016-04-28 Thread Gustavo Padovan
From: Gustavo Padovan 

Add entry in device-drivers.tmpl for sync_file documentation.

Signed-off-by: Gustavo Padovan 
Reviewed-by: Daniel Vetter 
---
 Documentation/DocBook/device-drivers.tmpl | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/DocBook/device-drivers.tmpl 
b/Documentation/DocBook/device-drivers.tmpl
index 184f3c7..509a187 100644
--- a/Documentation/DocBook/device-drivers.tmpl
+++ b/Documentation/DocBook/device-drivers.tmpl
@@ -136,6 +136,8 @@ X!Edrivers/base/interface.c
 !Iinclude/linux/seqno-fence.h
 !Edrivers/dma-buf/reservation.c
 !Iinclude/linux/reservation.h
+!Edrivers/dma-buf/sync_file.c
+!Iinclude/linux/sync_file.h
 !Edrivers/base/dma-coherent.c
 !Edrivers/base/dma-mapping.c
  
-- 
2.5.5

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


Re: [RFC v2 1/8] dma-buf/fence: add fence_collection fences

2016-04-28 Thread Gustavo Padovan
2016-04-26 Chris Wilson :

> On Mon, Apr 25, 2016 at 07:33:21PM -0300, Gustavo Padovan wrote:
> > +static const char *fence_collection_get_timeline_name(struct fence *fence)
> > +{
> > +   return "no context";
> 
> "unbound" to distinguish from fence contexts within a timeline?
> 
> > +static bool fence_collection_enable_signaling(struct fence *fence)
> > +{
> > +   struct fence_collection *collection = to_fence_collection(fence);
> > +   int i;
> > +
> > +   for (i = 0 ; i < collection->num_fences ; i++) {
> > +   if (fence_add_callback(collection->fences[i].fence,
> > +  &collection->fences[i].cb,
> > +  collection_check_cb_func)) {
> > +   atomic_dec(&collection->num_pending_fences);
> > +   return false;
> 
> Don't stop, we need to enable all the others!
> 
> > +   }
> > +   }
> > +
> > +   return !!atomic_read(&collection->num_pending_fences);
> 
> Redundant !!
> 
> > +}
> > +
> > +static bool fence_collection_signaled(struct fence *fence)
> > +{
> > +   struct fence_collection *collection = to_fence_collection(fence);
> > +
> > +   return (atomic_read(&collection->num_pending_fences) == 0);
> 
> Redundant ()
> 
> > +static signed long fence_collection_wait(struct fence *fence, bool intr,
> > +signed long timeout)
> > +{
> 
> What advantage does this have over fence_default_wait? You enable
> signaling on all, then wait sequentially. The code looks redundant and
> could just use fence_default_wait instead.

None actually, I'll just replace it with fence_default_wait().

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


Re: [RFC v2 8/8] drm/fence: add out-fences support

2016-04-28 Thread Gustavo Padovan
2016-04-26 Daniel Vetter :

> On Mon, Apr 25, 2016 at 07:33:28PM -0300, Gustavo Padovan wrote:
> > From: Gustavo Padovan 
> > 
> > Support DRM out-fences creating a sync_file with a fence for each crtc
> > update with the DRM_MODE_ATOMIC_OUT_FENCE flag.
> > 
> > We then send an struct drm_out_fences array with the out-fences fds back in
> > the drm_atomic_ioctl() as an out arg in the out_fences_ptr field.
> > 
> > struct drm_out_fences {
> > __u32   crtc_id;
> > __u32   fd;
> > };
> > 
> > v2: Comment by Rob Clark:
> > - Squash commit that adds DRM_MODE_ATOMIC_OUT_FENCE flag here.
> > 
> > Comment by Daniel Vetter:
> > - Add clean up code for out_fences
> > 
> > Signed-off-by: Gustavo Padovan 
> > ---
> >  drivers/gpu/drm/drm_atomic.c | 163 
> > +--
> >  include/drm/drm_crtc.h   |  10 +++
> >  include/uapi/drm/drm_mode.h  |  11 ++-
> >  3 files changed, 179 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/drm_atomic.c b/drivers/gpu/drm/drm_atomic.c
> > index 5f9d434..06c6007 100644
> > --- a/drivers/gpu/drm/drm_atomic.c
> > +++ b/drivers/gpu/drm/drm_atomic.c
> > @@ -1566,6 +1566,133 @@ void drm_atomic_clean_old_fb(struct drm_device *dev,
> >  }
> >  EXPORT_SYMBOL(drm_atomic_clean_old_fb);
> >  
> > +static struct drm_out_fence_state *get_out_fence(struct drm_device *dev,
> > +struct drm_atomic_state *state,
> > +uint32_t __user 
> > *out_fences_ptr,
> > +uint64_t count_out_fences,
> > +uint64_t user_data)
> > +{
> > +   struct drm_crtc *crtc;
> > +   struct drm_crtc_state *crtc_state;
> > +   struct drm_out_fences *out_fences;
> > +   struct drm_out_fence_state *fence_state;
> > +   int num_fences = 0;
> > +   int i, ret;
> > +
> > +   if (count_out_fences > dev->mode_config.num_crtc)
> > +   return ERR_PTR(-EINVAL);
> > +
> > +   out_fences = kcalloc(count_out_fences, sizeof(*out_fences),
> > +GFP_KERNEL);
> > +   if (!out_fences)
> > +   return ERR_PTR(-ENOMEM);
> 
> A bit tricky, but the above kcalloc is the only thing that catches integer
> overflows in count_out_fences. Needs a comment imo since this could be a
> security exploit if we accidentally screw it up.

The check above makes sure that count_out_fences is not bigger than
num_crtc. Don't that fix this?

> 
> Also needs a testcase imo.
> 
> > +
> > +   fence_state = kcalloc(count_out_fences, sizeof(*fence_state),
> > +GFP_KERNEL);
> > +   if (!fence_state) {
> > +   kfree(out_fences);
> > +   return ERR_PTR(-ENOMEM);
> > +   }
> > +
> > +   for (i = 0 ; i < count_out_fences ; i++)
> > +   fence_state[i].fd = -1;
> > +
> > +   for_each_crtc_in_state(state, crtc, crtc_state, i) {
> > +   struct drm_pending_vblank_event *e;
> > +   struct fence *fence;
> > +   char name[32];
> > +
> > +   fence = kzalloc(sizeof(*fence), GFP_KERNEL);
> > +   if (!fence) {
> > +   ret = -ENOMEM;
> > +   goto out;
> > +   }
> > +
> > +   fence_init(fence, &drm_crtc_fence_ops, &crtc->fence_lock,
> > +  crtc->fence_context, crtc->fence_seqno);
> > +
> > +   snprintf(name, sizeof(name), "crtc-%d_%lu",
> > +drm_crtc_index(crtc), crtc->fence_seqno++);
> 
> Hm ... fence_init_with_name? I'm kinda confused why we only name fences
> that are exported though, and why not all of them. Debugging fence
> deadlocks is real hard, so giving them all names might be a good idea.
> 
> Anyway, seems like more room for a bit more sync_file/struct fence
> merging.

We just removed name from sync_file_create() so snprintf() is not even
necessary here anymore.

> 
> > +
> > +   fence_state[i].fd = get_unused_fd_flags(O_CLOEXEC);
> > +   if (fence_state[i].fd < 0) {
> > +   fence_put(fence);
> > +   ret = fence_state[i].fd;
> > +   goto out;
> > +   }
> > +
> > +   fence_state[i].sync_file = sync_file_create(name, fence);
> > +   if(!fence_state[i].sync_file) {
> > +   fence_put(fence);
> > +   ret = -ENOMEM;
> > +   goto out;
> > +   }
> > +
> > +   if (crtc_state->event) {
> > +   crtc_state->event->base.fence = fence;
> > +   } else {
> 
> This looks a bit funny - I'd change the create event logic to create an
> event either if we have the either drm event or out-fence flag set.

Ok.

> 
> > +   e = create_vblank_event(dev, NULL, fence, user_data);
> > +   if (!e) {
> > +   ret = -ENOMEM;
> > +   goto out;
> > +   }
> > +
> > +   crt

[PATCH 2/8] staging: lustre: echo: remove echo_env_info() regions from echo_client.c

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

This function declartion is not needed so remove it.

Signed-off-by: John L. Hammond 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/5580
Reviewed-by: James Simmons 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/obdecho/echo_client.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdecho/echo_client.c 
b/drivers/staging/lustre/lustre/obdecho/echo_client.c
index b271895..1225944 100644
--- a/drivers/staging/lustre/lustre/obdecho/echo_client.c
+++ b/drivers/staging/lustre/lustre/obdecho/echo_client.c
@@ -163,8 +163,6 @@ static int cl_echo_object_put(struct echo_object *eco);
 static int cl_echo_object_brw(struct echo_object *eco, int rw, u64 offset,
  struct page **pages, int npages, int async);
 
-static struct echo_thread_info *echo_env_info(const struct lu_env *env);
-
 struct echo_thread_info {
struct echo_object_conf eti_conf;
struct lustre_mdeti_md;
-- 
2.7.4

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


[PATCH 3/8] staging: lustre: brw: added OBDO short io flag

2016-04-28 Thread James Simmons
From: Alexander Boyko 

To prevent collisions with any future flags needed in features written
against this branch.

Signed-off-by: Alexander Boyko 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1757
Xyratex-bug-id: MRP-1460
Reviewed-on: http://review.whamcloud.com/8182
Reviewed-by: Andreas Dilger 
Reviewed-by: Vitaly Fertman 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/lustre/lustre_idl.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h 
b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
index 0ef540a..9185ed2 100644
--- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
+++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h
@@ -1433,6 +1433,7 @@ enum obdo_flags {
OBD_FL_RECOV_RESEND = 0x0008, /* recoverable resent */
OBD_FL_NOSPC_BLK= 0x0010, /* no more block space on OST */
OBD_FL_FLUSH= 0x0020, /* flush pages on the OST */
+   OBD_FL_SHORT_IO = 0x0040, /* short io request */
 
/* Note that while these checksum values are currently separate bits,
 * in 2.x we can actually allow all values from 1-31 if we wanted.
-- 
2.7.4

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


[PATCH 7/8] staging: lustre: debugfs: improve osc/mdc "imports" connect data

2016-04-28 Thread James Simmons
From: Emoly Liu 

Improve /sys/debug/fs/lustre/{osc,mdc}/*/import files to print
the struct obd_connect_data data fields as "connect_data:"
in addition to the "connect_flags:" field.

Signed-off-by: Emoly Liu 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3386
Reviewed-on: http://review.whamcloud.com/6588
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Reviewed-by: John L. Hammond 
Signed-off-by: James Simmons 
---
 .../lustre/lustre/obdclass/lprocfs_status.c| 63 +++---
 1 file changed, 57 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c 
b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
index b2f309d..5a1eae1 100644
--- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
+++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c
@@ -49,7 +49,7 @@
 static const char * const obd_connect_names[] = {
"read_only",
"lov_index",
-   "unused",
+   "connect_from_mds",
"write_grant",
"server_lock",
"version",
@@ -122,6 +122,56 @@ int obd_connect_flags2str(char *page, int count, __u64 
flags, char *sep)
 }
 EXPORT_SYMBOL(obd_connect_flags2str);
 
+static void obd_connect_data_seqprint(struct seq_file *m,
+ struct obd_connect_data *ocd)
+{
+   int flags;
+
+   LASSERT(ocd);
+   flags = ocd->ocd_connect_flags;
+
+   seq_printf(m, "connect_data:\n"
+  "   flags: %llx\n"
+  "   instance: %u\n",
+  ocd->ocd_connect_flags,
+  ocd->ocd_instance);
+   if (flags & OBD_CONNECT_VERSION)
+   seq_printf(m, "   target_version: %u.%u.%u.%u\n",
+  OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
+  OBD_OCD_VERSION_MINOR(ocd->ocd_version),
+  OBD_OCD_VERSION_PATCH(ocd->ocd_version),
+  OBD_OCD_VERSION_FIX(ocd->ocd_version));
+   if (flags & OBD_CONNECT_MDS)
+   seq_printf(m, "   mdt_index: %d\n", ocd->ocd_group);
+   if (flags & OBD_CONNECT_GRANT)
+   seq_printf(m, "   initial_grant: %d\n", ocd->ocd_grant);
+   if (flags & OBD_CONNECT_INDEX)
+   seq_printf(m, "   target_index: %u\n", ocd->ocd_index);
+   if (flags & OBD_CONNECT_BRW_SIZE)
+   seq_printf(m, "   max_brw_size: %d\n", ocd->ocd_brw_size);
+   if (flags & OBD_CONNECT_IBITS)
+   seq_printf(m, "   ibits_known: %llx\n",
+  ocd->ocd_ibits_known);
+   if (flags & OBD_CONNECT_GRANT_PARAM)
+   seq_printf(m, "   grant_block_size: %d\n"
+  "   grant_inode_size: %d\n"
+  "   grant_extent_overhead: %d\n",
+  ocd->ocd_blocksize,
+  ocd->ocd_inodespace,
+  ocd->ocd_grant_extent);
+   if (flags & OBD_CONNECT_TRANSNO)
+   seq_printf(m, "   first_transno: %llx\n",
+  ocd->ocd_transno);
+   if (flags & OBD_CONNECT_CKSUM)
+   seq_printf(m, "   cksum_types: %#x\n",
+  ocd->ocd_cksum_types);
+   if (flags & OBD_CONNECT_MAX_EASIZE)
+   seq_printf(m, "   max_easize: %d\n", ocd->ocd_max_easize);
+   if (flags & OBD_CONNECT_MAXBYTES)
+   seq_printf(m, "   max_object_bytes: %llx\n",
+  ocd->ocd_maxbytes);
+}
+
 int lprocfs_read_frac_helper(char *buffer, unsigned long count, long val,
 int mult)
 {
@@ -624,6 +674,7 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
struct obd_device   *obd= data;
struct obd_import   *imp;
struct obd_import_conn  *conn;
+   struct obd_connect_data *ocd;
int j;
int k;
int rw  = 0;
@@ -635,9 +686,9 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
return rc;
 
imp = obd->u.cli.cl_import;
+   ocd = &imp->imp_connect_data;
 
-   seq_printf(m,
-  "import:\n"
+   seq_printf(m, "import:\n"
   "name: %s\n"
   "target: %s\n"
   "state: %s\n"
@@ -649,9 +700,9 @@ int lprocfs_rd_import(struct seq_file *m, void *data)
   imp->imp_connect_data.ocd_instance);
obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags,
  ", ");
-   seq_printf(m,
-  " ]\n"
-  "import_flags: [ ");
+   seq_printf(m, " ]\n");
+   obd_connect_data_seqprint(m, ocd);
+   seq_printf(m, "import_flags: [ ");
obd_import_flags2str(imp, m);
 
seq_printf(

[PATCH 8/8] staging: lustre: llite: quiet overly verbose info message

2016-04-28 Thread James Simmons
From: Andreas Dilger 

The client doesn't need to print a message for every client mount that
the layout lock feature is enabled.  This can be found at runtime via
the "import" proc file.

I also noticed that deleting OST objects logs into the debug log with
D_HA status, which is enabled by default.  Move this over to D_INODE
so it doesn't fill the OST debug logs.

Signed-off-by: Andreas Dilger 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1095
Reviewed-on: http://review.whamcloud.com/7918
Reviewed-by: Bob Glossman 
Reviewed-by: Emoly Liu 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/llite/llite_lib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c 
b/drivers/staging/lustre/lustre/llite/llite_lib.c
index 8d88d4c..64be2c1 100644
--- a/drivers/staging/lustre/lustre/llite/llite_lib.c
+++ b/drivers/staging/lustre/lustre/llite/llite_lib.c
@@ -331,10 +331,8 @@ static int client_common_fill_super(struct super_block 
*sb, char *md, char *dt,
else
sbi->ll_md_brw_size = PAGE_SIZE;
 
-   if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK) {
-   LCONSOLE_INFO("Layout lock feature supported.\n");
+   if (data->ocd_connect_flags & OBD_CONNECT_LAYOUTLOCK)
sbi->ll_flags |= LL_SBI_LAYOUT_LOCK;
-   }
 
if (data->ocd_ibits_known & MDS_INODELOCK_XATTR) {
if (!(data->ocd_connect_flags & OBD_CONNECT_MAX_EASIZE)) {
-- 
2.7.4

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


[PATCH 0/8] staging : lustre : missing fixes for lustre 2.5.53

2016-04-28 Thread James Simmons
This next set of patches covers what is in the upstream client that
is present in lustre 2.5.53

Alexander Boyko (1):
  staging: lustre: brw: added OBDO short io flag

Andreas Dilger (1):
  staging: lustre: llite: quiet overly verbose info message

Emoly Liu (2):
  staging: lustre: obd: add case LCFG_PARAM to osd_process_config
  staging: lustre: debugfs: improve osc/mdc "imports" connect data

John L. Hammond (1):
  staging: lustre: echo: remove echo_env_info() regions from echo_client.c

Oleg Drokin (1):
  staging: lustre: debug: initialize debug_msg_data if needed

Sebastien Buisson (1):
  staging: lustre: ldlm: dont always check max_pages_per_rpc alignement

wang di (1):
  staging: lustre: fld: add local fldb to each target

 drivers/staging/lustre/lustre/fid/fid_request.c|  5 +-
 drivers/staging/lustre/lustre/fld/fld_internal.h   |  9 +--
 drivers/staging/lustre/lustre/fld/fld_request.c| 79 +++---
 drivers/staging/lustre/lustre/include/cl_object.h  |  6 +-
 drivers/staging/lustre/lustre/include/lu_object.h  |  6 +-
 .../lustre/lustre/include/lustre/lustre_idl.h  | 20 +-
 .../staging/lustre/lustre/include/lustre_param.h   |  1 +
 .../lustre/lustre/include/lustre_req_layout.h  |  1 +
 .../staging/lustre/lustre/include/obd_support.h|  1 +
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c  |  6 ++
 drivers/staging/lustre/lustre/llite/llite_lib.c|  4 +-
 .../lustre/lustre/obdclass/lprocfs_status.c| 63 +++--
 .../staging/lustre/lustre/obdclass/obd_config.c| 20 +++---
 .../staging/lustre/lustre/obdecho/echo_client.c|  2 -
 drivers/staging/lustre/lustre/ptlrpc/layout.c  | 15 
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|  1 +
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c|  4 +-
 17 files changed, 176 insertions(+), 67 deletions(-)

--
2.7.4

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


[PATCH 4/8] staging: lustre: fld: add local fldb to each target

2016-04-28 Thread James Simmons
From: wang di 

Add local FLDB to each MDT, so OSD/OUT can check whether
FID is remote by looking up local FLDB, i.e. no need send RPC
to MDT0. This is just the client part of the work.

Signed-off-by: wang di 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4076
Reviewed-on: http://review.whamcloud.com/7884
Reviewed-by: John L. Hammond 
Reviewed-by: Andreas Dilger 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/fid/fid_request.c|  5 +-
 drivers/staging/lustre/lustre/fld/fld_internal.h   |  9 +--
 drivers/staging/lustre/lustre/fld/fld_request.c| 79 +++---
 .../lustre/lustre/include/lustre/lustre_idl.h  | 19 +-
 .../lustre/lustre/include/lustre_req_layout.h  |  1 +
 .../staging/lustre/lustre/include/obd_support.h|  1 +
 drivers/staging/lustre/lustre/ptlrpc/layout.c  | 15 
 .../staging/lustre/lustre/ptlrpc/lproc_ptlrpc.c|  1 +
 drivers/staging/lustre/lustre/ptlrpc/wiretest.c|  4 +-
 9 files changed, 95 insertions(+), 39 deletions(-)

diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c 
b/drivers/staging/lustre/lustre/fid/fid_request.c
index 39269c3..32e4d95 100644
--- a/drivers/staging/lustre/lustre/fid/fid_request.c
+++ b/drivers/staging/lustre/lustre/fid/fid_request.c
@@ -66,6 +66,7 @@ static int seq_client_rpc(struct lu_client_seq *seq,
unsigned int   debug_mask;
intrc;
 
+   LASSERT(exp && !IS_ERR(exp));
req = ptlrpc_request_alloc_pack(class_exp2cliimp(exp), &RQF_SEQ_QUERY,
LUSTRE_MDS_VERSION, SEQ_QUERY);
if (!req)
@@ -110,10 +111,10 @@ static int seq_client_rpc(struct lu_client_seq *seq,
 
ptlrpc_at_set_req_timeout(req);
 
-   if (seq->lcs_type == LUSTRE_SEQ_METADATA)
+   if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
mdc_get_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
rc = ptlrpc_queue_wait(req);
-   if (seq->lcs_type == LUSTRE_SEQ_METADATA)
+   if (opc != SEQ_ALLOC_SUPER && seq->lcs_type == LUSTRE_SEQ_METADATA)
mdc_put_rpc_lock(exp->exp_obd->u.cli.cl_rpc_lock, NULL);
if (rc)
goto out_req;
diff --git a/drivers/staging/lustre/lustre/fld/fld_internal.h 
b/drivers/staging/lustre/lustre/fld/fld_internal.h
index e8a3caf..75d6a48 100644
--- a/drivers/staging/lustre/lustre/fld/fld_internal.h
+++ b/drivers/staging/lustre/lustre/fld/fld_internal.h
@@ -101,12 +101,6 @@ struct fld_cache {
unsigned int fci_no_shrink:1;
 };
 
-enum fld_op {
-   FLD_CREATE = 0,
-   FLD_DELETE = 1,
-   FLD_LOOKUP = 2
-};
-
 enum {
/* 4M of FLD cache will not hurt client a lot. */
FLD_SERVER_CACHE_SIZE  = (4 * 0x10),
@@ -126,7 +120,8 @@ enum {
 extern struct lu_fld_hash fld_hash[];
 
 int fld_client_rpc(struct obd_export *exp,
-  struct lu_seq_range *range, __u32 fld_op);
+  struct lu_seq_range *range, __u32 fld_op,
+  struct ptlrpc_request **reqp);
 
 extern struct lprocfs_vars fld_client_debugfs_list[];
 
diff --git a/drivers/staging/lustre/lustre/fld/fld_request.c 
b/drivers/staging/lustre/lustre/fld/fld_request.c
index 2dfdb51..8150a90 100644
--- a/drivers/staging/lustre/lustre/fld/fld_request.c
+++ b/drivers/staging/lustre/lustre/fld/fld_request.c
@@ -392,55 +392,82 @@ void fld_client_fini(struct lu_client_fld *fld)
 EXPORT_SYMBOL(fld_client_fini);
 
 int fld_client_rpc(struct obd_export *exp,
-  struct lu_seq_range *range, __u32 fld_op)
+  struct lu_seq_range *range, __u32 fld_op,
+  struct ptlrpc_request **reqp)
 {
-   struct ptlrpc_request *req;
+   struct ptlrpc_request *req = NULL;
struct lu_seq_range   *prange;
__u32*op;
-   int rc;
+   int rc = 0;
struct obd_import *imp;
 
LASSERT(exp);
 
imp = class_exp2cliimp(exp);
-   req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY, LUSTRE_MDS_VERSION,
-   FLD_QUERY);
-   if (!req)
-   return -ENOMEM;
-
-   op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC);
-   *op = fld_op;
+   switch (fld_op) {
+   case FLD_QUERY:
+   req = ptlrpc_request_alloc_pack(imp, &RQF_FLD_QUERY,
+   LUSTRE_MDS_VERSION, FLD_QUERY);
+   if (!req)
+   return -ENOMEM;
+
+   /*
+* XXX: only needed when talking to old server(< 2.6), it should
+* be removed when < 2.6 server is not supported
+*/
+   op = req_capsule_client_get(&req->rq_pill, &RMF_FLD_OPC);
+   *op = FLD_LOOKUP;
+
+   if (imp->imp_connect_flags_orig & OBD_CONNECT_MDS_MDS)
+   req->rq_allow_repl

[PATCH 1/8] staging: lustre: debug: initialize debug_msg_data if needed

2016-04-28 Thread James Simmons
From: Oleg Drokin 

initialize the libcfs_debug_msg_data only if needed

Signed-off-by: Oleg Drokin 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1408
Reviewed-on: http://review.whamcloud.com/8338
Reviewed-by: Jinshan Xiong 
Reviewed-by: John L. Hammond 
Reviewed-by: Oleg Drokin 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/cl_object.h | 6 ++
 drivers/staging/lustre/lustre/include/lu_object.h | 6 ++
 2 files changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/cl_object.h 
b/drivers/staging/lustre/lustre/include/cl_object.h
index 587a236..d4c33dd 100644
--- a/drivers/staging/lustre/lustre/include/cl_object.h
+++ b/drivers/staging/lustre/lustre/include/cl_object.h
@@ -1041,9 +1041,8 @@ struct cl_page_operations {
  */
 #define CL_PAGE_DEBUG(mask, env, page, format, ...) \
 do {   \
-   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);\
-   \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {  \
+   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);\
cl_page_print(env, &msgdata, lu_cdebug_printer, page);  \
CDEBUG(mask, format, ## __VA_ARGS__); \
}  \
@@ -1054,9 +1053,8 @@ do {  
\
  */
 #define CL_PAGE_HEADER(mask, env, page, format, ...) \
 do { \
-   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);  \
- \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {\
+   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);
\
cl_page_header_print(env, &msgdata, lu_cdebug_printer, page); \
CDEBUG(mask, format, ## __VA_ARGS__);   \
}\
diff --git a/drivers/staging/lustre/lustre/include/lu_object.h 
b/drivers/staging/lustre/lustre/include/lu_object.h
index dad757f..41c45ff 100644
--- a/drivers/staging/lustre/lustre/include/lu_object.h
+++ b/drivers/staging/lustre/lustre/include/lu_object.h
@@ -781,9 +781,8 @@ int lu_cdebug_printer(const struct lu_env *env,
  */
 #define LU_OBJECT_DEBUG(mask, env, object, format, ...)   \
 do { \
-   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);  \
- \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {\
+   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);
\
lu_object_print(env, &msgdata, lu_cdebug_printer, object);\
CDEBUG(mask, format, ## __VA_ARGS__);   \
}\
@@ -794,9 +793,8 @@ do {
  \
  */
 #define LU_OBJECT_HEADER(mask, env, object, format, ...)   \
 do {   \
-   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);\
-   \
if (cfs_cdebug_show(mask, DEBUG_SUBSYSTEM)) {  \
+   LIBCFS_DEBUG_MSG_DATA_DECL(msgdata, mask, NULL);
\
lu_object_header_print(env, &msgdata, lu_cdebug_printer,\
   (object)->lo_header);\
lu_cdebug_printer(env, &msgdata, "\n");  \
-- 
2.7.4

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


[PATCH 6/8] staging: lustre: obd: add case LCFG_PARAM to osd_process_config

2016-04-28 Thread James Simmons
From: Emoly Liu 

Some proc parameters were moved from ofd to osd module and only
their symlinks were kept in ofd for interoperability/compatibility.
To process this kind of config params passed by ofd, this patch is
to do the following fixes:

 - since these parameters are not included by the static lprocfs var
   list, a pre-check is added for them to avoid "unknown param" error
   message confuses the uses. If they are matched in this check, they
   will be passed to the osd directly.
 - improve the error messages in class_process_proc_param() and
   class_process_proc_seq_param() a little.

Signed-off-by: Emoly Liu 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4221
Reviewed-on: http://review.whamcloud.com/8238
Reviewed-by: Andreas Dilger 
Reviewed-by: James Simmons 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/include/lustre_param.h |  1 +
 drivers/staging/lustre/lustre/obdclass/obd_config.c  | 20 +++-
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_param.h 
b/drivers/staging/lustre/lustre/include/lustre_param.h
index 383fe6f..a42cf90 100644
--- a/drivers/staging/lustre/lustre/include/lustre_param.h
+++ b/drivers/staging/lustre/lustre/include/lustre_param.h
@@ -89,6 +89,7 @@ int class_parse_nid_quiet(char *buf, lnet_nid_t *nid, char 
**endh);
 
 /* Prefixes for parameters handled by obd's proc methods (XXX_process_config) 
*/
 #define PARAM_OST"ost."
+#define PARAM_OSD  "osd."
 #define PARAM_OSC"osc."
 #define PARAM_MDT"mdt."
 #define PARAM_MDD"mdd."
diff --git a/drivers/staging/lustre/lustre/obdclass/obd_config.c 
b/drivers/staging/lustre/lustre/obdclass/obd_config.c
index e60ef4a..72ee1cb 100644
--- a/drivers/staging/lustre/lustre/obdclass/obd_config.c
+++ b/drivers/staging/lustre/lustre/obdclass/obd_config.c
@@ -1001,7 +1001,13 @@ int class_process_proc_param(char *prefix, struct 
lprocfs_vars *lvars,
for (i = 1; i < lcfg->lcfg_bufcount; i++) {
key = lustre_cfg_buf(lcfg, i);
/* Strip off prefix */
-   class_match_param(key, prefix, &key);
+   if (class_match_param(key, prefix, &key)) {
+   /*
+* If the prefix doesn't match, return error so we
+* can pass it down the stack
+*/
+   return -ENOSYS;
+   }
sval = strchr(key, '=');
if (!sval || (*(sval + 1) == 0)) {
CERROR("Can't parse param %s (missing '=')\n", key);
@@ -1034,18 +1040,14 @@ int class_process_proc_param(char *prefix, struct 
lprocfs_vars *lvars,
j++;
}
if (!matched) {
-   /* If the prefix doesn't match, return error so we
-* can pass it down the stack
-*/
-   if (strnchr(key, keylen, '.'))
-   return -ENOSYS;
-   CERROR("%s: unknown param %s\n",
+   CERROR("%.*s: %s unknown param %s\n",
+  (int)strlen(prefix) - 1, prefix,
   (char *)lustre_cfg_string(lcfg, 0), key);
/* rc = -EINVAL;continue parsing other params */
skip++;
} else if (rc < 0) {
-   CERROR("writing proc entry %s err %d\n",
-  var->name, rc);
+   CERROR("%s: error writing proc entry '%s': rc = %d\n",
+  prefix, var->name, rc);
rc = 0;
} else {
CDEBUG(D_CONFIG, "%s.%.*s: Set parameter %.*s=%s\n",
-- 
2.7.4

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


[PATCH 5/8] staging: lustre: ldlm: dont always check max_pages_per_rpc alignement

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

If connection is not established yet, cli->cl_chunkbits is
uninitilized so we cannot use it to check max_pages_per_rpc
alignment.

Signed-off-by: Sebastien Buisson 
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4379
Reviewed-on: http://review.whamcloud.com/8558
Reviewed-by: Andreas Dilger 
Reviewed-by: Bob Glossman 
Reviewed-by: Emoly Liu 
Signed-off-by: James Simmons 
---
 drivers/staging/lustre/lustre/ldlm/ldlm_lib.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c 
b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
index 00c93f3..a80569c 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lib.c
@@ -356,6 +356,12 @@ int client_obd_setup(struct obd_device *obddev, struct 
lustre_cfg *lcfg)
cli->cl_max_pages_per_rpc = min_t(int, PTLRPC_MAX_BRW_PAGES,
  LNET_MTU >> PAGE_SHIFT);
 
+   /*
+* set cl_chunkbits default value to PAGE_CACHE_SHIFT,
+* it will be updated at OSC connection time.
+*/
+   cli->cl_chunkbits = PAGE_SHIFT;
+
if (!strcmp(name, LUSTRE_MDC_NAME)) {
cli->cl_max_rpcs_in_flight = MDC_MAX_RIF_DEFAULT;
} else if (totalram_pages >> (20 - PAGE_SHIFT) <= 128 /* MB */) {
-- 
2.7.4

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


[PATCH 1/8] staging: rtl8192u: check return value of read_nic_word_E

2016-04-28 Thread Salah Triki
The call of read_nic_word_E may fail, therefore its return value must be
checked and propagated in the case of error.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8180_93cx6.c | 30 --
 drivers/staging/rtl8192u/r8180_93cx6.h |  2 +-
 2 files changed, 25 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c 
b/drivers/staging/rtl8192u/r8180_93cx6.c
index 97d9b3f..9e9959a 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.c
+++ b/drivers/staging/rtl8192u/r8180_93cx6.c
@@ -23,8 +23,11 @@
 static void eprom_cs(struct net_device *dev, short bit)
 {
u8 cmdreg;
+   int err;
 
-   read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   if (err)
+   return;
if (bit)
/* enable EPROM */
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CS_BIT);
@@ -40,8 +43,11 @@ static void eprom_cs(struct net_device *dev, short bit)
 static void eprom_ck_cycle(struct net_device *dev)
 {
u8 cmdreg;
+   int err;
 
-   read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   if (err)
+   return;
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_CK_BIT);
force_pci_posting(dev);
udelay(EPROM_DELAY);
@@ -56,8 +62,11 @@ static void eprom_ck_cycle(struct net_device *dev)
 static void eprom_w(struct net_device *dev, short bit)
 {
u8 cmdreg;
+   int err;
 
-   read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   err = read_nic_byte_E(dev, EPROM_CMD, &cmdreg);
+   if (err)
+   return;
if (bit)
write_nic_byte_E(dev, EPROM_CMD, cmdreg | EPROM_W_BIT);
else
@@ -71,8 +80,12 @@ static void eprom_w(struct net_device *dev, short bit)
 static short eprom_r(struct net_device *dev)
 {
u8 bit;
+   int err;
+
+   err = read_nic_byte_E(dev, EPROM_CMD, &bit);
+   if (err)
+   return err;
 
-   read_nic_byte_E(dev, EPROM_CMD, &bit);
udelay(EPROM_DELAY);
 
if (bit & EPROM_R_BIT)
@@ -93,7 +106,7 @@ static void eprom_send_bits_string(struct net_device *dev, 
short b[], int len)
 }
 
 
-u32 eprom_read(struct net_device *dev, u32 addr)
+int eprom_read(struct net_device *dev, u32 addr)
 {
struct r8192_priv *priv = ieee80211_priv(dev);
short read_cmd[] = {1, 1, 0};
@@ -101,6 +114,7 @@ u32 eprom_read(struct net_device *dev, u32 addr)
int i;
int addr_len;
u32 ret;
+   int err;
 
ret = 0;
/* enable EPROM programming */
@@ -144,7 +158,11 @@ u32 eprom_read(struct net_device *dev, u32 addr)
 * and reading data. (eeprom outs a dummy 0)
 */
eprom_ck_cycle(dev);
-   ret |= (eprom_r(dev)<<(15-i));
+   err = eprom_r(dev);
+   if (err)
+   return err;
+
+   ret |= err<<(15-i);
}
 
eprom_cs(dev, 0);
diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h 
b/drivers/staging/rtl8192u/r8180_93cx6.h
index b840348..9cf7f58 100644
--- a/drivers/staging/rtl8192u/r8180_93cx6.h
+++ b/drivers/staging/rtl8192u/r8180_93cx6.h
@@ -40,4 +40,4 @@
 #define EPROM_TXPW1 0x3d
 
 
-u32 eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */
+int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */
-- 
1.9.1

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


[PATCH V3 0/8] staging: rtl8192u: Checking return value/propagating errors

2016-04-28 Thread Salah Triki
These patchs check the return value/propagate error of the functions
read_nic_word_E, eprom_r, eprom_read, rtl8192_read_eeprom_info, write_nic_*.

Salah Triki (8):
  staging: rtl8192u: check return value of read_nic_word_E
  staging: rtl8192u: check return value eprom_read
  staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info
  staging: rtl8192u: check return value of rtl8192_read_eeprom_info
  staging: rtl8192u: propagate errors in write_nic_byte
  staging: rtl8192u: propagate errors in write_nic_byte_E
  staging: rtl8192u: propagate errors in write_nic_word
  staging: rtl8192u: propagate errors in write_nic_dword

 drivers/staging/rtl8192u/r8180_93cx6.c |  30 -
 drivers/staging/rtl8192u/r8180_93cx6.h |   2 +-
 drivers/staging/rtl8192u/r8192U.h  |   8 +-
 drivers/staging/rtl8192u/r8192U_core.c | 193 +++--
 4 files changed, 164 insertions(+), 69 deletions(-)

-- 
1.9.1

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


[PATCH 3/8] staging: rtl8192u: propagate errors in rtl8192_read_eeprom_info

2016-04-28 Thread Salah Triki
Propagate error from eprom_read and change the return type of
rtl8192_read_eeprom_info from void to int.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U_core.c | 37 +-
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 1c09c61..e7168da 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2433,7 +2433,7 @@ static inline u16 endian_swap(u16 *data)
return *data;
 }
 
-static void rtl8192_read_eeprom_info(struct net_device *dev)
+static int rtl8192_read_eeprom_info(struct net_device *dev)
 {
u16 wEPROM_ID = 0;
u8 bMac_Tmp_Addr[6] = {0x00, 0xe0, 0x4c, 0x00, 0x00, 0x02};
@@ -2446,7 +2446,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
RT_TRACE(COMP_EPROM, "===>%s()\n", __func__);
ret = eprom_read(dev, 0); /* first read EEPROM ID out; */
if (ret)
-   return;
+   return ret;
wEPROM_ID = (u16)ret;
RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID);
 
@@ -2460,22 +2460,22 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, EEPROM_VID >> 1);
if (ret)
-   return;
+   return ret;
tmpValue = (u16)ret;
priv->eeprom_vid = endian_swap(&tmpValue);
ret = eprom_read(dev, EEPROM_PID >> 1);
if (ret)
-   return;
+   return ret;
priv->eeprom_pid = (u16)ret;
ret = eprom_read(dev, EEPROM_ChannelPlan >> 1);
if (ret)
-   return;
+   return ret;
tmpValue = (u16)ret;
priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8;
priv->btxpowerdata_readfromEEPORM = true;
ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
if (ret)
-   return;
+   return ret;
priv->eeprom_CustomerID = (u16)ret;
} else {
priv->eeprom_vid = 0;
@@ -2497,7 +2497,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
ret = eprom_read(dev,
 (u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) 
>> 1));
if (ret)
-   return;
+   return ret;
*(u16 *)(&dev->dev_addr[i]) = (u16)ret;
}
} else {
@@ -2513,7 +2513,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1));
if (ret)
-   return;
+   return ret;
priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8;
} else {
priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower;
@@ -2523,7 +2523,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1));
if (ret)
-   return;
+   return ret;
priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff);
} else {
priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
@@ -2535,7 +2535,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_PwDiff >> 1));
if (ret)
-   return;
+   return ret;
priv->EEPROMPwDiff = ((u16)ret & 0x0f00) >> 8;
} else {
priv->EEPROMPwDiff = EEPROM_Default_PwDiff;
@@ -2545,7 +2545,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_CrystalCap >> 1));
if (ret)
-   return;
+   return ret;
priv->EEPROMCrystalCap = ((u16)ret & 0x0f);
} else {
priv->EEPROMCrystalCap = EEPROM_Default_CrystalCap;
@@ -2555,7 +2555,7 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
if (bLoad_From_EEPOM) {
ret = eprom_read(dev, (EEPROM_TxPwIndex_Ver >> 1));
if (ret)
-   return;
+ 

[PATCH 7/8] staging: rtl8192u: propagate errors in write_nic_word

2016-04-28 Thread Salah Triki
Propagate errors from kzalloc and usb_control_msg and change the
return type of write_nic_word from void to int.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 9 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index e0abcf5..27f9aa5 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1131,7 +1131,7 @@ int read_nic_dword(struct net_device *dev, int x, u32 
*data);
 int read_nic_word(struct net_device *dev, int x, u16 *data);
 int write_nic_byte(struct net_device *dev, int x, u8 y);
 int write_nic_byte_E(struct net_device *dev, int x, u8 y);
-void write_nic_word(struct net_device *dev, int x, u16 y);
+int write_nic_word(struct net_device *dev, int x, u16 y);
 void write_nic_dword(struct net_device *dev, int x, u32 y);
 void force_pci_posting(struct net_device *dev);
 
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 4c6d444..9303715 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -329,7 +329,7 @@ int write_nic_byte(struct net_device *dev, int indx, u8 
data)
 }
 
 
-void write_nic_word(struct net_device *dev, int indx, u16 data)
+int write_nic_word(struct net_device *dev, int indx, u16 data)
 {
 
int status;
@@ -339,7 +339,7 @@ void write_nic_word(struct net_device *dev, int indx, u16 
data)
u16 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
 
if (!usbdata)
-   return;
+   return -ENOMEM;
*usbdata = data;
 
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -348,9 +348,12 @@ void write_nic_word(struct net_device *dev, int indx, u16 
data)
 usbdata, 2, HZ / 2);
kfree(usbdata);
 
-   if (status < 0)
+   if (status < 0){
netdev_err(dev, "write_nic_word TimeOut! status: %d\n", status);
+   return status;
+   }
 
+   return 0;
 }
 
 
-- 
1.9.1

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


[PATCH 2/8] staging: rtl8192u: check return value eprom_read

2016-04-28 Thread Salah Triki
The call of eprom_read may fail, therefore its return value must be
checked.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U_core.c | 147 +++--
 1 file changed, 104 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 3a93218..1c09c61 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2432,6 +2432,7 @@ static inline u16 endian_swap(u16 *data)
*data = (tmp >> 8) | (tmp << 8);
return *data;
 }
+
 static void rtl8192_read_eeprom_info(struct net_device *dev)
 {
u16 wEPROM_ID = 0;
@@ -2440,9 +2441,13 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
struct r8192_priv *priv = ieee80211_priv(dev);
u16 tmpValue = 0;
int i;
+   int ret;
 
RT_TRACE(COMP_EPROM, "===>%s()\n", __func__);
-   wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */
+   ret = eprom_read(dev, 0); /* first read EEPROM ID out; */
+   if (ret)
+   return;
+   wEPROM_ID = (u16)ret;
RT_TRACE(COMP_EPROM, "EEPROM ID is 0x%x\n", wEPROM_ID);
 
if (wEPROM_ID != RTL8190_EEPROM_ID)
@@ -2453,14 +2458,25 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
bLoad_From_EEPOM = true;
 
if (bLoad_From_EEPOM) {
-   tmpValue = eprom_read(dev, EEPROM_VID >> 1);
+   ret = eprom_read(dev, EEPROM_VID >> 1);
+   if (ret)
+   return;
+   tmpValue = (u16)ret;
priv->eeprom_vid = endian_swap(&tmpValue);
-   priv->eeprom_pid = eprom_read(dev, EEPROM_PID >> 1);
-   tmpValue = eprom_read(dev, EEPROM_ChannelPlan >> 1);
+   ret = eprom_read(dev, EEPROM_PID >> 1);
+   if (ret)
+   return;
+   priv->eeprom_pid = (u16)ret;
+   ret = eprom_read(dev, EEPROM_ChannelPlan >> 1);
+   if (ret)
+   return;
+   tmpValue = (u16)ret;
priv->eeprom_ChannelPlan = (tmpValue & 0xff00) >> 8;
priv->btxpowerdata_readfromEEPORM = true;
-   priv->eeprom_CustomerID =
-   eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
+   ret = eprom_read(dev, (EEPROM_Customer_ID >> 1)) >> 8;
+   if (ret)
+   return;
+   priv->eeprom_CustomerID = (u16)ret;
} else {
priv->eeprom_vid = 0;
priv->eeprom_pid = 0;
@@ -2478,10 +2494,11 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
int i;
 
for (i = 0; i < 6; i += 2) {
-   u16 tmp = 0;
-
-   tmp = eprom_read(dev, (u16)((EEPROM_NODE_ADDRESS_BYTE_0 
+ i) >> 1));
-   *(u16 *)(&dev->dev_addr[i]) = tmp;
+   ret = eprom_read(dev,
+(u16)((EEPROM_NODE_ADDRESS_BYTE_0 + i) 
>> 1));
+   if (ret)
+   return;
+   *(u16 *)(&dev->dev_addr[i]) = (u16)ret;
}
} else {
memcpy(dev->dev_addr, bMac_Tmp_Addr, 6);
@@ -2493,48 +2510,77 @@ static void rtl8192_read_eeprom_info(struct net_device 
*dev)
 
if (priv->card_8192_version == (u8)VERSION_819xU_A) {
/* read Tx power gain offset of legacy OFDM to HT rate */
-   if (bLoad_From_EEPOM)
-   priv->EEPROMTxPowerDiff = (eprom_read(dev, 
(EEPROM_TxPowerDiff >> 1)) & 0xff00) >> 8;
-   else
+   if (bLoad_From_EEPOM) {
+   ret = eprom_read(dev, (EEPROM_TxPowerDiff >> 1));
+   if (ret)
+   return;
+   priv->EEPROMTxPowerDiff = ((u16)ret & 0xff00) >> 8;
+   } else {
priv->EEPROMTxPowerDiff = EEPROM_Default_TxPower;
+   }
RT_TRACE(COMP_EPROM, "TxPowerDiff:%d\n", 
priv->EEPROMTxPowerDiff);
/* read ThermalMeter from EEPROM */
-   if (bLoad_From_EEPOM)
-   priv->EEPROMThermalMeter = (u8)(eprom_read(dev, 
(EEPROM_ThermalMeter >> 1)) & 0x00ff);
-   else
+   if (bLoad_From_EEPOM) {
+   ret = eprom_read(dev, (EEPROM_ThermalMeter >> 1));
+   if (ret)
+   return;
+   priv->EEPROMThermalMeter = (u8)((u16)ret & 0x00ff);
+   } else {
priv->EEPROMThermalMeter = EEPROM_Default_ThermalMeter;
+   }
RT_TRACE(COMP_EPROM, "ThermalMeter:%d\n", 
priv->EEPROMThermalMeter);
/* for tx power track */
priv->TSSI_13dB

[PATCH 6/8] staging: rtl8192u: propagate errors in write_nic_byte_E

2016-04-28 Thread Salah Triki
Propagate errors from  kzalloc and usb_control_msg and change the
return type of write_nic_byte_E from void to int.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 9 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index da9b92b..e0abcf5 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1130,7 +1130,7 @@ int read_nic_byte_E(struct net_device *dev, int x, u8 
*data);
 int read_nic_dword(struct net_device *dev, int x, u32 *data);
 int read_nic_word(struct net_device *dev, int x, u16 *data);
 int write_nic_byte(struct net_device *dev, int x, u8 y);
-void write_nic_byte_E(struct net_device *dev, int x, u8 y);
+int write_nic_byte_E(struct net_device *dev, int x, u8 y);
 void write_nic_word(struct net_device *dev, int x, u16 y);
 void write_nic_dword(struct net_device *dev, int x, u32 y);
 void force_pci_posting(struct net_device *dev);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 678f4e7..4c6d444 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -254,7 +254,7 @@ u32 read_cam(struct net_device *dev, u8 addr)
return data;
 }
 
-void write_nic_byte_E(struct net_device *dev, int indx, u8 data)
+int write_nic_byte_E(struct net_device *dev, int indx, u8 data)
 {
int status;
struct r8192_priv *priv = (struct r8192_priv *)ieee80211_priv(dev);
@@ -262,7 +262,7 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 
data)
u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
 
if (!usbdata)
-   return;
+   return -ENOMEM;
*usbdata = data;
 
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -270,9 +270,12 @@ void write_nic_byte_E(struct net_device *dev, int indx, u8 
data)
 indx | 0xfe00, 0, usbdata, 1, HZ / 2);
kfree(usbdata);
 
-   if (status < 0)
+   if (status < 0){
netdev_err(dev, "write_nic_byte_E TimeOut! status: %d\n",
   status);
+   return status;
+   }
+   return 0;
 }
 
 int read_nic_byte_E(struct net_device *dev, int indx, u8 *data)
-- 
1.9.1

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


[PATCH 8/8] staging: rtl8192u: propagate errors in write_nic_dword

2016-04-28 Thread Salah Triki
Propagate errors from kzalloc and usb_control_msg and change the
return type of write_nic_dword from void to int.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U.h  | 2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 9 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index 27f9aa5..eb0c351 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1132,7 +1132,7 @@ int read_nic_word(struct net_device *dev, int x, u16 
*data);
 int write_nic_byte(struct net_device *dev, int x, u8 y);
 int write_nic_byte_E(struct net_device *dev, int x, u8 y);
 int write_nic_word(struct net_device *dev, int x, u16 y);
-void write_nic_dword(struct net_device *dev, int x, u32 y);
+int write_nic_dword(struct net_device *dev, int x, u32 y);
 void force_pci_posting(struct net_device *dev);
 
 void rtl8192_rtx_disable(struct net_device *);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 9303715..695faed 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -357,7 +357,7 @@ int write_nic_word(struct net_device *dev, int indx, u16 
data)
 }
 
 
-void write_nic_dword(struct net_device *dev, int indx, u32 data)
+int write_nic_dword(struct net_device *dev, int indx, u32 data)
 {
 
int status;
@@ -367,7 +367,7 @@ void write_nic_dword(struct net_device *dev, int indx, u32 
data)
u32 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
 
if (!usbdata)
-   return;
+   return -ENOMEM;
*usbdata = data;
 
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -377,10 +377,13 @@ void write_nic_dword(struct net_device *dev, int indx, 
u32 data)
kfree(usbdata);
 
 
-   if (status < 0)
+   if (status < 0){
netdev_err(dev, "write_nic_dword TimeOut! status: %d\n",
   status);
+   return status;
+   }
 
+   return 0;
 }
 
 
-- 
1.9.1

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


[PATCH 5/8] staging: rtl8192u: propagate errors in write_nic_byte

2016-04-28 Thread Salah Triki
Propagate errors from  kzalloc and usb_control_msg and change the
return type of write_nic_byte from void to int.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U.h  |  2 +-
 drivers/staging/rtl8192u/r8192U_core.c | 12 +++-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/rtl8192u/r8192U.h 
b/drivers/staging/rtl8192u/r8192U.h
index ee1c722..da9b92b 100644
--- a/drivers/staging/rtl8192u/r8192U.h
+++ b/drivers/staging/rtl8192u/r8192U.h
@@ -1129,7 +1129,7 @@ int read_nic_byte(struct net_device *dev, int x, u8 
*data);
 int read_nic_byte_E(struct net_device *dev, int x, u8 *data);
 int read_nic_dword(struct net_device *dev, int x, u32 *data);
 int read_nic_word(struct net_device *dev, int x, u16 *data);
-void write_nic_byte(struct net_device *dev, int x, u8 y);
+int write_nic_byte(struct net_device *dev, int x, u8 y);
 void write_nic_byte_E(struct net_device *dev, int x, u8 y);
 void write_nic_word(struct net_device *dev, int x, u16 y);
 void write_nic_dword(struct net_device *dev, int x, u32 y);
diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index 1f23a65..678f4e7 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -299,7 +299,7 @@ int read_nic_byte_E(struct net_device *dev, int indx, u8 
*data)
return 0;
 }
 /* as 92U has extend page from 4 to 16, so modify functions below. */
-void write_nic_byte(struct net_device *dev, int indx, u8 data)
+int write_nic_byte(struct net_device *dev, int indx, u8 data)
 {
int status;
 
@@ -308,7 +308,7 @@ void write_nic_byte(struct net_device *dev, int indx, u8 
data)
u8 *usbdata = kzalloc(sizeof(data), GFP_KERNEL);
 
if (!usbdata)
-   return;
+   return -ENOMEM;
*usbdata = data;
 
status = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -317,10 +317,12 @@ void write_nic_byte(struct net_device *dev, int indx, u8 
data)
 usbdata, 1, HZ / 2);
kfree(usbdata);
 
-   if (status < 0)
+   if (status < 0){
netdev_err(dev, "write_nic_byte TimeOut! status: %d\n", status);
-
-
+   return status;
+   }
+   
+   return 0;
 }
 
 
-- 
1.9.1

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


[PATCH 4/8] staging: rtl8192u: check return value of rtl8192_read_eeprom_info

2016-04-28 Thread Salah Triki
The call of rtl8192_read_eeprom_info may fail, therefore its return value must
be checked and propagated in the case of error.

Signed-off-by: Salah Triki 
---
 drivers/staging/rtl8192u/r8192U_core.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_core.c 
b/drivers/staging/rtl8192u/r8192U_core.c
index e7168da..1f23a65 100644
--- a/drivers/staging/rtl8192u/r8192U_core.c
+++ b/drivers/staging/rtl8192u/r8192U_core.c
@@ -2741,6 +2741,8 @@ static short rtl8192_init(struct net_device *dev)
 {
 
struct r8192_priv *priv = ieee80211_priv(dev);
+   int err;
+
memset(&(priv->stats), 0, sizeof(struct Stats));
memset(priv->txqueue_to_outpipemap, 0, 9);
 #ifdef PIPE12
@@ -2761,7 +2763,9 @@ static short rtl8192_init(struct net_device *dev)
rtl8192_init_priv_lock(priv);
rtl8192_init_priv_task(dev);
rtl8192_get_eeprom_size(dev);
-   rtl8192_read_eeprom_info(dev);
+   err = rtl8192_read_eeprom_info(dev);
+   if (err)
+   return err;
rtl8192_get_channel_map(dev);
init_hal_dm(dev);
setup_timer(&priv->watch_dog_timer, watch_dog_timer_callback,
-- 
1.9.1

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


[PATCH v2] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.

2016-04-28 Thread Jandy Gou
 make C=1 M=drivers/staging/rtl8723au/

 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:96:38: warning: cast to
 restricted __le16
 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:100:27: warning: cast to
 restricted __le32

Signed-off-by: Jandy Gou 
---
 drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c 
b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
index 1662c03c..fff652c 100644
--- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
+++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
@@ -56,8 +56,8 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, 
u32 CmdLen,
u32 msgbox_addr;
u32 msgbox_ex_addr;
struct hal_data_8723a *pHalData;
-   u32 h2c_cmd = 0;
-   u16 h2c_cmd_ex = 0;
+   __le32 h2c_cmd = 0;
+   __le16 h2c_cmd_ex = 0;
int ret = _FAIL;
 
padapter = GET_PRIMARY_ADAPTER(padapter);
@@ -91,14 +91,12 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, 
u32 CmdLen,
 
*(u8 *)(&h2c_cmd) |= ElementID;
 
-   if (h2c_cmd & BIT(7)) {
+   if (le32_to_cpu(h2c_cmd) & BIT(7)) {
msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * 
EX_MESSAGE_BOX_SIZE);
-   h2c_cmd_ex = le16_to_cpu(h2c_cmd_ex);
-   rtl8723au_write16(padapter, msgbox_ex_addr, h2c_cmd_ex);
+   rtl8723au_write16(padapter, msgbox_ex_addr, 
le16_to_cpu(h2c_cmd_ex));
}
msgbox_addr = REG_HMEBOX_0 + (h2c_box_num * MESSAGE_BOX_SIZE);
-   h2c_cmd = le32_to_cpu(h2c_cmd);
-   rtl8723au_write32(padapter, msgbox_addr, h2c_cmd);
+   rtl8723au_write32(padapter, msgbox_addr, le32_to_cpu(h2c_cmd));
 
bcmd_down = true;
 
-- 
1.9.1


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


Re: [PATCH v2] staging: r8723au: This patch tries to fix some byte order issues that is found by sparse check.

2016-04-28 Thread Jes Sorensen
Jandy Gou  writes:
>  make C=1 M=drivers/staging/rtl8723au/
>
>  drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:96:38: warning: cast to
>  restricted __le16
>  drivers/staging/rtl8723au/hal/rtl8723a_cmd.c:100:27: warning: cast to
>  restricted __le32
>
> Signed-off-by: Jandy Gou 
> ---
>  drivers/staging/rtl8723au/hal/rtl8723a_cmd.c | 12 +---
>  1 file changed, 5 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c 
> b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> index 1662c03c..fff652c 100644
> --- a/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> +++ b/drivers/staging/rtl8723au/hal/rtl8723a_cmd.c
> @@ -56,8 +56,8 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 ElementID, 
> u32 CmdLen,
>   u32 msgbox_addr;
>   u32 msgbox_ex_addr;
>   struct hal_data_8723a *pHalData;
> - u32 h2c_cmd = 0;
> - u16 h2c_cmd_ex = 0;
> + __le32 h2c_cmd = 0;
> + __le16 h2c_cmd_ex = 0;
>   int ret = _FAIL;
>  
>   padapter = GET_PRIMARY_ADAPTER(padapter);
> @@ -91,14 +91,12 @@ int FillH2CCmd(struct rtw_adapter *padapter, u8 
> ElementID, u32 CmdLen,
>  
>   *(u8 *)(&h2c_cmd) |= ElementID;
>  
> - if (h2c_cmd & BIT(7)) {
> + if (le32_to_cpu(h2c_cmd) & BIT(7)) {
>   msgbox_ex_addr = REG_HMEBOX_EXT_0 + (h2c_box_num * 
> EX_MESSAGE_BOX_SIZE);
> - h2c_cmd_ex = le16_to_cpu(h2c_cmd_ex);
> - rtl8723au_write16(padapter, msgbox_ex_addr, h2c_cmd_ex);
> + rtl8723au_write16(padapter, msgbox_ex_addr, 
> le16_to_cpu(h2c_cmd_ex));
>   }

This actually changes the behavior on big-endian systems. Did you test
this?

Second, the last line makes the line more than 80 charaters whish is
wrong.

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


Re: [PATCH 1/2] staging: wilc1000: fix double unlock

2016-04-28 Thread Greg Kroah-Hartman
On Thu, Apr 14, 2016 at 08:48:48PM +0530, Sudip Mukherjee wrote:
> The semaphore was being released twice, once at the beginning of the
> thread and then again when the thread is about to close.
> The semaphore is acquired immediately after creating the thread so we
> should be releasing it when the thread ends.
> 
> Signed-off-by: Sudip Mukherjee 
> ---
>  drivers/staging/wilc1000/linux_wlan.c | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/staging/wilc1000/linux_wlan.c 
> b/drivers/staging/wilc1000/linux_wlan.c
> index a858552..5643a3d 100644
> --- a/drivers/staging/wilc1000/linux_wlan.c
> +++ b/drivers/staging/wilc1000/linux_wlan.c
> @@ -313,7 +313,6 @@ static int linux_wlan_txq_task(void *vp)
>   vif = netdev_priv(dev);
>   wl = vif->wilc;
>  
> - up(&wl->txq_thread_started);
>   while (1) {
>   down(&wl->txq_event);
>  

Doesn't apply to my tree at all :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rts5208: Unnecessary parantheses around chip->sd_card

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 
---
 drivers/staging/rts5208/sd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/rts5208/sd.c b/drivers/staging/rts5208/sd.c
index 87d6976..fbd2f90 100644
--- a/drivers/staging/rts5208/sd.c
+++ b/drivers/staging/rts5208/sd.c
@@ -56,21 +56,21 @@ static u16 REG_SD_DCMPS1_CTL;
 
 static inline void sd_set_err_code(struct rtsx_chip *chip, u8 err_code)
 {
-   struct sd_info *sd_card = &(chip->sd_card);
+   struct sd_info *sd_card = &chip->sd_card;
 
sd_card->err_code |= err_code;
 }
 
 static inline void sd_clr_err_code(struct rtsx_chip *chip)
 {
-   struct sd_info *sd_card = &(chip->sd_card);
+   struct sd_info *sd_card = &chip->sd_card;
 
sd_card->err_code = 0;
 }
 
 static inline int sd_check_err_code(struct rtsx_chip *chip, u8 err_code)
 {
-   struct sd_info *sd_card = &(chip->sd_card);
+   struct sd_info *sd_card = &chip->sd_card;
 
return sd_card->err_code & err_code;
 }
-- 
1.9.1

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


[PATCH] staging: rts5208: Avoid multiple assignment in one line

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 
---
 drivers/staging/rts5208/rtsx.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 25d095a..77c2580 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -105,13 +105,13 @@ static int slave_configure(struct scsi_device *sdev)
 * the actual value or the modified one, depending on where the
 * data comes from.
 */
-   if (sdev->scsi_level < SCSI_2)
-   sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
-
+   if (sdev->scsi_level < SCSI_2) {
+   sdev->scsi_level  = SCSI_2;
+   sdev->sdev_target->scsi_level = SCSI_2;
+   }
return 0;
 }
 
-
 /***
  * /proc/scsi/ functions
  ***/
-- 
1.9.1

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


Re: [PATCH] staging: rts5208: Avoid multiple assignment in one line

2016-04-28 Thread Greg KH
On Thu, Apr 28, 2016 at 10:30:49PM -0700, Manav Batra wrote:
> Signed-off-by: Manav Batra 

I can't take patches without any changelog text :(
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: rts5208: Avoid multiple assignment in one line

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 

Separates out assignment in one line to two lines.
---
 drivers/staging/rts5208/rtsx.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c
index 25d095a..77c2580 100644
--- a/drivers/staging/rts5208/rtsx.c
+++ b/drivers/staging/rts5208/rtsx.c
@@ -105,13 +105,13 @@ static int slave_configure(struct scsi_device *sdev)
 * the actual value or the modified one, depending on where the
 * data comes from.
 */
-   if (sdev->scsi_level < SCSI_2)
-   sdev->scsi_level = sdev->sdev_target->scsi_level = SCSI_2;
-
+   if (sdev->scsi_level < SCSI_2) {
+   sdev->scsi_level  = SCSI_2;
+   sdev->sdev_target->scsi_level = SCSI_2;
+   }
return 0;
 }
 
-
 /***
  * /proc/scsi/ functions
  ***/
-- 
1.9.1

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


[PATCH] staging: rts5208: Alignment should match open paranthesis

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 

Fixed alignment of parantheses.
---
 drivers/staging/rts5208/ms.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rts5208/ms.c b/drivers/staging/rts5208/ms.c
index 0f0cd4a..6c5ef29 100644
--- a/drivers/staging/rts5208/ms.c
+++ b/drivers/staging/rts5208/ms.c
@@ -63,7 +63,7 @@ static int ms_transfer_tpc(struct rtsx_chip *chip, u8 
trans_mode,
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);
rtsx_add_cmd(chip, WRITE_REG_CMD, CARD_DATA_SOURCE,
-   0x01, PINGPONG_BUFFER);
+0x01, PINGPONG_BUFFER);
 
rtsx_add_cmd(chip, WRITE_REG_CMD, MS_TRANSFER,
0xFF, MS_TRANSFER_START | trans_mode);
-- 
1.9.1

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


[PATCH] staging: sm750fb: Braces {} on all arms

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 

Applied braces on all arms of the statement.
---
 drivers/staging/sm750fb/ddk750_chip.c | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_chip.c 
b/drivers/staging/sm750fb/ddk750_chip.c
index f80ee77..7748862 100644
--- a/drivers/staging/sm750fb/ddk750_chip.c
+++ b/drivers/staging/sm750fb/ddk750_chip.c
@@ -19,15 +19,16 @@ logical_chip_type_t getChipType(void)
physicalID = devId750; /* either 0x718 or 0x750 */
physicalRev = revId750;
 
-   if (physicalID == 0x718)
+   if (physicalID == 0x718) {
chip = SM718;
-   else if (physicalID == 0x750) {
+   } else if (physicalID == 0x750) {
chip = SM750;
/* SM750 and SM750LE are different in their revision ID only. */
if (physicalRev == SM750LE_REVISION_ID)
chip = SM750LE;
-   } else
+   } else {
chip = SM_UNKNOWN;
+   }
 
return chip;
 }
-- 
1.9.1

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


[PATCH] staging: sm750fb: Comparison to NULL fixed

2016-04-28 Thread Manav Batra
Signed-off-by: Manav Batra 

Improved comparison to NULL and removed some blank lines.
---
 drivers/staging/sm750fb/ddk750_dvi.c | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/sm750fb/ddk750_dvi.c 
b/drivers/staging/sm750fb/ddk750_dvi.c
index a4a2550..bac432b 100644
--- a/drivers/staging/sm750fb/ddk750_dvi.c
+++ b/drivers/staging/sm750fb/ddk750_dvi.c
@@ -8,7 +8,8 @@
 
 /* This global variable contains all the supported driver and its corresponding
function API. Please set the function pointer to NULL whenever the function
-   is not supported. */
+   is not supported.
+*/
 static dvi_ctrl_device_t g_dcftSupportedDviController[] = {
 #ifdef DVI_CTRL_SII164
{
@@ -28,7 +29,6 @@ static dvi_ctrl_device_t g_dcftSupportedDviController[] = {
 #endif
 };
 
-
 int dviInit(
unsigned char edgeSelect,
unsigned char busSelect,
@@ -45,7 +45,7 @@ int dviInit(
dvi_ctrl_device_t *pCurrentDviCtrl;
 
pCurrentDviCtrl = g_dcftSupportedDviController;
-   if (pCurrentDviCtrl->pfnInit != NULL) {
+   if (pCurrentDviCtrl->pfnInit) {
return pCurrentDviCtrl->pfnInit(edgeSelect, busSelect, 
dualEdgeClkSelect, hsyncEnable,
vsyncEnable, deskewEnable, 
deskewSetting, continuousSyncEnable,
pllFilterEnable, 
pllFilterValue);
@@ -55,4 +55,3 @@ int dviInit(
 
 #endif
 
-
-- 
1.9.1

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