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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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.
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>
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>
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);".
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>
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.
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.
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>
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>
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>
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>
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.
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.
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>
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>
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>
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.
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>
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.
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.
Andrea Lowe [Tue, 1 Dec 2015 20:38:26 +0000 (15:38 -0500)]
staging/rdma/hfi1: Adding counter resolutions for DataPortCounters
Changing the 32-bit reserved field in opa_port_data_counters_msg
to the new 'resolution' field. PMA will use resolutions to right-
shift values for LocalLinkIntegrity and LinkErrorRecovery when
computing the ErrorCounterSummary for a DataPortCounters request.
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com> Signed-off-by: Andrea Lowe <andrea.l.lowe@intel.com> Signed-off-by: Jubin John <jubin.john@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Harish Chegondi [Tue, 1 Dec 2015 20:38:24 +0000 (15:38 -0500)]
staging/rdma/hfi1: Consider VL15 MTU also when calculating the maximum VL MTU
Currently, only MTUs of VLs 0-7 are checked when calculating the maximum VL
MTU which is used to set the port MTU capability in DCC_CFG_PORT_CONFIG CSR
This can cause a port MTU capability to be set to 0 if MTUs of VLs 0-7 is 0
This would affect the VL15 traffic.
Reviewed-by: Dean Luick <dean.luick@intel.com> Reviewed-by: Arthur Kepner <arthur.kepner@intel.com> Signed-off-by: Harish Chegondi <harish.chegondi@intel.com> Signed-off-by: Jubin John <jubin.john@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>