platform/kernel/linux-starfive.git
8 years agostaging: rtl8723au: core: rtw_recv: use list_first_entry_or_null()
Geliang Tang [Tue, 1 Mar 2016 15:35:31 +0000 (23:35 +0800)]
staging: rtl8723au: core: rtw_recv: use list_first_entry_or_null()

Use list_first_entry_or_null() instead of list_empty() + container_of()
to simplify the code.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoRevert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"
Greg Kroah-Hartman [Fri, 11 Mar 2016 03:35:54 +0000 (19:35 -0800)]
Revert "staging: comedi: drivers: Remove unneeded NULL check before kfree()"

This reverts commit 3545bee9b8ec00ba733e17363f494c8761fb5e49.

It's not correct.

Reported-by: Hartley Sweeten <HartleyS@visionengravers.com>
Cc: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 19:04:44 +0000 (00:34 +0530)]
staging: comedi: ni_pcidio.c: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: dt282x: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:54:49 +0000 (00:24 +0530)]
staging: comedi: dt282x: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: rtd520: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:49:38 +0000 (00:19 +0530)]
staging: comedi: rtd520: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:35:16 +0000 (00:05 +0530)]
staging: comedi: drivers: ni_mio_common: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP
Bhaktipriya Shridhar [Wed, 9 Mar 2016 18:33:49 +0000 (00:03 +0530)]
staging: comedi: drivers: amplc_pci230: Prefer using macro DIV_ROUND_UP

The macro DIV_ROUND_UP performs the computation
(((n) + (d) - 1) /(d)). It clarifies the divisor calculations.
This was done using the coccinelle script:
@@
expression e1;
expression e2;
@@
(
- ((e1) + e2 - 1) / (e2)
+ DIV_ROUND_UP(e1,e2)
|
- ((e1) + (e2 - 1)) / (e2)
+ DIV_ROUND_UP(e1,e2)
)

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).
Sandhya Bankar [Sun, 6 Mar 2016 07:05:29 +0000 (12:35 +0530)]
Staging: comedi: Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Use predefined macro offset_in_page() instead of (addr & ~PAGE_MASK).

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API
Amitoj Kaur Chawla [Sun, 6 Mar 2016 00:21:52 +0000 (05:51 +0530)]
staging: comedi: drivers: gsc_hpdi: Remove use of deprecated pci API

Replace pci_[alloc|free]_consistent occurences with
dma_[alloc|free]_coherent.

The Coccinelle semantic patch that was used to make some of these
changes is as follows:
@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_KERNEL
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_KERNEL
  )
)

gsc_hpdi_auto_attach does not affect interrupt status but contains a
call to comedi_alloc_devpriv() which calls kzalloc with GFP_KERNEL flag.
Thus, there seems to be no danger that dma_alloc_coherent can be called
with interrupts turned off, and GFP_KERNEL can be used.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visornic: Remove unnecessary else after return
Bhaktipriya Shridhar [Thu, 10 Mar 2016 17:39:14 +0000 (23:09 +0530)]
staging: unisys: visornic: Remove unnecessary else after return

This patch fixes the checkpatch warning that else is not generally
useful after a break or return.

This was done using Coccinelle:
@@
expression e2;
statement s1;
@@
if(e2) { ... return ...; }
-else
         s

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: clean up visorchannel_clear
David Kershner [Wed, 9 Mar 2016 02:28:28 +0000 (21:28 -0500)]
staging: unisys: visorbus: clean up visorchannel_clear

Goto label was ambiguous change to out_free_page to signify that
we will always go through the path even on success.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: cleanup gotos in visorchannel_create_guts
David Kershner [Wed, 9 Mar 2016 02:28:27 +0000 (21:28 -0500)]
staging: unisys: visorbus: cleanup gotos in visorchannel_create_guts

Away label is ambiguous change to it err_destroy_channel to make it
clear this is an error path.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Timothy Sell <timothy.sell@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddre...
Sandhya Bankar [Sun, 6 Mar 2016 10:20:35 +0000 (15:50 +0530)]
Staging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN).

Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN) to check if the endpoint has IN direction.
This correction is based on following semantic patch,

@@
struct usb_endpoint_descriptor *endpoint;
expression E;
@@

(
- endpoint->bEndpointAddress & USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- endpoint->bEndpointAddress == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
|
- (endpoint->bEndpointAddress & E) == USB_DIR_IN
+ usb_endpoint_dir_in(endpoint)
)

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Use list_first_entry instead of list_entry
Bhumika Goyal [Sun, 6 Mar 2016 15:36:47 +0000 (21:06 +0530)]
Staging: most: Use list_first_entry instead of list_entry

This patch replaces list_entry with list_first_entry as it makes the
code more clear.
Done using coccinelle:

