GitHub/LineageOS/android_kernel_motorola_exynos9610.git
9 years agostaging: comedi: rearrange comedi_write() code
Ian Abbott [Wed, 18 Nov 2015 17:55:04 +0000 (17:55 +0000)]
staging: comedi: rearrange comedi_write() code

Rearrange the code in `comedi_write()` to reduce the amount of
indentation.  The code never reiterates the `while` loop once `count`
has become non-zero, so we can check that in the `while` condition to
save an indentation level.  (Note that `nbytes` has been checked to be
non-zero before entering the loop, so we can remove that check.)  Move
the code that makes the subdevice "become non-busy" outside the `while`
loop, using a new flag variable `become_nonbusy` to decide whether it
needs to be done.  This simplifies the wait queue handling so there is a
single place where the task is removed from the wait queue, and we can
remove the `on_wait_queue` flag variable.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: update the MODULE_DESCRIPTION
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:34 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: update the MODULE_DESCRIPTION

Change the MODULE_DESCRIPTION to something more useful than the
generic "Comedi low-level driver".

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: tidy up the comedi comment block
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:33 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: tidy up the comedi comment block

The Description is a bit long winded and the same information is in
the Devices. Shorten the Description and tidy up the Devices.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: move pci_dio_override_cardtype()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:32 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move pci_dio_override_cardtype()

This function is called as part of the pci_driver (*probe) before
doing the (*auto_attach) of the comedi driver. For aesthetics, move
the function to a more logical place in the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: move and rename the MAX_*_SUBDEV[SG] defines
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:31 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move and rename the MAX_*_SUBDEV[SG] defines

For aesthetics, move these defines after the register defines and rename
them to have namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: move and rename enum hw_cards_id
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:30 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: move and rename enum hw_cards_id

For aesthetics, move this enum after the register defines and rename
it to have namespace associated with the driver.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove boardinfo 'cardtype'
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:29 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove boardinfo 'cardtype'

This member of the boardinfo is identical to the offset of the boardinfo
in the boardtypes array. It's also passed as the 'context' to the driver
(*auto_attach).

The 'cardtype' is only needed by the (*auto_attach) to determine which
PCI BAR to use and in pci_dio_reset() to handle the board specific code.

Remove the 'cardtype' member and use the 'context' value instead.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: cleanup PCI-1762 interrupt registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:28 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-1762 interrupt registers

For aesthetics, use a common define for the interrupt control and status
registers.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: rename PCI1752_6_CFC define
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:27 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: rename PCI1752_6_CFC define

For aesthetics, rename this define and fix the alignment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: cleanup PCI-175[46] interrupt registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:26 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-175[46] interrupt registers

For aesthetics, replace these defines with a macro.

Refactor the switch in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: cleanup PCI-1753 interrupt register defines
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:25 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup PCI-1753 interrupt register defines

For aesthetics, replace these defines with some macros.

Refactor the switch in pci_dio_reset() to not require the fallthrough
comment.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: use common defines for PCI-1739/175[01] registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:24 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use common defines for PCI-1739/175[01] registers

These boards use the same offsets for the interrupt control registers.
For aesthetics, remove the current defines and use common ones.

Fix the switch() in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: use common defines for PCI-173[036] registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:23 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use common defines for PCI-173[036] registers

These boards use the same offsets for the interrupt control registers.
For aesthetics, remove the current defines and use common ones.

Fix the switch() in pci_dio_reset() to use common code.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: cleanup "disable and clear interrupts" comments
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:22 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: cleanup "disable and clear interrupts" comments

For aesthetics, use a common comment for the switch() that disables and clears
interrupts.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: disable channel freeze outside of switch
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:21 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: disable channel freeze outside of switch

For aesthetics, move the disable of the channel freeze for the PCI-1752
and PCI-1756 boards out of the switch used to disable and clear interrupts.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: use a default case in pci_dio_reset()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:20 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use a default case in pci_dio_reset()

For aesthetics, use a default case in the switch (board->cardtype) used
to reset the various boards.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove defines used for the dio (8255) registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:19 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the dio (8255) registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove defines used for the do registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:18 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the do registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: reset digital outputs in subdevice init
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:17 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: reset digital outputs in subdevice init

Currently the board reset function also resets the digital output channels
to 0. This works but it makes the reset function a bit messy and each
board type has to be handled special.

