Commit Graph

215 Commits

Author SHA1 Message Date
Ricardo Silva 9d15662175 staging: vme: Use BIT macro for bit definitions
Use the BIT(n) macro instead of '(1 << n)' in definitions where the bit
semantics clearly applies.

Fixes true positive "Prefer using the BIT macro" checks reported by
checkpatch.

Some of these checks are still triggering on definitions using
'(1 << n)', namely for PIO2_CNTR_SC_DEV1, PIO2_CNTR_RW_LSB and
PIO2_CNTR_MODE1. Leave them be, as the context there is more of a
"multi-bit field value" ((val << n), where for some cases 'val' happens
to be 1) rather than a "single bit" (1 << n), so keeping the value as is
in the code makes it more readable that using a combination of BIT
macros.

Signed-off-by: Ricardo Silva <rjpdasilva@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-05-16 13:53:23 +02:00
Linus Torvalds 291b38a756 Annotation of module parameters that specify device settings
-----BEGIN PGP SIGNATURE-----
 
 iQIVAwUAWPiW6vSw1s6N8H32AQLOrw/+NTqGf7bjq+64YKS6NfR0XDgE+wNJltGO
 ck7zJW3NHIg76RNu8s0I9xg5aVmwizz3Z5DGROZquaolnezux4tQihZ3AFyxIzLc
 +Y3WHYagcML7yFfjl/WznCLRD5EW3yPln4lCvQO0nW/xICRYeRI057JaIbi2Dtek
 BhcXt3c4AjXDLdYJkgtHV3p2R2mt8hcdFdWqqx6s7JaIThZNRGNzxAgtbcB9k5IW
 HVG9ZEIL73VBYWHrYivzjHYF5rBnNCPt87eOwDQeTOSkhv8te+u9k+bH8vxZw1T0
 XUtDrLBndKiuVo2GUfLkkF8LItx3Q9eLCJYy0joaIliyPqTEsPx9KjQ+Af0cxS9s
 ZPCZ5SYf96stKmDeL5xaMfrAmeyVHJ4lc4JTOqdzbIT8blsOSfYO/03p0ALShSDv
 /RQLaKGlf8Bjoy8PwKFcXb4sIDufcd/U1Av/EMFXxOfgN/u2JUkGKq6EaIM5B68L
 fHPje+aR9VNELPmPjwNOWtmN4I79EH3EItQf7zv0KG+UeKhcHLx/EAcSJ3ZRKEkH
 Lathg7pPOEJGArPiVO79TZzBG01ADn1aiwv65XObMzNZ+54xI/mN/Y1DNF/kL5jU
 XzvNzEjFt8mwMIZGVNdAt4+pDyMfIZGZSyUkSRKFnaQZMIvQrfQIU9RLBYLX5eOx
 +/p0VkIwDpg=
 =lbS7
 -----END PGP SIGNATURE-----

Merge tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs

