Commit graph

737332 commits

Author SHA1 Message Date
Rodrigo Siqueira f22fb87d4c staging:iio:meter: Aligns open parenthesis
This patch fixes the checkpatch.pl checks:

staging/iio/meter/ade7854-spi.c:19: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:44: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:70: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:97: CHECK: Alignment should match open
parenthesis
staging/iio/meter/ade7854-spi.c:125: CHECK: Alignment should match open
parenthesis

...

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07 20:10:07 +00:00
Rodrigo Siqueira b5724925da staging:iio:meter: Remove unused macro IIO_DEV_ATTR_CH_OFF
This patch removes the macro IIO_DEV_ATTR_CH_OFF. The macro
IIO_DEV_ATTR_CH_OFF is not required, due to the replace of it by the
direct use of IIO_DEVICE_ATTR in files staging/iio/meter/ade7759.c and
staging/iio/meter/ade7753.c.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07 20:09:24 +00:00
Rodrigo Siqueira 75f800a7eb staging:iio:meter: Replaces IIO_DEV_ATTR_CH_OFF by IIO_DEVICE_ATTR
The macro IIO_DEV_ATTR_CH_OFF is a wrapper for IIO_DEVICE_ATTR, with a
tiny change in the name definition. This extra macro does not improve
the readability and also creates some checkpatch errors.

This patch fixes the checkpatch.pl errors:

staging/iio/meter/ade7753.c:391: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7753.c:395: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7759.c:331: ERROR: Use 4 digit octal (0777) not
decimal permissions
staging/iio/meter/ade7759.c:335: ERROR: Use 4 digit octal (0777) not
decimal permissions

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07 20:07:07 +00:00
HariPrasath Elango 844ed8220c staging: iio: meter: Remove reduntant __func__ from debug print
dev_dbg includes the function name & line number by default when dynamic
debugging is enabled. Hence__func__ is reduntant here and removed.

Signed-off-by: HariPrasath Elango <hariprasath.elango@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07 19:56:40 +00:00
Arushi Singhal bd28425a30 staging: iio: Remove unnecessary cast on void pointer
The following Coccinelle script was used to detect this:
@r@
expression x;
void* e;
type T;
identifier f;
@@
(
  *((T *)e)
|
  ((T *)x)[...]
|
  ((T*)x)->f
|

- (T*)
  e
)

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-07 19:52:58 +00:00
Shreeya Patel 200905fdf0 Staging: iio: adis16209: Add _REG postfix for registers
The defined names for registers does not make it very
clear that they are registers and hence, add _REG postfix.
This improves the readability of the code.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:41:22 +00:00
Shreeya Patel c97712c41f Staging: iio: adis16209: Change the definition name
The change in the definition name makes it then obvious
what the units are throughout the driver and there will
be no need of the comment.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:40:21 +00:00
Shreeya Patel 5824d0938d Staging: iio: adis16209: Arrange headers in alphabetical order
Arrange the headers in alphabetical order for cleanup
purpose.

Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:38:24 +00:00
Rodrigo Siqueira 5def839c48 iio:magnetometer: Replace magic number 0 by IIO_CHAN_INFO_RAW
The function magn_3d_read_raw has a switch statement handling multiple
cases per channel. The first case statement uses the magic number 0,
which means IIO_CHAN_INFO_RAW. Additionally, the iio_chan_spec for
magn_3d_channels is configured to be IIO_CHAN_INFO_RAW. Therefore, this
patch replaces the magic number 0 for the appropriate IIO_CHAN_INFO_RAW.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:23:13 +00:00
Rodrigo Siqueira 5556dfe54b iio:dummy: Add extra paragraphs on Kconfig
This patch fixes the checkpatch.pl warning:

drivers/iio/dummy/Kconfig:21: WARNING: please write a paragraph that
describes the config symbol fully
drivers/iio/dummy/Kconfig:27: WARNING: please write a paragraph that
describes the config symbol fully

