Commit Graph

26 Commits

Author SHA1 Message Date
Uwe Kleine-König b36be72b5a staging: most: Switch i2c driver back to use .probe()
After commit b8a1a4cd5a ("i2c: Provide a temporary .probe_new()
call-back type"), all drivers being converted to .probe_new() and then
03c835f498 ("i2c: Switch .probe() to not take an id parameter") convert
back to (the new) .probe() to be able to eventually drop .probe_new() from
struct i2c_driver.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20230524151646.486847-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-28 10:15:29 +01:00
Menna Mahmoud 8f51a66a62 staging: most: use inline functions for to_hdm
Convert `to_hdm` macro into a static inline function.
it is not great to have macro that use `container_of` macro,
because from looking at the definition one cannot tell
what type it applies to.

One can get the same benefit from an efficiency point of view
by making an inline function.

Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Signed-off-by: Menna Mahmoud <eng.mennamahmoud.mm@gmail.com>
Link: https://lore.kernel.org/r/20230320103356.6498-1-eng.mennamahmoud.mm@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-03-22 10:17:14 +01:00
Uwe Kleine-König 9a2c1d64c8 staging: most: i2c: Convert to i2c's .probe_new()
The probe function doesn't make use of the i2c_device_id * parameter so it
can be trivially converted.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20221118224540.619276-570-uwe@kleine-koenig.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2022-11-22 13:23:25 +01:00
Uwe Kleine-König ed5c2f5fd1 i2c: Make remove callback return void
The value returned by an i2c driver's remove function is mostly ignored.
(Only an error message is printed if the value is non-zero that the
error is ignored.)

So change the prototype of the remove function to return no value. This
way driver authors are not tempted to assume that passing an error to
the upper layer is a good idea. All drivers are adapted accordingly.
There is no intended change of behaviour, all callbacks were prepared to
return 0 before.

Reviewed-by: Peter Senna Tschudin <peter.senna@gmail.com>
Reviewed-by: Jeremy Kerr <jk@codeconstruct.com.au>
Reviewed-by: Benjamin Mugnier <benjamin.mugnier@foss.st.com>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Reviewed-by: Crt Mori <cmo@melexis.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Marek Behún <kabel@kernel.org> # for leds-turris-omnia
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Petr Machata <petrm@nvidia.com> # for mlxsw
Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for surface3_power
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> # for bmc150-accel-i2c + kxcjk-1013
Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> # for media/* + staging/media/*
Acked-by: Miguel Ojeda <ojeda@kernel.org> # for auxdisplay/ht16k33 + auxdisplay/lcd2s
Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # for versaclock5
Reviewed-by: Ajay Gupta <ajayg@nvidia.com> # for ucsi_ccg
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # for iio
Acked-by: Peter Rosin <peda@axentia.se> # for i2c-mux-*, max9860
Acked-by: Adrien Grassein <adrien.grassein@gmail.com> # for lontium-lt8912b
Reviewed-by: Jean Delvare <jdelvare@suse.de> # for hwmon, i2c-core and i2c/muxes
Acked-by: Corey Minyard <cminyard@mvista.com> # for IPMI
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com> # for drivers/power
Acked-by: Krzysztof Hałasa <khalasa@piap.pl>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
2022-08-16 12:46:26 +02:00
Lee Jones f74afcfd94 staging: most: i2c: Fix a little doc-rot
Fixes the following W=1 kernel build warning(s):

 drivers/staging/most/i2c/i2c.c:66: warning: Function parameter or member 'most_iface' not described in 'configure_channel'
 drivers/staging/most/i2c/i2c.c:66: warning: Function parameter or member 'ch_idx' not described in 'configure_channel'
 drivers/staging/most/i2c/i2c.c:66: warning: Excess function parameter 'iface' description in 'configure_channel'
 drivers/staging/most/i2c/i2c.c:66: warning: Excess function parameter 'channel' description in 'configure_channel'
 drivers/staging/most/i2c/i2c.c:121: warning: Function parameter or member 'most_iface' not described in 'enqueue'
 drivers/staging/most/i2c/i2c.c:121: warning: Function parameter or member 'ch_idx' not described in 'enqueue'
 drivers/staging/most/i2c/i2c.c:121: warning: Excess function parameter 'iface' description in 'enqueue'
 drivers/staging/most/i2c/i2c.c:121: warning: Excess function parameter 'channel' description in 'enqueue'
 drivers/staging/most/i2c/i2c.c:166: warning: Function parameter or member 'most_iface' not described in 'poison_channel'
 drivers/staging/most/i2c/i2c.c:166: warning: Function parameter or member 'ch_idx' not described in 'poison_channel'
 drivers/staging/most/i2c/i2c.c:166: warning: Excess function parameter 'iface' description in 'poison_channel'
 drivers/staging/most/i2c/i2c.c:166: warning: Excess function parameter 'channel_id' description in 'poison_channel'

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Cc: linux-staging@lists.linux.dev
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Link: https://lore.kernel.org/r/20210414181129.1628598-34-lee.jones@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-05-10 11:19:25 +02:00
Colin Ian King 7fe5bbdd1f staging: most: Fix spelling mistake "tranceiver" -> "transceiver"
There is a spelling mistake in the Kconfig help text. Fix it.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Link: https://lore.kernel.org/r/20201126224602.13878-1-colin.king@canonical.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-12-09 19:45:13 +01:00
Christian Gromm b276527539 staging: most: move core files out of the staging area
This patch moves the core module to the /drivers/most directory
and makes all necessary changes in order to not break the build.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1583845362-26707-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-24 13:42:44 +01:00
Masahiro Yamada 532c291907 staging: most: remove header include path to drivers/staging
There is no need to add "ccflags-y += -I $(srctree)/drivers/staging"
just for including <most/most.h>.

Use the #include "..." directive with the correct relative path.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Link: https://lore.kernel.org/r/20200115164451.13203-1-masahiroy@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-16 20:56:31 +01:00
Christian Gromm 6f4d22d76b staging: most: use angle brackets in include path
This patch replaces the double quotes in all include paths
with angle brackets.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1576238662-16512-7-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 13:58:31 +01:00
Christian Gromm c1d3fb8abe staging: most: rename core.h to most.h
This patch renames the core header file core.h to most.h. The intention
behind this is to have a meaningful name once this file is moved to the
/include/linux directory.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Link: https://lore.kernel.org/r/1576238662-16512-2-git-send-email-christian.gromm@microchip.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-17 13:50:03 +01:00
Greg Kroah-Hartman 97ed8eab2a staging: add missing SPDX lines to Makefile files
There are a few remaining drivers/staging/*/Makefile files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Greg Kroah-Hartman 99b75a4e32 staging: add missing SPDX lines to Kconfig files
There are a few remaining drivers/staging/*/Kconfig files that do not
have SPDX identifiers in them.  Add the correct GPL-2.0 identifier to
them to make scanning tools happy.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03 11:10:15 +02:00
Wentao Cai 5b628549e9 staging: most: Replace '--help--' in Kconfig file
Replace '--help--' with 'help' to silence checkpatch.pl warning:
WARNING: prefer 'help' over '---help---' for new help texts

Signed-off-by: Wentao Cai <etsai042@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18 07:05:24 +01:00
Masahiro Yamada 2fa495892b staging: prefix header search paths with $(srctree)/
Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5b
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-02-04 12:30:27 +01:00
Christian Gromm 7e6e228873 staging: most: i2c: reduce parameters inconsistency
Currently, there are two module parameters for the i2c driver:
  - polling_req: boolean irq/polling mode;
  - scan_rate: polling rate, that is used in the case where the polling
    mode is active

This model is misconfiguration-prone.  For example, it is possible to
select polling mode with the zero polling rate or configure non-zero
polling rate in a combination with the IRQ mode.

This patch replaces the 'polling_req' and 'scan_rate' by the
'polling_rate', where the value zero means the interrupt driven mode and
other values are used as the polling rate in the polling mode.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm eb50842c5f staging: most: i2c: remove redundant list_mutex
The elements of the dev->rx.list are consumed in the pending_rx_work and
populated in the function enqueue() that cancels the pending_rx_work.

The function enqueue() and poison_channel() do not race anyway.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm 6471c2693f staging: most: i2c: remove redundant is_open
The variable is_open is checked only in the work function
pending_rx_work() that is only active between the calls
configure_channel() and poison_channel().

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm 0003718c92 staging: most: i2c: trace real polling rate
The real polling rate depends on the CONFIG_HZ and may differ from the
required polling rate.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm ea8bcd5282 staging: most: i2c: prevent zero delay polling
This patch avoids that a configured scan_rate of more than MSEC_PER_SEC
might result in a polling delay of zero.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm cd2e7148e7 staging: most: i2c: avoid polling in case of misconfig
This patch prevents the driver from falling back to polling mode
in case of IRQ misconfiguration.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm 795ce21892 staging: most: i2c: do not wait in work function
This patch removes the function wait_event_interruptible from the
work function to avoid waiting.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:49 +02:00
Christian Gromm 0ecbf7fc36 staging: most: i2c: shorten lifetime of IRQ handler
Currently the IRQ handler used for the rx channel lives between the
functions i2c_probe and i2c_remove. This patch shortens the lifetime
and keeps the handler alive only between the functions configure_channel
and poison_channel.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:48 +02:00
Christian Gromm 95b2f82d63 staging: most: i2c: remove unnecessary poison_channel call
This removes call of the poison_channel that is:
  - not allowed after most_deregister_interface;
  - is made during the most_deregister_interface call.

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:48 +02:00
Christian Gromm ceb1edc2a0 staging: most: i2c: prevent division by zero
This prevents division by zero scan_rate.

The zero scan_rate does not need any special action as it actually means
"never poll again".

Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de>
Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-05-08 13:41:48 +02:00
Christian Gromm 4d5f022f3a staging: most: remove proprietary kobjects
This patch removes the proprietary kobjects used by the driver modules and
replaces them with device structs. The patch is needed to have the driver
being integrated into the kernel's device model.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:34 +01:00
Christian Gromm 77550c2012 staging: most: i2c: rename module
This patch renames the folder of the i2c module. It is needed
to clear the directory layout.

Signed-off-by: Christian Gromm <christian.gromm@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-27 09:20:33 +01:00