Char/Misc driver fixes for 5.17-rc6
Here are a few small driver fixes for 5.17-rc6 for reported issues. The majority of these are IIO fixes for small things, and the other two are a mvmem and mtd core conflict fix. All of these have been in linux-next with no reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> -----BEGIN PGP SIGNATURE----- iG0EABECAC0WIQT0tgzFv3jCIUoxPcsxR9QN2y37KQUCYhjVGA8cZ3JlZ0Brcm9h aC5jb20ACgkQMUfUDdst+ymtYQCgwSOl1N4iPmv2lpaHmofd+BF4frgAn1DJ0q/A OCG5siwdf3wMxPjL9HIC =AUOQ -----END PGP SIGNATURE----- Merge tag 'char-misc-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc Pull char/misc driver fixes from Greg KH: "Here are a few small driver fixes for 5.17-rc6 for reported issues. The majority of these are IIO fixes for small things, and the other two are a mvmem and mtd core conflict fix. All of these have been in linux-next with no reported issues" * tag 'char-misc-5.17-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: mtd: core: Fix a conflict between MTD and NVMEM on wp-gpios property nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property iio: imu: st_lsm6dsx: wait for settling time in st_lsm6dsx_read_oneshot iio: Fix error handling for PM iio: addac: ad74413r: correct comparator gpio getters mask usage iio: addac: ad74413r: use ngpio size when iterating over mask iio: addac: ad74413r: Do not reference negative array offsets iio: adc: men_z188_adc: Fix a resource leak in an error handling path iio: frequency: admv1013: remove the always true condition iio: accel: fxls8962af: add padding to regmap for SPI iio:imu:adis16480: fix buffering for devices with no burst mode iio: adc: ad7124: fix mask used for setting AIN_BUFP & AIN_BUFM bits iio: adc: tsc2046: fix memory corruption by preventing array overflow
This commit is contained in:
commit
c47658311d
@ -1783,11 +1783,14 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "Unable to register iio device\n");
|
||||
goto err_trigger_unregister;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
err_trigger_unregister:
|
||||
bmc150_accel_unregister_triggers(data, BMC150_ACCEL_TRIGGERS - 1);
|
||||
err_buffer_cleanup:
|
||||
|
@ -173,12 +173,20 @@ struct fxls8962af_data {
|
||||
u16 upper_thres;
|
||||
};
|
||||
|
||||
const struct regmap_config fxls8962af_regmap_conf = {
|
||||
const struct regmap_config fxls8962af_i2c_regmap_conf = {
|
||||
.reg_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = FXLS8962AF_MAX_REG,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(fxls8962af_regmap_conf);
|
||||
EXPORT_SYMBOL_GPL(fxls8962af_i2c_regmap_conf);
|
||||
|
||||
const struct regmap_config fxls8962af_spi_regmap_conf = {
|
||||
.reg_bits = 8,
|
||||
.pad_bits = 8,
|
||||
.val_bits = 8,
|
||||
.max_register = FXLS8962AF_MAX_REG,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(fxls8962af_spi_regmap_conf);
|
||||
|
||||
enum {
|
||||
fxls8962af_idx_x,
|
||||
|
@ -18,7 +18,7 @@ static int fxls8962af_probe(struct i2c_client *client)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = devm_regmap_init_i2c(client, &fxls8962af_regmap_conf);
|
||||
regmap = devm_regmap_init_i2c(client, &fxls8962af_i2c_regmap_conf);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(&client->dev, "Failed to initialize i2c regmap\n");
|
||||
return PTR_ERR(regmap);
|
||||
|
@ -18,7 +18,7 @@ static int fxls8962af_probe(struct spi_device *spi)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
|
||||
regmap = devm_regmap_init_spi(spi, &fxls8962af_regmap_conf);
|
||||
regmap = devm_regmap_init_spi(spi, &fxls8962af_spi_regmap_conf);
|
||||
if (IS_ERR(regmap)) {
|
||||
dev_err(&spi->dev, "Failed to initialize spi regmap\n");
|
||||
return PTR_ERR(regmap);
|
||||
|
@ -17,6 +17,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq);
|
||||
int fxls8962af_core_remove(struct device *dev);
|
||||
|
||||
extern const struct dev_pm_ops fxls8962af_pm_ops;
|
||||
extern const struct regmap_config fxls8962af_regmap_conf;
|
||||
extern const struct regmap_config fxls8962af_i2c_regmap_conf;
|
||||
extern const struct regmap_config fxls8962af_spi_regmap_conf;
|
||||
|
||||
#endif /* _FXLS8962AF_H_ */
|
||||
|
@ -1590,11 +1590,14 @@ static int kxcjk1013_probe(struct i2c_client *client,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "unable to register iio device\n");
|
||||
goto err_buffer_cleanup;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(&client->dev);
|
||||
pm_runtime_disable(&client->dev);
|
||||
err_buffer_cleanup:
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
err_trigger_unregister:
|
||||
|
@ -495,11 +495,14 @@ static int mma9551_probe(struct i2c_client *client,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "unable to register iio device\n");
|
||||
goto out_poweroff;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(&client->dev);
|
||||
pm_runtime_disable(&client->dev);
|
||||
out_poweroff:
|
||||
mma9551_set_device_state(client, false);
|
||||
|
||||
|
@ -1134,12 +1134,15 @@ static int mma9553_probe(struct i2c_client *client,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "unable to register iio device\n");
|
||||
goto out_poweroff;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
dev_dbg(&indio_dev->dev, "Registered device %s\n", name);
|
||||
return 0;
|
||||
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(&client->dev);
|
||||
pm_runtime_disable(&client->dev);
|
||||
out_poweroff:
|
||||
mma9551_set_device_state(client, false);
|
||||
return ret;
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define AD7124_CONFIG_REF_SEL(x) FIELD_PREP(AD7124_CONFIG_REF_SEL_MSK, x)
|
||||
#define AD7124_CONFIG_PGA_MSK GENMASK(2, 0)
|
||||
#define AD7124_CONFIG_PGA(x) FIELD_PREP(AD7124_CONFIG_PGA_MSK, x)
|
||||
#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(7, 6)
|
||||
#define AD7124_CONFIG_IN_BUFF_MSK GENMASK(6, 5)
|
||||
#define AD7124_CONFIG_IN_BUFF(x) FIELD_PREP(AD7124_CONFIG_IN_BUFF_MSK, x)
|
||||
|
||||
/* AD7124_FILTER_X */
|
||||
|
@ -103,6 +103,7 @@ static int men_z188_probe(struct mcb_device *dev,
|
||||
struct z188_adc *adc;
|
||||
struct iio_dev *indio_dev;
|
||||
struct resource *mem;
|
||||
int ret;
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&dev->dev, sizeof(struct z188_adc));
|
||||
if (!indio_dev)
|
||||
@ -128,8 +129,14 @@ static int men_z188_probe(struct mcb_device *dev,
|
||||
adc->mem = mem;
|
||||
mcb_set_drvdata(dev, indio_dev);
|
||||
|
||||
return iio_device_register(indio_dev);
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
goto err_unmap;
|
||||
|
||||
return 0;
|
||||
|
||||
err_unmap:
|
||||
iounmap(adc->base);
|
||||
err:
|
||||
mcb_release_mem(mem);
|
||||
return -ENXIO;
|
||||
|
@ -388,7 +388,7 @@ static int tsc2046_adc_update_scan_mode(struct iio_dev *indio_dev,
|
||||
mutex_lock(&priv->slock);
|
||||
|
||||
size = 0;
|
||||
for_each_set_bit(ch_idx, active_scan_mask, indio_dev->num_channels) {
|
||||
for_each_set_bit(ch_idx, active_scan_mask, ARRAY_SIZE(priv->l)) {
|
||||
size += tsc2046_adc_group_set_layout(priv, group, ch_idx);
|
||||
tsc2046_adc_group_set_cmd(priv, group, ch_idx);
|
||||
group++;
|
||||
@ -548,7 +548,7 @@ static int tsc2046_adc_setup_spi_msg(struct tsc2046_adc_priv *priv)
|
||||
* enabled.
|
||||
*/
|
||||
size = 0;
|
||||
for (ch_idx = 0; ch_idx < priv->dcfg->num_channels; ch_idx++)
|
||||
for (ch_idx = 0; ch_idx < ARRAY_SIZE(priv->l); ch_idx++)
|
||||
size += tsc2046_adc_group_set_layout(priv, ch_idx, ch_idx);
|
||||
|
||||
priv->tx = devm_kzalloc(&priv->spi->dev, size, GFP_KERNEL);
|
||||
|
@ -134,7 +134,6 @@ struct ad74413r_state {
|
||||
#define AD74413R_CH_EN_MASK(x) BIT(x)
|
||||
|
||||
#define AD74413R_REG_DIN_COMP_OUT 0x25
|
||||
#define AD74413R_DIN_COMP_OUT_SHIFT_X(x) x
|
||||
|
||||
#define AD74413R_REG_ADC_RESULT_X(x) (0x26 + (x))
|
||||
#define AD74413R_ADC_RESULT_MAX GENMASK(15, 0)
|
||||
@ -288,7 +287,7 @@ static void ad74413r_gpio_set_multiple(struct gpio_chip *chip,
|
||||
unsigned int offset = 0;
|
||||
int ret;
|
||||
|
||||
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
|
||||
for_each_set_bit_from(offset, mask, chip->ngpio) {
|
||||
unsigned int real_offset = st->gpo_gpio_offsets[offset];
|
||||
|
||||
ret = ad74413r_set_gpo_config(st, real_offset,
|
||||
@ -316,7 +315,7 @@ static int ad74413r_gpio_get(struct gpio_chip *chip, unsigned int offset)
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
status &= AD74413R_DIN_COMP_OUT_SHIFT_X(real_offset);
|
||||
status &= BIT(real_offset);
|
||||
|
||||
return status ? 1 : 0;
|
||||
}
|
||||
@ -334,11 +333,10 @@ static int ad74413r_gpio_get_multiple(struct gpio_chip *chip,
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
for_each_set_bit_from(offset, mask, AD74413R_CHANNEL_MAX) {
|
||||
for_each_set_bit_from(offset, mask, chip->ngpio) {
|
||||
unsigned int real_offset = st->comp_gpio_offsets[offset];
|
||||
|
||||
if (val & BIT(real_offset))
|
||||
*bits |= offset;
|
||||
__assign_bit(offset, bits, val & BIT(real_offset));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@ -840,7 +838,7 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev,
|
||||
{
|
||||
struct ad74413r_state *st = iio_priv(indio_dev);
|
||||
struct spi_transfer *xfer = st->adc_samples_xfer;
|
||||
u8 *rx_buf = &st->adc_samples_buf.rx_buf[-1 * AD74413R_FRAME_SIZE];
|
||||
u8 *rx_buf = st->adc_samples_buf.rx_buf;
|
||||
u8 *tx_buf = st->adc_samples_tx_buf;
|
||||
unsigned int channel;
|
||||
int ret = -EINVAL;
|
||||
@ -894,9 +892,10 @@ static int ad74413r_update_scan_mode(struct iio_dev *indio_dev,
|
||||
|
||||
spi_message_add_tail(xfer, &st->adc_samples_msg);
|
||||
|
||||
xfer++;
|
||||
tx_buf += AD74413R_FRAME_SIZE;
|
||||
rx_buf += AD74413R_FRAME_SIZE;
|
||||
if (xfer != st->adc_samples_xfer)
|
||||
rx_buf += AD74413R_FRAME_SIZE;
|
||||
xfer++;
|
||||
}
|
||||
|
||||
xfer->rx_buf = rx_buf;
|
||||
|
@ -348,7 +348,7 @@ static int admv1013_update_mixer_vgate(struct admv1013_state *st)
|
||||
|
||||
vcm = regulator_get_voltage(st->reg);
|
||||
|
||||
if (vcm >= 0 && vcm < 1800000)
|
||||
if (vcm < 1800000)
|
||||
mixer_vgate = (2389 * vcm / 1000000 + 8100) / 100;
|
||||
else if (vcm > 1800000 && vcm < 2600000)
|
||||
mixer_vgate = (2375 * vcm / 1000000 + 125) / 100;
|
||||
|
@ -1188,11 +1188,14 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "unable to register iio device\n");
|
||||
goto err_buffer_cleanup;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
err_buffer_cleanup:
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
err_trigger_unregister:
|
||||
|
@ -1403,6 +1403,7 @@ static int adis16480_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
||||
const struct adis_data *adis16480_data;
|
||||
irq_handler_t trigger_handler = NULL;
|
||||
struct iio_dev *indio_dev;
|
||||
struct adis16480 *st;
|
||||
int ret;
|
||||
@ -1474,8 +1475,12 @@ static int adis16480_probe(struct spi_device *spi)
|
||||
st->clk_freq = st->chip_info->int_clk;
|
||||
}
|
||||
|
||||
/* Only use our trigger handler if burst mode is supported */
|
||||
if (adis16480_data->burst_len)
|
||||
trigger_handler = adis16480_trigger_handler;
|
||||
|
||||
ret = devm_adis_setup_buffer_and_trigger(&st->adis, indio_dev,
|
||||
adis16480_trigger_handler);
|
||||
trigger_handler);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -1385,7 +1385,7 @@ static int kmx61_probe(struct i2c_client *client,
|
||||
ret = iio_device_register(data->acc_indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "Failed to register acc iio device\n");
|
||||
goto err_buffer_cleanup_mag;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
ret = iio_device_register(data->mag_indio_dev);
|
||||
@ -1398,6 +1398,9 @@ static int kmx61_probe(struct i2c_client *client,
|
||||
|
||||
err_iio_unregister_acc:
|
||||
iio_device_unregister(data->acc_indio_dev);
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(&client->dev);
|
||||
pm_runtime_disable(&client->dev);
|
||||
err_buffer_cleanup_mag:
|
||||
if (client->irq > 0)
|
||||
iio_triggered_buffer_cleanup(data->mag_indio_dev);
|
||||
|
@ -1374,8 +1374,12 @@ static int st_lsm6dsx_read_oneshot(struct st_lsm6dsx_sensor *sensor,
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
/*
|
||||
* we need to wait for sensor settling time before
|
||||
* reading data in order to avoid corrupted samples
|
||||
*/
|
||||
delay = 1000000000 / sensor->odr;
|
||||
usleep_range(delay, 2 * delay);
|
||||
usleep_range(3 * delay, 4 * delay);
|
||||
|
||||
err = st_lsm6dsx_read_locked(hw, addr, &data, sizeof(data));
|
||||
if (err < 0)
|
||||
|
@ -962,13 +962,14 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "unable to register iio device\n");
|
||||
goto err_disable_runtime_pm;
|
||||
goto err_pm_cleanup;
|
||||
}
|
||||
|
||||
dev_dbg(dev, "Registered device %s\n", name);
|
||||
return 0;
|
||||
|
||||
err_disable_runtime_pm:
|
||||
err_pm_cleanup:
|
||||
pm_runtime_dont_use_autosuspend(dev);
|
||||
pm_runtime_disable(dev);
|
||||
err_buffer_cleanup:
|
||||
iio_triggered_buffer_cleanup(indio_dev);
|
||||
|
@ -546,6 +546,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
|
||||
config.stride = 1;
|
||||
config.read_only = true;
|
||||
config.root_only = true;
|
||||
config.ignore_wp = true;
|
||||
config.no_of_node = !of_device_is_compatible(node, "nvmem-cells");
|
||||
config.priv = mtd;
|
||||
|
||||
@ -833,6 +834,7 @@ static struct nvmem_device *mtd_otp_nvmem_register(struct mtd_info *mtd,
|
||||
config.owner = THIS_MODULE;
|
||||
config.type = NVMEM_TYPE_OTP;
|
||||
config.root_only = true;
|
||||
config.ignore_wp = true;
|
||||
config.reg_read = reg_read;
|
||||
config.size = size;
|
||||
config.of_node = np;
|
||||
|
@ -771,7 +771,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
|
||||
|
||||
if (config->wp_gpio)
|
||||
nvmem->wp_gpio = config->wp_gpio;
|
||||
else
|
||||
else if (!config->ignore_wp)
|
||||
nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
|
||||
GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(nvmem->wp_gpio)) {
|
||||
|
@ -70,7 +70,8 @@ struct nvmem_keepout {
|
||||
* @word_size: Minimum read/write access granularity.
|
||||
* @stride: Minimum read/write access stride.
|
||||
* @priv: User context passed to read/write callbacks.
|
||||
* @wp-gpio: Write protect pin
|
||||
* @wp-gpio: Write protect pin
|
||||
* @ignore_wp: Write Protect pin is managed by the provider.
|
||||
*
|
||||
* Note: A default "nvmem<id>" name will be assigned to the device if
|
||||
* no name is specified in its configuration. In such case "<id>" is
|
||||
@ -92,6 +93,7 @@ struct nvmem_config {
|
||||
enum nvmem_type type;
|
||||
bool read_only;
|
||||
bool root_only;
|
||||
bool ignore_wp;
|
||||
struct device_node *of_node;
|
||||
bool no_of_node;
|
||||
nvmem_reg_read_t reg_read;
|
||||
|
Loading…
Reference in New Issue
Block a user