Pull hw lockdown support from David Howells:
 "Annotation of module parameters that configure hardware resources
  including ioports, iomem addresses, irq lines and dma channels.

  This allows a future patch to prohibit the use of such module
  parameters to prevent that hardware from being abused to gain access
  to the running kernel image as part of locking the kernel down under
  UEFI secure boot conditions.

  Annotations are made by changing:

        module_param(n, t, p)
        module_param_named(n, v, t, p)
        module_param_array(n, t, m, p)

  to:

        module_param_hw(n, t, hwtype, p)
        module_param_hw_named(n, v, t, hwtype, p)
        module_param_hw_array(n, t, hwtype, m, p)

  where the module parameter refers to a hardware setting

  hwtype specifies the type of the resource being configured. This can
  be one of:

        ioport          Module parameter configures an I/O port
        iomem           Module parameter configures an I/O mem address
        ioport_or_iomem Module parameter could be either (runtime set)
        irq             Module parameter configures an I/O port
        dma             Module parameter configures a DMA channel
        dma_addr        Module parameter configures a DMA buffer address
        other           Module parameter configures some other value

  Note that the hwtype is compile checked, but not currently stored (the
  lockdown code probably won't require it). It is, however, there for
  future use.

  A bonus is that the hwtype can also be used for grepping.

  The intention is for the kernel to ignore or reject attempts to set
  annotated module parameters if lockdown is enabled. This applies to
  options passed on the boot command line, passed to insmod/modprobe or
  direct twiddling in /sys/module/ parameter files.

  The module initialisation then needs to handle the parameter not being
  set, by (1) giving an error, (2) probing for a value or (3) using a
  reasonable default.

  What I can't do is just reject a module out of hand because it may
  take a hardware setting in the module parameters. Some important
  modules, some ipmi stuff for instance, both probe for hardware and
  allow hardware to be manually specified; if the driver is aborts with
  any error, you don't get any ipmi hardware.

  Further, trying to do this entirely in the module initialisation code
  doesn't protect against sysfs twiddling.

  [!] Note that in and of itself, this series of patches should have no
      effect on the the size of the kernel or code execution - that is
      left to a patch in the next series to effect. It does mark
      annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in
      an already existing field"

* tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits)
  Annotate hardware config module parameters in sound/pci/
  Annotate hardware config module parameters in sound/oss/
  Annotate hardware config module parameters in sound/isa/
  Annotate hardware config module parameters in sound/drivers/
  Annotate hardware config module parameters in fs/pstore/
  Annotate hardware config module parameters in drivers/watchdog/
  Annotate hardware config module parameters in drivers/video/
  Annotate hardware config module parameters in drivers/tty/
  Annotate hardware config module parameters in drivers/staging/vme/
  Annotate hardware config module parameters in drivers/staging/speakup/
  Annotate hardware config module parameters in drivers/staging/media/
  Annotate hardware config module parameters in drivers/scsi/
  Annotate hardware config module parameters in drivers/pcmcia/
  Annotate hardware config module parameters in drivers/pci/hotplug/
  Annotate hardware config module parameters in drivers/parport/
  Annotate hardware config module parameters in drivers/net/wireless/
  Annotate hardware config module parameters in drivers/net/wan/
  Annotate hardware config module parameters in drivers/net/irda/
  Annotate hardware config module parameters in drivers/net/hamradio/
  Annotate hardware config module parameters in drivers/net/ethernet/
  ...
2017-05-10 19:13:03 -07:00
David Howells ea38fd72fb Annotate hardware config module parameters in drivers/staging/vme/
When the kernel is running in secure boot mode, we lock down the kernel to
prevent userspace from modifying the running kernel image.  Whilst this
includes prohibiting access to things like /dev/mem, it must also prevent
access by means of configuring driver modules in such a way as to cause a
device to access or modify the kernel image.

To this end, annotate module_param* statements that refer to hardware
configuration and indicate for future reference what type of parameter they
specify.  The parameter parser in the core sees this information and can
skip such parameters with an error message if the kernel is locked down.
The module initialisation then runs as normal, but just sees whatever the
default values for those parameters is.

Note that we do still need to do the module initialisation because some
drivers have viable defaults set in case parameters aren't specified and
some drivers support automatic configuration (e.g. PNP or PCI) in addition
to manually coded parameters.

This patch annotates drivers in drivers/staging/vme/.

Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
cc: Martyn Welch <martyn@welchs.me.uk>
cc: Manohar Vanga <manohar.vanga@gmail.com>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: devel@driverdev.osuosl.org
2017-04-20 12:02:32 +01:00
Elena Reshetova d3cfd5b9c8 drivers: convert vme_user_vma_priv.refcnt from atomic_t to refcount_t
refcount_t type and corresponding API should be
used instead of atomic_t when the variable is used as
a reference counter. This allows to avoid accidental
refcounter overflows that might lead to use-after-free
situations.

Signed-off-by: Elena Reshetova <elena.reshetova@intel.com>
Signed-off-by: Hans Liljestrand <ishkamiel@gmail.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: David Windsor <dwindsor@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-14 06:23:12 +08:00
Philip Thiemann 00e293b9ef staging: vme: vme_user.c: fix warning 'line over 80 characters'
Removed checkpatch.pl warning 'line over 80 characters' by inserting a
linebreak in the comment line 50.

