Todd Poynor
eef60d21af
staging: gasket: fix check_and_invoke_callback log param
...
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 >
2018-09-04 11:20:06 -07:00
Todd Poynor
0a9d6ccbbf
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-09-04 11:19:32 -07:00
Todd Poynor
342c986d28
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-09-04 11:18:57 -07:00
Todd Poynor
53f54339d7
staging: gasket: apex ioctl add __user annotations
...
Add __user annotation to ioctl pointer argument, for sparse checking.
Change-Id: I677aa0a2eed9a34b799273e0a3a7cb45ced14c8e
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-09-04 11:18:20 -07:00
Todd Poynor
73e7d5fac5
staging: gasket: top ioctl handler add __user annotations
...
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 >
2018-09-04 11:12:15 -07:00
Todd Poynor
c4e2ac2703
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-09-04 11:11:40 -07:00
Todd Poynor
4984eecc63
staging: gasket: fix multi-line comment syntax in gasket_core.h
...
Use consistent kernel-style multi-line comment syntax.
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 >
2018-09-04 11:11:05 -07:00
Todd Poynor
c685c4ea9c
staging: gasket: remove extra parens in gasket_write_mappable_regions
...
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 >
2018-09-04 11:10:30 -07:00
Todd Poynor
4e7e569724
staging: gasket: gasket_mmap use PAGE_MASK
...
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 >
2018-09-04 11:09:55 -07:00
Todd Poynor
d99aa15f2e
staging: gasket: remove unnecessary parens in page table code
...
gasket_alloc_coherent_memory() extra parentheses in statement.
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 >
2018-09-04 11:09:20 -07:00
Todd Poynor
e4c3d02829
staging: gasket: fix comment syntax in apex.h
...
Use kernel-style multi-line comment syntax.
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 >
2018-09-04 11:08:45 -07:00
Todd Poynor
35ae6935e7
staging: gasket: remove else clause after return in if clause
...
Else after return is unnecessary and may cause static code checkers to
complain.
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 >
2018-09-04 11:08:11 -07:00
Todd Poynor
b710f906c5
staging: gasket: gasket page table functions use bool return type
...
Convert from int to bool return type for gasket page table functions
that return values used as booleans.
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 >
2018-09-04 11:07:36 -07:00
Todd Poynor
5f5275b6c8
staging: gasket: apex_clock_gating simplify logic, reduce indentation
...
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 >
2018-09-04 11:07:01 -07:00
Todd Poynor
21ea6458c2
staging: gasket: gasket_mmap return error instead of valid BAR index
...
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 >
2018-09-04 11:06:28 -07:00
Todd Poynor
a666b28f2c
staging: gasket: don't treat no device reset callback as an error
...
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 >
2018-09-04 11:05:53 -07:00
Todd Poynor
087af27461
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-09-04 11:05:18 -07:00
Todd Poynor
48ad480759
staging: gasket: fix class create bug handling
...
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 >
2018-09-04 11:04:43 -07:00
Todd Poynor
aca27c50a9
staging: gasket: remove code for no physical device
...
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 >
2018-09-04 11:04:08 -07:00
Todd Poynor
c29bd5bbb6
staging: gasket: gasket_enable_dev remove unnecessary variable
...
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 >
2018-09-04 11:03:33 -07:00
Leonid Lobachev
378d57f04e
Keep apex in reset mode unless it's used.
...
Change-Id: I56eb88a1a138290f6939a19e8b973fb78d2e3c40
2018-07-23 17:27:43 -07:00
Alex Van Damme
237454b288
Apex performance ioctl
...
Change-Id: Id3ae759f748b3f8c6f6a5320a5088c43fad0e812
2018-07-23 16:11:16 -07:00
Alex Van Damme
d737e80b17
Enable Apex on ARM64, fix compile issue
...
- Change from X86 only to X86 or ARM64 in Kconfig
- refcount_read doesn't exist in 4.11, so use atomic_read instead. This
is the same call that refcount_read in 4.12+ would make.
Change-Id: I48c97dd8c14136dcccaa8378b3a931a7872e1289
2018-07-23 16:11:14 -07:00
Todd Poynor
883c9a9fa9
staging: gasket: drop gasket_cdev_get_info, use container_of
...
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 >
2018-07-23 16:08:22 -07:00
Todd Poynor
e7cddbb9bd
staging: gasket: bail out of reset sequence on device callback error
...
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 >
2018-07-23 16:08:22 -07:00
Todd Poynor
d7ea69e8a4
staging: gasket: gasket_wait_with_reschedule use 32 bits of retry count
...
Don't need a 64-bit retry counter.
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-23 16:08:22 -07:00
Todd Poynor
bb0f4d4a3f
staging: gasket: gasket_wait_with_reschedule simplify logic
...
gasket_wait_with_reschedule() is a little more clear if we just return
directly when the waited-for condition is hit. This also allows the
following condition check to be removed and identation of the
conditionally-executed code to be reduced.
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-23 16:08:22 -07:00
Todd Poynor
11eb4eb149
staging: gasket: gasket_wait_with_reschedule use msleep
...
Replace schedule_timeout() call with msleep() for simplicity.
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-23 16:08:22 -07:00
Todd Poynor
c850f2c77e
staging: gasket: fix gasket_wait_with_reschedule timeout return code
...
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 >
2018-07-23 16:08:22 -07:00
Todd Poynor
dd69b60312
staging: gasket: convert gasket_mmap_has_permissions to bool return
...
gasket_mmap_has_permissions() should return a boolean value.
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-23 16:08:22 -07:00
Todd Poynor
04f5568b57
staging: gasket: Remove stale pointers on error allocating attr array
...
If gasket_sysfs_create_mapping() hits errors allocating the attribute
array, remove stale pointers to device info from the mapping object.
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-23 16:08:22 -07:00
Todd Poynor
a7546cc34c
staging: gasket: Return EBUSY on mapping create when already in use
...
gasket_sysfs_create_mapping() return EBUSY if sysfs mapping already in
use, as a more appropriate error code than the current return of EINVAL,
which would indicate invalid parameters.
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-23 16:08:21 -07:00
Todd Poynor
d57203b516
staging: gasket: hold mutex on gasket driver unregistration
...
Take the global mutex on driver unregistration updates for proper
ordering of updates and consistent access procedures.
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-23 16:08:21 -07:00
Todd Poynor
dc5522d1dc
staging: gasket: remove driver registration on class creation failure
...
If class_create() fails, remove the gasket driver from the global
registration table.
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-23 16:08:21 -07:00
Todd Poynor
1563830458
staging: gasket: whitespace fix in gasket_page_table_init
...
Tab replaced with space.
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-23 16:08:21 -07:00
Todd Poynor
cc9c05a0c8
staging: gasket: fix typo in gasket_core.h comments
...
Grammar fixup in gasket_core.h comments describing struct
gasket_interrupt_desc.
Signed-off-by: Todd Poynor <toddpoynor@google.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-07-23 16:08:21 -07:00
Todd Poynor
ef0319c4c4
staging: gasket: fix typo in apex_enter_reset
...
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 >
2018-07-23 16:08:21 -07:00
Greg Kroah-Hartman
39bdbb8951
staging: gasket: remove gasket_wait_sync()
...
This function is not called anywhere, so just remove it.
Also, as an added benifit, Arnd points out that it doesn't even work
properly:
This code won't work correct during leap seconds or a concurrent
settimeofday() call, and it probably doesn't do what the author intended
even for the normal case, as it passes a timeout in nanoseconds but
reads the time using a jiffies-granularity accessor.
Reported-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-07-23 16:08:21 -07:00
Greg Kroah-Hartman
1ba805dba8
staging: gasket: sysfs: remove legacy_device field
...
This field is only ever checked, never actually set, and looks to be
left-over from some old interface of some sort. As it's not being used
at all here, and is just adding to the complexity, delete it.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
1180baae6b
staging: gasket: remove gasket_sysfs_register_show()
...
In an attempt to start to clean up the monstrosity of the sysfs abuse in
the gasket driver, let's remove code that is not used at all. The
gasket_sysfs_register_show() function is never used, so delete it.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
e5fd02987e
staging: gasket: remove GASKET_SYSFS_REG()
...
In an attempt to start to clean up the monstrosity of the sysfs abuse in
the gasket driver, let's remove code that is not used at all. The
GASKET_SYSFS_REG() macro is never used, so delete it.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
8ab2804fad
staging: gasket: remove gasket_page_table_num_extended_entries()
...
It is exported, yet no one calls it so just remove the dead code.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
2343ad2d61
staging: gasket: remove gasket_interrupt_get_msix_entries()
...
No one calls it, it is claimed to be "legacy", whatever that means, so
just remove the dead code.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
97ca040342
staging: gasket: remove gasket_interrupt_trigger_eventfd()
...
No one calls it, so just remove the dead code.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
e7d963fa61
staging: gasket: remove gasket_interrupt_get_eventfd_ctxs()
...
It is exported, yet no one calls it so just remove the dead code.
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-23 16:08:21 -07:00
Greg Kroah-Hartman
5335078357
staging: gasket: remove pointless gasket_interrupt_pause()
...
gasket_interrupt_pause() does nothing, and no one calls it, so remove it
as it is dead-weight.
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-23 16:08:20 -07:00
Felix Siegel
b27f5c2e98
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-23 16:08:20 -07:00
Felix Siegel
dbd32599d2
staging: gasket: remove "function entered" log messages
...
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 >
2018-07-23 16:08:20 -07:00
Felix Siegel
c2b4e1cb8d
staging: gasket: fix multi line comments style
...
This patch fixes checkpatch.pl warnings:
WARNING: Block comments should align the * on each line
Signed-off-by: Felix Siegel <felix.siegel@posteo.de >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-07-23 16:08:20 -07:00
Felix Siegel
4ec0581576
staging: gasket: Move open-curly brace to match kernel code style
...
Move open open-curly brace to the next line following function
definition to match the kernel's coding style
Signed-off-by: Felix Siegel <felix.siegel@posteo.de >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2018-07-23 16:08:20 -07:00