Commit graph

737201 commits

Author SHA1 Message Date
Valentin Vidic 5ca565adaf staging: pi433: fix CamelCase for syncValues
Fixes checkpatch warnings:

  CHECK: Avoid CamelCase: <syncValues>

Signed-off-by: Valentin Vidic <Valentin.Vidic@CARNet.hr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:35:04 +01:00
Jeremy Sowden d63923ff93 staging: ccree: fixed pointer signedness warnings.
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>
2018-02-16 15:33:02 +01:00
Ajay Singh 773b486994 staging: wilc1000: fix line over 80 chars in wilc_spi_clear_int_ext()
Refactor wilc_spi_clear_int_ext() to fix the "line over 80 char" issue
reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:30 +01:00
Ajay Singh 12ec07a4c7 staging: wilc1000: fix line over 80 characters in wilc_spi_read_int()
Refactor wilc_spi_read_int() to fix the line over 80 char issues reported
by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:30 +01:00
Ajay Singh c73f595089 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().

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:29 +01:00
Ajay Singh 169ed7ee33 staging: wilc1000: fix line over 80 characters in spi_cmd_complete()
Refactor spi_cmd_complete() to fix the line over 80 char issues reported
by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:29 +01:00
Ajay Singh 89f3091dff staging: wilc1000: removed the unnecessary commented code
Cleanup patch to remove the unused commented code.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:29 +01:00
Ajay Singh 00c2903b16 staging: wilc1000: modified code comments as per linux coding style
Cleanup patch to follow the comments style as per the Linux coding
style.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:31:29 +01:00
Ajay Singh 10660003be staging: wilc1000: rename Handle_Key() and Handle_ConnectTimeout()
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:33 +01:00
Ajay Singh e5b85ff324 staging: wilc1000: rename Handle_ScanDone function to avoid camelCase
Fix "Avoid camelCase" issue reported by checkpatch.pl.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:33 +01:00
Ajay Singh e33ff51ef9 staging: wilc1000: rename pu8CurrByte variable to avoid camelCase
Fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:33 +01:00
Ajay Singh cdbdae15d0 staging: wilc1000: rename u32WidsCount to avoid camelCase
Fix "Avoid camleCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:33 +01:00
Ajay Singh 173508b82c staging: wilc1000: rename strWIDList variable to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:32 +01:00
Ajay Singh 0414b40721 staging: wilc1000: rename Handle_DelAllSta() and its variable using camelCase
Fix "Avoid camelCase" issue reported by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:32 +01:00
Ajay Singh f10d4c18d8 staging: wilc1000: rename variables using camelCase in host_int_ParseJoinBssParam()
Fix "Avoid CamelCase:" issue reported by checkpatch.pl script.
Rename host_int_ParseJoinBssParam() & its variables using camelCase.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:32 +01:00
Arnd Bergmann 5c5e6ef628 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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:32 +01:00
Corentin Labbe e5fe0af517 staging: vc04_services: remove unused files
All thoses files are not used by anybody.
Lets just remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Acked-by: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:23:32 +01:00
NeilBrown 058643de84 staging: lustre: remove l_wait_event() and related code
These macros are no longer used, so they can
be removed.

Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Patrick Farrell <paf@cray.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:19:11 +01:00
NeilBrown 1c6ce08297 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>
2018-02-16 15:19:11 +01:00
NeilBrown cda3520497 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>
2018-02-16 15:19:11 +01:00
NeilBrown 9fc53ff230 staging: lustre: use explicit poll loop in ptlrpc_unregister_reply
replace l_wait_event() with wait_event_idle_timeout() and explicit
loop.  This approach is easier to understand.

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>
2018-02-16 15:19:11 +01:00
NeilBrown 0a0e5afcb2 staging: lustre: use explicit poll loop in ptlrpc_service_unlink_rqbd
Rather an using l_wait_event(), use wait_event_idle_timeout()
with an explicit loop so it is easier to see what is happening.

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>
2018-02-16 15:19:11 +01:00
NeilBrown fdeb5f9a51 staging: lustre: improve waiting in sptlrpc_req_refresh_ctx
Replace l_wait_event with wait_event_idle_timeout() and call the
handler function explicitly.  This makes it more clear
what is happening.

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>
2018-02-16 15:19:11 +01:00
NeilBrown c7621ba215 staging: lustre: use wait_event_idle_timeout in ptlrpcd()
We can replace l_wait_event() with
wait_event_idle_timeout() here providing we call the
timeout function when wait_event_idle_timeout() returns zero.