Signed-off-by: Philip Thiemann <philip.thiemann@fau.de>
Signed-off-by: Fabian Arnold <fabian.arnold@fau.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-01-16 18:08:56 +01:00
Linus Torvalds 72cca7baf4 Staging/IIO patches for 4.10-rc1
Here's the "big" staging/iio pull request for 4.10-rc1.
 
 Not as big as 4.9 was, but still just over a thousand changes.  We
 almost broke even of lines added vs. removed, as the slicoss driver was
 removed (got a "clean" driver for the same hardware through the netdev
 tree), and some iio drivers were also dropped, but I think we ended up
 adding a few thousand lines to the source tree in the end.  Other than
 that it's a lot of minor fixes all over the place, nothing major stands
 out at all.
 
 All of these have been in linux-next for a while.  There will be a merge
 conflict with Al's vfs tree in the lustre code, but the resolution for
 that should be pretty simple, that too has been in linux-next.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 
 iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCWFAk1Q8cZ3JlZ0Brcm9h
 aC5jb20ACgkQMUfUDdst+ymikACg05b0h/iVTTH18474PXXnzw6jk9IAn0gI2fx9
 cqp2MglTvphhrXzddL7V
 =MeTw
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging/IIO updates from Greg KH:
 "Here's the "big" staging/iio pull request for 4.10-rc1.

  Not as big as 4.9 was, but still just over a thousand changes. We
  almost broke even of lines added vs. removed, as the slicoss driver
  was removed (got a "clean" driver for the same hardware through the
  netdev tree), and some iio drivers were also dropped, but I think we
  ended up adding a few thousand lines to the source tree in the end.
  Other than that it's a lot of minor fixes all over the place, nothing
  major stands out at all.

  All of these have been in linux-next for a while. There will be a
  merge conflict with Al's vfs tree in the lustre code, but the
  resolution for that should be pretty simple, that too has been in
  linux-next"

* tag 'staging-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (1002 commits)
  staging: comedi: comedidev.h: Document usage of 'detach' handler
  staging: fsl-mc: remove unnecessary info prints from bus driver
  staging: fsl-mc: add sysfs ABI doc
  staging/lustre/o2iblnd: Fix misspelled attemps->attempts
  staging/lustre/o2iblnd: Fix misspelling intialized->intialized
  staging/lustre: Convert all bare unsigned to unsigned int
  staging/lustre/socklnd: Fix whitespace problem
  staging/lustre/o2iblnd: Add missing space
  staging/lustre/lnetselftest: Fix potential integer overflow
  staging: greybus: audio_module: remove redundant OOM message
  staging: dgnc: Fix lines longer than 80 characters
  staging: dgnc: fix blank line after '{' warnings.
  staging/android: remove Sync Framework tasks from TODO
  staging/lustre/osc: Revert erroneous list_for_each_entry_safe use
  staging: slicoss: remove the staging driver
  staging: lustre: libcfs: remove lnet upcall code
  staging: lustre: remove set but unused variables
  staging: lustre: osc: set lock data for readahead lock
  staging: lustre: import: don't reconnect during connect interpret
  staging: lustre: clio: remove mtime check in vvp_io_fault_start()
  ...
2016-12-13 11:35:00 -08:00
Walt Feasel 1fede02031 staging: vme: vme_user.c Spelling corrections
Make spelling corrections for 'correctly' and
'unregister'

Signed-off-by: Walt Feasel <waltfeasel@gmail.com>
Acked-by: Martyn Welch <martyn at welchs.e.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-19 14:21:58 +01:00
Greg Kroah-Hartman 41849215b0 Revert "Staging: vme: Use BIT macro for bit field definitions."
This reverts commit d4ef13130e.

It's wrong :(

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman gregkh@linuxfoundation.org
2016-11-14 15:44:57 +01:00
Anton Leshchenko 2a0fc8bc0c Staging: vme: Fix parenthesis alignment.
Align broken line for code readability.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 10:58:32 +01:00
Anton Leshchenko f0316a1950 Staging: vme: Add required identifier names.
Add identifier names for function definition arguments.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 10:58:32 +01:00
Anton Leshchenko d4ef13130e Staging: vme: Use BIT macro for bit field definitions.
Instead of using shift operation use BIT macro for bit field
definitions.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 10:58:32 +01:00
Anton Leshchenko b197fd9d67 Staging: vme: Remove excessive blank lines.
To make code more readable, remove excessive blank lines.

Signed-off-by: Anton Leshchenko <antonl1911@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-11-07 10:58:32 +01:00
Mauro Carvalho Chehab 8c27ceff36 docs: fix locations of several documents that got moved
The previous patch renamed several files that are cross-referenced
along the Kernel documentation. Adjust the links to point to
the right places.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2016-10-24 08:12:35 -02:00
Andrew Kanner fbafd397fb drivers: staging: vme: convert to octal notation for permission bits
Ran checkpatch.pl -f vme_pio2_core.c
Fixed: WARNING: Symbolic permissions are not preferred. Consider using
octal permissions (0444)

