History log of /linux-master/drivers/staging/nvec/nvec_ps2.c
Revision Date Author Comments
# cedff4e3 03-Apr-2023 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

staging: nvec_ps2: Convert to platform remove callback returning void

The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is (mostly) ignored
and this typically results in resource leaks. To improve here there is a
quest to make the remove callback return void. In the first step of this
quest all drivers are converted to .remove_new() which already returns
void.

Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230403154014.2564054-22-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 946e2f00 22-Mar-2021 Arnd Bergmann <arnd@arndb.de>

staging/nvec:: avoid Wempty-body warning

This driver has a few disabled diagnostics, which can probably
just get removed, or might still be helpful:

drivers/staging/nvec/nvec_ps2.c: In function 'nvec_ps2_notifier':
drivers/staging/nvec/nvec_ps2.c:94:77: error: suggest braces around empty body in an 'if' statement [-Werror=empty-body]
94 | NVEC_PHD("unhandled mouse event: ", msg, msg[1] + 2);

Changing the empty macro to the usual 'do {} while (0)' at least
shuts up the compiler warnings.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lore.kernel.org/r/20210322103545.704121-2-arnd@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# aca1bf72 31-Jan-2021 Kumar Kartikeya Dwivedi <memxor@gmail.com>

staging: nvec: Switch from strlcpy to strscpy

strlcpy is marked as deprecated in Documentation/process/deprecated.rst,
and there is no functional difference when the caller expects truncation
(when not checking the return value). strscpy is relatively better as it
also avoids scanning the whole source string.

This silences the related checkpatch warnings from:
5dbdb2d87c29 ("checkpatch: prefer strscpy to strlcpy")

Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20210131172838.146706-6-memxor@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d6d69c82 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: nvec: remove redundant license text

Now that the SPDX tag is in all drivers/staging/nvec/ 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: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 971bcfca 11-Jan-2018 Greg Kroah-Hartman <gregkh@linuxfoundation.org>

staging: nvec: add SPDX identifier.

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 staging nvec driver to have a proper SPDX identifiers, 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: Thomas Gleixner <tglx@linutronix.de>
Cc: Kate Stewart <kstewart@linuxfoundation.org>
Cc: Philippe Ombredanne <pombredanne@nexb.com>
Cc: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# cf13a747 14-Feb-2017 Arushi Singhal <arushisinghal19971997@gmail.com>

staging:nvec:nvec_ps2.c: Prefering kzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct serio)...)

Prefer kzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct
serio)...) as reported by checkpatch.pl.

Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 68fae2f3 01-Nov-2016 Marc Dietrich <marvin24@gmx.de>

staging: nvec: remove managed resource from PS2 driver

This basicly reverts commit e534f3e9 (staging:nvec: Introduce the use of
the managed version of kzalloc). Serio struct should never by managed
because it is refcounted. Doing so will lead to a double free oops on module
remove.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Fixes: e534f3e9429f ("staging:nvec: Introduce the use of the managed version of kzalloc")
Cc: stable <stable@vger.kernel.org> # 3.15+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 17c1c9ba 27-Oct-2016 Paul Fertser <fercerpav@gmail.com>

Revert "staging: nvec: ps2: change serio type to passthrough"

This reverts commit 36b30d6138f4677514aca35ab76c20c1604baaad.

This is necessary to detect paz00 (ac100) touchpad properly as one
speaking ETPS/2 protocol. Without it X.org's synaptics driver doesn't
work as the touchpad is detected as an ImPS/2 mouse instead.

Commit ec6184b1c717b8768122e25fe6d312f609cc1bb4 changed the way
auto-detection is performed on ports marked as pass through and made the
issue apparent.

A pass through port is an additional PS/2 port used to connect a slave
device to a master device that is using PS/2 to communicate with the
host (so slave's PS/2 communication is tunneled over master's PS/2
link). "Synaptics PS/2 TouchPad Interfacing Guide" describes such a
setup (PS/2 PASS-THROUGH OPTION section).