This patch expands the explanation about IIO_DUMMY_EVGEN by using the
code documentation found in iio/dummy/iio_dummy_evgen.c. In the same
way, the information related to IIO_SIMPLE_DUMMY_BUFFER was extracted
from file iio_simple_dummy_buffer.c.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:20:16 +00:00
Rodrigo Siqueira a34a3ed73c iio: dummy: Add correct tabs and spaces to Kconfig
Kconfig from iio/dummy does not follow the coding style recommendations.
According to the coding-style, Lines under a config definition are
indented with one tab, while help text is indented an additional two
spaces. This patch adds the proper tabulation and space.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:19:38 +00:00
Jeff LaBundy 0f07954715 iio: light: lv0104cs: Add support for LV0104CS light sensor
This patch adds support for the On Semiconductor LV0104CS ambient
light sensor.

Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:16:57 +00:00
Andy Shevchenko b61d8e630a iio: proximity: sx9500: Add GPIO ACPI mapping table
In order to satisfy GPIO ACPI library requirements convert users of
gpiod_get_index() to correctly behave when there no mapping is provided
by firmware.

Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:11:27 +00:00
Fabrice Gasnier c0879ed618 dt-bindings: iio: adc: stm32-dfsdm: fix types, add missing pinctrl
- Add missing pinctrl description. Support is made optional as dfsdm
  may use internal sources (e.g. via registers)
- Fix typo in IIO STM32 DFSDM filter "MANCH_F" description.
Basically, this should be "falling edge = logic 0", not "1" that applies
to "MANCH_R".
BTW, make the description complete by describing both rising/falling
edges as described in reference manuals.

Fixes: 6c82f947fc ("IIO: add DT bindings for stm32 DFSDM filter")

Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:07:14 +00:00
Gwendal Grignou 0dad1eceeb iio: cros_ec: Relax sampling frequency before suspending
If an application set a tight sampling frequency, given the interrupt
use is a wakeup source, suspend will not happen: the kernel will receive
a wake up interrupt and will cancel the suspend process.

Given cros_ec sensors type is non wake up, this patch adds prepare and
complete callbacks to set 1s sampling period just before suspend. This
ensures the sensor hub will not be a source of interrupt during the
suspend process.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03 15:02:58 +00:00
Rodrigo Siqueira 6de543e31d staging:iio:meter: Add name to function definition arguments
This patch fixes the checkpatch.pl warning:

drivers/staging/iio/meter/ade7854.h:157: WARNING: function definition
argument 'struct device *' should also have an identifier name...

This commit adds arguments names to the signature declared in the
ade7854_state struct. For consistency reason, It also renames all
arguments in function definitions.

Signed-off-by: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24 13:40:21 +00:00
Dan Carpenter c50fadeff7 iio temperature/mlx90632: silence a static checker warning
This shouldn't affect runtime at all, but Smatch complains that we
should check if mlx90632_read_ambient_raw() otherwise we
"ambient_new_raw" can be uninitialized.

    drivers/iio/temperature/mlx90632.c:509 mlx90632_calc_ambient_dsp105()
    error: uninitialized symbol 'ambient_new_raw'.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Crt Mori <cmo@melexis.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24 13:32:05 +00:00
Andy Shevchenko 1b3079a721 iio: accel: bmc150: Remove redundant __func__ in dev_dbg()
Dynamic debug has a run time knob to enable function name printing.
Remove this from dev_dbg() calls.

Furthermore, functional tracing when enabled can show what function is
called, therefore remove empty dev_dbg() calls.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24 13:29:36 +00:00
Quentin Schulz adc18ba906 iio: adc: axp20x_adc: remove !! in favor of ternary condition
!!'s behaviour isn't that obvious and sparse complained about it, so
let's replace it with a ternary condition.

Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24 12:19:45 +00:00
Richard Lai 4c73b809a9 iio: chemical: ccs811: Renamed resistance member in ccs811_reading struct
The resistance member in ccs811_reading struct is an unsigned 16-bit
integer variable used to store RAW_DATA register bytes read from CCS811.
It is kind of misleading to name this struct member as resistance.

About the RAW_DATA register bytes, the CCS811 datasheet states that:
-----
Two byte read only register which contains the latest readings from the
sense resistor.

The most significant 6 bits of the Byte 0 contain the value of the current
through the sensor (0μA to 63μA).

The lower 10 bits contain (as computed from the ADC) the readings of the
voltage across the sensor with the selected current (1023 = 1.65V)"
-----

Hence, the RAW_DATA register byte contains information about electric
current and voltage of the CCS811 sensor. Calling this struct member
'resistance' is kind of misleading, although both electric current and
voltage are needed to calculate the electrical resistance of the sensor
using Ohm's law, V = I x R, in which a new channel type of IIO_RESISTANCE
may be added to the driver in the future.

