Somya Anand [Fri, 13 Mar 2015 19:33:10 +0000 (01:03 +0530)]
Staging: lustre: Iterate list using list_for_each_entry
Code using doubly linked list is iterated generally using list_empty and
list_entry functions, but it can be better written using list_for_each_entry
macro.
This patch replaces the while loop containing list_empty and list_entry with
list_for_each_entry and list_for_each_entry_safe. list_for_each_entry is a
macro which is used to iterate over a list of given type. So while loop used to
iterate over a list can be replaced with list_for_each_entry macro. However, if
list_del is used in the loop, then list_for_each_entry_safe is a better choice.
This transformation is done by using the following coccinelle script.
@ rule1 @
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry;
@@
- while (list_empty(&E1) == 0)
+ list_for_each_entry (I1, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...when != list_del(...);
when != list_del_init(...);
}
@ rule2 @
expression E1;
identifier I1, I2;
type T;
iterator name list_for_each_entry_safe;
@@
T *I1;
+ T *tmp;
...
- while (list_empty(&E1) == 0)
+ list_for_each_entry_safe (I1, tmp, &E1, I2)
{
...when != T *I1;
- I1 = list_entry(E1.next, T, I2);
...
}
Haneen Mohammed [Fri, 13 Mar 2015 17:48:53 +0000 (20:48 +0300)]
Staging: lustre: Remove parentheses around right side an assignment
Parentheses are not needed around the right hand side of an assignment.
This patch remove parenthese of such occurenses. Issue was detected and
solved using the following coccinelle script:
@rule1@
identifier x, y, z;
expression E1, E2;
@@
(
x = (y == z);
|
x = (E1 == E2);
|
x =
-(
...
-)
;
)
Signed-off-by: Haneen Mohammed <hamohammed.sa@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Staging: rtl8192u: Replace printk() with netdev_dbg()
This patch replaces the printk() function with netdev_dbg() in order to
fix the following: "WARNING: printk() should include KERN_ facility level"
and "WARNING: line over 80 characters".
Staging: rtl8192u: Add function to improve code quality
This patch introduces a new function for the authentication response
error check in the ieee80211_rx_frame_softmac() function to fix the
indentation problem. It also adds the iotAction variable in the new
function to fix the "more than 80 characters per line" warning.
Somya Anand [Mon, 9 Mar 2015 13:48:24 +0000 (19:18 +0530)]
Staging: rtl8188eu: Remove redundant local variable
This patch removes a redundant variable "val" and adds
inline return statements. It also adds a default case
to the switch statement which returns 0 to keep the logic
intact.
It also removes a redundant variable "inx" and adds inline
return statements.
This issue is identified by the following coccinelle script.
@@
expression ret;
identifier f;
@@
Somya Anand [Wed, 11 Mar 2015 11:32:12 +0000 (17:02 +0530)]
Staging: dgnc: Remove redundant parentheses
This patch removes the redundant parentheses inorder to make code
simplified. While doing this, the precedence order of the operation
is taken into consideration to keep the logic of the code intact.
Remove FSF address because it's known in the past that it has changed.
Also, remove the pointless "do not change the coding style" comments
because it's one of the reasons why it's in staging and it's quite
contradictory to what it says in TODO. Also, they contain wrong e-mails
of people which are responsible for these drivers - see TODO or
MAINTAINERS for that. We can preserve the original copyright at the top
of the most files because it shows who originally made them.
Dan Carpenter [Tue, 10 Mar 2015 07:39:42 +0000 (10:39 +0300)]
staging: dgnc: off by one in dgnc_mgmt_ioctl()
"dgnc_NumBoards" is the number of initialized elements in the
dgnc_Board[] array so the comparison should be ">=" instead of ">" so we
don't read invalid data. We can remove the special handling of the
empty array now that we've fixed this bug.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
dgnc: Make all lines under 80 characters in dgnc_driver.c
Some of the lines are over 80 characters in dgnc_driver.c so fix them by
moving the comments closer to the code, tidying the comments to make
them smaller, and remove a redundant space after +.
There are a lot double of blank lines in dgnc_cls.c thus remove them to make
the file follow the CodingStyle. Also, remove one blank line at the
end of dgnc_cls.c.
Staging: sm750fb: provide error path for hw_sm750le_setBLANK()
This provides a default path for the switch statement in
hw_sm750le_setBLANK() so that the compiler will not correctly complain
about undefined values being sent to the hardware.
Instead, properly error out if the blank command is unknown by the
driver.
Staging: sm750fb: fix build warning with lynx_accel
Change the return value of lynx_accel to be void, to fix the build
warning, and due to the fact that the function can't seem to fail at
all, and no one cares if it does or not.
Staging: sm750fb: fix build warning with proc_panDisplay
Change the options to the proc_panDisplay function pointer to match the
function pointer that we want to assign to it, in order to remove the
build warning.
Lorenzo Stoakes [Tue, 10 Mar 2015 15:25:47 +0000 (15:25 +0000)]
staging: sm750fb: Cleanup the type of mmio750
This patch assigns the more appropriate void* type to the mmio750 variable
eliminating an unnecessary volatile qualifier in the process. Additionally it
updates parameter types as necessary where those parameters interact with
mmio750, removes unnecessary casts and updates the type of the
lynx_share->pvReg field which is passed to the ddk750_set_mmio method.
As a consequence, this patch fixes the following sparse warning:-
drivers/staging/sm750fb/ddk750_help.c:12:17: warning: incorrect type in assignment (different address spaces)
Signed-off-by: Lorenzo Stoakes <lstoakes@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Sudip Mukherjee [Tue, 10 Mar 2015 17:16:52 +0000 (22:46 +0530)]
staging: sm750fb: remove unused functions
removed the functions which were not used anywhere.
it has been build tested also confirmed with git grep that there is
no other reference of these functions.
Sudip Mukherjee [Tue, 10 Mar 2015 08:45:39 +0000 (14:15 +0530)]
staging: sm750fb: fix build failure
for powerpc-allyesconfig build failed with an error of g_option
undeclared. we will get this error on all architecture if MODULE is
not defined. fixed the declaration of g_option.
Sudip Mukherjee [Tue, 10 Mar 2015 08:45:38 +0000 (14:15 +0530)]
staging: sm750fb: fix undeclared function
kbuild test robot reported that for microblaze-allyesconfig
chan_to_field() and lynxfb_ops_set_par() were not defined. These two
functions were defined under CONFIG_PM, so for any archtecture if
CONFIG_PM is not defined we will have this error.
while moving the lynxfb_suspend() function some very obvious
checkpatch errors, like space after comma, space after if, space
before opening brace, were taken care of.
Sudip Mukherjee [Tue, 10 Mar 2015 08:45:35 +0000 (14:15 +0530)]
staging: sm750fb: wrong type for print
mention correct format specifier while printing.
fixes all the build warnings about incorrect argument type while
printing.
since this is a framebuffer device and it should follow what the
framebuffer layer is suggesting in struct fb_fix_screeninfo at
smem_start and mmio_start, so accordingly changed the datatypes of
vidmem_start, vidreg_start, vidmem_size and vidreg_size.
This patch removes the IEEE80211_PRINT_STR macro definition because it appears
only in the header file and it doesn't serve any purpose in this context.
Variable len is used only to store the return value. Hence len is
removed and the return statement modified. Coccinelle was used to
detect such removable variables:
@rule1@
identifier ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Variable len is used only to store the return value. Hence len is
removed and the return statement modified. Coccinelle was used to
detect such removable variables:
@rule1@
identifier ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Variable ret is used only to store the error code to be returned.
Hence use of ret is removed and the return statement modified.
Coccinelle was used to prepare the patch:
@rule1@
identifier ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Variable ret is used only to store the return value. Hence ret is
removed and the return statement modified. Coccinelle was used to
detect such removable variables:
@rule1@
identifier ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Variable ret is used only to store the return value. Hence ret is
removed and the return statement modified. Coccinelle was used to
detect such removable variables:
@rule1@
identifier ret;
expression e;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Tina Johnson <tinajohnson.1234@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Somya Anand [Sat, 7 Mar 2015 17:50:01 +0000 (23:20 +0530)]
Staging: iio: Change data type to u16 to avoid unnecessary typecast
In the adis16220_read16bit() function we earlier used a s16 value 'val'
which is used by the adis_read_reg_16 function to read data and takes a
u16 value as a parameter.
So, this patch changes the data type of 'val' from s16 to u16. It is safe
to remove the extra sign extension, since the user of the function uses it
to read a 10 unsigned value which will lead to the same result in both cases.
Further this patch removes the unnecessary typecast for the simplification of
code. In addition to this, initialization of 'val' to 0 is also dropped. This is
due to the fact that not initializing helps the compiler provide useful warnings
if the code gets changed to return an otherwise uninitialized result.
Linus Torvalds [Sun, 8 Mar 2015 19:47:18 +0000 (12:47 -0700)]
Merge tag 'usb-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB fixes from Greg KH:
"Here's a round of USB fixes for 4.0-rc3.
Nothing major, the usual gadget, xhci and usb-serial fixes and a few
new device ids as well.
All have been in linux-next successfully"
* tag 'usb-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (36 commits)
xhci: Workaround for PME stuck issues in Intel xhci
xhci: fix reporting of 0-sized URBs in control endpoint
usb: ftdi_sio: Add jtag quirk support for Cyber Cortex AV boards
USB: ch341: set tty baud speed according to tty struct
USB: serial: cp210x: Adding Seletek device id's
USB: pl2303: disable break on shutdown
USB: mxuport: fix null deref when used as a console
USB: serial: clean up bus probe error handling
USB: serial: fix port attribute-creation race
USB: serial: fix tty-device error handling at probe
USB: serial: fix potential use-after-free after failed probe
USB: console: add dummy __module_get
USB: ftdi_sio: add PIDs for Actisense USB devices
Revert "USB: serial: make bulk_out_size a lower limit"
cdc-acm: Add support for Denso cradle CU-321
usb-storage: support for more than 8 LUNs
uas: Add US_FL_NO_REPORT_OPCODES for JMicron JMS539
USB: usbfs: don't leak kernel data in siginfo
xhci: Clear the host side toggle manually when endpoint is 'soft reset'
xhci: Allocate correct amount of scratchpad buffers
...
Linus Torvalds [Sun, 8 Mar 2015 19:25:40 +0000 (12:25 -0700)]
Merge tag 'tty-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty
Pull tty/serial fixes from Greg KH:
"Here are some tty and serial driver fixes for 4.0-rc3.
Along with the atime fix that you know about, here are some other
serial driver bugfixes as well. Most notable is a wait_until_sent
bugfix that was traced back to being around since before 2.6.12 that
Johan has fixed up.
All have been in linux-next successfully"
* tag 'tty-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
TTY: fix tty_wait_until_sent maximum timeout
TTY: fix tty_wait_until_sent on 64-bit machines
USB: serial: fix infinite wait_until_sent timeout
TTY: bfin_jtag_comm: remove incorrect wait_until_sent operation
net: irda: fix wait_until_sent poll timeout
serial: uapi: Declare all userspace-visible io types
serial: core: Fix iotype userspace breakage
serial: sprd: Fix missing spin_unlock in sprd_handle_irq()
console: Fix console name size mismatch
tty: fix up atime/mtime mess, take four
serial: 8250_dw: Fix get_mctrl behaviour
serial:8250:8250_pci: delete unneeded quirk entries
serial:8250:8250_pci: fix redundant entry report for WCH_CH352_2S
Change email address for 8250_pci
serial: 8250: Revert "tty: serial: 8250_core: read only RX if there is something in the FIFO"
Revert "tty/serial: of_serial: add DT alias ID handling"
Linus Torvalds [Sun, 8 Mar 2015 19:15:47 +0000 (12:15 -0700)]
Merge tag 'char-misc-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver fixes from Greg KH:
"Here are two char/misc fixes for 4.0-rc3.
One is a reported binder driver fix needed due to a change in the mm
core that happened in 4.0-rc1. Another is a mei driver fix that
resolves a reported issue in that driver.
Both have been in linux-next for a while"
* tag 'char-misc-4.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
mei: make device disabled on stop unconditionally
android: binder: fix binder mmap failures
Linus Torvalds [Sun, 8 Mar 2015 18:51:04 +0000 (11:51 -0700)]
Merge tag 'cc-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull "code of conflict" from Greg KH:
"This file tries to set the rational basis for our code reviews, gives
some advice on how to conduct them, and provides an excalation channel
for any kernel developers if they so desire it"
[ Let's see how this works ]
* tag 'cc-4.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
Code of Conflict
Linus Torvalds [Sat, 7 Mar 2015 19:31:17 +0000 (11:31 -0800)]
Merge tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux
Pull arm64 fixes from Catalin Marinas:
"arm64 and generic kernel/module.c (acked by Rusty) fixes for
CONFIG_DEBUG_SET_MODULE_RONX"
* tag 'arm64-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux:
kernel/module.c: Update debug alignment after symtable generation
arm64: Don't use is_module_addr in setting page attributes
Johan Hovold [Wed, 4 Mar 2015 09:39:07 +0000 (10:39 +0100)]
TTY: fix tty_wait_until_sent maximum timeout
Currently tty_wait_until_sent may take up to twice as long as the
requested timeout while waiting for driver and hardware buffers to
drain.
Fix this by taking the remaining number of jiffies after waiting for
driver buffers to drain into account so that the timeout actually
becomes a maximum timeout as it is documented to be.
Note that this specifically implies tighter timings when closing a port
as a consequence of actually honouring the port closing-wait setting
for drivers relying on tty_wait_until_sent_from_close (e.g. via
tty_port_close_start).
Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Johan Hovold [Wed, 4 Mar 2015 09:39:06 +0000 (10:39 +0100)]
TTY: fix tty_wait_until_sent on 64-bit machines
Fix overflow bug in tty_wait_until_sent on 64-bit machines, where an
infinite timeout (0) would be passed to the underlying tty-driver's
wait_until_sent-operation as a negative timeout (-1), causing it to
return immediately.
This manifests itself for example as tcdrain() returning immediately,
drivers not honouring the drain flags when setting terminal attributes,
or even dropped data on close as a requested infinite closing-wait
timeout would be ignored.
The first symptom was reported by Asier LLANO who noted that tcdrain()
returned prematurely when using the ftdi_sio usb-serial driver.
Fix this by passing 0 rather than MAX_SCHEDULE_TIMEOUT (LONG_MAX) to the
underlying tty driver.
Note that the serial-core wait_until_sent-implementation is not affected
by this bug due to a lucky chance (comparison to an unsigned maximum
timeout), and neither is the cyclades one that had an explicit check for
negative timeouts, but all other tty drivers appear to be affected.
Remove incorrect and redundant wait_until_sent operation, which waits
for the driver buffer rather than any hardware buffers to drain,
something which is already taken care of by the tty layer (and
chars_in_buffer).
Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 1 Mar 2015 15:24:28 +0000 (10:24 -0500)]
serial: uapi: Declare all userspace-visible io types
ioctl(TIOCGSERIAL|TIOCSSERIAL) report and can change the port->iotype.
UART drivers use the UPIO_* definitions, but the uapi header defines
parallel values and userspace uses these parallel values for ioctls;
thus the userspace values are definitive.
Define UPIO_* iotypes in terms of the uapi defines, SERIAL_IO_*;
extend the uapi defines to include all values in use by the serial
core.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 1 Mar 2015 15:18:16 +0000 (10:18 -0500)]
serial: core: Fix iotype userspace breakage
commit 3ffb1a8193bea ("serial: core: Add big-endian iotype")
re-numbered userspace-dependent values; ioctl(TIOCSSERIAL) can
assign the port iotype (which is expected to match the selected
i/o accessors), so iotype values must not be changed.
Cc: Kevin Cernekee <cernekee@gmail.com> Cc: <stable@vger.kernel.org> # 3.19+ Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Reviewed-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Axel Lin [Mon, 16 Feb 2015 14:39:04 +0000 (22:39 +0800)]
serial: sprd: Fix missing spin_unlock in sprd_handle_irq()
Fix return from sprd_handle_irq() with spin_lock held.
Signed-off-by: Axel Lin <axel.lin@ingics.com> Reviewed-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Peter Hurley [Sun, 1 Mar 2015 15:11:05 +0000 (10:11 -0500)]
console: Fix console name size mismatch
commit 6ae9200f2cab7 ("enlarge console.name") increased the storage
for the console name to 16 bytes, but not the corresponding
struct console_cmdline::name storage. Console names longer than
8 bytes cause read beyond end-of-string and failure to match
console; I'm not sure if there are other unexpected consequences.
But it still misses one point. As John Paul correctly points out, we
do not care about setting date. If somebody ever changes wall
time backwards (by mistake for example), tty timestamps are never
updated until the original wall time passes.
So check the absolute difference of times and if it large than "8
seconds or so", always update the time. That means we will update
immediatelly when changing time. Ergo, CAP_SYS_TIME can foul the
check, but it was always that way.
Thanks John for serving me this so nicely debugged.
Signed-off-by: Jiri Slaby <jslaby@suse.cz> Reported-by: John Paul Perry <john_paul.perry@alcatel-lucent.com> Cc: <stable@vger.kernel.org> # all, as b0b885657 was backported Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Desmond Liu [Fri, 27 Feb 2015 00:35:57 +0000 (16:35 -0800)]
serial: 8250_dw: Fix get_mctrl behaviour
Fixed behaviour of get_mctrl() serial driver function as documented in:
https://www.kernel.org/doc/Documentation/serial/driver
Added device-tree properties 'dcd-override', 'dsr-override',
'cts-override', and 'ri-override' specific to the Synopsis 8250
DesignWare UART driver. Allows one to force Data Carrier Detect,
Clear To Send, and Data Set Ready signals to permanently be reported as
active. The Ring indicator can be forced to be reported as inactive.
It is possible that if modem control signalling is enabled on a port
that doesn't have these pins (e.g. - a simple two wire Tx/Rx port), the
driver can hang indefinitely waiting for the state to change. The new
DT properties allow the driver to ignore the state of these pins on
serial ports that don't support them, as recommended in the kernel
documentation.
Reported-by: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Wang YanQing <udknight@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The conditional RX-FIFO read seems to cause spurious interrupts and we
see just:
|serial8250: too much work for irq29
The previous behaviour was "default" for decades and Marvell's 88f6282 SoC
might not be the only that relies on it. Therefore the Omap fix is
reverted for now.
Fixes: 0aa525d11859 ("tty: serial: 8250_core: read only RX if there is
something in the FIFO") Reported-By: Nicolas Schichan <nschichan@freebox.fr> Debuged-By: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The fsl-mc object allocator driver manages "allocatable" fsl-mc
objects such as DPBPs, DPMCPs and DPCONs. It provides services to
other fsl-mc drivers to allocate/deallocate these types of objects.
Signed-off-by: J. German Rivera <German.Rivera@freescale.com> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
staging: fsl-mc: Device driver for FSL-MC DPRC devices
A DPRC (Data Path Resource Container) is an isolation device
that contains a set of DPAA networking devices to be
assigned to an isolation domain (e.g., a virtual machine).
Signed-off-by: J. German Rivera <German.Rivera@freescale.com> Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com> Acked-by: Alexander Graf <agraf@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>