summaryrefslogtreecommitdiffstats
path: root/drivers/staging/gasket/apex_driver.c
Commit message (Collapse)AuthorAgeFilesLines
* staging: gasket: apex: fix copy-paste typoIvan Bornyakov2019-07-251-1/+1
| | | | | | | | | | | In sysfs_show() case-branches ATTR_KERNEL_HIB_PAGE_TABLE_SIZE and ATTR_KERNEL_HIB_SIMPLE_PAGE_TABLE_SIZE do the same. It looks like copy-paste mistake. Signed-off-by: Ivan Bornyakov <brnkv.i1@gmail.com> Cc: stable <stable@vger.kernel.org> Link: https://lore.kernel.org/r/20190710204518.16814-1-brnkv.i1@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: Prefer using the BIT macroSanjana Sanikommu2019-03-291-2/+2
| | | | | | | | | | | | | | | | | Challenge suggested by coccinelle. Replace bit shifting on 1 with the BIT(x) macro. Coccinelle script: @@ constant c; @@ -(1 << c) +BIT(c) Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: Remove return variableNishka Dasgupta2019-03-201-3/+1Star
| | | | | | | | | Remove return variable and return the return value directly. Issue suggested by ret.cocci. Signed-off-by: Nishka Dasgupta <nishka.dasgupta@yahoo.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: Remove extra blank lineMaya Nakamura2018-10-191-1/+0Star
| | | | | | | | | Remove extra blank line. Issue found by checkpatch.pl. Signed-off-by: Maya Nakamura <m.maya.nakamura@gmail.com> Reviewed-by: Vaishali Thakkar <vthakkar@vaishalithakkar.in> Acked-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: fix sysfs_showNick Ewalt2018-10-151-1/+1
| | | | | | | | | sysfs_show was incorrectly extracting the sysfs_attribute_type from the gasket_sysfs_attribute. This prevented dispatch from working properly. Signed-off-by: Nick Ewalt <nicholasewalt@google.com> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: remove unused array cm_mappable_regionsColin Ian King2018-08-271-3/+0Star
| | | | | | | | | | | Array cm_mappable_regions is defined but is never used hence it is redundant and can be removed. Cleans up clang warning: warning: 'cm_mappable_regions' defined but not used [-Wunused-const-variable=] Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: place in low power reset until openedTodd Poynor2018-08-081-0/+4
| | | | | | | | | The apex device is left out of reset mode at the end of device probe/initialize processing. Add a call to enter reset at the end of the sequence, triggering power gating and other low power features. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: move sysfs setup code to probe functionTodd Poynor2018-08-081-9/+5Star
| | | | | | | | | The gasket framework no longer provides callbacks to the device driver for sysfs setup and teardown. Move the sysfs setup code to the device probe function. Apex does not implement sysfs cleanup code. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: fold device add/remove logic inlineTodd Poynor2018-08-081-37/+32Star
| | | | | | | | | | Gasket device drivers are now in charge of the device add and remove sequences; the framework callbacks for these are deleted. Move the apex device add callback code to the probe function. Apex did not implement the removal callback. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: enable/disable gasket device from apexTodd Poynor2018-08-081-0/+12
| | | | | | | | | Gasket framework now places device drivers in charge of calling APIs to enable and disable gasket device operations. Make the appropriate calls from the apex driver. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: remove device enable and disable callbacksTodd Poynor2018-08-081-3/+0Star
| | | | | | | | These are not implemented for apex, and are now being removed from the gasket framework. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: move PCI core calls to apex driverTodd Poynor2018-08-081-1/+48
| | | | | | | | | Apex driver moves PCI core calls like probe, enable, and remove from gasket to apex. Call new functions in gasket to register apex as a PCI device to the gasket framework. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: enable power save mode by defaultTodd Poynor2018-08-021-1/+1
| | | | | | | | | Set default value of allow_power_save parameter to enable power save mode, which is expected to be the state usually desired. Signed-off-by: Marty Faltesek <mfaltesek@google.com> Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: drop reset type paramTodd Poynor2018-08-021-12/+8Star
| | | | | | | | | | | | Apex doesn't implement different types of resets based on the reset type param passed through the gasket layer or from userspace via the gasket_reset ioctl. The reset type is dropped from the gasket framework in a previous patch due to a lack of present need and non-conforming use of this parameter by the framework. Drop the parameter from the apex driver as well. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: move driver-private defines out of apex.hTodd Poynor2018-08-011-0/+29
| | | | | | | | | | apex.h is supposed to contain kernel-userspace interface definitions, but has a number of defines that are only used by apex_driver.c or are not used at all. Move driver implementation defines not shared with userspace to the driver source. Remove unused defines. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: fix function param line continuation styleTodd Poynor2018-07-301-61/+58Star
| | | | | | | | | | | | 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>
* staging: gasket: apex: remove static function forward declarationsTodd Poynor2018-07-301-226/+190Star
| | | | | | | | 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: apex: simplify comments for static functionsTodd Poynor2018-07-301-54/+10Star
| | | | | | | | 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: apex: fixup undefined PCI classTodd Poynor2018-07-281-0/+7
| | | | | | | | Apex chips with class 0 (PCI_CLASS_NOT_DEFINED) fixed up to PCI_CLASS_SYSTEM_OTHER to enable PCI resource assignments. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: convert to standard loggingTodd Poynor2018-07-271-35/+26Star
| | | | | | | Drop gasket logging calls in favor of standard logging. Signed-off-by: Todd Poynor <toddpoynor@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: apex: convert various logs to debug levelTodd Poynor2018-07-241-5/+5
| | | | | | | | | | | 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: apex return error on sysfs show of missing attributeTodd Poynor2018-07-241-2/+2
| | | | | | | | | | Apex sysfs show function return -ENODEV if the attribute is not present, rather than silently failing from the standpoint of the userspace accessor. 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: apex ioctl add __user annotationsTodd Poynor2018-07-211-7/+10
| | | | | | | | | Add __user annotation to ioctl pointer argument, 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-11/+4Star
| | | | | | | | | | | | | 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: apex_clock_gating simplify logic, reduce indentationTodd Poynor2018-07-211-23/+20Star
| | | | | | | | | | Collapse together two checks and return immediately, avoid conditional indentation for most of function code. 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: fix gasket_wait_with_reschedule timeout return codeTodd Poynor2018-07-191-4/+4
| | | | | | | | | Return -ETIMEDOUT, not -EINVAL, on timeout, including callers. 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: fix typo in apex_enter_resetTodd Poynor2018-07-191-1/+1
| | | | | | | | Fix typo in log message. 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: Use __func__ instead of hardcoded string - StyleFelix Siegel2018-07-131-3/+4
| | | | | | | | 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>
* staging: gasket: remove "function entered" log messagesFelix Siegel2018-07-131-8/+0Star
| | | | | | | | Remove log messages that solely print the function's name everytime it is called. Signed-off-by: Felix Siegel <felix.siegel@posteo.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* staging: gasket: remove redundant license informationGreg Kroah-Hartman2018-07-121-10/+2Star
| | | | | | | | | | | | | | | | 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>
* staging: gasket: add SPDX identifiers to all files.Greg Kroah-Hartman2018-07-121-0/+1
| | | | | | | | | | | | | | | 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>
* drivers/staging: Gasket driver framework + Apex driverSimon Que2018-07-021-0/+771
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>