Signed-off-by: Andrew Kanner <andrew.kanner@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-17 23:36:53 +02:00
Ryan Swan 65f5c3ea62 staging: vme/devices: vme_user.c: fix: converted decimal permissions to octal
Ran checkpatch.pl -f vme_user.c
Fixed: ERROR: Use 4 digit octal (0777) not decimal permissions

Signed-off-by: Ryan Swan <ryan@ryanswan.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-13 15:01:29 +02:00
Linus Torvalds 2f37dd131c Staging and IIO driver update for 4.7-rc1
Here's the big staging and iio driver update for 4.7-rc1.
 
 I think we almost broke even with this release, only adding a few more
 lines than we removed, which isn't bad overall given that there's a
 bunch of new iio drivers added.  The Lustre developers seem to have
 woken up from their sleep and have been doing a great job in cleaning up
 the code and pruning unused or old cruft, the filesystem is almost
 readable :)
 
 Other than that, just a lot of basic coding style cleanups in the churn.
 All have been in linux-next for a while with no reported issues.
 
 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iEYEABECAAYFAlc/00QACgkQMUfUDdst+ynXYQCdG9oEsw4CCItbjGfQau5YVGbd
 TOcAnA19tZz+Wcg3sLT8Zsm979dgVvDt
 =9UG/
 -----END PGP SIGNATURE-----

Merge tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging and IIO driver updates from Greg KH:
 "Here's the big staging and iio driver update for 4.7-rc1.

  I think we almost broke even with this release, only adding a few more
  lines than we removed, which isn't bad overall given that there's a
  bunch of new iio drivers added.

  The Lustre developers seem to have woken up from their sleep and have
  been doing a great job in cleaning up the code and pruning unused or
  old cruft, the filesystem is almost readable :)

  Other than that, just a lot of basic coding style cleanups in the
  churn.  All have been in linux-next for a while with no reported
  issues"

* tag 'staging-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (938 commits)
  Staging: emxx_udc: emxx_udc: fixed coding style issue
  staging/gdm724x: fix "alignment should match open parenthesis" issues
  staging/gdm724x: Fix avoid CamelCase
  staging: unisys: rename misleading var ii with frag
  staging: unisys: visorhba: switch success handling to error handling
  staging: unisys: visorhba: main path needs to flow down the left margin
  staging: unisys: visorinput: handle_locking_key() simplifications
  staging: unisys: visorhba: fail gracefully for thread creation failures
  staging: unisys: visornic: comment restructuring and removing bad diction
  staging: unisys: fix format string %Lx to %llx for u64
  staging: unisys: remove unused struct members
  staging: unisys: visorchannel: correct variable misspelling
  staging: unisys: visorhba: replace functionlike macro with function
  staging: dgnc: Need to check for NULL of ch
  staging: dgnc: remove redundant condition check
  staging: dgnc: fix 'line over 80 characters'
  staging: dgnc: clean up the dgnc_get_modem_info()
  staging: lustre: lnet: enable configuration per NI interface
  staging: lustre: o2iblnd: properly set ibr_why
  staging: lustre: o2iblnd: remove last of kiblnd_tunables_fini
  ...
2016-05-20 22:20:48 -07:00
Linus Walleij cbc3f10f9e staging: vme: use gpiochip data pointer
This makes the driver use the data pointer added to the gpio_chip
to store a pointer to the state container instead of relying on
container_of().

Cc: Manohar Vanga <manohar.vanga@gmail.com>
Cc: devel@driverdev.osuosl.org
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-04-26 15:35:16 +02:00
Clifton Barnes 148e45dc87 staging: vme: fix bare use of 'unsigned'
fix checkpatch.pl warning about 'Prefer 'unsigned int' to bare use of
'unsigned''

Signed-off-by: Clifton Barnes <clifton.a.barnes@gmail.com>
Acked-by: Martyn Welch <martyn@welchs.me.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-04-04 12:41:24 -07:00
Amitoj Kaur Chawla 0c56665923 staging: vme: devices: Replace kzalloc with devm_kzalloc
Devm_ functions allocate memory that is released when a driver
detaches. Replace kzalloc with devm_kzalloc and remove corresponding
kfrees from probe and remove functions of a platform
device.