Signed-off-by: Richard Lai <richard@richardman.com>

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-02-24 11:04:28 +00:00
Santha Meena Ramamoorthy 721dfe4133 staging: speakup: remove space after a cast
Remove blank space after a cast to conform to Linux kernel coding style.
Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:57 +01:00
Santha Meena Ramamoorthy f6222d13d9 staging: speakup: match alignment with open parenthesis
Match alignment with open parenthesis to conform to Linux kernel coding
style. Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:57 +01:00
Santha Meena Ramamoorthy 0f7be57c05 staging: speakup: add spaces around arithmetic operators
Add space around arithmetic operators ('+', '-' and '*') to conform to
Linux kernel coding style. Problem found using checkpatch.

Signed-off-by: Santha Meena Ramamoorthy <santhameena13@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:56 +01:00
Quytelda Kahja ba3d01560b Staging: gdm724x: LTE: Refactor gdm_lte_pdn_table().
Mostly this change just reverses the primary conditional so most of
the code can be pulled back a tab, which fixes some code style
warnings.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:56 +01:00
Quytelda Kahja 1b5e56ece3 Staging: gdm724x: Simplify the struct gdm_endian to a variable.
Since the testing for host endianness and in-driver conversion were
removed in 77e8a50149, the gdm_endian struct contains only one member,
and can therefore be simplified to a single u8 variable.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:56 +01:00
Quytelda Kahja 8db3656310 Staging: gdm724x: LTE: Fix trailing open parentheses.
Fix lines with a trailing open parenthesis, which is a coding style issue.

Signed-off-by: Quytelda Kahja <quytelda@tamalin.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-23 09:54:56 +01:00
Bogdan Purcareata 7afe031c1a staging: fsl-mc: Move irqchip code out of staging
Now that the fsl-mc bus core infrastructure is out of staging, the
remaining irqchip glue code used (irq-gic-v3-its-fsl-mc-msi.c) goes
to drivers/irqchip.

Create new Kconfig option for irqchip code that depends on
FSL_MC_BUS and ARM_GIC_V3_ITS. This ensures irqchip code only
gets built on ARM64 platforms. We can now remove #ifdef
GENERIC_MSI_DOMAIN_OPS as it was only needed for x86.

Signed-off-by: Stuart Yoder <stuyoder@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
[add Kconfig dependency on ARM_GIC_V3_ITS]
Signed-off-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:11:30 +01:00
Bogdan Purcareata 6bd067c48e staging: fsl-mc: Move core bus out of staging
Move the source files out of staging into their final locations:
  -mc.h include file in drivers/staging/fsl-mc/include go to include/linux/fsl
  -source files in drivers/staging/fsl-mc/bus go to drivers/bus/fsl-mc
  -overview.rst, providing an overview of DPAA2, goes to
   Documentation/networking/dpaa2/overview.rst

Update or delete other remaining staging files -- Makefile, Kconfig, TODO.
Update dpaa2_eth and dpio staging drivers.
Add integration bits for the documentation build system.

