Use devm_input_allocate_device to simplify the error handling code.
This conversion also makes input_register_device() to be called after
acpi_remove_notify_handler. This avoid a small window that it's possible
to call notify_handler after unregister input device.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
Use ACPI_FAILURE() to replace !ACPI_SUCCESS(), this avoid !! operations.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Henrique de Moraes Holschuh <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: Andy Shevchenko <[email protected]>
The logic of "value = ~CS35L34_MCLK_DIV & CS35L34_MCLK_RATE_XXXXXX;" is
unnecessary complex. By setting CS35L34_MCLK_DIV | CS35L34_MCLK_RATE_MASK
as the mask for regmap_update_bits() call, what the code does is exactly
the same as setting value = CS35L34_MCLK_RATE_XXXXXX.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Paul Handrigan <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The table_len, *table, remap and max_mV fields are not used, so remove
them.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The min_mV, max_mV and flags fields are not used, so remove them.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The rest of the code uses ARRAY_SIZE to count the number of entries in
ppmu_events array. The NULL terminated entry makes ARRAY_SIZE return
off-by-one value.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Chanwoo Choi <[email protected]>
Signed-off-by: MyungJoo Ham <[email protected]>
pm8916_wcd_analog_enable_micbias_int1() should set micbias1_cap_mode
rather than micbias2_cap_mode.
Also change the order of pm8916_wcd_analog_enable_micbias_int1/init2
functions for better readability.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Drop the assignment of regmap_read return code to val, so the code checks
the value read.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Stephen Boyd <[email protected]>
CS35L34_CHIP_ID is not a register address, it's the value read from
CS35L34_DEVID_AB/CD/E registers.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Current code does not use gpio_irq/irq_base/gpio_base fields from
struct max77620_gpio, so remove them.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
The driver uses the spin_lock but does not initialize it. Fix it.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Neil Armstrong <[email protected]>
Signed-off-by: Thierry Reding <[email protected]>
Use devfreq_list_lock around list_del() to prevent list corruption.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: MyungJoo Ham <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
load_count/total_count are reset by devfreq_event_get_event(), so
remove the redundant code in exynos_nocp_get_event().
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Chanwoo Choi <[email protected]>
[ rjw: Subject/changelog ]
Signed-off-by: Rafael J. Wysocki <[email protected]>
This driver uses devm_regmap_init_mmio(), so select REGMAP_MMIO to avoid
build failure.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Chanwoo Choi <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
It's only used in this driver and never get modified, make it static const.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Thor Thayer <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Current code uses devm_input_allocate_device() so don't explicitly call
input_free_device if input_register_device fails.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Dmitry Torokhov <[email protected]>
A kfree(readbuf) call was missed if hid_hw_raw_request() fails, fix it.
Also avoid mixing direct return with goto in the error paths.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Benjamin Tissoires <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
Current code uses devm_regulator_get() in .probe so a regulator_put() will
be automatically called when unload the module. Remove the explictly
regulator_put() call and then we can also remove rk3399_dmcfreq_remove().
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Chanwoo Choi <[email protected]>
Acked-by: MyungJoo Ham <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
devm_* API is supposed to be used only in probe function call.
The resource is allocated at 'probe' and free automatically at 'remove'.
Usage of devm_* functions outside probe sometimes leads to resource leak.
Thus avoid using devm_* APIs in .setup/.cleanup callbacks.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
This driver now uses regmap APIs, so it needs to select REGMAP_I2C.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Add missing .owner field in ns2_pci_phy_ops, which is used for refcounting.
While at it, also makes ns2_pci_phy_ops const as it's never get modified.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-and-tested-by: Jon Mason <[email protected]>
Reviewed-by: Pramod Kumar <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
By setting phy_set_drvdata(phy, mdiodev), struct ns2_pci_phy can be
removed.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-and-tested-by: Jon Mason <[email protected]>
Reviewed-by: Pramod Kumar <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
The 'reg' local variable does not need to be static.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
Return proper error instead of 0 if brcm_sata_phy_init fails.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Kishon Vijay Abraham I <[email protected]>
Use devm_* APIs to simplify the code a bit.
This patch also fixes the memory leak when unload the module.
Signed-off-by: Axel Lin <[email protected]>
Tested-by: Liviu Dudau <[email protected]>
Acked-by: Liviu Dudau <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.
Signed-off-by: Axel Lin <[email protected]>
Tested-by: Liviu Dudau <[email protected]>
Acked-by: Liviu Dudau <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
Use devm_* API to simplify the code.
This patch also fixes the return value in probe error paths.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
devm_gpiod_get_optional() returns NULL when the gpio is not assigned.
So the if (PTR_ERR(cs35l33->reset_gpio) == -ENOENT) test is always false.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Paul Handrigan <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Current code uses devm_request_threaded_irq() so it does not need to
explicitly call free_irq() in .probe error path and .remove.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Paul Handrigan <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Since commit b42261078a ("regmap: i2c: fallback to SMBus if the adapter
does not support standard I2C"), regmap-i2c will check the
I2C_FUNC_SMBUS_[BYTE|WORD]_DATA functionality based on the regmap_config
setting if the adapter does not support standard I2C.
So remove the I2C_FUNC_SMBUS_WORD_DATA functionality check in the driver code.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Laurent Pinchart <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
The update_lock mutex is not used, so remove it.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
Use ATTRIBUTE_GROUPS macro and devm_hwmon_device_register_with_groups() to
simplify the code a bit.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Guenter Roeck <[email protected]>
I got below build error:
ERROR: "tegra_xusb_padctl_legacy_probe"
[drivers/phy/tegra/phy-tegra-xusb.ko] undefined!
with below build configuration:
CONFIG_ARCH_TEGRA=y
CONFIG_PINCTRL_TEGRA_XUSB=y
CONFIG_PHY_TEGRA_XUSB=y
The problem is below line in drivers/pinctrl/Makefile
obj-$(CONFIG_PINCTRL_TEGRA) += tegra/
So even CONFIG_PINCTRL_TEGRA_XUSB=y is set, kbuild still does not compile
the code in drivers/pinctrl/tegra folder if !CONFIG_PINCTRL_TEGRA.
phy-tegra-xusb.c does not use any symbol from pinctrl-tegra.c,
so build pinctrl-tegra.c only when CONFIG_PINCTRL_TEGRA is set.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Jon Hunter <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Use regulator_list_voltage_linear_range in rpm_smps_ldo_ops_fixed is
wrong because it is used for fixed regulator without any linear range.
The rpm_smps_ldo_ops_fixed is used for pm8941_lnldo which has fixed_uV
set and n_voltages = 1. In this case, regulator_list_voltage() can return
rdev->desc->fixed_uV without .list_voltage implementation.
Fixes: 3bfbb4d1a4 ("regulator: qcom_smd: add list_voltage callback")
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
According to the datasheet:
SLEW Register(Address = 07h)
b7 b6 b5 b4 b3 b2 b1 b0
48mV/us 42mV/us 36mV/us 30mV/us 24mV/us 18mV/us 12mV/us 6mV/us
Current code does not set correct slew rate in some cases:
e.g. Assume ramp_delay is 10000, current code sets slew register to 6mV/us.
Fix the logic to set slew register.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Laxman Dewangan <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Current code can set ramp delay to a wrong setting that the return value
from .set_voltage_time_sel is not enough for proper delay.
Fix the logic in .set_ramp_delay and also remove unused ret_val variable.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
Current code does not use ctldata at all, so remove spi_set_ctldata call.
spi_setup() will set spi->bits_per_word = 8 if it was not set, so remove
!spi->max_speed_hz checking.
The spi core allows absent of spi->max_speed_hz setting, if it was not set
spi_setup() assigns spi->master->max_speed_hz to it.
spi core allows spi->max_speed_hz > spi->master->max_speed_hz, in this case
spi core will limit the transfer speed to ensure xfer->speed_hz won't
greater than spi->master->max_speed_hz so remove checking if
spi->max_speed_hz is higher than spi->master->max_speed_hz.
As a result, both pic32_sqi_setup() and pic32_sqi_cleanup() can be removed.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
The relaxed I/O accessors are available on all architectures now.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
devm_ioremap_resource() returns ERR_PTR on error.
Also remove the redundant dev_err message, the implementation of
devm_ioremap_resource() already print error messages on error paths.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
This driver only supports 8/16/32 bits_per_word, so set
master->bits_per_word_mask accordingly. With this change, we can remove
the spi->bits_per_word checking in pic32_spi_setup as it's done by spi
core.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
i2c_smbus_write_byte_data() can fail. To ensure the
cached buffer has consistent status with h/w status, don't
update the cached gpio->buffer if write fails.
Also refactor the code a bit by adding a tpic2810_set_mask_bits()
helper and use it to simplify the code.
Signed-off-by: Axel Lin <[email protected]>
Reviewed-by: Alexandre Courbot <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Current code calls irq_domain_alloc_irqs_parent() in .alloc,
so it should call irq_domain_free_irqs_parent() accordingly in .free.
Fix it by switching to use irq_domain_free_irqs_common() instead.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Marc Zyngier <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
platform_get_resource() can return NULL, thus add NULL test to prevent NULL
pointer dereference.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Current code uses a uninitialized spin lock.
bgpio_init() already initialized a spin lock, so let's switch to use
&gc->bgpio_lock instead and remove the lock from struct men_z127_gpio.
Fixes: f436bc2726 "gpio: add driver for MEN 16Z127 GPIO controller"
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
Set it once is enough, so remove the second platform_set_drvdata() call.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
These drivers can be built as module, so make them depend on I2C rather
than I2C=y.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Adam Thomson <[email protected]>
Signed-off-by: Lee Jones <[email protected]>
Setting gc->direction_output to gc->direction_output looks strange.
I think this change makes the intention more clear.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
*read_reg and *write_reg can be removed because at all the places to call
them, we can just use gc->read_reg/gc->write_reg instead.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
For devtype with specific gpio_dir_out implementation, current code is
wrong because below code sets both gc->direction_output and
mpc8xxx_gc->direction_output to the same function.
gc->direction_output = devtype->gpio_dir_out ?: gc->direction_output;
mpc8xxx_gc->direction_output = gc->direction_output;
Set mpc8xxx_gc->direction_output = gc->direction_output first to fix it.
This way mpc8xxx_gc->direction_output actually calls the standard
bgpio_dir_out() to update register.
Fixes: commit 42178e2a1e ("drivers/gpio: Switch gpio-mpc8xxx to use gpio-generic")
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
The implementation of lp3943_gpio_request/lp3943_gpio_free test pin_used
for tracing the pin usage. However, gpiolib already checks FLAG_REQUESTED
flag for the same purpose. So remove the redundant implementation.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
These fields are initialized by bgpio_init() with exactly the same settings
so remove the redundant code.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
These fields are never used and not required at all, remove them.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
This driver has .can_sleep flag set.
So the pisosr_gpio_get() can be called from contexts that can sleep.
Thus use the cansleep() variant in pisosr_gpio_refresh().
Signed-off-by: Axel Lin <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>
gpio->load_gpio is optional, so use devm_gpiod_get_optional instead.
Signed-off-by: Axel Lin <[email protected]>
Acked-by: Andrew F. Davis <[email protected]>
Signed-off-by: Linus Walleij <[email protected]>