Also, unnecessary labels have been removed.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11 22:09:09 -08:00
Egor Uleyskiy 6e23ec4a11 drivers: staging: vme: Deleted casting to (void *)
Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Egor Uleyskiy 59a04f1135 drivers: staging: vme: Fixed checking NULL and 0 code style
Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Egor Uleyskiy 48a42206dd drivers: staging: vme: Deleted extra bracking
* Deleted extra bracking of VME_* constants
* Deleted extra bracking of address operator

Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Egor Uleyskiy 93a28666a9 drivers: staging: vme: Fixed the using of sizeof
Constructions that looks like
    card = kzalloc(sizeof(struct pio2_card), GFP_KERNEL);
  are changed to
    card = kzalloc(sizeof(*card), GFP_KERNEL);

Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Egor Uleyskiy cad5636db7 drivers: staging: vme: Deleted extra empty lines
Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Egor Uleyskiy 24e394b08e drivers: staging: vme: Fixed indention
Signed-off-by: Egor Uleyskiy <egor.ulieiskii@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-24 15:30:50 -08:00
Junsu Shin bda9e24909 staging: vme: devices: add spaces around '-'
This is a patch to the vme_pio2_core.c that adds spaces around '-'.

Signed-off-by: Junsu Shin <jjunes0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:56:54 -07:00
Junsu Shin a8f401f9e7 staging: vme: devices: fix NULL comparison style
This is a patch to vme_pio2_core.c that fixes up the NULL comparison style.

Signed-off-by: Junsu Shin <jjunes0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:56:54 -07:00
Junsu Shin 6c37e74457 staging: vme: devices: remove blank line after open brace
This is a patch to the vme_pio2_core.c that removes blank line after open brace '{'.

Signed-off-by: Junsu Shin <jjunes0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:56:54 -07:00
Junsu Shin d5f0a90e60 staging: vme: devices: remove multiple blank lines
This is a patch to vm2_pio2_core.c that removes multiple blanks lines.

Signed-off-by: Junsu Shin <jjunes0@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-14 18:56:54 -07:00
Navy Cheng 44ae5443ef Staging: vme: remove an unnecessary and wrong warning message
The wrong warning message in vme_user_probe() will mislead developers and
users. As the error message which prompt cdev_add() error already exists,
just remove the unnecessary and wrong message.

Signed-off-by: Navy Cheng <navych@126.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-08-07 15:10:58 -07:00
Dmitry Kalinkin 32491f561b staging: vme_user: remove okcount variable
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:15 -07:00
Dmitry Kalinkin 18f8bee206 staging: vme_user: remove distracting comment
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:15 -07:00
Dmitry Kalinkin 457ab28619 staging: vme_user: remove unused variable
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:15 -07:00
Dmitry Kalinkin 7c78e0cdd0 staging: vme_user: switch to returning -EFAULT on __copy_*_user errors
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:15 -07:00
Dmitry Kalinkin 8e4d138cc0 staging: vme_user: allow large read()/write()
This changes large master transfers to do shorter read/write rather than
return -EINVAL. User space will now be able to optimistically request a
large transfer and get at least some data.

This also removes comments suggesting on how to implement large
transfers. Current vme_master_* read and write implementations use CPU
copies that don't produce burst PCI accesses and subsequently no block
transfer on VME bus. In the end overall performance is quiet low and it
can't be fixed by doing direct copy to user space. Much easier solution
would be to just reuse kernel buffer.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:15 -07:00
Dmitry Kalinkin 1f0622de0d staging: vme_user: fix kmalloc style
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:14 -07:00
Dmitry Kalinkin f99b71be37 staging: vme_user: fix NULL comparison style
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:14 -07:00
Dmitry Kalinkin cd974d35ab staging: vme_user: fix blank lines
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:14 -07:00
Dmitry Kalinkin 86eadace5d staging: vme_user: fix code alignment
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-07-14 22:50:14 -07:00
Dmitry Kalinkin 625a9e012d staging: vme_user: remove buf_unalloc helper
buf_unalloc is essentially a vme_free_consistent:
1) image[i].kern_buf is never NULL in buf_alloc call
2) kern_buf, pci_buf and size_buf get zeroed in vme_user_probe anyway

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-13 14:46:38 -07:00
Dmitry Kalinkin 0b029cb2f5 staging: vme_user: remove open/release
Checking for image[minor].resource != NULL is not needed since all
resources are allocated before device is created.

