Fix to return a negative error code from the es2_arpc_in_enable() error
handling case instead of 0, as done elsewhere in this function.
Fixes: 9d9d3777a9 ("greybus: es2: Add a new bulk in endpoint for APBridgeA RPC")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This node pointer is returned by of_find_compatible_node() with
refcount incremented in this function. of_node_put() on it before
exitting this function.
This is detected by Coccinelle semantic patch.
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Some of the print messages are using the incorrect device pointer, fix
them.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Some of the print messages are using the incorrect device pointer, fix
them.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Acked-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When checking the value of delay_on to set the channel as active, it was
checked the pointer and not the value, as it should be.
Fixes: cc43368a3c ("greybus: lights: Control runtime pm suspend/resume on AP side")
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Even though we trust leds core that the pointers should be valid, we are
safer to check delay_{on|off} before use.
Also, this avoid a smatch warning:
drivers/staging/greybus/light.c:484 gb_blink_set()
warn: variable dereferenced before check 'delay_on' (see line 476)
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fix allocation of attributes with the correct size, this also fix smatch
warning:
drivers/staging/greybus/light.c:293 channel_attr_groups_set()
warn: double check that we're allocating correct size: 8 vs 16
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
When checking for command flags field if response is not available we
really need to compare it with the right define and not bitwise AND it.
smatch warn:
drivers/staging/greybus/sdio.c:481 gb_sdio_command()
warn: bitwise AND condition is false here
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Checkpatch printed a style ERROR concerning a missing space before '('.
This patch fixes this issue.
Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
A system configured without CONFIG_CPUFREQ will return 0 for cpufreq_get().
greybus-timesync can subsequently then do a divide-by-zero as result. This
patch fixes by checking for a zero return value from cpufreq_get() and
setting to a default value of 19.2MHz.
Reported-by: Rui Miguel Silva <rmfrfs@gmail.com>
Signed-off-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Removed braces for single line if statement.
Signed-off-by: Chase Metzger <chasemetzger15@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Currently, if info is null, the dev_err message is dereferencing an
uninitialized module pointer. Instead, it should use codec->dev pointer
in dev_err call and better align with other err msg in this function.
Also, ret variable might be used uninitialized in a specific case.
Avoid using it this way.
Found using static analysis with cppcheck:
Checking drivers/staging/greybus/audio_topology.c...
[drivers/staging/greybus/audio_topology.c:175]: (error) Uninitialized
variable: module
[drivers/staging/greybus/audio_topology.c:495]: (error) Uninitialized
variable: ret
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This patch uses setup_timer function instead of initializing timer with the
function and data fields.
Signed-off-by: sayli karnik <karniksayli1995@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Declare the 'arche_apb_ctrl_of_match' array as const. This array is only stored
in the .of_match_table field of a device_driver structure, which is declared as
const. This addresses the checkpatch warning:
WARNING: struct of_device_id should be normally const
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Declare the arrays 'arche_platform_of_match' and 'arche_combined_id' as const.
'arche_platform_of_match' is only stored in the .of_match_table field of a
device_driver structure, which is declared as const.
'arche_combined_id' is passed to MODULE_DEVICE_TABLE. This macro does not
modify the array and therefore the array can be declared as const. Checkpatch
pointed out both issues.
WARNING: struct of_device_id should be normally const
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Fixes checkpatch.pl warning:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Minor error spotted by checkpatch.pl in greybus
code indent should use tabs where possible
Signed-off-by: Richard Groux <rgroux@sauron-mordor.net>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Minor error spotted by checkpatch.pl in greybus
space required before the open brace '{'
Signed-off-by: Richard Groux <rgroux@sauron-mordor.net>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Modify return statement to use the value being returned directly instead of
assigning it first to 'ret' and returning this variable. Coccinelle semantic
patch used:
@@
expression e;
local idexpression ret;
@@
-ret =
+return
e;
-return ret;
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Eliminate unneeded parentheses around the right hand side of an assignment.
Coccinelle semantic patch used:
@@
expression e1, e2;
identifier v;
@@
(
v = (e1 == e2)
|
v = (e1 != e2)
|
v = (e1 <= e2)
|
v = (e1 >= e2)
|
v =
- (
e1
- )
)
Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
CONFIG_MEDIA is not a thing, but CONFIG_MEDIA_SUPPORT is, so use that.
Reported-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As suggested by checkpatch.pl:
CHECK: Prefer kernel type 'u16' over 'uint16_t'
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
As suggested by checkpatch.pl:
CHECK: Prefer kernel type 'u8' over 'uint8_t'
Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
The last thing remaining in kernel_ver.h was the setting of
CONFIG_PM_RUNTIME, which isn't needed in a in-tree implementation. So
remove the setting of this value, and the .h file entirely as that was
the last thing left in it.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Remove BROKEN keyword to allow the light driver to be select now that
we fixed the kernel version dependencies. Also fix the module name in
the help section.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Greybus SPI driver depends on gb-spilib and we need to state that at
makefile to make it link correctly.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Power Supply
driver, so remove the checks as needed, we can now rely on all of the
correct Power Supply core apis being present. Also move some properties
definitions to the power supply greybus code.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus SDIO driver, so
remove the checks as needed, we can now rely on all of the correct SDIO
core apis being present.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Light driver, so
remove the checks as needed, we can now rely on all of the correct LED
core apis being present. And compile only if flash and v4l2 flash is
reachable.
Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The 0-day bot pointed out a type difference in one min() call, so fix it
up by being explicit about the type being compared.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus SPI and spilib
driver, so remove the checks as needed, we can now rely on all of the
correct SPI core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus GPIO driver, so
remove the checks as needed, we can now rely on all of the correct
GPIO core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
No need to support older kernel versions in the Greybus Vibrator driver,
so remove the checks as needed, we can now rely on all of the correct
driver core apis being present.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
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>
Now that we do not care about the kernel version we are building
against, we can strip out lots of backward compatibilty that was added
to kernel_ver.h in order to write semi-portable driver code.
To start with, remove the functions and #defines that are now in the
kernel tree, no need to have duplicate copies of them all.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This adds a proper Kconfig file for drivers/staging/greybus and fixes up
the Makefile to work correctly within the kernel build system (modules
depend on the .config options, etc.)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
The Toshiba ES1 chip is no longer around, so remove the USB descriptor
documentation for it as no one cares anymore.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Only the tools subdirectory needs a .gitignore entry, so move it there
and fix it up to only list the needed file.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We don't need yet-another-copy of the GPLv2 in the tree, and the README
is now pointless, so remove both of these files.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We do not need an example of the sysfs tree in the kernel code itself,
so remove these files, as they are now pointless.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
When the greybus tree was external, it contained a copy of checkpatch.pl
to keep everyone "in line". This is no longer needed and can now be
removed.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
gb_phy runtime functions use struct gbphy_device *gbphy_dev,
and not struct device. When CONFIG_PM_RUNTIME is not enabled
a compile error will show.
Fix this by passing struct gbphy_device * as parameter
Testing Done: compile with CONFIG_PM_RUNTIME disabled
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
If a gpio line is getting used for an irq, gpio core will create
/proc/irq/X/gpiolib/ directory for it. This directory gets removed while
the gpio controller is unregistered.
In case of greybus, gb_gpio_irqchip_add() creates an irqdomain and
creates irq mappings for the gpio lines. Currently they are added after
registering the gpio controller and removed before the gpio controller
is removed. On the removal path, while the core tries to remove the irq
directory (/proc/irq/X), it finds that the irq is still getting used and
a "gpiolib" directory is present within it and so it gives this warning:
Steps to reproduce:
$ cd /sys/class/gpio
$ echo X > export
$ echo both > gpioX/edge
$ echo <interface-number> > /sys/bus/greybus/devices/1-svc/intf_eject
[ 139.171436] ------------[ cut here ]------------
[ 139.171468] WARNING: at /home/vireshk/all/work/repos/ara/arche/kernel/arche/fs/proc/generic.c:552 remove_proc_entry+0x154/0x188()
[ 139.171476] remove_proc_entry: removing non-empty directory 'irq/683', leaking at least 'gpiolib'
[ 139.171589] Modules linked in: gb_vibrator(O) gb_usb(O) gb_uart(O) gb_spi(O) gb_sdio(O) gb_raw(O) gb_pwm(O) gb_power_supply(O) gb_loopback(O) gb_log(O) gb_light(O) gb_i2c(O) gb_hid(O) gb_gpio(O) gb_gbphy(O) gb_firmware(O) gb_spilib(O) gb_es2(O) gb_camera(O) gb_bootrom(O) gb_audio_module(O) gb_audio_manager(O) gb_audio_codec(O) gb_audio_gb(O) gb_audio_apbridgea(O) gb_arche(O) greybus(O)
[ 139.171605] CPU: 1 PID: 280 Comm: kworker/u16:4 Tainted: G W O 3.10.83-g9771b10cbeed #107
[ 139.171652] Workqueue: greybus1:svc gb_svc_intf_set_power_mode [greybus]
[ 139.171657] Call trace:
[ 139.171677] [<ffffffc000207b40>] dump_backtrace+0x0/0x268
[ 139.171689] [<ffffffc000207db8>] show_stack+0x10/0x1c
[ 139.171707] [<ffffffc000ccad78>] dump_stack+0x1c/0x28
[ 139.171723] [<ffffffc00021f9dc>] warn_slowpath_common+0x74/0x9c
[ 139.171735] [<ffffffc00021fa60>] warn_slowpath_fmt+0x5c/0x80
[ 139.171747] [<ffffffc00035fa38>] remove_proc_entry+0x150/0x188
[ 139.171763] [<ffffffc00027464c>] unregister_irq_proc+0xb4/0xdc
[ 139.171779] [<ffffffc00026e3f4>] free_desc+0x2c/0x70
[ 139.171791] [<ffffffc00026e48c>] irq_free_descs+0x54/0x9c
[ 139.171802] [<ffffffc000273448>] irq_dispose_mapping+0x54/0x64
[ 139.171814] [<ffffffbffc0621e8>] 0xffffffbffc0621e8
[ 139.171825] [<ffffffbffc05e01c>] 0xffffffbffc05e01c
[ 139.171843] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4
[ 139.171854] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38
[ 139.171867] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148
[ 139.171878] [<ffffffc0005d1cb0>] device_del+0x108/0x16c
[ 139.171888] [<ffffffc0005d1d64>] device_unregister+0x50/0x68
[ 139.171901] [<ffffffbffc05e2bc>] gb_gbphy_deregister_driver+0xf0/0x4ec [gb_gbphy]
[ 139.171924] [<ffffffbffc0014c4>] greybus_disabled+0x14c4/0x1760 [greybus]
[ 139.171936] [<ffffffc0005d4e30>] __device_release_driver+0x90/0xe4
[ 139.171948] [<ffffffc0005d4ea4>] device_release_driver+0x20/0x38
[ 139.171959] [<ffffffc0005d4634>] bus_remove_device+0x12c/0x148
[ 139.171969] [<ffffffc0005d1cb0>] device_del+0x108/0x16c
[ 139.171992] [<ffffffbffc004cec>] gb_bundle_destroy+0x7c/0x1b0 [greybus]
[ 139.172017] [<ffffffbffc004074>] gb_interface_disable+0xb4/0x178 [greybus]
[ 139.172040] [<ffffffbffc002ae4>] gb_module_del+0x5c/0xf8 [greybus]
[ 139.172063] [<ffffffbffc008418>] gb_svc_intf_set_power_mode+0xea0/0xfe8 [greybus]
[ 139.172078] [<ffffffc00023888c>] process_one_work+0x268/0x3c8
[ 139.172089] [<ffffffc000239a64>] worker_thread+0x204/0x358
[ 139.172108] [<ffffffc00023f43c>] kthread+0xb8/0xc4
[ 139.172114] ---[ end trace 6fa3314e8c6157ca ]---
Also note that registering the gpio controller before creating irqdomain
is incorrect as well and may lead to kernel panic, as a gpio may get
requested as an interrupt source right after the controller is
registered, and the greybus gpio driver wouldn't be fully ready by then.
This patch changes the sequence in both probe() and remove() to fix it.
Fixes: 426e88a47d39 ("greybus: gpio: add interrupt handling support")
Reported-by: David Hsu <davidhsu@google.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Properly report which endpoints are being ignored and which ones are
"unknown" to the driver.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
usb_kill_urb() and usb_free_urb() can be called with NULL pointers, so
no need to check before calling them.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We don't need the defines for the number of bulk in or out endpoints
anymore, as the driver just grabs the first ones it finds and runs with
it.
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>