summaryrefslogtreecommitdiff
path: root/drivers/staging/greybus/hid.c
AgeCommit message (Collapse)Author
2021-02-13staging: greybus: Fixed a misspelling in hid.cPritthijit Nath
Fixed the spelling of 'transfered' to 'transferred'. Signed-off-by: Pritthijit Nath <pritthijit.nath@icloud.com> Link: https://lore.kernel.org/r/20210212101324.12391-1-pritthijit.nath@icloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-02-12staging: greybus: Fixed alignment issue in hid.cPritthijit Nath
This change fixes a checkpatch CHECK style issue for "Alignment should match open parenthesis". Signed-off-by: Pritthijit Nath <pritthijit.nath@icloud.com> Link: https://lore.kernel.org/r/20210212081835.9497-1-pritthijit.nath@icloud.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-13staging: greybus: hid: remove braces {} around single statement blockDan Jessie
This patch fixes the checkpatch.pl warning: WARNING: braces {} are not necessary for single statement blocks This is the only instance of the problem noted by checkpatch.pl in staging: greybus. Signed-off-by: Dan Jessie <dtjessie@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Link: https://lore.kernel.org/r/20200328222134.19344-1-dtjessie@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-08-27staging: greybus: move core include files to include/linux/greybus/Greg Kroah-Hartman
With the goal of moving the core of the greybus code out of staging, the include files need to be moved to include/linux/greybus.h and include/linux/greybus/ Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: Johan Hovold <johan@kernel.org> Cc: Vaibhav Agarwal <vaibhav.sr@gmail.com> Cc: Rui Miguel Silva <rmfrfs@gmail.com> Cc: David Lin <dtwlin@gmail.com> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Cc: greybus-dev@lists.linaro.org Cc: devel@driverdev.osuosl.org Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Alex Elder <elder@kernel.org> Link: https://lore.kernel.org/r/20190825055429.18547-8-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-01staging: greybus: hid: Remove print following unsuccessful kmallocSanjana Sanikommu
Challenge suggested by Coccinelle Remove print statement following unsuccessful kmalloc when there is not enough memory. Kmalloc and variants normally produce a backtrace in such a case. Hence, a print statement is not necessary. Found using the following Coccinelle semantic patch: @@ identifier i,print; constant char [] c; @@ i = (\(kmalloc\|devm_kzalloc\|kmalloc_array\| devm_ioremap\|usb_alloc_urb\|alloc_netdev\|dev_alloc_skb\| kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\| kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\)(...)); ( if (i == NULL) { -print(...,c,...); ...when any } | if (!i) { -print(...,c,...); ...when any } ) Signed-off-by: Sanjana Sanikommu <sanjana99reddy99@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-26staging: greybus: Parenthesis alignmentCristian Sicilia
Some parameters are aligned with parentheses. Some parentheses was opened at end of line. Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-11staging: greybus: Remove redundant license textGreg Kroah-Hartman
Now that the SPDX tag is in all greybus 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. No copyright headers or other non-license-description text was removed. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Acked-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-11staging: greybus: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/greybus files files with the correct SPDX license 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. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-08greybus: hid: remove custom locking from gb_hid_open/closeDmitry Torokhov
Now that HID core enforces serialization of transport driver open/close calls we can remove custom locking from greybus hid driver. Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
2016-09-19staging: greybus: hid: remove KERNEL_VERSION checksGreg Kroah-Hartman
No need to support older kernel versions in the Greybus HID driver, so remove the checks as needed, we can now rely on all of the "new" apis being present. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-07-22greybus: HID: Add runtime pm supportPhilip Yang
Modify HID greybus driver to support runtime PM framework. The suspend and resume fucntion have been test with tutorial-hid, e-ink-display and gpbridge-test image by sysfs resume, all HID buttons work well on suspend/resume. Testing Done: Compiled and verified on EVT2, DB3.5, GPB test module with daughter board, Red module. Signed-off-by: Philip Yang <yang_philip@projectara.com> Reviewed-by: David Lin <dtwlin@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-10greybus: Remove extra blank linesViresh Kumar
This patch removes few blank lines across the repository at places where two blank lines were present together or when a blank line is present at the start or end of a routine. Note that this doesn't remove most of them from greybus_protocols.h as they were added on purpose. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-03-22greybus: convert drivers to use connection->private set/getGreg Kroah-Hartman
This converts all drivers to use the gb_connection_get_data() and gb_connection_set_data() functions to make it a bit more explicit as to what is going on. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-29greybus: hid: Replace WARN_ON() with dev_err()Viresh Kumar
WARN_ON() is a bit harsh here, as we just failed to power-off the HID device while it is getting removed. Replace it with dev_err(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-29greybus: hid: Don't disable connection-tx before destroying hid-deviceViresh Kumar
hid_destroy_device() can potentially call callbacks defined in struct hid_ll_driver, which may initiate few greybus operations. And so connection (tx) should be kept enabled until the hid-device isn't destroyed. Reported-by: Jiss Kuruvila <jkuruvila@google.com> Reported-by: Laurent Pinchart <laurent.pinchart@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-21greybus: hid: convert to bundle driverJohan Hovold
Convert the legacy HID protocol driver to a bundle driver. This also fixes a potential crash should a (malicious) module have sent an early request before the private data had been initialised. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-21greybus: hid: clean up init error pathsJohan Hovold
Separate success and error paths more clearly. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-04greybus: don't use %h and %hh for printing short and char variablesViresh Kumar
Because the width of our fields is already known, we can use %0Nx (for hex) to print N bytes and %u (for unsigned decimal), instead of using %h and %hh, which isn't that readable. This patch makes following changes: - s/%hx/%04x - s/%04hx/%04x - s/%hhx/%02x - s/%02hhx/%02x - s/%hhu/%u - s/%hu/%u - s/%x/%02x for u8 value (only at a single place) Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-05greybus: hid: hid should not be part of the bridged-phy driver.Greg Kroah-Hartman
HID is a stand-alone greybus protocol, not part of the bridged-phy protocols, so make it a stand-alone kernel module. Note, some hard-coded android init script might need to be changed to load the gb-hid.ko kernel module now. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
2015-10-15greybus: hid: use the bundle struct device instead of the connectorGreg Kroah-Hartman
We are removing struct device from the gb_connection structure in the near future. The gb_bundle structure's struct device should be used as a replacement. This patch moves the hid driver to use the bundle pointer instead of the connection pointer. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org>
2015-09-29greybus: operation: remove gb_operation_destroyJohan Hovold
Remove legacy interface to "destroy" operations, which is now just a wrapper for gb_operation_put. The old interface name hides the fact that all operations are refcounted and may live on even after having "destroyed" them. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-12greybus: hid: Move request/response structure/definitions to greybus_protocols.hViresh Kumar
These must be exposed to external modules, like gbsim. Move them to greybus_protocols.h file. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11greybus: hid: Drop get_version supportViresh Kumar
This is done from a common place now, no need to replicate it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-10greybus: hid: Use (already defined) major/minor macrosViresh Kumar
We already have macros for these, use them instead of writing fixed values. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-10greybus: hid: spell fix (s/infomation/information)Viresh Kumar
Minor spell fix. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-01greybus: operation: allow atomic operation allocationsJohan Hovold
Add gfp mask argument to gb_operation_create to allow operations to be allocated in atomic context. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-01greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()Viresh Kumar
This macro is also required by core protocols like control and svc, and hence the 'gpbridge' name doesn't fit anymore. Lets call this macro gb_builtin_protocol_driver(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-20greybus: Use gb_gpbridge_protocol_init()Viresh Kumar
Start using gb_gpbridge_protocol_init() in gpbridge drivers. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-07greybus: eliminate extra response flag definitionsAlex Elder
All protocols use the same value to distinguish between request and response message types. This is a requirement. Use GB_MESSAGE_TYPE_RESPONSE rather than GB_OPERATION_TYPE_RESPONSE for the name of the flag used to distiguish between request and response messages. Get rid of the redundant response flag definitions that are associated with specific protocols. Describe the symbolic values as "operation types" rather than "message types" where they are defined. The message type for a request is the same as the operation type; the message type for a response is the operation type OR'd with GB_MESSAGE_TYPE_RESPONSE. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-06greybus: hid: Use payload-size to get report sizeViresh Kumar
Report size isn't passed as first two bytes of the report according to USB-HID spec. Get it from payload-size. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-03-30greybus: operation: refactor response handlingJohan Hovold
Send response to incoming requests from the operation request handler rather than in every protocol request_recv callback. This simplifies request_recv error handling and allows for further code reuse. Note that if we ever get protocols that need to hold off sending responses we could implement this by letting them return a special value (after acquiring the necessary operation references) to suppress the response from being sent by greybus core. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: hid: fix missing response on request errorsJohan Hovold
Send response also to incoming requests that cannot be fulfilled. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: hid: fix missing input verification of report eventsJohan Hovold
Add minimal verification of incoming report size, before using it to determine what buffer and size to pass on to HID core. Add comment about protocol needing to be revisited. If we are going to be parsing the report data received, then those fields have to be defined in the Greybus specification at least. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: hid: fix null-deref on short report requestsJohan Hovold
Make sure to verify the length of incoming requests before trying to parse the request buffer, which can even be NULL on empty requests. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: hid: fix success response being sent on errorsJohan Hovold
Make sure to only send a success response if we did not detect any errors. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-30greybus: hid: replace pr_err with dev_errJohan Hovold
Replace pr_err with dev_err and clean up error messages somewhat. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-19greybus: hid: don't support OUTPUT report over interrupt channelViresh Kumar
There is no interrupt channel as such and so no need to support ->output_report(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-03-16greybus: hid: add HID class driverViresh Kumar
This adds HID transport layer driver for Greybus. Most of the stuff is implemented, but is untested. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>