Since paz00's embedded controller is not connected to a PS/2 port
itself, the PS/2 interface it exposes is not a pass-through one.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Fixes: 36b30d6138f4 ("staging: nvec: ps2: change serio type to passthrough")
Cc: stable <stable@vger.kernel.org> # 3.4+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d8f8a74d 27-Oct-2016 Paul Fertser <fercerpav@gmail.com>

drivers: staging: nvec: remove bogus reset command for PS/2 interface

This command was sent behind serio's back and the answer to it was
confusing atkbd probe function which lead to the elantech touchpad
getting detected as a keyboard.

To prevent this from happening just let every party do its part of the
job.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Cc: stable <stable@vger.kernel.org> # 3.4+
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 0df8f51e 10-Mar-2016 Ben Marsh <bmarsh94@gmail.com>

Staging: nvec: removes an unnecessary cast on a void pointer

Patch to nvec_ps2.c to remove an unnecessary cast on a void pointer.

Signed-off-by: Ben Marsh <bmarsh94@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 716baa7b 16-Jun-2015 Peng Fan <van.freenix@gmail.com>

staging: nvec: remove duplicated const

Sparse checking warning:
"drivers/staging/nvec/nvec_ps2.c:172:14: warning: duplicate const".
Remove the duplicated const to fix the warning.

Signed-off-by: Peng Fan <van.freenix@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 4c42d979 16-Mar-2015 Somya Anand <somyaanand214@gmail.com>

Staging: nvec: use !x instead of x == NULL

Functions like devm_kzalloc, kmalloc_array, devm_ioremap,
usb_alloc_urb, alloc_netdev return NULL as a return value on failure.
Generally, When NULL represents failure, !x is commonly used.

This patch cleans up the tests on the results of these functions, thereby
using !x instead of x == NULL or NULL == x. This is done via following
coccinelle script:
@prob_7@
identifier x;
statement S;
@@

(
x = devm_kzalloc(...);
|
x = usb_alloc_urb(...);
|
x = kmalloc_array(...);
|
x = devm_ioremap(...);
|
x = alloc_netdev(...);
)
...
- if(NULL == x)
+ if(!x)
S
Further we have used isomorphism characteristics of coccinelle to
indicate x == NULL and NULL == x are equivalent. This is done via
following iso script.

Expression
@ is_null @ expression X; @@
X == NULL <=> NULL == X

Signed-off-by: Somya Anand <somyaanand214@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d5dbc024 20-Oct-2014 Wolfram Sang <wsa@kernel.org>

staging: nvec: drop owner assignment from platform_drivers

A platform_driver does not need to set an owner, it will be populated by the
driver core.

Signed-off-by: Wolfram Sang <wsa@the-dreams.de>


# fa799617 03-Jul-2014 Pawel Lebioda <pawel.lebioda89@gmail.com>

staging: nvec: insert blank lines after declarations

This patch fixes coding style warnings reported by checkpatch.pl:
"Missing a blank line after declarations".

Signed-off-by: Pawel Lebioda <pawel.lebioda89@gmail.com>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# e534f3e9 07-Mar-2014 Himangi Saraogi <himangi774@gmail.com>

staging:nvec: Introduce the use of the managed version of kzalloc

This patch moves shared private data kzalloc to managed devm_kzalloc.
There are no kfree statements associated with this data, so using devm
adds the possibility of the data being freed, if the proble function
fails (if that is possible) or if the remove function succeeds.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# c2b62f60 29-Apr-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: cleanup childs on remove

Disable device functions and unregister notifier if available. The
serio device must not be "kzallocated". Otherwise serio_unregister_port
will fail because the device is already freed.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 99758dec 29-Apr-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: add missing module aliases

Keyboard and mouse drivers were missing MODULE_ALIAS
definitions. This fixes auto module loading of these
drivers.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# d398f56e 29-Apr-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: cleanup childs on remove

Disable device functions and unregister notifier if available. The
serio device must not be "kzallocated". Otherwise serio_unregister_port
will fail because the device is already freed.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 38dc92ed 29-Apr-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: add missing module aliases

Keyboard and mouse drivers were missing MODULE_ALIAS
definitions. This fixes auto module loading of these
drivers.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 93eff83f 27-Jan-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: cleanup the string mess

Replace the various command strings by named constants.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 85a90528 27-Jan-2013 Marc Dietrich <marvin24@gmx.de>

