1
0
Fork 0
Commit Graph

17 Commits (583c53185399cea5c51195064564d1c9ddc70cf3)

Author SHA1 Message Date
Todd Poynor 1c65a2e2f6 staging: gasket: remove "reset type" param from framework
The "type of reset" parameter to the gasket device reset APIs isn't
required by the only gasket device submitted upstream, apex.

The framework documents the param as private to the device driver and a
pass-through at the gasket layer, but the gasket core calls the device
driver with a hardcoded reset type of zero, which is not documented as
having a predefined meaning.

In light of all this, remove the reset type parameter from the
framework.  Remove the reset ioctl reset type parameter, and bump the
framework version number to reflect the interface change.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-02 11:00:21 +02:00
Todd Poynor 3e84508313 staging: gasket: ioctl: fix function param line continuation style
Fix multi-line alignment formatting to look like:
      int ret = long_function_name(device, VARIABLE1, VARIABLE2,
                                   VARIABLE3, VARIABLE4);

Many of these TODO items were previously cleaned up during the conversion
to standard logging functions.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-01 20:07:02 +02:00
Todd Poynor ea174ccd2a staging: gasket: ioctl: remove static function forward declarations
Remove forward declarations of static functions, move code to avoid
forward references, for kernel style.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-01 20:07:02 +02:00
Todd Poynor 73832cf08f staging: gasket: ioctl: simplify comments for static functions
Static functions don't need kernel doc formatting, can be simplified.
Reformat comments that can be single-line.  Remove extraneous text.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-30 10:54:51 +02:00
Todd Poynor e25bed80b6 staging: gasket: ioctl: convert to standard logging
Replace gasket logging calls with standard logging calls.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-27 17:09:17 +02:00
Todd Poynor 1d079f20d5 staging: gasket: ioctl common: convert various logs to debug level
Debugging information is improperly logged at non-debug log level in a
number of places, and some logs regarding error conditions may be
generated too frequently, such that these could cause performance
problems and/or obscure other logs.  Convert these to debug log level.

Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-24 13:56:46 +02:00
Todd Poynor 5c4a5d3ddd staging: gasket: avoid copy to user on error in coherent alloc config
gasket_config_coherent_allocator() on error return the error to caller
without copying a possibly-update DMA address back to userspace.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-24 13:56:45 +02:00
Todd Poynor 8fc1cb4cef staging: gasket: gasket_handle_ioctl fix ioctl exit trace param
Pass the return value from the device ioctl permissions callback to the
tracepoint when the callback returns an error.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-24 13:56:45 +02:00
Todd Poynor 996e650030 staging: gasket: remove duplicate call to retrieve device callback
gasket_handle_ioctl() calls gasket_get_ioctl_permissions_cb() twice;
simplify the code and avoid duplicated work by fetching the callback
pointer only once.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-24 13:56:45 +02:00
Todd Poynor 56edc4e3f9 staging: gasket: common ioctls add __user annotations
Add __user annotation to gasket common ioctl pointer arguments for
sparse checking.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:36 +02:00
Todd Poynor de3690d025 staging: gasket: common ioctl dispatcher add __user annotations
Add __user annotation to gasket core common ioctl pointer arguments for
sparse checking.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:36 +02:00
Todd Poynor ed74277bd8 staging: gasket: always allow root open for write
Always allow root to open device for writing.

Drop special-casing of ioctl permissions for root vs. owner.

Convert to bool types as appropriate.

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:35 +02:00
Todd Poynor ed6e96c795 staging: gasket: remove unnecessary code in coherent allocator
Remove extraneous statement in gasket_config_coherent_allocator()

Reported-by: Dmitry Torokhov <dtor@chromium.org>
Signed-off-by: Zhongze Hu <frankhu@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-21 08:50:35 +02:00
Felix Siegel 948fd537bd staging: gasket: Use __func__ instead of hardcoded string - Style
Changed logging statements to use %s and __func__ instead of hard coding
the function name in a string.

Signed-off-by: Felix Siegel <felix.siegel@posteo.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-13 10:34:39 +02:00
Greg Kroah-Hartman bf9c7a8673 staging: gasket: remove redundant license information
Now that the SPDX tag is in all gasket files, that identifies the
license in a specific and legally-defined manner.  So the extra GPL text
wording can be removed as it is no longer needed at all.

This is done on a quest to remove the 700+ different ways that files in
the kernel describe the GPL license text.  And there's unneeded stuff
like the address (sometimes incorrect) for the FSF which is never
needed.

Cc: Rob Springer <rspringer@google.com>
Cc: John Joseph <jnjoseph@google.com>
Cc: Ben Chan <benchan@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 21:48:30 +02:00
Greg Kroah-Hartman 2dec0644e0 staging: gasket: add SPDX identifiers to all files.
It's good to have SPDX identifiers in all files to make it easier to
audit the kernel tree for correct licenses.

Fix up the all of the staging gasket files to have a proper SPDX
identifier, based on the license text in the file itself.  The SPDX
identifier is a legally binding shorthand, which can be used instead of
the full boiler plate text.

Cc: Rob Springer <rspringer@google.com>
Cc: John Joseph <jnjoseph@google.com>
Cc: Ben Chan <benchan@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-12 21:48:30 +02:00
Simon Que 9a69f5087c drivers/staging: Gasket driver framework + Apex driver
The Gasket (Google ASIC Software, Kernel Extensions, and Tools) kernel
framework is a generic, flexible system that supports thin kernel
drivers. Gasket kernel drivers are expected to handle opening and
closing devices, mmap'ing BAR space as requested, a small selection of
ioctls, and handling page table translation (covered below). Any other
functions should be handled by userspace code.

The Gasket common module is not enough to run a device. In order to
customize the Gasket code for a given piece of hardware, a device
specific module must be created. At a minimum, this module must define a
struct gasket_driver_desc containing the device-specific data for use by
the framework; in addition, the module must declare an __init function
that calls gasket_register_device with the module's gasket_driver_desc
struct. Finally, the driver must define an exit function that calls
gasket_unregister_device with the module's gasket_driver_desc struct.

One of the core assumptions of the Gasket framework is that precisely
one process is allowed to have an open write handle to the device node
at any given time. (That process may, once it has one write handle, open
any number of additional write handles.) This is accomplished by
tracking open and close data for each driver instance.

Signed-off-by: Rob Springer <rspringer@google.com>
Signed-off-by: John Joseph <jnjoseph@google.com>
Signed-off-by: Simon Que <sque@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-02 09:01:49 +02:00