Skip to content

Commit

Permalink
Merge tag 'char-misc-5.18-rc5' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
 "Here are a small number of char/misc/other driver fixes for 5.18-rc5

  Nothing major in here, this is mostly IIO driver fixes along with some
  other small things:

   - at25 driver fix for systems without a dma-able stack

   - phy driver fixes for reported issues

   - binder driver fixes for reported issues

  All of these have been in linux-next without any reported problems"

* tag 'char-misc-5.18-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (31 commits)
  eeprom: at25: Use DMA safe buffers
  binder: Gracefully handle BINDER_TYPE_FDA objects with num_fds=0
  binder: Address corner cases in deferred copy and fixup
  phy: amlogic: fix error path in phy_g12a_usb3_pcie_probe()
  iio: imu: inv_icm42600: Fix I2C init possible nack
  iio: dac: ltc2688: fix voltage scale read
  interconnect: qcom: sdx55: Drop IP0 interconnects
  interconnect: qcom: sc7180: Drop IP0 interconnects
  phy: ti: Add missing pm_runtime_disable() in serdes_am654_probe
  phy: mapphone-mdm6600: Fix PM error handling in phy_mdm6600_probe
  phy: ti: omap-usb2: Fix error handling in omap_usb2_enable_clocks
  bus: mhi: host: pci_generic: Flush recovery worker during freeze
  bus: mhi: host: pci_generic: Add missing poweroff() PM callback
  phy: ti: tusb1210: Fix an error handling path in tusb1210_probe()
  phy: samsung: exynos5250-sata: fix missing device put in probe error paths
  phy: samsung: Fix missing of_node_put() in exynos_sata_phy_probe
  phy: ti: Fix missing of_node_put in ti_pipe3_get_sysctrl()
  phy: ti: tusb1210: Make tusb1210_chg_det_states static
  iio:dac:ad3552r: Fix an IS_ERR() vs NULL check
  iio: sx9324: Fix default precharge internal resistance register
  ...
  • Loading branch information
torvalds committed Apr 30, 2022
2 parents a6b5c5d + fda0573 commit e2e5ebe
Show file tree
Hide file tree
Showing 25 changed files with 148 additions and 113 deletions.
10 changes: 9 additions & 1 deletion drivers/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -2295,6 +2295,7 @@ static int binder_do_deferred_txn_copies(struct binder_alloc *alloc,
{
int ret = 0;
struct binder_sg_copy *sgc, *tmpsgc;
struct binder_ptr_fixup *tmppf;
struct binder_ptr_fixup *pf =
list_first_entry_or_null(pf_head, struct binder_ptr_fixup,
node);
Expand Down Expand Up @@ -2349,7 +2350,11 @@ static int binder_do_deferred_txn_copies(struct binder_alloc *alloc,
list_del(&sgc->node);
kfree(sgc);
}
BUG_ON(!list_empty(pf_head));
list_for_each_entry_safe(pf, tmppf, pf_head, node) {
BUG_ON(pf->skip_size == 0);
list_del(&pf->node);
kfree(pf);
}
BUG_ON(!list_empty(sgc_head));

return ret > 0 ? -EINVAL : ret;
Expand Down Expand Up @@ -2486,6 +2491,9 @@ static int binder_translate_fd_array(struct list_head *pf_head,
struct binder_proc *proc = thread->proc;
int ret;

if (fda->num_fds == 0)
return 0;

fd_buf_size = sizeof(u32) * fda->num_fds;
if (fda->num_fds >= SIZE_MAX / sizeof(u32)) {
binder_user_error("%d:%d got transaction with invalid number of fds (%lld)\n",
Expand Down
2 changes: 2 additions & 0 deletions drivers/bus/mhi/host/pci_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,7 @@ static int __maybe_unused mhi_pci_freeze(struct device *dev)
* the intermediate restore kernel reinitializes MHI device with new
* context.
*/
flush_work(&mhi_pdev->recovery_work);
if (test_and_clear_bit(MHI_PCI_DEV_STARTED, &mhi_pdev->status)) {
mhi_power_down(mhi_cntrl, true);
mhi_unprepare_after_power_down(mhi_cntrl);
Expand All @@ -1085,6 +1086,7 @@ static const struct dev_pm_ops mhi_pci_pm_ops = {
.resume = mhi_pci_resume,
.freeze = mhi_pci_freeze,
.thaw = mhi_pci_restore,
.poweroff = mhi_pci_freeze,
.restore = mhi_pci_restore,
#endif
};
Expand Down
12 changes: 6 additions & 6 deletions drivers/iio/adc/ad7280a.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,15 @@ static int ad7280a_write_thresh(struct iio_dev *indio_dev,
case IIO_EV_DIR_RISING:
addr = AD7280A_CELL_OVERVOLTAGE_REG;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
1, val);
1, value);
if (ret)
break;
st->cell_threshhigh = value;
break;
case IIO_EV_DIR_FALLING:
addr = AD7280A_CELL_UNDERVOLTAGE_REG;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
1, val);
1, value);
if (ret)
break;
st->cell_threshlow = value;
Expand All @@ -770,18 +770,18 @@ static int ad7280a_write_thresh(struct iio_dev *indio_dev,
case IIO_EV_DIR_RISING:
addr = AD7280A_AUX_ADC_OVERVOLTAGE_REG;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
1, val);
1, value);
if (ret)
break;
st->aux_threshhigh = val;
st->aux_threshhigh = value;
break;
case IIO_EV_DIR_FALLING:
addr = AD7280A_AUX_ADC_UNDERVOLTAGE_REG;
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER, addr,
1, val);
1, value);
if (ret)
break;
st->aux_threshlow = val;
st->aux_threshlow = value;
break;
default:
ret = -EINVAL;
Expand Down
5 changes: 4 additions & 1 deletion drivers/iio/chemical/scd4x.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,12 +471,15 @@ static ssize_t calibration_forced_value_store(struct device *dev,
ret = scd4x_write_and_fetch(state, CMD_FRC, arg, &val, sizeof(val));
mutex_unlock(&state->lock);

if (ret)
return ret;

if (val == 0xff) {
dev_err(dev, "forced calibration has failed");
return -EINVAL;
}

return ret ?: len;
return len;
}