staging: nvec: fix mouse suspend/resume calls

The EC command for enable/disable is not an EC command. Instead it needs
to be send to the mouse.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 1a6a8a84 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: nvec: remove use of __devexit

CONFIG_HOTPLUG is going away as an option so __devexit is no
longer needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 46620803 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: nvec: remove use of __devinit

CONFIG_HOTPLUG is going away as an option so __devinit is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 44b90a3f 19-Nov-2012 Bill Pemberton <wfp5p@virginia.edu>

staging: nvec: remove use of __devexit_p

CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer
needed.

Signed-off-by: Bill Pemberton <wfp5p@virginia.edu>
Cc: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 3cdde3a3 24-Jun-2012 Marc Dietrich <marvin24@gmx.de>

staging: nvec: add remove function to nvec childs

This patch cleanups registered devices on remove.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# ebefae28 24-Jun-2012 Marc Dietrich <marvin24@gmx.de>

staging: nvec: cleanup powermanagement callbacks

Simplify powermanagement initialization by using pm_ops macro.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 9891b1ce 24-Jun-2012 Marc Dietrich <marvin24@gmx.de>

staging: nvec: cleanup driver registration

This patch simplifies code by using the module_platform_driver
macro.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# f5e3352e 24-Jun-2012 Marc Dietrich <marvin24@gmx.de>

staging: nvec: convert to devm_ functions

This patch cleanups the nvec and its childs by replacing calls to
resource allocations by their devm_* equivalents.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


# 36b30d61 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: change serio type to passthrough

This changes the serio type of the nvec_ps2 mouse port to passthrough.
The old 8042 type seems appropiete for keyboards only.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# a573298b 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: disable/enable mouse on suspend/resume

This change makes the touchpad buttons work after suspend/resume.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 0eedab70 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: add some more debug functions

This can print the mouse traffic which goes over the i2c bus. Make
mouse debugging messages configurable and disable them by default.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 4b625c3a 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: tell nvec to send 6 byte long messages

This packet size used on most modern touchpads. Ideally, this should
be configurable or autodetected.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 34ba143b 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: let the start/stop streaming commands be called by the start/stop functions of serio

Instead of executing these commands during open/close, the start/stop
event of the serio device seem to be more appropiete.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# d1b5342c 26-Dec-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: ps2: add suspend/resume functions

This adds suspend and resume functions to the nvec_ps2 mouse driver.

During suspend the nvec sends a "Cancel all mouse events" command. If
this is missed, there will be still some bytes in the received buffer
after resume which make the mouse go out of sync.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 1e46e627 27-Sep-2011 Julian Andres Klode <jak@jak-linux.org>

staging: nvec: ps2: Always sample 4 bytes instead of just 1

Get 4 bytes of data from nvec at once instead of just a single
byte. This makes the driver more similar to nvidias and might
improve reliability.

Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# ff006d12 27-Sep-2011 Julian Andres Klode <jak@jak-linux.org>

staging: nvec: Return error in PS2 driver if write fails

Return the return value of nvec_write_async() in the methods
returning an int.

Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 162c7d8c 27-Sep-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: coding style fixes / add copyright notice

This patch fixes coding style and adds copyright notices.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
[jak@jak-linux.org: Merge later cleanup into that patch]
Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 7974035c 27-Sep-2011 Julian Andres Klode <jak@jak-linux.org>

staging: nvec: Include missing headers

Those headers were apparently included by other headers
previously, but are not anymore.

Signed-off-by: Julian Andres Klode <jak@jak-linux.org>
Acked-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# f686e9af 24-Aug-2011 Marc Dietrich <marvin24@gmx.de>

staging: nvec: convert to use platform register and mfdcells

This patch converts the nvec to use mfd cells and improves the
registration of the platform driver. The child drivers are also
converted to use mfd cells and platform registration.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>


# 32890b98 19-May-2011 Marc Dietrich <marvin24@gmx.de>

Staging: initial version of the nvec driver

This is an implementation of a NVidia compliant embedded controller
protocol driver. It is used on some ARM-Tegra boards for device
communication.

Signed-off-by: Marc Dietrich <marvin24@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>