@@
expression e;
@@
(
- list_entry(e->next,
+ list_first_entry(e,
  ...)
|
- list_entry(e->prev,
+ list_last_entry(e,
  ...)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorinput: convert pr_err() to dev_err()
Eva Rachel Retuya [Sat, 5 Mar 2016 15:16:17 +0000 (23:16 +0800)]
staging: unisys: visorinput: convert pr_err() to dev_err()

Replace pr_err() calls with respective dev_err() counterpart.
Semantic patch used to detect and apply the transformation:

@r exists@
identifier f,s,i;
position p;
@@

f(...,struct s *i,...) {
  <+...
  pr_err@p(...)
  ...+>
}

@s@
identifier r.s, dev;
@@

struct s {
...
struct device dev;
...
};

@t@
identifier r.i, s.dev;
expression fmt;
position r.p;
@@

- pr_err@p(
+ dev_err(&i->dev,
fmt, ...);

Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: most: Replace pr_err with dev_err
Bhumika Goyal [Sat, 5 Mar 2016 13:46:40 +0000 (19:16 +0530)]
Staging: most: Replace pr_err with dev_err

All devm functions has a device structure as the first argument which is
required by dev_{err,info,dbg} printing functions.
This patch converts pr_err to dev_err as dev_* is preferred after calls
to devm functions.

Done using coccinelle:

@r1 exists@
expression e,e1;
identifier f =~ "^devm_";
identifier g =~ "^pcim_";
identifier h =~ "^dmam_";
@@
e=\(f\|g\|h\)(e1,...);
<+...
(
- pr_info(
+ dev_info(e1,
   ...);
|
- pr_err(
+ dev_err(e1,
  ...);
|
- pr_debug(
+ dev_dbg(e1,
  ...);
)
...+>

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: unisys: visorbus: variable adjustment should be a u64
David Kershner [Thu, 3 Mar 2016 18:00:38 +0000 (13:00 -0500)]
staging: unisys: visorbus: variable adjustment should be a u64

This patch fixes the smatch error:

drivers/staging/unisys/visorbus/visorchipset.c:2217 visorchipset_ioctl()
warn: user controlled 'adjustment' cast to postive rl = 's64min-s64max'

This is because we read a s64 and pass it to a function as u64.

Signed-off-by: David Kershner <david.kershner@unisys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vt6655: Remove & from function name.
Sandhya Bankar [Sun, 6 Mar 2016 07:13:27 +0000 (12:43 +0530)]
Staging: vt6655: Remove & from function name.

Remove & from function name,when function name passed as an argument to another function.
Function name is used as pointer without &.

Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: vt6655: remove unnecessary blank lines from card.c
Ben Marsh [Tue, 1 Mar 2016 18:45:09 +0000 (19:45 +0100)]
Staging: vt6655: remove unnecessary blank lines from card.c

This a patch to card.c to remove unnecessary blank lines in order to
remove a checkpatch.pl warning.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6656: Remove unnecessary parentheses
Rehas Sachdeva [Fri, 26 Feb 2016 12:57:05 +0000 (18:27 +0530)]
staging: vt6656: Remove unnecessary parentheses

This patch removes the following checkpatch.pl warnings:
Unnecessary parentheses around al7230_init_table_amode[0][0]
Unnecessary parentheses around al7230_channel_table2[0][0]

Signed-off-by: Rehas Sachdeva <aquannie@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace dwData with data.
Malcolm Priestley [Sun, 6 Mar 2016 12:57:12 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace dwData with data.

Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace wOffset with offset.
Malcolm Priestley [Sun, 6 Mar 2016 12:57:11 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace wOffset with offset.

Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace byOrgDMACtl with org_dma_ctl
Malcolm Priestley [Sun, 6 Mar 2016 12:57:10 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace byOrgDMACtl with org_dma_ctl

Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac Replace dwCurrDescAddr with curr_desc_addr.
Malcolm Priestley [Sun, 6 Mar 2016 12:57:09 +0000 (12:57 +0000)]
staging: vt6655: mac Replace dwCurrDescAddr with curr_desc_addr.

Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace VNSvInPortB with ioread8
Malcolm Priestley [Sun, 6 Mar 2016 12:57:08 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace VNSvInPortB with ioread8

Removing the macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: MACvSetLoopbackMode replace byOrgValue with ioread8
Malcolm Priestley [Sun, 6 Mar 2016 12:57:07 +0000 (12:57 +0000)]
staging: vt6655: MACvSetLoopbackMode replace byOrgValue with ioread8

Removing VNSvInPortB and nesting inside iowrite8.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: MACbPSWakeup replace VNSvInPortB byOrgValue with ioread8
Malcolm Priestley [Sun, 6 Mar 2016 12:57:06 +0000 (12:57 +0000)]
staging: vt6655: MACbPSWakeup replace VNSvInPortB byOrgValue with ioread8

removing byOrgValue variable.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace VNSvOutPortB with iowrite8
Malcolm Priestley [Sun, 6 Mar 2016 12:57:05 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace VNSvOutPortB with iowrite8

removing macro from functions

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace VNSvOutPortW with iowrite16
Malcolm Priestley [Sun, 6 Mar 2016 12:57:04 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace VNSvOutPortW with iowrite16

removig macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c replace VNSvOutPortD with iowrite32.
Malcolm Priestley [Sun, 6 Mar 2016 12:57:03 +0000 (12:57 +0000)]
staging: vt6655: mac.c replace VNSvOutPortD with iowrite32.

Removing the macro from functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c/h resize all unsigned long to u32
Malcolm Priestley [Sun, 6 Mar 2016 12:57:02 +0000 (12:57 +0000)]
staging: vt6655: mac.c/h resize all unsigned long to u32

All addressing is limited to 32 bits match this to all
functions and port out functions.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: MACvRestoreContext replace for loops with memcpy_toio.
Malcolm Priestley [Sun, 6 Mar 2016 12:57:01 +0000 (12:57 +0000)]
staging: vt6655: MACvRestoreContext replace for loops with memcpy_toio.

Removing the need for variable ii.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c rename pbyCxtBuf to cxt_buf
Malcolm Priestley [Sun, 6 Mar 2016 12:57:00 +0000 (12:57 +0000)]
staging: vt6655: mac.c rename pbyCxtBuf to cxt_buf

Removing camel case and type prefix.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: MACvSaveContext use memcpy_fromio to read context.
Malcolm Priestley [Sun, 28 Feb 2016 19:02:57 +0000 (19:02 +0000)]
staging: vt6655: MACvSaveContext use memcpy_fromio to read context.

Use memcpy_fromio to store data removing the need for local count.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: replace VNSvInPortD dwData reads with ioread32
Malcolm Priestley [Sun, 28 Feb 2016 19:02:56 +0000 (19:02 +0000)]
staging: vt6655: replace VNSvInPortD dwData reads with ioread32

Removing dwData variable altogether.

The reads are always 32 bit insize.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c Replace VNSvInPortB byData reads with ioread8.
Malcolm Priestley [Sun, 28 Feb 2016 19:02:55 +0000 (19:02 +0000)]
staging: vt6655: mac.c Replace VNSvInPortB byData reads with ioread8.

Removing byData variable altogether.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: vt6655: mac.c rename dwIoBase to io_base
Malcolm Priestley [Sun, 28 Feb 2016 19:02:54 +0000 (19:02 +0000)]
staging: vt6655: mac.c rename dwIoBase to io_base

Removing camel case.

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: make lustre dependent on LNet
James Simmons [Tue, 8 Mar 2016 22:35:29 +0000 (17:35 -0500)]
staging: lustre: make lustre dependent on LNet

In the case of lustre routers you only need a functioning
LNet stack. Especially since often the routers are very
light weight and want to avoid any addition software that
would create additional pressures on the system.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: add help section of Kconfig config LNET
James Simmons [Tue, 8 Mar 2016 22:35:28 +0000 (17:35 -0500)]
staging: lustre: add help section of Kconfig config LNET

Include a help section for Kconfig LNET.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fixup kernel Kconfig option LNET_MAX_PAYLOAD
James Simmons [Tue, 8 Mar 2016 22:35:27 +0000 (17:35 -0500)]
staging: lustre: fixup kernel Kconfig option LNET_MAX_PAYLOAD

A few errors exist for the Kconfig option LNET_MAX_PAYLOAD. First
mistake is the default size is 1MB not 2MB as it is shown to the
person configuring the kernel. Second the LNET_MAX_PAYLOAD option
is more closely related to LNET than the LUSTRE_FS option.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: move libcfs to lnet layer
James Simmons [Tue, 8 Mar 2016 22:35:26 +0000 (17:35 -0500)]
staging: lustre: move libcfs to lnet layer

The lustre file system has a layered architecture with
libcfs as the lowest layer and LNet layered on top. Then
on top of LNet we run the lustre client. This patch moves
the libcfs module code out of lustre into the lnet tree.
This fits into the long term goal of eventually merging
libcfs into LNet.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: make LNet use lprocfs_call_handler
James Simmons [Mon, 7 Mar 2016 23:10:24 +0000 (18:10 -0500)]
staging: lustre: make LNet use lprocfs_call_handler

Sometime ago a patch was submitted to duplicate the
proc_call_handler code in the LNet layer. This was
due to the thinking libcfs was not used by the LNet
layer. This was a wrong assumption so lets make LNet
use the lprocfs_call_handler from the libcfs layer.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: rename proc_call_handler to lprocfs_call_handler
James Simmons [Mon, 7 Mar 2016 23:10:23 +0000 (18:10 -0500)]
staging: lustre: rename proc_call_handler to lprocfs_call_handler

Using proc_call_handler as a function name is way too generic.
Rename to lprocfs_call_handler to avoid possible collisions.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: change test to assert in LNetGetId
James Simmons [Mon, 7 Mar 2016 23:10:22 +0000 (18:10 -0500)]
staging: lustre: change test to assert in LNetGetId

The ln_refcount test was changed into an assert.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Correct missing newline
James Nunez [Mon, 7 Mar 2016 23:10:21 +0000 (18:10 -0500)]
staging: lustre: Correct missing newline

Several error messages are missing newline characters
at the end of the message. Newlines are added where
necessary and other minor corrections; no punctuation
at the end of an error message, add a return code to
the end of error messages, device name at the beginning,
etc.

There are just a couple of places where newlines are
removed and this is only in LDLM_DEBUG_NOLOCK. The definition
of LDLM_DEBUG_NOLOCK already has a newline in it and
resulted in double newlines printed.

Signed-off-by: James Nunez <james.a.nunez@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4871
Reviewed-on: http://review.whamcloud.com/10000
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Cliff White <cliff.white@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fix 'data race condition' issue in framework.c
Sebastien Buisson [Mon, 7 Mar 2016 23:10:20 +0000 (18:10 -0500)]
staging: lustre: fix 'data race condition' issue in framework.c

Fix 'data race condition' defects found by Coverity version 6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6568
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fix 'NULL pointer dereference' errors
Sebastien Buisson [Mon, 7 Mar 2016 23:10:19 +0000 (18:10 -0500)]
staging: lustre: fix 'NULL pointer dereference' errors

Fix 'NULL pointer dereference' defects found by Coverity version
6.5.3:
Dereference after null check (FORWARD_NULL)
For instance, Passing null pointer to a function which dereferences
it.
Dereference before null check (REVERSE_INULL)
Null-checking variable suggests that it may be null, but it has
already been dereferenced on all paths leading to the check.
Dereference null return value (NULL_RETURNS)

The following fixes for the LNet layer are broken out of patch
http://review.whamcloud.com/4720.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2217
Reviewed-on: http://review.whamcloud.com/4720
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: fix 'data race condition' issue in conrpc.c
Sebastien Buisson [Mon, 7 Mar 2016 23:10:18 +0000 (18:10 -0500)]
staging: lustre: fix 'data race condition' issue in conrpc.c

Fix 'data race condition' defects found by Coverity version 6.5.0:
Data race condition (MISSING_LOCK)
Accessing variable without holding lock. Elsewhere,
this variable is accessed with lock held.

Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2744
Reviewed-on: http://review.whamcloud.com/6567
Reviewed-by: Liang Zhen <liang.zhen@intel.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: LNet network latency simulation
Liang Zhen [Mon, 7 Mar 2016 23:10:17 +0000 (18:10 -0500)]
staging: lustre: LNet network latency simulation

Incoming lnet message can be delayed for seconds if it can match
any of LNet Delay Rules.

User can add/remove/list Delay Rule by lctl commands:
- lctl net_delay_add
  Add a new Delay Rule to LNet, options
  <-s | --source SRC_NID>
  <-d | --dest DST_NID>
  <<-r | --rate RATE_NUMBER>
  <-i | --interlval SECONDS>>
  <-l | --latency DELAY_LATENCY>

- lctl net_delay_del
  Remove matched Delay Rule from LNet, options:
  <[-a | --all] |
  <-s | --source SRC_NID>
  <-d | --dest DST_NID>>

- lctl net_delay_list
  List all Delay Rules in LNet

- lctl net_delay_reset
  Reset statistic counters for all Delay Rules

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11409
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: LNet drop rule implementation
Liang Zhen [Mon, 7 Mar 2016 23:10:16 +0000 (18:10 -0500)]
staging: lustre: LNet drop rule implementation

This is implementation of LNet Drop Rule, which can randomly drop
LNet messages at specified rate.

LNet Drop Rule can only be applied to receive side of message. User
can add drop_rule either on end point of cluster (client/server) or
on LNet routers.

Here are lctl command to control LNet Drop Rules:
 - net_drop_add -s SRC_NID -d DEST_NID --rate VALUE
   drop 1/@VALUE of messages from @SRC_NID to @DEST_NID

 - net_drop_del -s SRC_NID -d DEST_NID
   remove all drop rules from @SRC_NID to @DEST_NID

 - net_drop_list
   list all drop rules on current node

 Examples:
 - lctl net_drop_add -s *@o2ib0 -d 192.168.1.102@tcp 1000
   add new drop rule, it will drop 1/1000 messages from network o2ib0
   to 192.168.1.102@tcp

 - lctl net_drop_add -s 10.8.6.123@o2ib1 -d * 500
   add new drop rule, it will drop 1/500 messages from 10.8.6.123@o2ib1
   to all nodes

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5435
Reviewed-on: http://review.whamcloud.com/11314
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Johann Lombardi <johann.lombardi@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoisdn: i4l: move active-isdn drivers to staging
Arnd Bergmann [Wed, 2 Mar 2016 19:06:46 +0000 (20:06 +0100)]
isdn: i4l: move active-isdn drivers to staging

The icn, act2000 and pcbit drivers are all for very old hardware,
and it is highly unlikely that anyone is actually still using them
on modern kernels, if at all.

All three drivers apparently are for hardware that predates PCI
being the common connector, as they are ISA-only and active
PCI ISDN cards were widely available in the 1990s.

Looking through the git logs, it I cannot find any indication of a
patch to any of these drivers that has been tested on real hardware,
only cleanups or global API changes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Karsten Keil <isdn@linux-pingi.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoisdn: icn: remove a #warning
Arnd Bergmann [Wed, 2 Mar 2016 19:06:45 +0000 (20:06 +0100)]
isdn: icn: remove a #warning

The icn driver currently produces an unconditional #warning whenever
we build it, introduced by Karsten Keil back in 2003:

 #warning TODO test headroom or use skb->nb to flag ACK

Karsten's original commit (from BitKeeper) contains this description:

    - here are lot of bugs left, so ISDN is not stable yet but
      I think it's really time to fix it, even if it need some cycles
      to get it right (normally I'm only send patches if it works 100% for
      me).
    - I add some additional #warnings to address places which need fixing
      (I hope that some of the other ISDN developer jump in)

Apparently this has not happened, and it is unlikely that it ever will,
given that the driver doesn't seem to work. No substantial bug fixes
other than janitorial cleanups have happened in the driver since then,
and I see no indication that anyone who patched it had the hardware.

We should probably either remove the driver, or remove all of i4l,
but for now, this shuts up the distracting #warning by turning it
into a comment.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: http://git.meleeweb.net/linux.git/commit/?id=b0deac0886b0056765afd149e9834373b38e096b
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: comedi.h: Fix comment for struct comedi_krange
Ian Abbott [Wed, 2 Mar 2016 14:27:38 +0000 (14:27 +0000)]
staging: comedi: comedi.h: Fix comment for struct comedi_krange

The kernel-doc comment for `struct comedi_krange` refers to the macro
constant `RF_external`.  It should be `RF_EXTERNAL`, so fix it.  It also
documents the value of the constant as `(1 << 8)`, but the macro now
expands to the hexadecimal constant `0x100`, so use that as the
documented value.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: comedi.h: Do not use BIT macro
Ian Abbott [Wed, 2 Mar 2016 14:27:37 +0000 (14:27 +0000)]
staging: comedi: comedi.h: Do not use BIT macro

The "comedi.h" file is part of the user API for COMEDI devices, and is
intended to be migrated to "include/uapi/linux".  The `BIT` macro from
"include/linux/bitops.h" should not be used there.

Replace the use of the `BIT` macro with hexadecimal constants of the
same value.  The `BIT` macro replaced expressions of the form `(1 << N)`
in this file originally, but reverting back to that form would encourage
patches changing them back to use the `BIT` macro.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: cb_pcimdda: Fix long lines in comments
Rasmus Linusson [Sun, 28 Feb 2016 15:38:12 +0000 (16:38 +0100)]
staging: comedi: cb_pcimdda: Fix long lines in comments

Reorder comments to keep 80 character limit

Signed-off-by: Rasmus Linusson <rasmus@linusson.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: cb_pcimdda: Fix multi-line comments
Rasmus Linusson [Sun, 28 Feb 2016 15:38:11 +0000 (16:38 +0100)]
staging: comedi: cb_pcimdda: Fix multi-line comments

Add asterisks to multi-line comments currently missing them

Signed-off-by: Rasmus Linusson <rasmus@linusson.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: s626.c: Remove unused functions
Bhumika Goyal [Sun, 28 Feb 2016 07:58:47 +0000 (13:28 +0530)]
Staging: comedi: s626.c: Remove unused functions

The functions s626_get_clk_mult, s626_get_clk_mult, s626_get_enc_mode,
s626_set_index_pol are not used anywhere in the kernel so they can be
removed. This also cleans the code. Grepped to find the occurences.

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: Remove use of deprecated pci API
Amitoj Kaur Chawla [Wed, 24 Feb 2016 11:15:34 +0000 (16:45 +0530)]
staging: comedi: drivers: Remove use of deprecated pci API

Replace pci_[alloc|free]_consistent occurences with
dma_[alloc|free]_coherent.

The Coccinelle semantic patch that was used to make some of these
changes is as follows:
@deprecated@
idexpression id;
position p;
@@

(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@bad1@
idexpression id;
position deprecated.p;
@@
...when != &id->dev
   when != pci_get_drvdata ( id )
   when != pci_enable_device ( id )
(
  pci_dma_supported@p ( id, ...)
|
  pci_alloc_consistent@p ( id, ...)
)

@depends on !bad1@
idexpression id;
expression direction;
position deprecated.p;
@@

(
- pci_dma_supported@p ( id,
+ dma_supported ( &id->dev,
...
+ , GFP_KERNEL
  )
|
- pci_alloc_consistent@p ( id,
+ dma_alloc_coherent ( &id->dev,
...
+ , GFP_KERNEL
  )
)

alloc_and_init_dma_members does not affect the interrupt status and is
only called by auto_attach, which also does not affect the interrupt
status. auto_attach() also contains a call to comedi_alloc_devpriv()
which calls kzalloc with GFP_KERNEL flag.  Thus, there seems to be no
danger that dma_alloc_coherent can be called with interrupts turned
off, and GFP_KERNEL can be used.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: drivers: Remove unneeded NULL check before kfree()
Janani Ravichandran [Wed, 24 Feb 2016 00:36:04 +0000 (19:36 -0500)]
staging: comedi: drivers: Remove unneeded NULL check before kfree()

Remove NULL check before kfree as it is not needed.

Signed-off-by: Janani Ravichandran <janani.rvchndrn@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: comedi: contec_pci_dio: fixed comment blocks coding style issues
Philippe Loctaux [Mon, 22 Feb 2016 23:47:59 +0000 (00:47 +0100)]
Staging: comedi: contec_pci_dio: fixed comment blocks coding style issues

Makes the comment blocks start with /* on separate lines, and end
with */ on separate lines as well,
starting with * for each comment lines.

Signed-off-by: Philippe Loctaux <phil@philippeloctaux.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: comedi: Use macro DIV_ROUND_CLOSEST
Bhaktipriya Shridhar [Sun, 21 Feb 2016 10:43:01 +0000 (16:13 +0530)]
staging: comedi: Use macro DIV_ROUND_CLOSEST

Occurences of the computation (x +d/2)/d can be replaced with
the macro DIV_ROUND_CLOSEST.

This was detected by the following Coccinelle script.

@@
expression e1,e2;
@@
(
- ((e1) + e2/2) / (e2)
+ DIV_ROUND_CLOSEST(e1,e2)
|
- ((e1) + (e2/2)) / (e2)
+ DIV_ROUND_CLOSEST(e1,e2)
)

Since some lines exceeded the 80 character limit,
some changes were made by hand.

Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agocomedi: note a coverity discovered hole that needs fixing
Alan [Mon, 15 Feb 2016 18:59:06 +0000 (18:59 +0000)]
comedi: note a coverity discovered hole that needs fixing

It's not trivial to just post up a fix, so add it to the TODO list and
ensure it doesn't get lost.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm724x: Replace random_ether_addr with eth_random_addr
Bhumika Goyal [Tue, 1 Mar 2016 19:43:22 +0000 (01:13 +0530)]
Staging: gdm724x: Replace random_ether_addr with eth_random_addr

The macro random_ether_addr is calling the function eth_random_addr.
Therefore, the call to random_ether_addr can be replaced with
eth_random_addr.
Done using coccinelle:

@@
expression addr;
@@
- random_ether_addr(addr);
+ eth_random_addr(addr);

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm724x: Use min instead of ternary operator
Bhumika Goyal [Fri, 26 Feb 2016 10:04:32 +0000 (15:34 +0530)]
Staging: gdm724x: Use min instead of ternary operator

This patch replaces ternary operator with macro min as it shorter and
thus increases code readability. Macro min return the minimum of the
two compared values.
Made a semantic patch for changes:

@@
type T;
T x;
T y;
@@
(
- x < y ? x : y
+ min(x,y)
|
- x > y ? x : y
+ max(x,y)
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: gdm724x: gdm_usb: Remove create_workqueue()
Amitoj Kaur Chawla [Sun, 28 Feb 2016 14:24:41 +0000 (19:54 +0530)]
staging: gdm724x: gdm_usb: Remove create_workqueue()

With concurrency managed workqueues, use of dedicated workqueues
can be replaced by using system_wq. Drop usb_tx_wq and usb_rx_wq
by using system_wq.

Since there are multiple work items per udev but different udevs
do not need to be ordered, increase of concurrency level by
switching to system_wq should not break anything.

cancel_work_sync() is used to ensure that work is not pending or
executing on any CPU.

Lastly, since all devices are suspended, which shutdowns the work
items before the driver can be unregistered, it is guaranteed
that no work item is pending or executing by the time exit path
runs.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm72xx: remove duplicate condition
Dan Carpenter [Mon, 22 Feb 2016 19:33:33 +0000 (22:33 +0300)]
Staging: gdm72xx: remove duplicate condition

We know "len" is not zero because we tested for that at the beginning of
the function so this test can be removed.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm72xx: underflow bug in gdm_wimax_ioctl_get_data()
Dan Carpenter [Mon, 22 Feb 2016 19:33:09 +0000 (22:33 +0300)]
Staging: gdm72xx: underflow bug in gdm_wimax_ioctl_get_data()

"size" here should be unsigned, otherwise we might end up trying to copy
negative bytes in gdm_wimax_ioctl_get_data() resulting in an information
leak.

Reported-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: gdm72xx: zero out padding
Dan Carpenter [Mon, 22 Feb 2016 19:32:38 +0000 (22:32 +0300)]
staging: gdm72xx: zero out padding

We pad the start of this buffer with 256 bytes of padding.   It's not
clear to me exactly what's going on or how it's used but let's zero it
out.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm72xx: make "len" unsigned
Dan Carpenter [Mon, 22 Feb 2016 19:32:21 +0000 (22:32 +0300)]
Staging: gdm72xx: make "len" unsigned

We had an underflow bug here and I think I fixed it but we may as
well be proactive and make "len" unsigned to be double sure.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: gdm72xx: silence underflow warning in netlink_send()
Dan Carpenter [Mon, 22 Feb 2016 19:31:31 +0000 (22:31 +0300)]
Staging: gdm72xx: silence underflow warning in netlink_send()

The value of "group" comes from "idx" in __gdm_wimax_event_send():

if (sscanf(e->dev->name, "wm%d", &idx) == 1)

Smatch marks sscanf values as user controlled.  It's supposed to be a
number in 0-30 range.  We cap the upper bound but allow negatives.  Fix
this by making it type u16 instead.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: gdm72xx: underflow in netlink_rcv_cb()
Dan Carpenter [Mon, 22 Feb 2016 19:30:46 +0000 (22:30 +0300)]
staging: gdm72xx: underflow in netlink_rcv_cb()

If nlh->nlmsg_len is less than ND_IFINDEX_LEN we end up trying to memcpy
a negative size.  I also re-ordered slighty the condition to make it
more uniform.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agodrivers: staging: rtl8712: rtl871x_xmit.c: Fix Comparisons should place the constant...
Tapan Prakash T [Tue, 23 Feb 2016 17:15:48 +0000 (22:45 +0530)]
drivers: staging: rtl8712: rtl871x_xmit.c: Fix Comparisons should place the constant on the right side of the test warning

Fixed checkpatch.pl warning 'Comparisons should place the constant on the
right side of the test'

Signed-off-by: Tapan Prakash T <tapanprakasht@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agortl871x: avoid running off end of buffer
Alan [Mon, 15 Feb 2016 18:58:10 +0000 (18:58 +0000)]
rtl871x: avoid running off end of buffer

If 32 bytes of non zero are passed in pdata->pointer then the mac_pton
function will run off the end of the buffer. Make sure we always have a
terminated string kernel side.

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: speakup: Remove unnecessary test in if condition
Amitoj Kaur Chawla [Wed, 24 Feb 2016 15:24:28 +0000 (20:54 +0530)]
staging: speakup: Remove unnecessary test in if condition

Remove unnecessary test on synth->alive since it has already been
tested previously.

This fixes the following smatch warning:
drivers/staging/speakup/synth.c:182 spk_synth_is_alive_restart() warn:
we tested 'synth->alive' before and it was 'false'

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: speakup: remove multiple assignments
Alison Schofield [Wed, 24 Feb 2016 05:38:58 +0000 (21:38 -0800)]
staging: speakup: remove multiple assignments

Remove multiple assignments by factorizing.

Coccinelle semantic patch used:
@@ identifier x,y; constant z; @@
- x=y=z;
+ x=z;
+ y=z;

Signed-off-by: Alison Schofield <amsfield22@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: speakup: Add space around '|'
Dilek Uzulmez [Mon, 22 Feb 2016 19:56:01 +0000 (21:56 +0200)]
Staging: speakup: Add space around '|'

Add space around operator '|'. Problem found using checkpatch.pl
CHECK: spaces preferred around that '|' (ctx:VxV)

Signed-off-by: Dilek Uzulmez <dilekuzulmez@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: handle complex strings in cfs_str2num_check
James Simmons [Thu, 3 Mar 2016 16:00:58 +0000 (11:00 -0500)]
staging: lustre: handle complex strings in cfs_str2num_check

Originally the function cfs_str2num_check used simple_strtoul
but has been updated to kstrtoul. The string passed into
cfs_str2num_check can be a very complex, for example we could
have 10.37.202.[59-61]. When simple_strtoul was used the first
number until we hit a non-digit character could be extracted
but testing showed that kstrtoul will not return any value if
it detects any non-digit character. Because of this change in
behavior a different approach is needed to handle these types
of complex strings. The use of sscanf was investigated to see
if it could be used to extract numbers from the passed in
string but unlike its glibc counterpart the kernel version
also just reported a error with no results if a non-digit value
in the string was encountered. Another possible approach would
be to use __parse_int directly but that class of functions is
not exported by the kernel. So the approach in this patch is
to scan the string passed in for the first non-digit character
and replace that character with a '\0' so kstrtoul can be used.
Once completed the original character is restored. We also
restore a original behavior that was removed to return 0 when
we encounter any non digit character before the nob count.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: use switch statement instead of multiple if statement
Chaehyun Lim [Thu, 3 Mar 2016 12:05:22 +0000 (21:05 +0900)]
staging: wilc1000: use switch statement instead of multiple if statement

It is more readable than multiple if-else statement.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove unnecessary comments
Chaehyun Lim [Thu, 3 Mar 2016 12:05:21 +0000 (21:05 +0900)]
staging: wilc1000: remove unnecessary comments

This patch removes unnecessary comments because enum cfg_cmd_type
shows each command type without it.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: add enum cfg_type_cmd
Chaehyun Lim [Thu, 3 Mar 2016 12:05:20 +0000 (21:05 +0900)]
staging: wilc1000: add enum cfg_type_cmd

This patch adds a new enum cfg_type_cmd to change hard-coded command
type.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: rename hardwareProductVersion in struct wilc_mac_cfg
Chaehyun Lim [Thu, 3 Mar 2016 12:05:19 +0000 (21:05 +0900)]
staging: wilc1000: rename hardwareProductVersion in struct wilc_mac_cfg

This patch renames hardwareProductVersion to hw_product_version to avoid
camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove commented codes
Chaehyun Lim [Thu, 3 Mar 2016 12:05:18 +0000 (21:05 +0900)]
staging: wilc1000: remove commented codes

This patch removes commented codes in struct wilc_cfg_str.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: use TAG_PARAM_OFFSET define
Chaehyun Lim [Thu, 3 Mar 2016 12:05:17 +0000 (21:05 +0900)]
staging: wilc1000: use TAG_PARAM_OFFSET define

TAG_PARAM_OFFSET is defined at top of this file so that it is used
to simplify codes.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: Remove a whitespace before parenthesis
Anchal Jain [Wed, 2 Mar 2016 15:42:19 +0000 (21:12 +0530)]
staging: wilc1000: Remove a whitespace before parenthesis

Remove a whitespace before parenthesis "("

Signed-off-by: Anchal Jain <anchalj109@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove typedef from enum tenuConnectSts
Chaehyun Lim [Thu, 3 Mar 2016 05:28:24 +0000 (14:28 +0900)]
staging: wilc1000: remove typedef from enum tenuConnectSts

This patch removes typedef from enum tenuConnectSts and renames it to
connect_status to avoid camelcase.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove unused define
Chaehyun Lim [Thu, 3 Mar 2016 05:28:23 +0000 (14:28 +0900)]
staging: wilc1000: remove unused define

This patch removes INFINITE_SLEEP_TIME that is not used in the driver,
so just remove it.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove typedef from sdio_cmd53_t
Chaehyun Lim [Thu, 3 Mar 2016 05:28:22 +0000 (14:28 +0900)]
staging: wilc1000: remove typedef from sdio_cmd53_t

This patch removes typedef from struct sdio_cmd53_t and renames it to
sdio_cmd53.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove unnecessary comment codes
Chaehyun Lim [Thu, 3 Mar 2016 05:28:21 +0000 (14:28 +0900)]
staging: wilc1000: remove unnecessary comment codes

This patch removes unnecessary comment code in struct sdio_cmd53_t.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: wilc1000: remove typedef from struct sdio_cmd52_t
Chaehyun Lim [Thu, 3 Mar 2016 05:28:20 +0000 (14:28 +0900)]
staging: wilc1000: remove typedef from struct sdio_cmd52_t

This patch removes typedef from struct sdio_cmd52_t and renames it to
sdio_cmd52.

Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: do less intense allocating retry for ko2iblnd
Liang Zhen [Wed, 2 Mar 2016 23:53:30 +0000 (18:53 -0500)]
staging: lustre: do less intense allocating retry for ko2iblnd

ko2iblnd may retry too frequent for growing pools, all schedulers
are spinning if another thread is in progress of allocating a new
pool and can't finish right away because of high system load.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7054
Reviewed-on: http://review.whamcloud.com/16470
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: avoid intensive reconnecting for ko2iblnd
Liang Zhen [Wed, 2 Mar 2016 23:53:29 +0000 (18:53 -0500)]
staging: lustre: avoid intensive reconnecting for ko2iblnd

When there is a connection race between two nodes and one side
of the connection is rejected by the other side. o2iblnd will
reconnect immediately, this is going to generate a lot of
trashes if:

 - race winner is slow and can't send out connecting request
   in short time.
 - remote side leaves a cmid in TIMEWAIT state, which will reject
   future connection requests

To resolve this problem, this patch changed the reconnection
behave: reconnection is submitted by connd only if a zombie
connection is being destroyed and there is a pending
reconnection request for the corresponding peer.

Also, after a few rejections, reconnection will have a time
interval between each attempt.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7569
Reviewed-on: http://review.whamcloud.com/17892
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: check wr_id returned by ib_poll_cq
Liang Zhen [Wed, 2 Mar 2016 23:53:28 +0000 (18:53 -0500)]
staging: lustre: check wr_id returned by ib_poll_cq

If ib_poll_cq returned +ve without initialising ib_wc::wr_id (bug
in driver), then o2iblnd will run into unpredictable situation
because ib_wc::wr_id may refer to stale tx/rx pointer in stack.

It indicates bug in HCA driver if this happened, ko2iblnd should
output console error then close current connection.

This patch could also be helpful for LU-5271

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-519
Reviewed-on: http://review.whamcloud.com/12747
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Change connect peer failed cleanup order
Doug Oucharek [Wed, 2 Mar 2016 23:53:27 +0000 (18:53 -0500)]
staging: lustre: Change connect peer failed cleanup order

A race condition has been found where connd is cleaning up failed
connections, the peer ref counter goes to zero, but we stil have
a connecting counter > 0.

One possible race is when we are retrying a connection by
calling kiblnd_connect_peer() which itself fails and decrements
the peer ref counter and gets swapped out before it can decrement
the connecting counter.  connd swaps in and cleans up the
connection where it sees a peer ref counter of 1 and a connecting
counter of 1.  This will trigger the assert seen in LU-7210 when
it decrements the peer counter.

The solution: be sure to decrement the connecting counter
before decrementing the peer counter in the peer connect
failure path.

Signed-off-by: Doug Oucharek <doug.s.oucharek@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7210
Reviewed-on: http://review.whamcloud.com/17004
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: take extra refcount in kiblnd_connreq_done
Liang Zhen [Wed, 2 Mar 2016 23:53:26 +0000 (18:53 -0500)]
staging: lustre: take extra refcount in kiblnd_connreq_done

refcount taken by cmid is not reliable after kiblnd_connreq_done
released the glock because this connection is visible to other
threads, another thread can find and close this connection right
after kiblnd_connreq_done released the glock, if kiblnd_cm_callback
for RDMA_CM_EVENT_DISCONNECTED is called, it can release the
connection refcount taken by cmid. It means the connection could be
destroyed before kiblnd_connreq_done() finish operations on it.

Signed-off-by: Liang Zhen <liang.zhen@intel.com>
ntel-bug-id: https://jira.hpdd.intel.com/browse/LU-7210
Reviewed-on: http://review.whamcloud.com/17527
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: make ko2iblnd connect parameters persistent
Amir Shehata [Wed, 2 Mar 2016 23:53:25 +0000 (18:53 -0500)]
staging: lustre: make ko2iblnd connect parameters persistent

Store map-on-demand and peertx credits in the peer, since the peer
is persistent. Also made sure that when assigning the parameters
received on the connection to the peer structure through create,
that if another peer is added before grabbing the lock we assign
these parameters to it as well.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3322
Reviewed-on: http://review.whamcloud.com/17074
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: Support different ko2iblnd configs between systems
Jeremy Filizetti [Wed, 2 Mar 2016 23:53:24 +0000 (18:53 -0500)]
staging: lustre: Support different ko2iblnd configs between systems

This patch adds suppoort for ko2iblnd to have different values for
peer_credits and map_on_demand between systems.

Signed-off-by: Jeremy Filizetti <jeremy.filizetti@gmail.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3322
Reviewed-on: http://review.whamcloud.com/11794
Reviewed-by: Amir Shehata <amir.shehata@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agoStaging: lustre: lnet: Remove and rename struct typedefs
Bhumika Goyal [Wed, 2 Mar 2016 19:16:37 +0000 (00:46 +0530)]
Staging: lustre: lnet: Remove and rename struct typedefs

Remove typedefs from structures stt_timer_t and lst_ping_data_t as typedef
for a structure type is not preferred. The suffix '_t' and the typedefs
are removed using coccinelle.

Script 1:
//Drop typedefs and '_t'
@r1@
type T;
@@

typedef struct { ... } T;

@script:python c1@
T2;
T << r1.T;
@@
if T[-2:] =="_t":
  coccinelle.T2 = T[:-2];
  print T
else:
  coccinelle.T2=T;

@@
type r1.T;
identifier c1.T2;
@@
-typedef
struct
+ T2
{ ... }
-T
;

Script 2:
//Replacement
@@
typedef stt_timer_t;
typedef lst_ping_data_t;
@@
(
- stt_timer_t
+ struct stt_timer
|
- lst_ping_data_t
+ struct lst_ping_data
)

Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: llite: Remove unnecessary test in if condition
Amitoj Kaur Chawla [Wed, 2 Mar 2016 20:02:14 +0000 (01:32 +0530)]
staging: lustre: llite: Remove unnecessary test in if condition

Remove unnecessary test on `rc` variable since it has already been
tested previously.
Fixes following smatch warning:
drivers/staging/lustre/lustre/llite/llite_lib.c:1331 ll_setattr_raw()
warn: we tested 'rc' before and it was 'false'

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: change ibh_mrs from array to pointer
Amir Shehata [Wed, 2 Mar 2016 22:02:03 +0000 (17:02 -0500)]
staging: lustre: change ibh_mrs from array to pointer

With the removal of PMR we no longer require ibh_mrs field
to be a array so change it to a simple pointer.

Signed-off-by: Amir Shehata <amir.shehata@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6850
Reviewed-on: http://review.whamcloud.com/15788
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Frank Zago <fzago@cray.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
8 years agostaging: lustre: corrected some typos and grammar errors
Frank Zago [Wed, 2 Mar 2016 22:02:02 +0000 (17:02 -0500)]
staging: lustre: corrected some typos and grammar errors

Cleanup various typos and grammar errors.

Signed-off-by: Frank Zago <fzago@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5710
Reviewed-on: http://review.whamcloud.com/12201
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>