image[minor].users accounting is deleted because it's not being used.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-13 14:46:38 -07:00
Dmitry Kalinkin e4aea6aa03 staging: vme_user: remove forward declarations
Reorder code so that forward declarations are not needed.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-13 14:46:38 -07:00
Dmitry Kalinkin d884dd8c88 staging: vme_user: remove unused counters
Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:29:37 -07:00
Dmitry Kalinkin 615c40dd9f staging: vme_user: refactor llseek to switch(){}
This makes vme_user_llseek ignore all minors that don't have llseek
implementation.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-06-12 17:26:57 -07:00
Dmitry Kalinkin c74a804f11 staging: vme: mmap() support for vme_user
We also make sure that user won't be able to reconfigure the window while it is
mmap'ed.

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Martyn Welch <martyn.welch@ge.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 17:03:22 -08:00
Dmitry Kalinkin 0cd189a42d staging: vme: use image mutex for ioctl()
This implements more granular locking in vme_user_ioctl() by using separate
locks for each devfs device.

This also provides a synchronization between vme_user_read(), vme_user_write()
and vme_user_ioctl().

Signed-off-by: Dmitry Kalinkin <dmitry.kalinkin@gmail.com>
Cc: Martyn Welch <martyn.welch@ge.com>
Cc: Igor Alekseev <igor.alekseev@itep.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-06 17:03:22 -08:00
Navya Sri Nizamkari 0b5c85e0f4 staging: Remove <linux/moduleparam.h> header.
This patch drops #include <linux/moduleparam.h> in all the staging
driver files that also include #include <linux/module.h> as
module.h includes moduleparam.h already.

The following semantic patch is used to make these changes:

@ includesmodule @
@@
@ depends on includesmodule @
@@
- #include <linux/moduleparam.h>

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-03-01 17:09:52 -08:00
Vaishali Thakkar e31a0e6280 Staging: vme: devices: Use kasprintf
This patch uses kasprintf which combines kmalloc and sprintf.
kasprintf also takes care of the size calculation.

This is done using Coccinelle. Semantic patch used is as follows:

@@
expression a,flag;
expression list args;
statement S;
@@

 a =
- \(kmalloc\|kzalloc\)(...,flag)
+ kasprintf (flag,args)
  <... when != a
  if (a == NULL || ...) S
  ...>
- sprintf(a,args);

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-27 10:33:05 +08:00
Kumari Radha a7a4f87e3c staging: vme: devices: Added a paragraph to describe Kconfig symbol
This patch adds module name information about config symbol fixing the following checkpatch.pl warning in Kconfig:
WARNING: please write a paragraph that describes the config symbol fully

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-10-20 10:29:18 +08:00
Linus Torvalds 77c688ac87 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull vfs updates from Al Viro:
 "The big thing in this pile is Eric's unmount-on-rmdir series; we
  finally have everything we need for that.  The final piece of prereqs
  is delayed mntput() - now filesystem shutdown always happens on
  shallow stack.

  Other than that, we have several new primitives for iov_iter (Matt
  Wilcox, culled from his XIP-related series) pushing the conversion to
  ->read_iter()/ ->write_iter() a bit more, a bunch of fs/dcache.c
  cleanups and fixes (including the external name refcounting, which
  gives consistent behaviour of d_move() wrt procfs symlinks for long
  and short names alike) and assorted cleanups and fixes all over the
  place.

  This is just the first pile; there's a lot of stuff from various
  people that ought to go in this window.  Starting with
  unionmount/overlayfs mess...  ;-/"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (60 commits)
  fs/file_table.c: Update alloc_file() comment
  vfs: Deduplicate code shared by xattr system calls operating on paths
  reiserfs: remove pointless forward declaration of struct nameidata
  don't need that forward declaration of struct nameidata in dcache.h anymore
  take dname_external() into fs/dcache.c
  let path_init() failures treated the same way as subsequent link_path_walk()
  fix misuses of f_count() in ppp and netlink
  ncpfs: use list_for_each_entry() for d_subdirs walk
  vfs: move getname() from callers to do_mount()
  gfs2_atomic_open(): skip lookups on hashed dentry
  [infiniband] remove pointless assignments
  gadgetfs: saner API for gadgetfs_create_file()
  f_fs: saner API for ffs_sb_create_file()
  jfs: don't hash direct inode
  [s390] remove pointless assignment of ->f_op in vmlogrdr ->open()
  ecryptfs: ->f_op is never NULL
  android: ->f_op is never NULL
  nouveau: __iomem misannotations
  missing annotation in fs/file.c
  fs: namespace: suppress 'may be used uninitialized' warnings
  ...
2014-10-13 11:28:42 +02:00