static IIO_DEVICE_ATTR_RW(calibration_auto_enable, 0);
Expand Down
6 changes: 3 additions & 3 deletions drivers/iio/dac/ad3552r.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ static int ad3552r_reset(struct ad3552r_desc *dac)
{
struct reg_addr_pool addr;
int ret;
u16 val;
int val;

dac->gpio_reset = devm_gpiod_get_optional(&dac->spi->dev, "reset",
GPIOD_OUT_LOW);
Expand Down Expand Up @@ -809,10 +809,10 @@ static int ad3552r_configure_custom_gain(struct ad3552r_desc *dac,

gain_child = fwnode_get_named_child_node(child,
"custom-output-range-config");
if (IS_ERR(gain_child)) {
if (!gain_child) {
dev_err(dev,
"mandatory custom-output-range-config property missing\n");
return PTR_ERR(gain_child);
return -EINVAL;
}

dac->ch_data[ch].range_override = 1;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/dac/ad5446.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ static int ad5446_read_raw(struct iio_dev *indio_dev,

switch (m) {
case IIO_CHAN_INFO_RAW:
*val = st->cached_val;
*val = st->cached_val >> chan->scan_type.shift;
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
*val = st->vref_mv;
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/dac/ad5592r-base.c
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ static int ad5592r_alloc_channels(struct iio_dev *iio_dev)
if (!ret)
st->channel_modes[reg] = tmp;

fwnode_property_read_u32(child, "adi,off-state", &tmp);
ret = fwnode_property_read_u32(child, "adi,off-state", &tmp);
if (!ret)
st->channel_offstate[reg] = tmp;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/iio/dac/ltc2688.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ static int ltc2688_read_raw(struct iio_dev *indio_dev,
if (ret)
return ret;

*val = 16;
*val2 = 16;
return IIO_VAL_FRACTIONAL_LOG2;
case IIO_CHAN_INFO_CALIBBIAS:
ret = regmap_read(st->regmap,
Expand Down
28 changes: 18 additions & 10 deletions drivers/iio/dac/ti-dac5571.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/mod_devicetable.h>
#include <linux/property.h>
#include <linux/regulator/consumer.h>

enum chip_id {
Expand Down Expand Up @@ -311,6 +312,7 @@ static int dac5571_probe(struct i2c_client *client,
const struct dac5571_spec *spec;
struct dac5571_data *data;
struct iio_dev *indio_dev;
enum chip_id chip_id;
int ret, i;

indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
Expand All @@ -326,7 +328,13 @@ static int dac5571_probe(struct i2c_client *client,
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = dac5571_channels;

spec = &dac5571_spec[id->driver_data];
if (dev_fwnode(dev))
chip_id = (uintptr_t)device_get_match_data(dev);
else
chip_id = id->driver_data;

spec = &dac5571_spec[chip_id];

indio_dev->num_channels = spec->num_channels;
data->spec = spec;

Expand Down Expand Up @@ -385,15 +393,15 @@ static int dac5571_remove(struct i2c_client *i2c)
}

static const struct of_device_id dac5571_of_id[] = {
{.compatible = "ti,dac5571"},
{.compatible = "ti,dac6571"},
{.compatible = "ti,dac7571"},
{.compatible = "ti,dac5574"},
{.compatible = "ti,dac6574"},
{.compatible = "ti,dac7574"},
{.compatible = "ti,dac5573"},
{.compatible = "ti,dac6573"},
{.compatible = "ti,dac7573"},
{.compatible = "ti,dac5571", .data = (void *)single_8bit},
{.compatible = "ti,dac6571", .data = (void *)single_10bit},
{.compatible = "ti,dac7571", .data = (void *)single_12bit},
{.compatible = "ti,dac5574", .data = (void *)quad_8bit},
{.compatible = "ti,dac6574", .data = (void *)quad_10bit},
{.compatible = "ti,dac7574", .data = (void *)quad_12bit},
{.compatible = "ti,dac5573", .data = (void *)quad_8bit},
{.compatible = "ti,dac6573", .data = (void *)quad_10bit},
{.compatible = "ti,dac7573", .data = (void *)quad_12bit},
{}
};
MODULE_DEVICE_TABLE(of, dac5571_of_id);
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/filter/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ menu "Filters"
config ADMV8818
tristate "Analog Devices ADMV8818 High-Pass and Low-Pass Filter"
depends on SPI && COMMON_CLK && 64BIT
select REGMAP_SPI
help
Say yes here to build support for Analog Devices ADMV8818
2 GHz to 18 GHz, Digitally Tunable, High-Pass and Low-Pass Filter.
Expand Down
20 changes: 14 additions & 6 deletions drivers/iio/imu/bmi160/bmi160_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)

ret = regmap_write(data->regmap, BMI160_REG_CMD, BMI160_CMD_SOFTRESET);
if (ret)
return ret;
goto disable_regulator;

usleep_range(BMI160_SOFTRESET_USLEEP, BMI160_SOFTRESET_USLEEP + 1);

Expand All @@ -741,29 +741,37 @@ static int bmi160_chip_init(struct bmi160_data *data, bool use_spi)
if (use_spi) {
ret = regmap_read(data->regmap, BMI160_REG_DUMMY, &val);
if (ret)
return ret;
goto disable_regulator;
}

ret = regmap_read(data->regmap, BMI160_REG_CHIP_ID, &val);
if (ret) {
dev_err(dev, "Error reading chip id\n");
return ret;
goto disable_regulator;
}
if (val != BMI160_CHIP_ID_VAL) {
dev_err(dev, "Wrong chip id, got %x expected %x\n",
val, BMI160_CHIP_ID_VAL);
return -ENODEV;
ret = -ENODEV;
goto disable_regulator;
}

ret = bmi160_set_mode(data, BMI160_ACCEL, true);
if (ret)
return ret;
goto disable_regulator;

ret = bmi160_set_mode(data, BMI160_GYRO, true);
if (ret)
return ret;
goto disable_accel;

return 0;

disable_accel:
bmi160_set_mode(data, BMI160_ACCEL, false);

disable_regulator:
regulator_bulk_disable(ARRAY_SIZE(data->supplies), data->supplies);
return ret;
}

static int bmi160_data_rdy_trigger_set_state(struct iio_trigger *trig,
Expand Down
15 changes: 9 additions & 6 deletions drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ static int inv_icm42600_i2c_bus_setup(struct inv_icm42600_state *st)
unsigned int mask, val;
int ret;

/* setup interface registers */
ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6,
INV_ICM42600_INTF_CONFIG6_MASK,
INV_ICM42600_INTF_CONFIG6_I3C_EN);
if (ret)
return ret;
/*
* setup interface registers
* This register write to REG_INTF_CONFIG6 enables a spike filter that
* is impacting the line and can prevent the I2C ACK to be seen by the
* controller. So we don't test the return value.
*/
regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG6,
INV_ICM42600_INTF_CONFIG6_MASK,
INV_ICM42600_INTF_CONFIG6_I3C_EN);

ret = regmap_update_bits(st->map, INV_ICM42600_REG_INTF_CONFIG4,
INV_ICM42600_INTF_CONFIG4_I3C_BUS_ONLY, 0);
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/magnetometer/ak8975.c
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ static int ak8975_power_on(const struct ak8975_data *data)
if (ret) {
dev_warn(&data->client->dev,
"Failed to enable specified Vid supply\n");
regulator_disable(data->vdd);
return ret;
}

Expand Down
32 changes: 25 additions & 7 deletions drivers/iio/proximity/sx9324.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,17 @@
#define SX9324_REG_AFE_PH2 0x2a
#define SX9324_REG_AFE_PH3 0x2b
#define SX9324_REG_AFE_CTRL8 0x2c
#define SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM 0x02
#define SX9324_REG_AFE_CTRL8_RESERVED 0x10
#define SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM 0x02
#define SX9324_REG_AFE_CTRL9 0x2d
#define SX9324_REG_AFE_CTRL9_AGAIN_1 0x08

#define SX9324_REG_PROX_CTRL0 0x30
#define SX9324_REG_PROX_CTRL0_GAIN_MASK GENMASK(5, 3)
#define SX9324_REG_PROX_CTRL0_GAIN_1 0x80
#define SX9324_REG_PROX_CTRL0_GAIN_SHIFT 3
#define SX9324_REG_PROX_CTRL0_GAIN_RSVD 0x0
#define SX9324_REG_PROX_CTRL0_GAIN_1 0x1
#define SX9324_REG_PROX_CTRL0_GAIN_8 0x4
#define SX9324_REG_PROX_CTRL0_RAWFILT_MASK GENMASK(2, 0)
#define SX9324_REG_PROX_CTRL0_RAWFILT_1P50 0x01
#define SX9324_REG_PROX_CTRL1 0x31
Expand Down Expand Up @@ -379,7 +383,14 @@ static int sx9324_read_gain(struct sx_common_data *data,
if (ret)
return ret;

*val = 1 << FIELD_GET(SX9324_REG_PROX_CTRL0_GAIN_MASK, regval);
regval = FIELD_GET(SX9324_REG_PROX_CTRL0_GAIN_MASK, regval);
if (regval)
regval--;
else if (regval == SX9324_REG_PROX_CTRL0_GAIN_RSVD ||
regval > SX9324_REG_PROX_CTRL0_GAIN_8)
return -EINVAL;

*val = 1 << regval;

return IIO_VAL_INT;
}
Expand Down Expand Up @@ -725,8 +736,12 @@ static int sx9324_write_gain(struct sx_common_data *data,
unsigned int gain, reg;
int ret;

gain = ilog2(val);
reg = SX9324_REG_PROX_CTRL0 + chan->channel / 2;

gain = ilog2(val) + 1;
if (val <= 0 || gain > SX9324_REG_PROX_CTRL0_GAIN_8)
return -EINVAL;

gain = FIELD_PREP(SX9324_REG_PROX_CTRL0_GAIN_MASK, gain);

mutex_lock(&data->mutex);
Expand Down Expand Up @@ -781,12 +796,15 @@ static const struct sx_common_reg_default sx9324_default_regs[] = {
{ SX9324_REG_AFE_PH2, 0x1a },
{ SX9324_REG_AFE_PH3, 0x16 },

{ SX9324_REG_AFE_CTRL8, SX9324_REG_AFE_CTRL8_RESFILTN_4KOHM },
{ SX9324_REG_AFE_CTRL8, SX9324_REG_AFE_CTRL8_RESERVED |
SX9324_REG_AFE_CTRL8_RESFILTIN_4KOHM },
{ SX9324_REG_AFE_CTRL9, SX9324_REG_AFE_CTRL9_AGAIN_1 },

{ SX9324_REG_PROX_CTRL0, SX9324_REG_PROX_CTRL0_GAIN_1 |
{ SX9324_REG_PROX_CTRL0,
SX9324_REG_PROX_CTRL0_GAIN_1 << SX9324_REG_PROX_CTRL0_GAIN_SHIFT |
SX9324_REG_PROX_CTRL0_RAWFILT_1P50 },
{ SX9324_REG_PROX_CTRL1, SX9324_REG_PROX_CTRL0_GAIN_1 |
{ SX9324_REG_PROX_CTRL1,
SX9324_REG_PROX_CTRL0_GAIN_1 << SX9324_REG_PROX_CTRL0_GAIN_SHIFT |
SX9324_REG_PROX_CTRL0_RAWFILT_1P50 },
{ SX9324_REG_PROX_CTRL2, SX9324_REG_PROX_CTRL2_AVGNEG_THRESH_16K },
{ SX9324_REG_PROX_CTRL3, SX9324_REG_PROX_CTRL3_AVGDEB_2SAMPLES |
Expand Down
1 change: 1 addition & 0 deletions drivers/iio/proximity/sx_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ int sx_common_probe(struct i2c_client *client,
return dev_err_probe(dev, ret, "error reading WHOAMI\n");

ACPI_COMPANION_SET(&indio_dev->dev, ACPI_COMPANION(dev));
indio_dev->dev.of_node = client->dev.of_node;
indio_dev->modes = INDIO_DIRECT_MODE;

indio_dev->channels = data->chip_info->iio_channels;
Expand Down
Loading

0 comments on commit e2e5ebe

Please sign in to comment.