Remove the macro 'gdm_tty_send_control' which adds unnecessary complexity,
is unused, and has arguments that could mistakenly be evaluated multiple
times.
Stefano Manni [Sun, 18 Feb 2018 19:52:13 +0000 (20:52 +0100)]
staging: rtl8712: fix signedness of length to rtl8717_set_ie
rtl8717_set_it() takes an unsigned int pointer as length,
fixed signedness in code using it.
Sparse warnings:
drivers/staging/rtl8712/ieee80211.c:191:53: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:191:53: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:191:53: got int *<noident>
drivers/staging/rtl8712/ieee80211.c:197:57: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:197:57: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:197:57: got int *<noident>
drivers/staging/rtl8712/ieee80211.c:199:63: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:199:63: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:199:63: got int *<noident>
drivers/staging/rtl8712/ieee80211.c:202:67: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:202:67: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:202:67: got int *<noident>
drivers/staging/rtl8712/ieee80211.c:206:73: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:206:73: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:206:73: got int *<noident>
drivers/staging/rtl8712/ieee80211.c:209:75: warning: incorrect type in argument 5 (different signedness)
drivers/staging/rtl8712/ieee80211.c:209:75: expected unsigned int [usertype] *frlen
drivers/staging/rtl8712/ieee80211.c:209:75: got int *<noident>
Stefano Manni [Sun, 18 Feb 2018 19:52:12 +0000 (20:52 +0100)]
staging: rtl8712: make unsigned length for rtl8717_get{_wpa_, _wpa2_, _}ie
Fixed r8712_get_ie, r8712_get_wpa_ie, r8712_get_wpa2_ie
to have a length as unsigned int pointer instead of signed.
Sparse warnings:
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: warning: incorrect type in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: expected signed int *len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:173:27: got unsigned int *<noident>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: warning: incorrect type in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: expected signed int *len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:613:35: got unsigned int *<noident>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: warning: incorrect type in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: expected signed int *len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1411:67: got unsigned int *<noident>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: warning: incorrect type in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: expected int *rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1992:33: got unsigned int *<noident>
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: warning: incorrect type in argument 2 (different signedness)
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: expected int *rsn_ie_len
drivers/staging/rtl8712/rtl871x_ioctl_linux.c:1998:33: got unsigned int *<noident>
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: warning: incorrect type in argument 3 (different signedness)
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: expected signed int *len
drivers/staging/rtl8712/rtl871x_mlme.c:1701:59: got unsigned int *<noident>
Dafna Hirschfeld [Sun, 18 Feb 2018 16:43:04 +0000 (18:43 +0200)]
staging: rtl8723bs: clean up conditionals
Move all closing braces and parentheses to the end of the line.
Remove braces from 'if' statements with a single 'then' line.
Move logical operators to the end of lines in multiline conditional.
Remove unnecessary parentheses.
Issues found with checkpatch.pl
Dafna Hirschfeld [Sun, 18 Feb 2018 20:08:34 +0000 (22:08 +0200)]
staging: rtl8188eu: Replace function name in string with __func__
Replace hard coded function name FillH2CCmd_88E with __func__
and break the line to avoid more then 80 characters line.
Issue found using checkpatch.pl
staging: comedi: Remove a newline inside a dereference
Remove a new line inside a dereference so that it is not on
multiple lines.
And avoid making the line go over 80 columns by moving the whole
dma_alloc_coherent() call back 4 columns. Problem found with
checkpatch.
Yisheng Xie [Mon, 12 Feb 2018 10:43:14 +0000 (18:43 +0800)]
staging: android: ion: Combine cache and uncache pools
Now we call dma_map in the dma_buf API callbacks and handle explicit
caching by the dma_buf sync API, which make cache and uncache pools
in the same handling flow, which can be combined.
ion_page_pool_alloc_pages calls alloc_pages to allocate pages for page
pools. If alloc_pages return NULL, it will return NULL, or it will
return the pages allocate from alloc_pages. So we can just return
alloc_pages without any judgement.
Yisheng Xie [Mon, 12 Feb 2018 10:43:11 +0000 (18:43 +0800)]
staging: android: ion: Remove dead code in ion_page_pool_free
ion_page_pool_add will always return 0, however ion_page_pool_free will
call ion_page_pool_free_pages when ion_page_pool_add's return value is
not 0, so it is a dead code which can be removed.
Yisheng Xie [Mon, 12 Feb 2018 10:43:09 +0000 (18:43 +0800)]
staging: android: ion: Avoid NULL point in error path
If we failed to create debugfs for ion at ion_device_create, the
debug_root of ion_device will be NULL, and then when try to create debug
file for shrinker of heap it will be create on the top of debugfs. If we
also failed to create this the debug file, it call dentry_path to found
the path of debug_root, then a NULL point will occur.
Fix this by avoiding call dentry_path, but show the debug name only when
failed to create debug file for shrinker.
Yisheng Xie [Mon, 12 Feb 2018 10:43:08 +0000 (18:43 +0800)]
staging: android: ion: Nuke ion_page_pool_init
ion_page_pool.c now is used to apply pool APIs for system heap, which do
not need do any initial at device_initcall. Therefore ion_page_pool_init
can be nuked.
David Kershner [Wed, 31 Jan 2018 16:41:16 +0000 (11:41 -0500)]
staging: unisys: visorinput: Fix spacing after open paranthesis
Checkpatch was giving errors about an open parenthesis being the last thing
on a line. This patch cleans up some names and removes the checkpatch
warnings.
Signed-off-by: David Kershner <david.kershner@unisys.com> Reviewed-by: Tim Sell <timothy.sell@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Tim Sell [Wed, 31 Jan 2018 16:41:12 +0000 (11:41 -0500)]
staging: unisys: visorinput: remove need for 'depends on FB'
Previously, we used a hack to determine the max x,y resolution of the
visor virtual mouse: we just looked at the resolution of the
first-registered framebuffer device, using the currently-valid assumption
that in a Unisys s-Par guest environment the video will be provided by an
efifb framebuffer device.
This hack has been removed, by instead determining the default mouse
resolution by looking at fields within the visor mouse channel memory,
mouse.x_res and mouse.y_res. If these fields are 0, a default resolution
of 1024x768 is assumed.
Signed-off-by: Tim Sell <Timothy.Sell@unisys.com> Signed-off-by: David Kershner <david.kershner@unisys.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Dileep Sankhla [Mon, 12 Feb 2018 11:34:27 +0000 (17:04 +0530)]
staging: vt6656: Remove unnecessary 'out of memory' message
This patch removes the unnecessary out of memory message fixing the
following checkpatch.pl warning in usbpipe.c:
WARNING: Possible unnecessary 'out of memory' message
staging: rtl8723bs: make 'myid' function to follow kernel coding rules
Checkpatch.pl produced errors regarding inline keyword placement and
parenthesis around returned value in 'myid'.
Place inline after static keyword and remove mentioned parenthesis.
The driver uses a mixture of signed and unsigned integer variables for
holding arrays lengths and indices, which gives rise to the following
sparse warnings when the addresses of signed variables are passed to
functions expecting pointers to unsigned integers:
drivers/staging/ccree/cc_buffer_mgr.c:1050:46: warning: incorrect type in argument 4 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1050:46: expected unsigned int [usertype] *lbytes
drivers/staging/ccree/cc_buffer_mgr.c:1050:46: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1083:62: warning: incorrect type in argument 7 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1083:62: expected unsigned int [usertype] *lbytes
drivers/staging/ccree/cc_buffer_mgr.c:1083:62: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1092:46: warning: incorrect type in argument 4 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1092:46: expected unsigned int [usertype] *lbytes
drivers/staging/ccree/cc_buffer_mgr.c:1092:46: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1120:49: warning: incorrect type in argument 4 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1120:49: expected unsigned int [usertype] *src_last_bytes
drivers/staging/ccree/cc_buffer_mgr.c:1120:49: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1121:49: warning: incorrect type in argument 5 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1121:49: expected unsigned int [usertype] *dst_last_bytes
drivers/staging/ccree/cc_buffer_mgr.c:1121:49: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1124:49: warning: incorrect type in argument 2 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1124:49: expected unsigned int [usertype] *src_last_bytes
drivers/staging/ccree/cc_buffer_mgr.c:1124:49: got int *<noident>
drivers/staging/ccree/cc_buffer_mgr.c:1125:44: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_buffer_mgr.c:1125:44: expected unsigned int [usertype] *dst_last_bytes
drivers/staging/ccree/cc_buffer_mgr.c:1125:44: got int *<noident>
drivers/staging/ccree/cc_cipher.c:697:67: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_cipher.c:697:67: expected unsigned int *seq_size
drivers/staging/ccree/cc_cipher.c:697:67: got int *<noident>
drivers/staging/ccree/cc_cipher.c:700:31: warning: incorrect type in argument 8 (different signedness)
drivers/staging/ccree/cc_cipher.c:700:31: expected unsigned int *seq_size
drivers/staging/ccree/cc_cipher.c:700:31: got int *<noident>
drivers/staging/ccree/cc_hash.c:480:57: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_hash.c:480:57: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:480:57: got int *<noident>
drivers/staging/ccree/cc_hash.c:530:57: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_hash.c:530:57: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:530:57: got int *<noident>
drivers/staging/ccree/cc_hash.c:1305:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1305:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1305:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1307:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1307:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1307:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1317:69: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_hash.c:1317:69: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1317:69: got int *<noident>
drivers/staging/ccree/cc_hash.c:1390:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1390:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1390:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1393:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1393:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1393:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1404:69: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_hash.c:1404:69: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1404:69: got int *<noident>
drivers/staging/ccree/cc_hash.c:1469:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1469:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1469:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1472:43: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_hash.c:1472:43: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1472:43: got int *<noident>
drivers/staging/ccree/cc_hash.c:1483:69: warning: incorrect type in argument 6 (different signedness)
drivers/staging/ccree/cc_hash.c:1483:69: expected unsigned int *seq_size
drivers/staging/ccree/cc_hash.c:1483:69: got int *<noident>
drivers/staging/ccree/cc_aead.c:2011:37: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_aead.c:2011:37: expected unsigned int *seq_size
drivers/staging/ccree/cc_aead.c:2011:37: got int *<noident>
drivers/staging/ccree/cc_aead.c:2017:45: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_aead.c:2017:45: expected unsigned int *seq_size
drivers/staging/ccree/cc_aead.c:2017:45: got int *<noident>
drivers/staging/ccree/cc_aead.c:2020:45: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_aead.c:2020:45: expected unsigned int *seq_size
drivers/staging/ccree/cc_aead.c:2020:45: got int *<noident>
drivers/staging/ccree/cc_aead.c:2024:44: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_aead.c:2024:44: expected unsigned int *seq_size
drivers/staging/ccree/cc_aead.c:2024:44: got int *<noident>
drivers/staging/ccree/cc_aead.c:2026:44: warning: incorrect type in argument 3 (different signedness)
drivers/staging/ccree/cc_aead.c:2026:44: expected unsigned int *seq_size
drivers/staging/ccree/cc_aead.c:2026:44: got int *<noident>
This patch fixes those warnings by converting those signed variables to
unsigned as follows:
* changed the types of a number of index and length variables from
signed to unsigned integer types.
* changed the return-types of a couple of functions that return length
values which are assigned to one of these variables from signed to
unsigned integer types.
Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Ajay Singh [Wed, 14 Feb 2018 11:10:13 +0000 (16:40 +0530)]
staging: wilc1000: fix line over 80 characters in wilc_spi_init()
Modified wilc_spi_init() to fix the line over 80 char issues reported
by checkpatch.pl script.
To overcome the checkpatch.pl reported issue modified debug logs and
comments used in wilc_spi_init().
Arnd Bergmann [Fri, 2 Feb 2018 15:01:46 +0000 (16:01 +0100)]
staging: vc04_services: merge vchiq_kern_lib.c into vchiq_arm.c
There are two incompatible definitions of 'vchiq_instance_struct', so
passing them through vchiq_initialise(), vchiq_connect() or another
such interface is broken, as shown by building the driver with link-time
optimizations:
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h:129:0: error: type of 'vchiq_initialise' does not match original declaration [-Werror=lto-type-mismatch]
extern VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *pinstance);
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c:68:0: note: 'vchiq_initialise' was previously declared here
VCHIQ_STATUS_T vchiq_initialise(VCHIQ_INSTANCE_T *instance_out)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c:68:0: note: code may be misoptimized unless -fno-strict-aliasing is used
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h:131:0: error: type of 'vchiq_connect' does not match original declaration [-Werror=lto-type-mismatch]
extern VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance);
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_kern_lib.c:168:0: note: 'vchiq_connect' was previously declared here
VCHIQ_STATUS_T vchiq_connect(VCHIQ_INSTANCE_T instance)
It's possible that only one of the two sides actually access the members,
but it's clear that they need to agree on the layout. The easiest way
to achieve this appears to be to merge the two files into one. I tried
moving the structure definition into a shared header first, but ended
up running into too many interdependencies that way.
NeilBrown [Mon, 12 Feb 2018 23:47:59 +0000 (10:47 +1100)]
staging: lustre: replace l_wait_event_exclusive_head() with wait_event_idle_exclusive
This l_wait_event_exclusive_head() will wait indefinitely
if the timeout is zero. If it does wait with a timeout
and times out, the timeout for next time is set to zero.
The can be mapped to a call to either
wait_event_idle_exclusive()
or
wait_event_idle_exclusive_timeout()
depending in the timeout setting.
The current code arranges for LIFO queuing of waiters,
but include/event.h doesn't support that yet.
Until it does, fall back on FIFO with
wait_event_idle_exclusive{,_timeout}().
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 23:47:59 +0000 (10:47 +1100)]
staging: lustre: remove l_wait_event from ptlrpc_set_wait
This is the last remaining use of l_wait_event().
It is the only use of LWI_TIMEOUT_INTR_ALL() which
has a meaning that timeouts can be interrupted.
Only interrupts by "fatal" signals are allowed, so
introduce l_wait_event_abortable_timeout() to
support this.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 23:47:59 +0000 (10:47 +1100)]
staging: lustre: remove back_to_sleep()
When 'back_to_sleep()' is passed as the 'timeout' function,
the effect is to wait indefinitely for the event, polling
once after the timeout.
If LWI_ON_SIGNAL_NOOP is given, then after the timeout
we allow fatal signals to interrupt the wait.
Make this more obvious in both places "back_to_sleep()" is
used but using two explicit sleeps.
The code in ptlrpcd_add_req() looks odd - why not just have one
wait_event_idle()? However I believe this is a faithful
transformation of the existing code.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 23:47:59 +0000 (10:47 +1100)]
staging: lustre: simplify waiting in ptlrpc_invalidate_import()
This waiter currently wakes up every second to re-test if
imp_flight is zero. If we ensure wakeup is called whenever
imp_flight is decremented to zero, we can just have a simple
wait_event_idle_timeout().
So add a wake_up_all to the one place it is missing, and simplify
the wait_event.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Tue, 13 Feb 2018 20:17:30 +0000 (07:17 +1100)]
staging: lustre: simplify waiting in ldlm_completion_ast()
If a signal-callback (lwi_on_signal) is set without lwi_allow_intr, as
is the case in ldlm_completion_ast(), the behavior depends on the
timeout set.
If a timeout is set, then signals are ignored. If the timeout is
reached, the timeout handler is called. If the timeout handler
return 0, which ldlm_expired_completion_wait() always does, the
l_wait_event() switches to exactly the behavior if no timeout was set.
If no timeout is set, then "fatal" signals are not ignored. If one
arrives the callback is run, but as the callback is empty in this
case, that is not relevant.
This can be simplified to:
if a timeout is wanted
wait_event_idle_timeout()
if that timed out, call the timeout handler
l_wait_event_abortable()
i.e. the code always waits indefinitely. Sometimes it performs a
non-abortable wait first. Sometimes it doesn't. But it only
aborts before the condition is true if it is signaled.
This doesn't quite agree with the comments and debug messages.
Now that we call the timeout handler (ldlm_expired_completion_wait())
wait directly, we can pass the two args directly rather then
using a special-purpose struct.
Reviewed-by: Patrick Farrell <paf@cray.com> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
staging: lustre: simplify l_wait_event when intr handler but no timeout.
If l_wait_event() is given a function to be called on a signal,
but no timeout or timeout handler, then the intr function is simply
called at the end if the wait was aborted by a signal.
So a simpler way to write the code (in the one place this case is
used) it to open-code the body of the function after the
wait_event, if -ERESTARTSYS was returned.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
staging: lustre: introduce and use l_wait_event_abortable()
lustre sometimes wants to wait for an event, but abort if
one of a specific list of signals arrives. This is a little
bit like wait_event_killable(), except that the signals are
identified a different way.
So introduce l_wait_event_abortable() which provides this
functionality.
Having separate functions for separate needs is more in line
with the pattern set by include/linux/wait.h, than having a
single function which tries to include all possible needs.
Also introduce l_wait_event_abortable_exclusive().
Note that l_wait_event() return -EINTR on a signal, while
Linux wait_event functions return -ERESTARTSYS.
l_wait_event_{abortable_,}exclusive follow the Linux pattern.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
staging: lustre: use wait_event_idle_timeout() where appropriate.
When the lwi arg has a timeout, but no timeout
callback function, l_wait_event() acts much the same as
wait_event_idle_timeout() - the wait is not interruptible and
simply waits for the event or the timeouts.
The most noticable difference is that the return value is
-ETIMEDOUT or 0, rather than 0 or non-zero.
Another difference is that if the timeout is zero, l_wait_event()
will not time out at all. In the one case where that is possible
we need to conditionally use wait_event_idle().
So replace all such calls with wait_event_idle_timeout(), being
careful of the return value.
In one case, there is no event expected, only the timeout
is needed. So use schedule_timeout_uninterruptible().
Note that the presence or absence of LWI_ON_SIGNAL_NOOP
has no effect in these cases. It only has effect if the timeout
callback is non-NULL, or the timeout is zero, or
LWI_TIMEOUT_INTR_ALL() is used.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
staging: lustre: discard cfs_time_seconds()
cfs_time_seconds() converts a number of seconds to the
matching number of jiffies.
The standard way to do this in Linux is "* HZ".
So discard cfs_time_seconds() and use "* HZ" instead.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
staging: lustre: replace simple cases of l_wait_event() with wait_event().
When the lwi arg is full of zeros, l_wait_event() behaves almost
identically to the standard wait_event_idle() interface, so use that
instead.
l_wait_event() uses TASK_INTERRUPTIBLE, but blocks all signals.
wait_event_idle() uses the new TASK_IDLE and so avoids adding
to the load average without needing to block signals.
In one case, wait_event_idle_exclusive() is needed.
Also remove all l_wait_condition*() macros which were short-cuts
for setting lwi to {0}.
Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
NeilBrown [Mon, 12 Feb 2018 21:22:36 +0000 (08:22 +1100)]
sched/wait: add wait_event_idle() functions.
The new TASK_IDLE state (TASK_UNINTERRUPTIBLE | __TASK_NOLOAD)
is not much used. One way to make it easier to use is to
add wait_event*() family functions that make use of it.
This patch adds:
wait_event_idle()
wait_event_idle_timeout()
wait_event_idle_exclusive()
wait_event_idle_exclusive_timeout()
This set was chosen because lustre needs them before
it can discard its own l_wait_event() macro.
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: James Simmons <jsimmons@infradead.org> Signed-off-by: NeilBrown <neilb@suse.com> Reviewed-by: Patrick Farrell <paf@cray.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>