As ptlrpc_expired_set() returns 1, the l_wait_event() aborts of the
first 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>
2018-02-16 15:19:11 +01:00
NeilBrown 1307a0fdf9 staging: lustre: make polling loop in ptlrpc_unregister_bulk more obvious
This use of l_wait_event() is a polling loop that re-checks
every second.  Make this more obvious with a while loop
and wait_event_idle_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>
2018-02-16 15:19:11 +01:00
NeilBrown cac6e45735 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>
2018-02-16 15:19:11 +01:00
NeilBrown 4796293a7a 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>
2018-02-16 15:19:11 +01:00
NeilBrown 60f51d5974 staging: lustre: open code polling loop instead of using l_wait_event()
Two places that LWI_TIMEOUT_INTERVAL() is used, the outcome is a
simple polling loop that polls every second for some event (with a
limit).

So write a simple loop to make this more apparent.

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>
2018-02-16 15:19:10 +01:00
NeilBrown e3382addbc 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>
2018-02-16 15:19:10 +01:00
NeilBrown d7ce88fbb5 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>
2018-02-16 15:19:10 +01:00
NeilBrown eb7e1f3a3b 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>
2018-02-16 15:19:10 +01:00
NeilBrown 98b0928044 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>
2018-02-16 15:19:10 +01:00
NeilBrown 672b63e55b 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>
2018-02-16 15:19:10 +01:00
NeilBrown db1d6cbc2a 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>
2018-02-16 15:19:10 +01:00
NeilBrown 7f76eb1a6b staging: lustre: discard SVC_SIGNAL and related functions
This flag is never set, so remove checks and remove
the flag.

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>
2018-02-16 15:19:10 +01:00
NeilBrown 0957a2c1d9 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>
2018-02-16 15:19:09 +01:00
NeilBrown 8016ab9ebb staging: lustre: llite: refine ll_find_alias based on d_exact_alias
The task of ll_find_alias() is now very similar to d_exact_alias().
We cannot use that function directly, but we can copy much of
the structure so that the similarities and differences are more
obvious.
Examining d_exact_alias() shows that the d_lock spinlock does not
need to be held in ll_find_alias as much as it currently is.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:15:08 +01:00
NeilBrown 7e08e9a894 staging: lustre: llite: simplify ll_find_alias()
Now that ll_find_alias is only searching for one type
of dentry, we can return as soon as we find it.
This allows substantial simplification, and brings the
bonus that we don't need to take the d_lock again just
to increment the ref-count.  We can increment it immediately
that the dentry is found.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:15:08 +01:00
NeilBrown ac63774689 staging: lustre: llite: remove directory-specific code from ll_find_alias()
Now that ll_find_alias() is never called for directories,
we can remove code that only applies to directories.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:15:07 +01:00
NeilBrown e9d4f0b9f5 staging: lustre: llite: use d_splice_alias for directories.
In the Linux dcache a directory only ever has one dentry,
so d_splice_alias() can be used by ll_splice_alias() for directories.
It will find the one dentry whether it is DCACHE_DISCONNECTED or
IS_ROOT() or d_lustre_invalid().
Separating out the directories from non-directories will allow us
to simplify the non-directory code.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:32 +01:00
NeilBrown a22c3d41d1 staging: lustre: llite: handle DCACHE_PAR_LOOKUP in ll_dcompare
ll_dcompare is used in two slightly different contexts.
It is called (from __d_lookup, __d_lookup_rcu, and d_exact_alias)
to compare a name against a dentry that is already in the dcache.
It is also called (from d_alloc_parallel) to compare a name against
a dentry that is not in the dcache yet, but is part of an active
"lookup" or "atomic_open" call.

In the first case we need to avoid matching against "invalid" dentries
as a match implies something about ldlm locks which is not accurate.
In the second case we need to allow matching against "invalid" dentries
as the dentry will always be invalid (set by ll_d_init()) but we still
want to guard against multiple concurrent lookups of the same name.
d_alloc_parallel() will repeat the call to ll_dcompare() after
the lookup has finished, and if the dentry is still invalid, the whole
d_alloc_parallel() process is repeated.  This assures us that it is safe
to report success whenever d_in_lookup().

