History log of /linux-master/drivers/staging/greybus/hid.c
Revision Date Author Comments
# ff17bb87 29-Jan-2023 Thomas Weißschuh <linux@weissschuh.net>

staging: greybus: hid: Constify lowlevel HID driver

Since commit 52d225346904 ("HID: Make lowlevel driver structs const")
the lowlevel HID drivers are only exposed as const.

Take advantage of this to constify the underlying structure, too.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20230130-hid-const-ll-driver-v1-9-3fc282b3b1d0@weissschuh.net
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>


# 51063101 12-Feb-2021 Pritthijit Nath <pritthijit.nath@icloud.com>

staging: greybus: Fixed a misspelling in hid.c

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>


# a2ea4e1d 12-Feb-2021 Pritthijit Nath <pritthijit.nath@icloud.com>

staging: greybus: Fixed alignment issue in hid.c

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>


# c42f7363 28-Mar-2020 Dan Jessie <dtjessie@gmail.com>

staging: greybus: hid: remove braces {} around single statement block

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>


# ec0ad868 24-Aug-2019 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: move core include files to include/linux/greybus/

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>


# 591ad6f1 31-Mar-2019 Sanjana Sanikommu <sanjana99reddy99@gmail.com>

staging: greybus: hid: Remove print following unsuccessful kmalloc

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>


# 8478c35a 25-Nov-2018 Cristian Sicilia <sicilia.cristian@gmail.com>

staging: greybus: Parenthesis alignment

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>


# 863dbc52 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: Remove redundant license text

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>


# eb50fd3a 07-Nov-2017 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: greybus: add SPDX identifiers to all greybus driver files

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>


# d9d2401f 07-Jun-2017 Dmitry Torokhov <dmitry.torokhov@gmail.com>

greybus: hid: remove custom locking from gb_hid_open/close

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>


# be21106d 08-Sep-2016 Greg Kroah-Hartman <gregkh@google.com>

staging: greybus: hid: remove KERNEL_VERSION checks

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>


# 43c85a09 22-Jul-2016 Philip Yang <yang_philip@projectara.com>

greybus: HID: Add runtime pm support

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>


# 60fb3405 10-Jun-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: Remove extra blank lines

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>


# 0ec30632 22-Mar-2016 Greg Kroah-Hartman <gregkh@google.com>

greybus: convert drivers to use connection->private set/get

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>


# 9b22f155 26-Feb-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Replace WARN_ON() with dev_err()

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>


# b22b7104 28-Feb-2016 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Don't disable connection-tx before destroying hid-device

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>


# 4324282d 21-Jan-2016 Johan Hovold <johan@kernel.org>

greybus: hid: convert to bundle driver

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>


# 5dd8cc53 21-Jan-2016 Johan Hovold <johan@kernel.org>

greybus: hid: clean up init error paths

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>


# 2f3db927 04-Dec-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: don't use %h and %hh for printing short and char variables

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>


# c9e9de26 04-Nov-2015 Greg Kroah-Hartman <gregkh@google.com>

greybus: hid: hid should not be part of the bridged-phy driver.

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>


# b2a637d7 14-Oct-2015 Greg Kroah-Hartman <gregkh@google.com>

greybus: hid: use the bundle struct device instead of the connector

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>


# 6ab1ce4d 26-Sep-2015 Johan Hovold <johan@kernel.org>

greybus: operation: remove gb_operation_destroy

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>


# 51aee043 12-Aug-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Move request/response structure/definitions to greybus_protocols.h

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>


# 2dad338c 10-Aug-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Drop get_version support

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>


# 34ec3645 07-Aug-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Use (already defined) major/minor macros

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>


# d79ae495 07-Aug-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: spell fix (s/infomation/information)

Minor spell fix.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>


# e420721b 30-Jun-2015 Johan Hovold <johan@kernel.org>

greybus: operation: allow atomic operation allocations

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>


# e18822e3 30-Jun-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: Rename gb_gpbridge_protocol_driver() as gb_builtin_protocol_driver()

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>


# bdac599c 20-May-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: Use gb_gpbridge_protocol_init()

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>


# 6d653370 07-May-2015 Alex Elder <elder@linaro.org>

greybus: eliminate extra response flag definitions

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>


# 581baacd 02-Apr-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: Use payload-size to get report size

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>


# 973ccfd6 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: operation: refactor response handling

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>


# d0eb755a 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: hid: fix missing response on request errors

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>


# 382145be 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: hid: fix missing input verification of report events

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>


# 36257f6b 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: hid: fix null-deref on short report requests

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>


# ecf47ab9 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: hid: fix success response being sent on errors

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>


# b67f2d13 26-Mar-2015 Johan Hovold <johan@kernel.org>

greybus: hid: replace pr_err with dev_err

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>


# 292cca99 18-Mar-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: don't support OUTPUT report over interrupt channel

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>


# 96eab779 16-Mar-2015 Viresh Kumar <viresh.kumar@linaro.org>

greybus: hid: add HID class driver

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>