Move the digital output reset into the subdevice init where it can be
handle based on the subdevice setup.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: do board reset early in (*auto_attach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:16 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: do board reset early in (*auto_attach)

The board reset function disables and clears all interrupts. It also
resets all the digital output channels to 0.

Interrupts are not currently used by this driver. For asthetics, do
the board reset early in the (*auto_attach) to make sure the interrupts
are disabled in case this feature is added.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove board reset during (*detach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:15 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove board reset during (*detach)

The board reset function disables and clears all interrupts. It also
resets all the digital output channels to 0.

Interrupts are not used by this driver so the disable/clear during the
(*detach) is not necessary.

Reseting all the digital outputs to 0 might not be desired depending
on what the outputs are connected to.

Remove the board reset and just use comedi_pci_detach() directly for
the driver (*detach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove defines used for the di registers
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:14 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the di registers

These defines are only used to initialize the diosubd_data 'addr' members
in the boardinfo. For aesthetics, just open-code the values and remove the
defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove defines used for the 'timer_regbase'
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:13 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove defines used for the 'timer_regbase'

These defines are only used to initialize the 'timer_regbase' boardinfo.
For aesthetics, just open-code the values and remove the defines.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: simplify the 'boardid' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:12 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: simplify the 'boardid' boardinfo

The "board id" register is always 4-bits (4 di channels) and the register
used to read the bits is always > 0.

Simplify the 'boardid' boardinfo by replacing it with a 'id_reg' member
and open-coding the subdevice n_chan.

For aesthetics, remove all the *_BOARDID defines and just open-code the
register values in the boardinfo.

Add the missing boardinfo for the pci1739 board id register and increase
the nsubdevs to handle it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:11 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use the diosubd_data 'addr' for di/do s->private

Currently the di/do subdevices store a pointer to the diosubd_data in s->private.
The (*insn_bits) functions then use that to get to the 'addr' needed to access
the registers.

The only member of diosubd_data that is needed by the (*insn_bits) functions is
the 'addr'. For aesthetics, just store the 'addr' in s->private.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove need for diosubd_data 'regs' member
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:10 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove need for diosubd_data 'regs' member

Currently the (*insn_bits) functions used the 'regs' member to determine how
many registers need to be read or written to update the subdevice. We can use
the subdevice 'n_chan' to determine this and make the code a bit clearer.

The (*auto_attach) also uses this member to determine how many 8255 devices
need to be initialized. These subdevices do not use the 'chans' member of
diosubd_data. Move the 'regs' value to the 'chans' to allow removing the
'regs' member completely.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: refactor 'io_access' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:09 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: refactor 'io_access' boardinfo

The boards supported by this driver either use 8-bit or 16-bit I/O. The
'io_access' member of the boardinfo is used by the (*auto_attach) to
determine which (*insn_bits) function to use.

Simplify the boardinfo a bit by refactoring the 'io_access' member into
a bit-field flag 'is_16bit'. Use the new flag and remove the switch ()
code in the (*auto_attach).

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: absorb pci_dio_add_di()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:08 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: absorb pci_dio_add_di()

This function initializes a digitial input subdevices. For aesthetics,
absorb it into the (*auto_attach).

Remove the improper initialization of the SDF_LSAMPL subdev_flag and
len_chanlist. These are only used by subdevices that support async
commands.

Also, remove the unnecessary 'specflags' from the diosubd_data. Only
the boardid subdevice uses it.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: absorb pci_dio_add_do()
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:07 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: absorb pci_dio_add_do()

This function initializes a digitial output subdevice. For aesthetics,
absorb it into the (*auto_attach).

Remove the improper initialization of the SDF_LSAMPL subdev_flag and
len_chanlist. These are only used by subdevices that support async
commands.

Also remove the unnecessary initilaization of the subdevice 'state'.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: use a const pointer to the diosubd_data
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:06 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: use a const pointer to the diosubd_data

For aesthetics, use a const pointer to access the diosubd_data in the
boardinfo when doing the (*auto_attach)..

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach)
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:05 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: post increment 'subdev' in (*auto_attach)

For aesthetics, post-increment the 'subdev' index when used to get a
comedi_subdevice pointer instead of incrementing it after the subdevice
is initialized.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove 'main_pci_region' boardinfo
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:04 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove 'main_pci_region' boardinfo

All the boards use PCI BAR2 for the dev->iobase except for the pci1736
which uses PCI BAR0. Just use the board->cardtype to determine which
PCI BAR to use.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: tidy up comedi driver block comment
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:03 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: tidy up comedi driver block comment

Reformat the bolck comment in the kernel CodingStyle.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: adv_pci_dio: remove unnecessary function separation comments
H Hartley Sweeten [Wed, 18 Nov 2015 17:07:02 +0000 (10:07 -0700)]
staging: comedi: adv_pci_dio: remove unnecessary function separation comments

These are not necessary and just add cruft. Remove them.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocomedi: ni_6527: Fix coding style - use BIT macro
Ranjith Thangavel [Mon, 16 Nov 2015 16:56:15 +0000 (22:26 +0530)]
comedi: ni_6527: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: ni_mio_common: add "no_channel" versions of some functions
Andrzej Pietrasiewicz [Sat, 14 Nov 2015 18:19:10 +0000 (19:19 +0100)]
staging: comedi: ni_mio_common: add "no_channel" versions of some functions

ni_release_ai_mite_channel(), ni_release_ao_mite_channel(),
ni_release_gpct_mite_channel() and ni_release_cdo_mite_channel()
call functions which interpret -1 as a special value meaning "no channel".
This patch adds explicit "no_channel" versions instead.

On the other hand, after "no_channel" versions are used,
ni_set_ai_dma_channel(), ni_set_ao_dma_channel(),
ni_set_gpct_dma_channel(), ni_set_cdo_dma_channel() are called with actual
"channel" parameter being always unsigned, so their signatures are changed
accordingly.

A side benefit of the changes is suppressesing 4 sparse warnings:
"warning: shift too big (4294967295) for type int".

Signed-off-by: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: comedi: Fixed multiple commenting and spacing codig style issues.
Daniel H. Hemmingsen [Thu, 12 Nov 2015 16:03:18 +0000 (17:03 +0100)]
Staging: comedi: Fixed multiple commenting and spacing codig style issues.

Fixed multiple comment blocks that didn't comply with the
kernels coding style, and fixed a few spacing issues as well.

Signed-off-by: Daniel H. Hemmingsen <dhh.kernel@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocomedi: cb_pcidda: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 16:27:51 +0000 (21:57 +0530)]
comedi: cb_pcidda: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocomedi: ni_65xx: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 16:22:02 +0000 (21:52 +0530)]
comedi: ni_65xx: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agocomedi: comedi_parport: Fix coding style - use BIT macro
Ranjith Thangavel [Wed, 11 Nov 2015 15:54:01 +0000 (21:24 +0530)]
comedi: comedi_parport: Fix coding style - use BIT macro

