summaryrefslogtreecommitdiffstats
path: root/drivers/staging/gasket/gasket_core.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: gasket: remove debug logs for callback invocationTodd Poynor2018-10-191-6/+1Star
| | | | | | | | Debug logs for device-specific callback invocation aren't very useful, remove. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: interrupt: simplify interrupt init parametersTodd Poynor2018-08-271-7/+1Star
| | | | | | | | | | | Pass the gasket driver descriptor to the interrupt init function, rather than exploding out separate parameters from various fields of that structure. This allows us to make more localized changes to the types of interrupts supported (MSIX vs. wire, etc.) without affecting the calling sequence, and seems nicer for simplification purposes. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: rename lookup_internal_desc to be PCI-specificTodd Poynor2018-08-271-4/+4
| | | | | | | | Rename lookup_internal_desc() to lookup_pci_internal_desc() to reflect use for PCI devices only, in prep for non-PCI devices in the future. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: factor out generic device remove code from PCITodd Poynor2018-08-271-10/+10
| | | | | | | | Separate code for generic parts of gasket device removal sequence from the PCI device removal code, in prep for non-PCI devices later. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: factor out generic device add code from PCI codeTodd Poynor2018-08-271-28/+48
| | | | | | | | Split out generic gasket device add code from the code for adding a PCI gasket device, in prep for other gasket device types in the future. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: remove gasket_exit()Todd Poynor2018-08-271-4/+0Star
| | | | | | | Remove now-empty gasket_exit() function. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove ftrace-style debug logsTodd Poynor2018-08-271-2/+0Star
| | | | | | | | Remove debug logs that only indicate the name of the entered function, in favor of using ftrace for function tracing style logs. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove kobj_name param from gasket_alloc_devTodd Poynor2018-08-271-9/+8Star
| | | | | | | | | | gasket_alloc_dev can retrieve the device name from the parent parameter, a separate parameter isn't needed for this. Rename the variable to better reflect its meaning, as the name of the parent device for which a gasket device is being allocated. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: fix line continuation indent in gasket_alloc_devTodd Poynor2018-08-271-2/+3
| | | | | | | | Previous cleanups missed a case of multi-line function call with line continuation parameters not aligned per kernel style. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove debug log that could crashTodd Poynor2018-08-271-2/+0Star
| | | | | | | | | | A debug log in gasket_alloc_dev() is issued regardless of whether the device pointer used returned success or error. The log isn't that useful anyway, remove it. Signed-off-by: Todd Poynor <toddpoynor@google.com> Reviewed-by: Rob Springer <rspringer@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove incorrect extraneous commentTodd Poynor2018-08-081-1/+0Star
| | | | | | | | A copy-and-pasted comment from another code sequence is removed from gasket core init sequence. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: protect against races during unregisterTodd Poynor2018-08-081-2/+1Star
| | | | | | | | | | | Keep mutex held across the unregistration operation, until the driver_desc field of the global table is removed, to prevent a concurrent accessor from looking up the driver_desc while gasket_unregister_device() is in the processing of removing it. Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove sysfs setup and cleanup callbacksTodd Poynor2018-08-081-10/+0Star
| | | | | | | | | | Gasket device drivers now call into the gasket framework to initialize and de-initialize, rather than the other way around. The calling code can perform sysfs setup and cleanup actions without callbacks from the framework. Remove the sysfs setup and cleanup callbacks. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: delete device add and remove callbacksTodd Poynor2018-08-081-10/+0Star
| | | | | | | | | Gasket device drivers are now in charge of orchestrating the device add and removal sequences, so the callbacks from the framework to the device drivers for these events are no longer needed. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: let device driver enable/disable gasket deviceTodd Poynor2018-08-081-14/+8Star
| | | | | | | | | | | | Move gasket device enable/disable functions from internal calls to external calls from the gasket device drivers. The device driver will call these functions at appropriate times in its processing, placing the device driver in control of this sequence and reducing the need for callbacks from framework back to the device drivers during the enable/disable sequences. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove device enable and disable callbacksTodd Poynor2018-08-081-9/+0Star
| | | | | | | | | | | Device enable/disable operations are moving from being initiated through the gasket framework to being initiated by the gasket device driver. The driver can perform any processing needed for these operations before or after the calls into the framework. Neither of these callbacks are implemented for the only gasket driver upstream today, apex. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: convert remaining info logs to debugTodd Poynor2018-08-081-4/+3Star
| | | | | | | | Remaining info-level logs in gasket core converted to debug-level; the information is not needed during normal system operation. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: move core PCI calls to device driversTodd Poynor2018-08-081-60/+22Star
| | | | | | | | | Remove gasket wrapping of PCI probe, enable, disable, and remove functions. Replace with calls to add and remove PCI gasket devices, to be called by the gasket device drivers. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Revert "staging: gasket: core: hold reference to pci_dev while used"Todd Poynor2018-08-051-2/+1Star
| | | | | | | | | | | | There's no need to take an additional reference on the pci_dev structure for the pointer copy saved in gasket data structures. This reverts commit: 8dd8a48b9a7d ("staging: gasket: core: hold reference to pci_dev while used") Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: add subsystem and device info to logsTodd Poynor2018-08-051-4/+9
| | | | | | | | | Identify gasket as the subsystem printing various messages. Add the driver name to appropriate messages to indicate which driver has a problem. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: device register debug log cleanupsTodd Poynor2018-08-051-5/+2Star
| | | | | | | | | At device/driver registration time, convert a not-very-informative info message to a more informative debug message, drop some not overly helpful debug messages. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove registration logsTodd Poynor2018-08-051-4/+0Star
| | | | | | | Remove logs for loading gasket drivers. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: remove "reset type" param from frameworkTodd Poynor2018-08-021-6/+5Star
| | | | | | | | | | | | | | | | | 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>
* staging: gasket: core: use bool type for ns_capable resultTodd Poynor2018-08-011-2/+2
| | | | | | | | | | When gasket core was converted from using capable() to use ns_capable() instead, the type of the variable holding the result should have been converted from int to bool. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: fix function param line continuation styleTodd Poynor2018-08-011-149/+145Star
| | | | | | | | | Fix multi-line alignment formatting to look like: int ret = long_function_name(device, VARIABLE1, VARIABLE2, VARIABLE3, VARIABLE4); Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: remove static function forward declarationsTodd Poynor2018-08-011-929/+873Star
| | | | | | | | 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>
* staging: gasket: core: simplify comments for static functionsTodd Poynor2018-07-301-120/+31Star
| | | | | | | | 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>
* staging: gasket: core: allow root access based on user namespaceTodd Poynor2018-07-301-2/+8
| | | | | | | | | Use user namespace to determine whether gasket device file opener is root, allowing root access to containers, if necessary. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: hold reference to pci_dev while usedTodd Poynor2018-07-301-2/+2
| | | | | | | | Hold a reference on the struct pci_dev while a pointer to it is held in the gasket data structures. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: hold reference on device while in useTodd Poynor2018-07-291-2/+2
| | | | | | | | | Hold a reference on the struct device while a pointer to that device is in use by gasket. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: page table: remove code for "no dma_ops"Todd Poynor2018-07-281-1/+1
| | | | | | | | | Remove code with TODOs on it for working around apparent problems previously seen in a qemu environment where dma_ops was not set correctly. There is no user of this in the current code. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: core: convert to standard loggingTodd Poynor2018-07-271-161/+134Star
| | | | | | | Use standard logging functions, drop use of gasket log functions. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: save struct device for a gasket deviceTodd Poynor2018-07-271-2/+3
| | | | | | | | | Save the struct device pointer to a gasket device in gasket's metadata, to facilitate use of standard logging calls and in anticipation of non-PCI gasket devices in the future. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: ioctl common: convert various logs to debug levelTodd Poynor2018-07-241-1/+1
| | | | | | | | | | | 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>
* staging: gasket: core: convert various logs to debug levelTodd Poynor2018-07-241-18/+20
| | | | | | | | | | | 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>
* staging: gasket: gasket_get_device drop check for NULL pci_devTodd Poynor2018-07-241-3/+1Star
| | | | | | | | | The pci_dev field of a struct gasket_dev can never be NULL, there's no need to check for this in gasket_get_device(). Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: remove unnecessary NULL checks on calls from VFSTodd Poynor2018-07-241-15/+0Star
| | | | | | | | | | Remove unneeded checks for NULL pointers in struct file pointers passed from the VFS layer or the private_data that must have been properly set at file open time. Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: print mmap starting address as unsigned longTodd Poynor2018-07-241-2/+2
| | | | | | | | | Page alignment error log should print the offending value as an unsigned long, not as a kernel pointer. Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: fix check_and_invoke_callback log paramTodd Poynor2018-07-241-1/+1
| | | | | | | | | The message should be passed the callback function pointer, not the pointer to the gasket device. 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>
* staging: gasket: top ioctl handler add __user annotationsTodd Poynor2018-07-211-2/+4
| | | | | | | | | | Add __user annotation to gasket_core top-level ioctl handling 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>
* staging: gasket: always allow root open for writeTodd Poynor2018-07-211-3/+5
| | | | | | | | | | | | | 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>
* staging: gasket: remove extra parens in gasket_write_mappable_regionsTodd Poynor2018-07-211-1/+1
| | | | | | | | | Remove unneeded parentheses around subexpressions. Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: gasket_mmap use PAGE_MASKTodd Poynor2018-07-211-1/+1
| | | | | | | | | | gasket_mmap use PAGE_MASK, instead of performing math on PAGE_SIZE, for simplicity and clarity. Reported-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: gasket_mmap return error instead of valid BAR indexTodd Poynor2018-07-211-1/+1
| | | | | | | | | When offset to be mapped matches both a BAR region and a coherent mapped region return an error as intended, not the BAR index. Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: don't treat no device reset callback as an errorTodd Poynor2018-07-211-5/+2Star
| | | | | | | | It is not an error for a device to not have a reset callback registered. Signed-off-by: Simon Que <sque@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: fix class create bug handlingTodd Poynor2018-07-211-1/+1
| | | | | | | | | | | class_create() never returns NULL, and this driver should never return PTR_ERR(NULL) anyway. Reported-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Zhongze Hu <frankhu@chromium.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Reviewed-by: Dmitry Torokhov <dtor@chromium.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: remove code for no physical deviceTodd Poynor2018-07-211-11/+1Star
| | | | | | | | | gasket_enable_dev code for enabling a gasket device with no physical PCI device registered shouldn't be necessary. Reported-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: gasket_enable_dev remove unnecessary variableTodd Poynor2018-07-211-4/+1Star
| | | | | | | | | Remove unnecessary variable, pass constant param instead. 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>
* staging: gasket: drop gasket_cdev_get_info, use container_ofTodd Poynor2018-07-191-22/+4Star
| | | | | | | | | | Remove gasket_cdev_get_info(), use container_of() directly instead, drop unnecessary NULL checks. 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>
* staging: gasket: bail out of reset sequence on device callback errorTodd Poynor2018-07-191-1/+3
| | | | | | | | | | If device reset callback returns an error, error out at the gasket level. 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>