aboutsummaryrefslogtreecommitdiff
path: root/drivers/siox
AgeCommit message (Collapse)AuthorFilesLines
2022-11-09siox: fix possible memory leak in siox_device_add()Yang Yingliang1-0/+2
If device_register() returns error in siox_device_add(), the name allocated by dev_set_name() need be freed. As comment of device_register() says, it should use put_device() to give up the reference in the error path. So fix this by calling put_device(), then the name can be freed in kobject_cleanup(), and sdevice is freed in siox_device_release(), set it to null in error path. Fixes: bbecb07fa0af ("siox: new driver framework for eckelmann SIOX") Signed-off-by: Yang Yingliang <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-21bus: Make remove callback return voidUwe Kleine-König1-3/+1
The driver core ignores the return value of this callback because there is only little it can do when a device disappears. This is the final bit of a long lasting cleanup quest where several buses were converted to also return void from their remove callback. Additionally some resource leaks were fixed that were caused by drivers returning an error code in the expectation that the driver won't go away. With struct bus_type::remove returning void it's prevented that newly implemented buses return an ignored error code and so don't anticipate wrong expectations for driver authors. Reviewed-by: Tom Rix <[email protected]> (For fpga) Reviewed-by: Mathieu Poirier <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> (For drivers/s390 and drivers/vfio) Acked-by: Russell King (Oracle) <[email protected]> (For ARM, Amba and related parts) Acked-by: Mark Brown <[email protected]> Acked-by: Chen-Yu Tsai <[email protected]> (for sunxi-rsb) Acked-by: Pali Rohár <[email protected]> Acked-by: Mauro Carvalho Chehab <[email protected]> (for media) Acked-by: Hans de Goede <[email protected]> (For drivers/platform) Acked-by: Alexandre Belloni <[email protected]> Acked-By: Vinod Koul <[email protected]> Acked-by: Juergen Gross <[email protected]> (For xen) Acked-by: Lee Jones <[email protected]> (For mfd) Acked-by: Johannes Thumshirn <[email protected]> (For mcb) Acked-by: Johan Hovold <[email protected]> Acked-by: Srinivas Kandagatla <[email protected]> (For slimbus) Acked-by: Kirti Wankhede <[email protected]> (For vfio) Acked-by: Maximilian Luz <[email protected]> Acked-by: Heikki Krogerus <[email protected]> (For ulpi and typec) Acked-by: Samuel Iglesias Gonsálvez <[email protected]> (For ipack) Acked-by: Geoff Levand <[email protected]> (For ps3) Acked-by: Yehezkel Bernat <[email protected]> (For thunderbolt) Acked-by: Alexander Shishkin <[email protected]> (For intel_th) Acked-by: Dominik Brodowski <[email protected]> (For pcmcia) Acked-by: Rafael J. Wysocki <[email protected]> (For ACPI) Acked-by: Bjorn Andersson <[email protected]> (rpmsg and apr) Acked-by: Srinivas Pandruvada <[email protected]> (For intel-ish-hid) Acked-by: Dan Williams <[email protected]> (For CXL, DAX, and NVDIMM) Acked-by: William Breathitt Gray <[email protected]> (For isa) Acked-by: Stefan Richter <[email protected]> (For firewire) Acked-by: Benjamin Tissoires <[email protected]> (For hid) Acked-by: Thorsten Scherer <[email protected]> (For siox) Acked-by: Sven Van Asbroeck <[email protected]> (For anybuss) Acked-by: Ulf Hansson <[email protected]> (For MMC) Acked-by: Wolfram Sang <[email protected]> # for I2C Acked-by: Sudeep Holla <[email protected]> Acked-by: Geert Uytterhoeven <[email protected]> Acked-by: Dmitry Torokhov <[email protected]> Acked-by: Finn Thain <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-06-24siox: Simplify error handling via dev_err_probe()Thorsten Scherer1-9/+10
commit a787e5400a1c ("driver core: add device probe log helper") introduced a helper for a common error checking pattern. Use it. Acked-by: Uwe Kleine-König <[email protected]> Signed-off-by: Thorsten Scherer <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-12-10siox: Make remove callback return voidUwe Kleine-König1-3/+2
The driver core ignores the return value of the remove callback, so don't give siox drivers the chance to provide a value. All siox drivers only allocate devm-managed resources in .probe, so there is no .remove callback to fix. Tested-by: Thorsten Scherer <[email protected]> Acked-by: Thorsten Scherer <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-12-10siox: Use bus_type functions for probe, remove and shutdownUwe Kleine-König1-24/+25
The eventual goal is to get rid of the callbacks in struct device_driver. Tested-by: Thorsten Scherer <[email protected]> Acked-by: Thorsten Scherer <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2020-01-14siox: Use the correct style for SPDX License IdentifierNishad Kamdar1-1/+1
This patch corrects the SPDX License Identifier style in header file related to Eckelmann SIOX driver. For C header files Documentation/process/license-rules.rst mandates C-like comments (opposed to C source files where C++ style should be used). Changes made by using a script provided by Joe Perches here: https://lkml.org/lkml/2019/2/7/46. Suggested-by: Joe Perches <[email protected]> Signed-off-by: Nishad Kamdar <[email protected]> Acked-by: Uwe Kleine-König <[email protected]> Acked-by: Thorsten Scherer <[email protected]> Link: https://lore.kernel.org/r/20200101131418.GA3110@nishad Signed-off-by: Greg Kroah-Hartman <[email protected]>
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner2-0/+2
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-07-07headers: separate linux/mod_devicetable.h from linux/platform_device.hRandy Dunlap1-0/+1
At over 4000 #includes, <linux/platform_device.h> is the 9th most #included header file in the Linux kernel. It does not need <linux/mod_devicetable.h>, so drop that header and explicitly add <linux/mod_devicetable.h> to source files that need it. 4146 #include <linux/platform_device.h> After this patch, there are 225 files that use <linux/mod_devicetable.h>, for a reduction of around 3900 times that <linux/mod_devicetable.h> does not have to be read & parsed. 225 #include <linux/mod_devicetable.h> This patch was build-tested on 20 different arch-es. It also makes these drivers SubmitChecklist#1 compliant. Signed-off-by: Randy Dunlap <[email protected]> Reported-by: kbuild test robot <[email protected]> # drivers/media/platform/vimc/ Reported-by: kbuild test robot <[email protected]> # drivers/pinctrl/pinctrl-u300.c Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-07-07siox: don't create a thread without starting itUwe Kleine-König1-5/+5
When a siox master device is registered a kthread is created that is only started when triggered by userspace. So this thread might be in TASK_UNINTERRUPTIBLE state for long and trigger a warning [ 241.130465] INFO: task siox-0:626 blocked for more than 120 seconds. with the respective debug settings enabled. It might be right to put an unstarted thread to TASK_IDLE (in kernel/kthread.c:kthread()) instead, but independant of this discussion it is cleaner for siox_master_register() to start the thread immediately. The effect is that it enters its own waiting state and then stays in state TASK_IDLE which doesn't trigger the above warning. As siox_poll_thread() uses some variables of the device the initialisation of these is moved before thread creation. Acked-by: Peter Zijlstra (Intel) <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Gavin Schenk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-07-07siox: treat type errors as status errorsUwe Kleine-König1-10/+10
The type bits are part of the per-device status word. So it's natural to consider an error in the type bits as a status error instead of only resulting in an unsynced state. Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: Gavin Schenk <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2018-03-15siox: fix possible buffer overflow in device_add_storeGavin Schenk1-1/+1
Width 20 given in format string is larger than destination buffer 'type[20]', use %19s to prevent overflowing it. Fixes: bbecb07fa0af ("siox: new driver framework for eckelmann SIOX") Cc: stable <[email protected]> Reported-by: David Binderman <[email protected]> Signed-off-by: Gavin Schenk <[email protected]> Reviewed-by: Uwe Kleine-König <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-12-19siox: add gpio bus driverUwe Kleine-König3-0/+182
This bus driver uses GPIOs to control the four SIOX bus lines. Acked-by: Gavin Schenk <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-12-19siox: add support for tracingUwe Kleine-König1-0/+12
Implement tracing for SIOX. There are events for the data that is written to the bus and for data being read from it. Acked-by: Gavin Schenk <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2017-12-19siox: new driver framework for eckelmann SIOXUwe Kleine-König4-0/+981
SIOX is a bus system invented at Eckelmann AG to control their building management and refrigeration systems. Traditionally the bus was implemented on custom microcontrollers, today Linux based machines are in use, too. The topology on a SIOX bus looks as follows: ,------->--DCLK-->---------------+----------------------. ^ v v ,--------. ,----------------------. ,------ | | | ,--------------. | | | |--->--DOUT-->---|->-|shift register|->-|--->---| | | | `--------------' | | | master | | device | | device | | | ,--------------. | | | |---<--DIN---<---|-<-|shift register|-<-|---<---| | | | `--------------' | | `--------' `----------------------' `------ v ^ ^ `----------DLD-------------------+----------------------' There are two control lines (DCLK and DLD) driven from the bus master to all devices in parallel and two daisy chained data lines, one for input and one for output. DCLK is the clock to shift both chains by a single bit. On an edge of DLD the devices latch both their input and output shift registers. This patch adds a framework for this bus type. Acked-by: Gavin Schenk <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>