Linus Torvalds
02e2af20f4
Merge tag 'char-misc-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
...
Pull char/misc and other driver updates from Greg KH:
"Here is the big set of char/misc and other small driver subsystem
updates for 5.18-rc1.
Included in here are merges from driver subsystems which contain:
- iio driver updates and new drivers
- fsi driver updates
- fpga driver updates
- habanalabs driver updates and support for new hardware
- soundwire driver updates and new drivers
- phy driver updates and new drivers
- coresight driver updates
- icc driver updates
Individual changes include:
- mei driver updates
- interconnect driver updates
- new PECI driver subsystem added
- vmci driver updates
- lots of tiny misc/char driver updates
All of these have been in linux-next for a while with no reported
problems"
* tag 'char-misc-5.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (556 commits)
firmware: google: Properly state IOMEM dependency
kgdbts: fix return value of __setup handler
firmware: sysfb: fix platform-device leak in error path
firmware: stratix10-svc: add missing callback parameter on RSU
arm64: dts: qcom: add non-secure domain property to fastrpc nodes
misc: fastrpc: Add dma handle implementation
misc: fastrpc: Add fdlist implementation
misc: fastrpc: Add helper function to get list and page
misc: fastrpc: Add support to secure memory map
dt-bindings: misc: add fastrpc domain vmid property
misc: fastrpc: check before loading process to the DSP
misc: fastrpc: add secure domain support
dt-bindings: misc: add property to support non-secure DSP
misc: fastrpc: Add support to get DSP capabilities
misc: fastrpc: add support for FASTRPC_IOCTL_MEM_MAP/UNMAP
misc: fastrpc: separate fastrpc device from channel context
dt-bindings: nvmem: brcm,nvram: add basic NVMEM cells
dt-bindings: nvmem: make "reg" property optional
nvmem: brcm_nvram: parse NVRAM content into NVMEM cells
nvmem: dt-bindings: Fix the error of dt-bindings check
...
2022-03-28 12:27:35 -07:00
Tom Rix
04c633873c
counter: add defaults to switch-statements
...
Clang static analysis reports this representative problem
counter-chrdev.c:482:3: warning: Undefined or garbage value
returned to caller
return ret;
^~~~~~~~~~
counter_get_data() has a multilevel switches, some without
defaults, so ret is sometimes not set.
Add returning -EINVAL similar to other defaults.
Link: https://lore.kernel.org/r/20220227161746.82776-1-trix@redhat.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com >
Signed-off-by: Tom Rix <trix@redhat.com >
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/b98d1a3ed4b0b324b261b23defd1bdddddba4d44.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-18 14:04:30 +01:00
Oleksij Rempel
257e3df40c
counter: interrupt-cnt: add counter_push_event()
...
Add counter_push_event() to notify user space about new pulses
Link: https://lore.kernel.org/r/20220203135727.2374052-3-o.rempel@pengutronix.de
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de >
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/9da3460113b5092e8658e12f23578567aab7cc5f.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-18 14:04:30 +01:00
William Breathitt Gray
4da08477ea
counter: Set counter device name
...
Naming the counter device provides a convenient way to identify it in
devres_log events and similar situations. This patch names the counter
device by combining the prefix "counter" with the counter device's
unique ID.
Link: https://lore.kernel.org/r/20220204084551.16397-1-vilhelm.gray@gmail.com
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/87cc8eb4c84f49f89290577dc9231b2e4d7d3e8c.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-18 14:04:30 +01:00
William Breathitt Gray
95c211f03f
counter: 104-quad-8: Add COMPILE_TEST depends
...
104_QUAD_8 depends on X86, but compiles fine on ARCH=arm. This patch
adds support for COMPILE_TEST which is useful for compile testing code
changes to the driver and Counter subsystem.
Link: https://lore.kernel.org/r/20220105094137.259111-1-vilhelm.gray@gmail.com
Cc: Syed Nayyar Waris <syednwaris@gmail.com >
Suggested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Acked-by: Syed Nayyar Waris <syednwaris@gmail.com >
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/3917721e792d362ee108b2f12cd2223675449d05.1647373009.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-18 14:04:30 +01:00
Uwe Kleine-König
01b44ef2bf
counter: Stop using dev_get_drvdata() to get the counter device
...
dev_get_drvdata() returns NULL since commit b56346ddbd ("counter: Use
container_of instead of drvdata to track counter_device") which wrongly
claimed there were no users of drvdata. Convert to container_of() to
fix a null pointer dereference.
Reported-by: Oleksij Rempel <o.rempel@pengutronix.de >
Fixes: b56346ddbd ("counter: Use container_of instead of drvdata to track counter_device")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com >
Link: https://lore.kernel.org/all/20220204082556.370348-1-u.kleine-koenig@pengutronix.de/
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/4a14311a3b935b62b33e665a97ecaaf2f078228a.1646957732.git.vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-03-15 19:24:13 +01:00
Dan Carpenter
fc55e63e14
counter: fix an IS_ERR() vs NULL bug
...
There are 8 callers for devm_counter_alloc() and they all check for NULL
instead of error pointers. I think NULL is the better thing to return
for allocation functions so update counter_alloc() and devm_counter_alloc()
to return NULL instead of error pointers.
Fixes: c18e276030 ("counter: Provide alternative counter registration functions")
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com >
Link: https://lore.kernel.org/r/20220111173243.GA2192@kili
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-01-26 19:40:33 +01:00
William Breathitt Gray
663d8fb0f8
counter: 104-quad-8: Fix use-after-free by quad8_irq_handler
...
On unbind an irq might be pending which results in quad8_irq_handler()
calling counter_push_event() for a counter that is already unregistered.
This patch fixes that situation by passing the struct counter_device dev
to devm_request_irq() rather than the parent's so that the irq handler
is cleaned before the counter is unregistered.
Fixes: 7aa2ba0df6 ("counter: 104-quad-8: Add IRQ support for the ACCES 104-QUAD-8")
Cc: Syed Nayyar Waris <syednwaris@gmail.com >
Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Signed-off-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Link: https://lore.kernel.org/r/20220105093052.258791-1-vilhelm.gray@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2022-01-06 15:51:13 +01:00
Uwe Kleine-König
f2ee4759fb
counter: remove old and now unused registration API
...
Usage of counter_register() yields issues in device lifetime tracking. All
drivers were converted to the new API, so the old one can go away.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-24-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
02758cb20d
counter: ti-eqep: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: f213729f67 ("counter: new TI eQEP driver")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Acked-by: David Lechner <david@lechnology.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-23-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
e75d678d04
counter: stm32-lptimer-cnt: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: 597f55e3f3 ("counter: stm32-lptimer: add counter device")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-22-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
e1717d2ea0
counter: stm32-timer-cnt: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: ad29937e20 ("counter: Add STM32 Timer quadrature encoder")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-21-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
5998ea6214
counter: microchip-tcb-capture: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: 106b104137 ("counter: Add microchip TCB capture counter")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-20-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
b5d6547c8e
counter: ftm-quaddec: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: a3b9a99980 ("counter: add FlexTimer Module Quadrature decoder counter driver")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-19-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
e99dec87a9
counter: intel-qep: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: b711f687a1 ("counter: Add support for Intel Quadrature Encoder Peripheral")
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com >
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-18-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
aefc7e1797
counter: interrupt-cnt: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: a55ebd47f2 ("counter: add IRQ or GPIO based counter")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-17-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
9e884bb19c
counter: 104-quad-8: Convert to new counter registration
...
This fixes device lifetime issues where it was possible to free a live
struct device.
Fixes: f1d8a071d4 ("counter: 104-quad-8: Add Generic Counter interface support")
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-16-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:07 +01:00
Uwe Kleine-König
c18e276030
counter: Provide alternative counter registration functions
...
The current implementation gets device lifetime tracking wrong. The
problem is that allocation of struct counter_device is controlled by the
individual drivers but this structure contains a struct device that
might have to live longer than a driver is bound. As a result a command
sequence like:
{ sleep 5; echo bang; } > /dev/counter0 &
sleep 1;
echo 40000000.timer:counter > /sys/bus/platform/drivers/stm32-timer-counter/unbind
can keep a reference to the struct device and unbinding results in
freeing the memory occupied by this device resulting in an oops.
This commit provides two new functions (plus some helpers):
- counter_alloc() to allocate a struct counter_device that is
automatically freed once the embedded struct device is released
- counter_add() to register such a device.
Note that this commit doesn't fix any issues, all drivers have to be
converted to these new functions to correct the lifetime problems.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-14-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
e152833b2c
counter: stm32-timer-cnt: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-13-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
e98ea385f8
counter: stm32-lptimer-cnt: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-12-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
8817c2d03a
counter: ti-eqep: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Acked-by: David Lechner <david@lechnology.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-11-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
1f1b40c057
counter: ftm-quaddec: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-10-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
53ada09552
counter: intel-qep: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-9-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
a49ede8208
counter: microchip-tcb-capture: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-8-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00
Uwe Kleine-König
63f0e2b6c0
counter: interrupt-cnt: Convert to counter_priv() wrapper
...
This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com >
Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com >
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de >
Link: https://lore.kernel.org/r/20211230150300.72196-7-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-12-30 17:44:06 +01:00