BIT macro is used for defining BIT location instead of
shifting operator - coding style issue

Signed-off-by: Ranjith Thangavel <ranjithece24@gmail.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: comedi: use kmalloc_array instead of kmalloc
Geliang Tang [Tue, 10 Nov 2015 14:41:34 +0000 (22:41 +0800)]
staging: comedi: use kmalloc_array instead of kmalloc

Use kmalloc_array instead of kmalloc to allocate memory for an array.

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range
Jitendra Kumar Khasdev [Tue, 24 Nov 2015 17:31:13 +0000 (23:01 +0530)]
staging: dgnc: dgnc_cls.c: Replaced udelay by usleep_range

This patch is to file dgnc_cls.c that fixes up udelay function by
usleep_range.
It is safe to use according to the following documentation
Documentation/timers/timers-howto.txt. So that is why I have given
an appropriate time range.

Signed-off-by: Jitendra Kumar Khasdev <jkhasdev@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: dgnc_tty: Typo error dgnc_wmove comment
Nizam Haider [Sat, 14 Nov 2015 14:40:46 +0000 (20:10 +0530)]
Staging: dgnc: dgnc_tty: Typo error dgnc_wmove comment

Fix Typo errror in the comment section of dgnc_wmove

Signed-off-by: Nizam Haider <nijamh@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: dgnc: dgnc_neo.c Braces {} should be used on all arms of this statement
Nizam Haider [Sat, 14 Nov 2015 14:40:45 +0000 (20:10 +0530)]
Staging: dgnc: dgnc_neo.c Braces {} should be used on all arms of this statement

Fix Checlpatch warning
HECK: braces {} should be used on all arms of this statement

Signed-off-by: Nizam Haider <nijamh@cdac.in>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agodriver:staging:dgnc Fix spaces preferred around that ...
Bogicevic Sasa [Fri, 13 Nov 2015 14:07:21 +0000 (15:07 +0100)]
driver:staging:dgnc Fix spaces preferred around that ...