With this patch, there will never be two threads concurrently in
ll_lookup_nd(), looking up the same name in the same directory.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:32 +01:00
NeilBrown 057d1df649 staging: lustre: honor error code from ll_iget().
Commit 020ecc6f32 ("staging: lustre: llite: Remove IS_ERR tests")
changed ll_prep_inode to assume any error from ll_iget() meant
-ENOMEM because at that time it only returned NULL for errors.
Commit c3397e7e67 ("staging: lustre: llite: add error handler in
inode prepare phase") changed ll_iget() to once again return
meaningful codes, but nobody told ll_prep_inode().

So change ll_prep_inode() back to using PTR_ERR(*inode).

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:32 +01:00
NeilBrown 2cd466fecc staging: lustre: fix inverted test on strcmp
This code tests various fields to see if they are different, except
for one where there test is if they are the same.
This is clearly wrong for a function that is tesding for equality.

So change "!strcmp()" which I always find hard to read, to
"strcmp() != 0" which obviously means that the strings are not equal.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:32 +01:00
James Simmons 1b168a467f staging: lustre: update the TODO list
As more people become involved with the progression of the lustre
client it needs to more clear what needs to be done to leave
staging. Update the TODO list with the various bugs and changes
to accomplish this. Some are simple bugs and others are far more
complex task that will change many lines of code. Some even cover
updating the user land utilities to meet the kernel requirements.
Several bugs have already been addressed and just need to be
pushed to the staging tree.

Signed-off-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:32 +01:00
Sumit Pundir 56cabde291 staging: lustre: lnet: return of an error code should be negative
Return value of error codes should typically be negative.
Issue reported by checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 15:13:31 +01:00
Dafna Hirschfeld aa4e0df863 staging: rtl8188eu: Move a blank line
Move a blank line from in the middle of a declaration list to
after the declaration list, to improve readability.

Issue found by checkpatch.

Signed-off-by: Dafna Hirschfeld <dafna3@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-16 12:29:35 +01:00
Linus Torvalds 7928b2cbe5 Linux 4.16-rc1 2018-02-11 15:04:29 -08:00
Al Viro 7a163b2195 unify {de,}mangle_poll(), get rid of kernel-side POLL...
except, again, POLLFREE and POLL_BUSY_LOOP.

With this, we finally get to the promised end result:

 - POLL{IN,OUT,...} are plain integers and *not* in __poll_t, so any
   stray instances of ->poll() still using those will be caught by
   sparse.

 - eventpoll.c and select.c warning-free wrt __poll_t

 - no more kernel-side definitions of POLL... - userland ones are
   visible through the entire kernel (and used pretty much only for
   mangle/demangle)

 - same behavior as after the first series (i.e. sparc et.al. epoll(2)
   working correctly).

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-11 14:37:22 -08:00
Linus Torvalds a9a08845e9 vfs: do bulk POLL* -> EPOLL* replacement
This is the mindless scripted replacement of kernel use of POLL*
variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
        L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
        for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
    done

with de-mangling cleanups yet to come.

NOTE! On almost all architectures, the EPOLL* constants have the same
values as the POLL* constants do.  But they keyword here is "almost".
For various bad reasons they aren't the same, and epoll() doesn't
actually work quite correctly in some cases due to this on Sparc et al.

The next patch from Al will sort out the final differences, and we
should be all done.

Scripted-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2018-02-11 14:34:03 -08:00
Linus Torvalds ee5daa1361 Merge branch 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull more poll annotation updates from Al Viro:
 "This is preparation to solving the problems you've mentioned in the
  original poll series.

  After this series, the kernel is ready for running

      for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
            L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
            for f in $L; do sed -i "-es/^\([^\"]*\)\(\<POLL$V\>\)/\\1E\\2/" $f; done
      done

  as a for bulk search-and-replace.

  After that, the kernel is ready to apply the patch to unify
  {de,}mangle_poll(), and then get rid of kernel-side POLL... uses
  entirely, and we should be all done with that stuff.

  Basically, that's what you suggested wrt KPOLL..., except that we can
  use EPOLL... instead - they already are arch-independent (and equal to
  what is currently kernel-side POLL...).

  After the preparations (in this series) switch to returning EPOLL...
  from ->poll() instances is completely mechanical and kernel-side
  POLL... can go away. The last step (killing kernel-side POLL... and
  unifying {de,}mangle_poll() has to be done after the
  search-and-replace job, since we need userland-side POLL... for
  unified {de,}mangle_poll(), thus the cherry-pick at the last step.

  After that we will have:

   - POLL{IN,OUT,...} *not* in __poll_t, so any stray instances of
     ->poll() still using those will be caught by sparse.

   - eventpoll.c and select.c warning-free wrt __poll_t

   - no more kernel-side definitions of POLL... - userland ones are
     visible through the entire kernel (and used pretty much only for
     mangle/demangle)

   - same behavior as after the first series (i.e. sparc et.al. epoll(2)
     working correctly)"

* 'work.poll2' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  annotate ep_scan_ready_list()
  ep_send_events_proc(): return result via esed->res
  preparation to switching ->poll() to returning EPOLL...
  add EPOLLNVAL, annotate EPOLL... and event_poll->event
  use linux/poll.h instead of asm/poll.h
  xen: fix poll misannotation
  smc: missing poll annotations
2018-02-11 13:57:19 -08:00