Signed-off-by: Stuart Yoder <stuyoder@gmail.com>
[rebased, add dpaa2_eth and dpio #include updates]
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
[rebased, split irqchip to separate patch]
Signed-off-by: Bogdan Purcareata <bogdan.purcareata@nxp.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:10:50 +01:00
Ajay Singh 281377cc66 staging: wilc1000: rename _WPARxGtk_end_case_ label to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:58 +01:00
Ajay Singh 90261dd94a staging: wilc1000: rename _WPAPtk_end_case_ label to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh e87bbe0a91 staging: wilc1000: rename pstrStationParam to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh 47daf86218 staging: wilc1000: rename pstrDelStaParam to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh 8a7c5bd346 staging: wilc1000: rename strDisconnectNotifInfo to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh fcc70105f6 staging: wilc1000: rename pstrStatistics to avoid camelCase
Fix "Avoid caseCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh 66ba14fc62 staging: wilc1000: rename pstrSetBeaconParam to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh ecf8d3d66b staging: wilc1000: rename Handle_SetMulticastFilter to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh f53df85694 staging: wilc1000: rename pu32InactiveTime to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh b5f9ce6461 staging: wilc1000: rename variables using camelCase in handle_rcvd_ntwrk_info()
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh 24701563ec staging: wilc1000: rename ptstrJoinBssParam to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Ajay Singh 07407dc79a staging: wilc1000: rename pu8HdnNtwrksWidVal to avoid camelCase
Fix "Avoid camelCase" issue found by checkpatch.pl script.

Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:08:57 +01:00
Dan Carpenter a139834ed6 staging: lustre: selftest: freeing an error pointer
We should just return directly if memdup_user() fails. The current code
tries to free "param" which is an error pointer so it will Oops.

Fixes: 2baddf262e ("staging: lustre: use memdup_user to allocate memory and copy from user")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:07:44 +01:00
NeilBrown 52edc44ffb staging: lustre: socklnd: simplify ksnc_rx_iov_space
ksnc_rx_iov_space is currently a union of two arrays,
one of 'struct kvec', the other of 'struct bio_vec'.

The 'struct bio_vec' option is never used.  The
array of kvec is used to read in a packet header, or
to read data that needs to be skipped so as to synchronize
with a packet boundary.
In each case the target memory location is a virtual address,
never a page, so 'struct bio_vec' is never needed.

When we read into a page, different code steps up a separate
array of 'struct bio_vec'.

So remove the bio_vec option, and remove the union ksock_rxiovspace..

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown 5955572b19 staging: lustre: fid: perform sanity checks before commiting
When fid fetches a new range from the server, it commits
to it (*output = *out) *before* performing sanity checks.
This looks backwards.
Don't commit to a value until it has been found to be sane.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown 8689a5027c staging: lustre: fid: fix up debugfs access to ->lcs_space
lcs_space can change while the lock is not held
if an RPC in underway.  This can be detected by
seq->ls_update being set.

In this case, reading or writing the value should return
-EBUSY.

Also, the D_INFO CDEBUG() which reports the lcs_space being
updated never fires, as it tests the wrong value -
ldebugfs_fid_write_common() returns 'count' on success.

Finally, this return value should be returned from
ldebugfs_fid_space_seq_write(), rather than always returning 'count',
so that errors can be detected.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown 8ede253133 staging: lustre: fid: remove seq_fid_alloc_fini() and simplify
seq_fid_alloc_fini() is tiny and only called
from two places in the one function.  We can move
both those calls earlier and merge them so only
one call is needed.  At that point, there is no
value added by having a separate function.

Also instead of using ++ and -- on ->lcs_update to
toggle between 0 and 1, explicitly set to 0 or 1
as appropriate.

Moving the locking earlier means that the code which updates
seq->lcs_fid is now protected, so
ldebugfs_fid_fid_seq_show() now cannot see a torn value.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown 40f5bd3501 staging: lustre: fid: use wait_event_cmd()
Rather than open-coding a wait event loop twice,
use wait_event_cmd() to wait, dropping the spinlock
over schedule().
This does require duplicating part of the wait
condition, but that is just three tests on values that
are in registers or in cache, so the cost is small
and the increased readability is large.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown daa5611c71 staging: lustre: fid: convert lcs_mutex to a spinlock
There is only one place where this lock is held
while the task might sleep - in
  ldebugfs_fid_space_seq_write()
while ldebugfs_fid_write_common() is called.

This call can easily be taken out of the locked region
by asking it to parse the user data into a local variable,
and then copying that variable into ->lcs_space while
holding the lock.

Note that ldebugfs_gid_write_common returns >0 on
success, so use that to gate updating ->lcs_space.

So make that change, and convert lcs_mutex to a spinlock
named lcs_lock.  spinlocks are slightly cheaper than mutexes
and using one makes is clear that the lock is only held for
a short time.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown ef8e5dbbb0 staging: lustre: ptlrpc: list_for_each improvements.
1/ use list_for_each_entry_safe() instead of
   list_for_each_safe() and similar.

2/ use list_first_entry() and list_last_entry() where appropriate.

3/ When removing everything from a list, use
     while ((x = list_first_entry_or_null()) {
   as it makes the intent clear

4/ No need to take a spinlock in a structure that is about
   to be freed - we must have exclusive access at this stage.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown 9ee1588001 staging: lustre: fix assorted checkpatch errors
Possibly the most interesting is the for-loop with no body.
Rearranging and initializing end_dirent on each iteration of
the outer while, makes the intent clearer.

Reviewed-by: "Eremin, Dmitry" <dmitry.eremin@intel.com>
Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00
NeilBrown d0efa68ae7 staging: lustre: remove phantom struct cfs_crypto_hash_desc
There is no "struct cfs_crypto_hash_desc" structure.  There
are only pointers to this structure, which are cast back and
forth to struct ahash_request.
So discard cfs_crypto_hash_desc, and just use ahash_request directly.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-02-22 15:06:36 +01:00