This fixes all "spaces preferred around that ..." messages from
checkpatch.pl

Signed-off-by: Bogicevic Sasa <brutallesale@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: Fix a jump label position in osc_get_info()
Markus Elfring [Mon, 21 Dec 2015 18:30:42 +0000 (19:30 +0100)]
staging: lustre: Fix a jump label position in osc_get_info()

The script "checkpatch.pl" pointed out that labels should not be indented.
Thus delete a horizontal tab before the jump label "out"
in the function "osc_get_info".

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover...
Markus Elfring [Mon, 21 Dec 2015 17:24:45 +0000 (18:24 +0100)]
staging: lustre: Delete an unnecessary variable initialisation in mgc_process_recover_log()

The variable "mne_swab" will eventually be set to an appropriate value
from a call of the ptlrpc_rep_need_swab() function.
Thus let us omit the explicit initialisation at the beginning.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: Delete unnecessary goto statements in six functions
Markus Elfring [Mon, 21 Dec 2015 17:15:45 +0000 (18:15 +0100)]
staging: lustre: Delete unnecessary goto statements in six functions

Six goto statements referred to a source code position
directly behind them.
Thus omit such unnecessary jumps.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: obdclass: Declare lu_site_hash_ops as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:30 +0000 (02:40 +0530)]
Staging: lustre: obdclass: Declare lu_site_hash_ops as static

lu_site_hash_ops is used only in this particular file. Thus declare
it as static.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: osc: Declare osc_attr_set as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:29 +0000 (02:40 +0530)]
Staging: lustre: osc: Declare osc_attr_set as static

osc_attr_set is used only in this particular file. Thus declare it
as static.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: osc: Declare as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:28 +0000 (02:40 +0530)]
Staging: lustre: osc: Declare as static

Declare osc_extent_find and osc_unreserve_grant as static since they
are used only in this particular file.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: libcfs: Remove unused libcfs_debug_set_level
Shraddha Barke [Thu, 17 Dec 2015 21:10:27 +0000 (02:40 +0530)]
Staging: lustre: libcfs: Remove unused libcfs_debug_set_level

Function libcfs_debug_set_level is defined but not used. Thus
remove it.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: obdclass: Declare cl_env_peek as static
Shraddha Barke [Thu, 17 Dec 2015 21:10:26 +0000 (02:40 +0530)]
Staging: lustre: obdclass: Declare cl_env_peek as static

Declare cl_env_peek as static since it is used only in this file.
Also remove the EXPORT SYMBOL.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lnet: Remove functions LNetEQWait and LNetEQGet
Shraddha Barke [Wed, 16 Dec 2015 17:40:17 +0000 (23:10 +0530)]
Staging: lustre: lnet: Remove functions LNetEQWait and LNetEQGet

Functions LNetEQWait and LNetEQGet are defined but not used. Thus
remove it. Also remove corresponding declarations from header file.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: include: Remove unused llog_backup declaration
Shraddha Barke [Wed, 16 Dec 2015 17:40:15 +0000 (23:10 +0530)]
Staging: lustre: include: Remove unused llog_backup declaration

Function llog_backup is declared in header file but not used.
Thus remove it.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: fix %.2X versus signed char issue
Rasmus Villemoes [Sun, 6 Dec 2015 00:41:31 +0000 (01:41 +0100)]
staging: lustre: fix %.2X versus signed char issue

When char is signed and one of the bytes in lmm happens to have a byte
value above 127, the result of printing that with %.2X will be 8 hex
chars, the first 6 of which are 'F'. Worst case, we'll overrun our
'carefully' allocated buffer.

I didn't have the tenacity to work through the gazillion and seven
layers of macros behind CERROR, but I assume it'll all end at some
function implemented in terms of the kernel's vsnprintf. Use %*phN for
a hexdump. That'll cap the number of dumped bytes at 64. If that's a
problem, the loop could be replaced by "bin2hex(buffer, lmm,
lmm_bytes);".

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: lustre: fld: Removed a blank line
Anjali Menon [Fri, 20 Nov 2015 05:55:22 +0000 (11:25 +0530)]
staging: lustre: lustre: fld: Removed a blank line

Removed a blank line after the open brace to remove the
check detected by the checkpatch.pl.

CHECK: Blank lines aren't necessary after an open brace '{'

Signed-off-by: Anjali Menon <cse.anjalimenon@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: libcfs.h: remove IS_PO2 and __is_po2
Aya Mahfouz [Tue, 17 Nov 2015 20:07:07 +0000 (22:07 +0200)]
staging: lustre: libcfs.h: remove IS_PO2 and __is_po2

Removes IS_PO2 and __is_po2 since the uses of IS_PO2 have
been replaced by is_power_of_2

Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: hash.c: Replace IS_PO2 by is_power_of_2
Aya Mahfouz [Tue, 17 Nov 2015 20:06:40 +0000 (22:06 +0200)]
staging: lustre: hash.c: Replace IS_PO2 by is_power_of_2

Replaces IS_PO2 by is_power_of_2. It is more accurate to use
is_power_of_2 since it returns 1 for numbers that are powers
of 2 only whereas IS_PO2 returns 1 for 0 and numbers that are
powers of 2.

Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agolustre: constify inode_operations structures
Julia Lawall [Sat, 14 Nov 2015 12:30:34 +0000 (13:30 +0100)]
lustre: constify inode_operations structures

The inode_operations structures are never modified, so declare them
as const, like all the other inode_operations structures.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: Remove cl_2queue_add wrapper
Shivani Bhardwaj [Wed, 11 Nov 2015 10:13:28 +0000 (15:43 +0530)]
staging: lustre: Remove cl_2queue_add wrapper

Remove the wrapper function cl_2queue_add() and replace all its calls in
different files with the function it wrapped. Also, comments are added
wherever necessary to make the working of function clear. Prototype of
the function is also removed from the header file as it is no longer
needed.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: cl_io: Remove cl_lock_descr_fid wrapper
Shivani Bhardwaj [Wed, 11 Nov 2015 08:59:07 +0000 (14:29 +0530)]
staging: lustre: cl_io: Remove cl_lock_descr_fid wrapper

Remove unnecessary wrapper function cl_lock_descr_fid() and replace all
its calls with the function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: acl: Remove lustre_posix_acl_xattr_free wrapper
Shivani Bhardwaj [Mon, 9 Nov 2015 18:54:17 +0000 (00:24 +0530)]
staging: lustre: acl: Remove lustre_posix_acl_xattr_free wrapper

Remove the wrapper function lustre_posix_acl_xattr_free() and replace its
call in the file xattr with the function kfree() that it wrapped. Also,
its prototype from the header lustre_eacl is removed as it is no longer
of any use.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove obsolete comment in tracefile.h
John L. Hammond [Mon, 9 Nov 2015 04:27:16 +0000 (23:27 -0500)]
staging: lustre: remove obsolete comment in tracefile.h

Remove comment about tracefile handling for user land
version of libcfs that no longer exist. Broken out of
patch http://review.whamcloud.com/11983.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/11983
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove {linux,posix}-tracefile.h
John L. Hammond [Mon, 9 Nov 2015 04:27:15 +0000 (23:27 -0500)]
staging: lustre: remove {linux,posix}-tracefile.h

Move the definition of the trace buffer type enum in
libcfs/libcfs/tracefile.h.  Remove the then unneeded headers
libcfs/libcfs/linux/linux-tracefile.h and
libcfs/libcfs/posix/posix-tracefile.h.

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675
Reviewed-on: http://review.whamcloud.com/11983
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: update Intel copyright messages 2015
Andreas Dilger [Sun, 8 Nov 2015 23:09:37 +0000 (18:09 -0500)]
staging: lustre: update Intel copyright messages 2015

Update copyright messages in files modified by Intel employees
in 2015 by non-trivial patches.  Exclude patches that are only
deleting code, renaming functions, or adding or removing whitespace.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-7243
Reviewed-on: http://review.whamcloud.com/16758
Reviewed-by: James Nunez <james.a.nunez@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove unnecessary EXPORT_SYMBOL for lnet layer
frank zago [Sun, 8 Nov 2015 23:09:36 +0000 (18:09 -0500)]
staging: lustre: remove unnecessary EXPORT_SYMBOL for lnet layer

A lot of symbols don't need to be exported at all because they are
only used in the module they belong to.

Signed-off-by: frank zago <fzago@cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5829
Reviewed-on: http://review.whamcloud.com/13320
Reviewed-by: James Simmons <uja.ornl@gmail.com>
Reviewed-by: Isaac Huang <he.huang@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: remove hsm_nl proc file
John L. Hammond [Sun, 8 Nov 2015 19:17:06 +0000 (14:17 -0500)]
staging: lustre: remove hsm_nl proc file

Remove the file /proc/fs/lustre/mdc/*/hsm_nl which was introduced "for
testing purposes."

Signed-off-by: John L. Hammond <john.hammond@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2489
Reviewed-on: http://review.whamcloud.com/6656
Reviewed-by: jacques-Charles Lafoucriere <jacques-charles.lafoucriere@cea.fr>
Reviewed-by: Aurelien Degremont <aurelien.degremont@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: mdc_request: Remove mdc_kuc_reregister wrapper
Shivani Bhardwaj [Sun, 8 Nov 2015 16:52:58 +0000 (22:22 +0530)]
staging: lustre: mdc_request: Remove mdc_kuc_reregister wrapper

Remove the wrapper function mdc_kuc_reregister() and replace its call
with the function it wrapped. Also, comment has been added for clarity.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: workitem: Remove cfs_wi_sched_unlock wrapper
Shivani Bhardwaj [Sun, 8 Nov 2015 09:17:34 +0000 (14:47 +0530)]
staging: lustre: workitem: Remove cfs_wi_sched_unlock wrapper

Remove the wrapper function cfs_wi_sched_unlock() and replace all its
calls with the function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging: lustre: workitem: Remove cfs_wi_sched_lock wrapper
Shivani Bhardwaj [Sun, 8 Nov 2015 09:17:10 +0000 (14:47 +0530)]
staging: lustre: workitem: Remove cfs_wi_sched_lock wrapper

Remove the wrapper function cfs_wi_sched_lock() and replace all its
calls with the function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: statahead: Remove agl_list_empty wrapper
Shivani Bhardwaj [Sat, 7 Nov 2015 09:53:11 +0000 (15:23 +0530)]
Staging: lustre: statahead: Remove agl_list_empty wrapper

Remove the function agl_list_empty() and replace its calls with the
function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: statahead: Remove sa_received_empty wrapper
Shivani Bhardwaj [Sat, 7 Nov 2015 09:52:18 +0000 (15:22 +0530)]
Staging: lustre: statahead: Remove sa_received_empty wrapper

Remove the wrapper sa_received_empty() and replace its calls with the
function it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: statahead: Remove agl_first_entry wrapper
Shivani Bhardwaj [Sat, 7 Nov 2015 09:51:39 +0000 (15:21 +0530)]
Staging: lustre: statahead: Remove agl_first_entry wrapper

Remove the wrapper function agl_first_entry() and replace its calls with
the function list_entry() that it wraps.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: statahead: Remove sa_first_received_entry wrapper
Shivani Bhardwaj [Sat, 7 Nov 2015 09:50:59 +0000 (15:20 +0530)]
Staging: lustre: statahead: Remove sa_first_received_entry wrapper

Remove the function sa_first_received_entry() and replace all its calls
with the function list_entry() that it wraps.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper
Shivani Bhardwaj [Sat, 7 Nov 2015 09:50:21 +0000 (15:20 +0530)]
Staging: lustre: statahead: Remove ll_sa_entry_unhashed wrapper

Remove the function ll_sa_entry_unhashed() and replace all its calls
with the function list_empty() that it wrapped.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: lustre_mds: Remove unused md_should_create
Shraddha Barke [Sat, 7 Nov 2015 09:44:24 +0000 (15:14 +0530)]
Staging: lustre: lustre_mds: Remove unused md_should_create

md_should_create has been defined in header file but not used.
Thus remove it.

Signed-off-by: Shraddha Barke <shraddha.6596@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: lustre: rw: Remove wrapper stride_page_count
Shivani Bhardwaj [Sat, 7 Nov 2015 08:02:07 +0000 (13:32 +0530)]
Staging: lustre: rw: Remove wrapper stride_page_count

Remove the function stride_page_count() and replace its calls with the
function stride_pg_count() that it wraps.

Signed-off-by: Shivani Bhardwaj <shivanib134@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Fix module parameter spelling
Jubin John [Fri, 18 Dec 2015 00:24:14 +0000 (19:24 -0500)]
staging/rdma/hfi1: Fix module parameter spelling

Fix the spelling of user_credit_return_threshold, it was incorrectly
spelled as user_credit_return_theshold causing two module parameters,
one with typo, to be shown in modinfo

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Remove incorrect link credit check
Dean Luick [Fri, 18 Dec 2015 00:24:13 +0000 (19:24 -0500)]
staging/rdma/hfi1: Remove incorrect link credit check

Remove an invalid sanity check that compares the local link
credits with the peer link credits.  The two have no dependency
on each other.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Dean Luick <dean.luick@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Change num_rcv_contexts to num_user_contexts and its meaning
Sebastian Sanchez [Fri, 11 Dec 2015 13:44:48 +0000 (08:44 -0500)]
staging/rdma/hfi1: Change num_rcv_contexts to num_user_contexts and its meaning

num_rcv_contexts sets the number of user contexts, both receive and send.
Renaming it to num_user_contexts makes sense to reflect its true meaning.
When num_rcv_contexts is 0, the default behavior is the number of CPU
cores instead of 0 contexts. This commit changes the variable
num_rcv_contexts to num_user_contexts, and it also makes any negative
value for this variable default to the number of CPU cores, so if
num_user_contexts is set >= 0, the value will number of contexts.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Fix for module parameter hdrq_entsize when it's 0
Sebastian Sanchez [Thu, 10 Dec 2015 21:02:49 +0000 (16:02 -0500)]
staging/rdma/hfi1: Fix for module parameter hdrq_entsize when it's 0

If driver is loaded with parameter hdrq_entsize=0, then
there's a NULL dereference when the driver gets unloaded.
This causes a kernel Oops and prevents the module  from
being unloaded. This patch fixes this issue by making sure
-EINVAL gets returned when hdrq_entsize=0.

Reviewed-by: Chegondi, Harish <harish.chegondi@intel.com>
Reviewed-by: Haralanov, Mitko <mitko.haralanov@intel.com>
Signed-off-by: Sebastian Sanchez <sebastian.sanchez@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Fix a possible null pointer dereference
Easwar Hariharan [Thu, 10 Dec 2015 16:13:38 +0000 (11:13 -0500)]
staging/rdma/hfi1: Fix a possible null pointer dereference

A code inspection pointed out that kmalloc_array may return NULL and
memset doesn't check the input pointer for NULL, resulting in a possible
NULL dereference. This patch fixes this.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Easwar Hariharan <easwar.hariharan@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: HFI now sends OPA Traps instead of IBTA
Erik E. Kahn [Thu, 10 Dec 2015 14:59:40 +0000 (09:59 -0500)]
staging/rdma/hfi1: HFI now sends OPA Traps instead of IBTA

send_trap() was still using old ib_smp instead of opa_smp
for formatting and sending traps.

Reviewed-by: Arthur Kepner <arthur.kepner@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Erik E. Kahn <erik.kahn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: add definitions for OPA traps
Jubin John [Thu, 10 Dec 2015 14:59:34 +0000 (09:59 -0500)]
staging/rdma/hfi1: add definitions for OPA traps

These new definitions will be used by follow-on
patches for formating and sending OPA traps.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agoStaging: rdma:Delete unnecessary NULL check before calling function "kmem_cache_destroy"
Yash Shah [Tue, 8 Dec 2015 10:24:17 +0000 (10:24 +0000)]
Staging: rdma:Delete unnecessary NULL check before calling function "kmem_cache_destroy"

The kmem_cache_destroy() function tests whether its argument is NULL
and then returns immediately.
Thus the NULL check before calling this function is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Yash Shah <yshah1@visteon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: convert buffers allocated atomic to per cpu
Mike Marciniszyn [Mon, 7 Dec 2015 20:39:22 +0000 (15:39 -0500)]
staging/rdma/hfi1: convert buffers allocated atomic to per cpu

Profiling has shown the the atomic is a performance issue
for the pio hot path.

If multiple cpus allocated an sc's buffer, the cacheline
containing the atomic will bounce from L0 to L0.

Convert the atomic to a percpu variable.

Reviewed-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: fix sdma build failures to always clean up
Mike Marciniszyn [Thu, 3 Dec 2015 21:41:05 +0000 (16:41 -0500)]
staging/rdma/hfi1: fix sdma build failures to always clean up

There are holes in the sdma build support routines that do
not clean any partially built sdma descriptors after mapping or
allocate failures.

This patch corrects these issues.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: fix pio progress routine race with allocator
Mike Marciniszyn [Thu, 3 Dec 2015 19:34:18 +0000 (14:34 -0500)]
staging/rdma/hfi1: fix pio progress routine race with allocator

The allocation code assumes that the shadow ring cannot
be overrun because the credits will limit the allocation.

Unfortuately, the progress mechanism in sc_release_update() updates
the free count prior to processing the shadow ring, allowing the
shadow ring to be overrun by an allocation.

Reviewed-by: Mark Debbage <mark.debbage@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Detect SDMA transmission error early
Mitko Haralanov [Tue, 8 Dec 2015 22:10:12 +0000 (17:10 -0500)]
staging/rdma/hfi1: Detect SDMA transmission error early

It is possible for an SDMA transmission error to happen
during the processing of an user SDMA transfer. In that
case it is better to detect it early and abort any further
attempts to send more packets.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Clean-up unnecessary goto statements
Mitko Haralanov [Tue, 8 Dec 2015 22:10:11 +0000 (17:10 -0500)]
staging/rdma/hfi1: Clean-up unnecessary goto statements

Clean-up unnecessary goto statements based on feedback from the
mailing list on previous patch submissions.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Add page lock limit check for SDMA requests
Mitko Haralanov [Tue, 8 Dec 2015 22:10:13 +0000 (17:10 -0500)]
staging/rdma/hfi1: Add page lock limit check for SDMA requests

The driver pins pages on behalf of user processes in two
separate instances - when the process has submitted a
SDMA transfer and when the process programs an expected
receive buffer.

When pinning pages, the driver is required to observe the
locked page limit set by the system administrator and refuse
to lock more pages than allowed. Such a check was done for
expected receives but was missing from the SDMA transfer
code path.

This commit adds the missing check for SDMA transfers. As of
this commit, user SDMA or expected receive requests will be
rejected if the number of pages required to be pinned will
exceed the set limit.

Due to the fact that the driver needs to take the MM semaphore
in order to update the locked page count (which can sleep), this
cannot be done by the callback function as it [the callback] is
executed in interrupt context. Therefore, it is necessary to put
all the completed SDMA tx requests onto a separate list (txcmp) and
offload the actual clean-up and unpinning work to a workqueue.

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Convert to use get_user_pages_fast
Mitko Haralanov [Tue, 8 Dec 2015 22:10:09 +0000 (17:10 -0500)]
staging/rdma/hfi1: Convert to use get_user_pages_fast

Convert hfi1_get_user_pages() to use get_user_pages_fast(),
which is much fatster. The mm semaphore is still taken to
update the pinned page count but is for a much shorter
amount of time.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Unconditionally clean-up SDMA queues
Mitko Haralanov [Tue, 8 Dec 2015 22:10:10 +0000 (17:10 -0500)]
staging/rdma/hfi1: Unconditionally clean-up SDMA queues

There is no need to cleck if the packet queue is allocated
when cleaning up a user context. The hfi1_user_sdma_free_queues()
function already does all the required checks.

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Mitko Haralanov <mitko.haralanov@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Return immediately on error
Dennis Dalessandro [Wed, 2 Dec 2015 05:43:38 +0000 (00:43 -0500)]
staging/rdma/hfi1: Return immediately on error

Now that the spinlock is not taken throughout hfi1_ioctl it is safe to return
early rather than setting a variable and falling through the switch.

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Reduce snoop locking scope in IOCTL handler.
Dennis Dalessandro [Wed, 2 Dec 2015 05:43:37 +0000 (00:43 -0500)]
staging/rdma/hfi1: Reduce snoop locking scope in IOCTL handler.

This patch avoids issues while calling into copy from/to user while holding the
lock by only taking the lock when it is absolutely required.

The only commands which require the snoop lock are: *Set Filter *Clear Filter
*Clear Queue

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Further clean up hfi1_ioctl parameter checks
Ira Weiny [Wed, 2 Dec 2015 05:43:36 +0000 (00:43 -0500)]
staging/rdma/hfi1: Further clean up hfi1_ioctl parameter checks

Final clean up of the if/then/else clause for the parameter checks of
hfi1_ioctl

Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: hfi1_ioctl remove setlink state
Ira Weiny [Wed, 2 Dec 2015 05:43:35 +0000 (00:43 -0500)]
staging/rdma/hfi1: hfi1_ioctl remove setlink state

Set link state is not supported remove from the switch statement and allow the
default to return -ENOTTY

Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Return early from hfi1_ioctl parameter errors
Ira Weiny [Wed, 2 Dec 2015 05:43:34 +0000 (00:43 -0500)]
staging/rdma/hfi1: Return early from hfi1_ioctl parameter errors

Rather than have a switch in a large else clause make the parameter checks
return immediately.

Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
9 years agostaging/rdma/hfi1: Fix camel case variables
Ira Weiny [Wed, 2 Dec 2015 05:43:33 +0000 (00:43 -0500)]
staging/rdma/hfi1: Fix camel case variables

physState, linkState, and devState should be phys_state, link_state, and
dev_state

Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>