]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Merge tag 'staging-5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh...
authorLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Oct 2021 03:10:00 +0000 (17:10 -1000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Mon, 18 Oct 2021 03:10:00 +0000 (17:10 -1000)
Pull staging and IIO driver fixes from Greg KH:
 "Here are a number of small IIO and staging driver fixes for 5.15-rc6.

  They include:

   - vc04_services bugfix for reported problem

   - r8188eu array underflow fix

   - iio driver fixes for a lot of tiny reported issues.

  All of these have been in linux-next for a while with no reported
  issues"

* tag 'staging-5.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
  staging: r8188eu: prevent array underflow in rtw_hal_update_ra_mask()
  staging: vc04_services: shut up out-of-range warning
  iio: light: opt3001: Fixed timeout error when 0 lux
  iio: adis16480: fix devices that do not support sleep mode
  iio: mtk-auxadc: fix case IIO_CHAN_INFO_PROCESSED
  iio: adis16475: fix deadlock on frequency set
  iio: ssp_sensors: add more range checking in ssp_parse_dataframe()
  iio: ssp_sensors: fix error code in ssp_print_mcu_debug()
  iio: adc: ad7793: Fix IRQ flag
  iio: adc: ad7780: Fix IRQ flag
  iio: adc: ad7192: Add IRQ flag
  iio: adc: aspeed: set driver data when adc probe.
  iio: adc: rzg2l_adc: add missing clk_disable_unprepare() in rzg2l_adc_pm_runtime_resume()
  iio: adc: max1027: Fix the number of max1X31 channels
  iio: adc: max1027: Fix wrong shift with 12-bit devices
  iio: adc128s052: Fix the error handling path of 'adc128_probe()'
  iio: adc: rzg2l_adc: Fix -EBUSY timeout error return
  iio: accel: fxls8962af: return IRQ_HANDLED when fifo is flushed
  iio: dac: ti-dac5571: fix an error code in probe()

16 files changed:
drivers/iio/accel/fxls8962af-core.c
drivers/iio/adc/ad7192.c
drivers/iio/adc/ad7780.c
drivers/iio/adc/ad7793.c
drivers/iio/adc/aspeed_adc.c
drivers/iio/adc/max1027.c
drivers/iio/adc/mt6577_auxadc.c
drivers/iio/adc/rzg2l_adc.c
drivers/iio/adc/ti-adc128s052.c
drivers/iio/common/ssp_sensors/ssp_spi.c
drivers/iio/dac/ti-dac5571.c
drivers/iio/imu/adis16475.c
drivers/iio/imu/adis16480.c
drivers/iio/light/opt3001.c
drivers/staging/r8188eu/hal/hal_intf.c
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c

index 0019f1ea7df27248766bc0ee699a34a60a038af4..f41db9e0249a71be2ea4f9a9fd29cc33d6a474ae 100644 (file)
@@ -738,7 +738,7 @@ static irqreturn_t fxls8962af_interrupt(int irq, void *p)
 
        if (reg & FXLS8962AF_INT_STATUS_SRC_BUF) {
                ret = fxls8962af_fifo_flush(indio_dev);
-               if (ret)
+               if (ret < 0)
                        return IRQ_NONE;
 
                return IRQ_HANDLED;
index ee8ed9481025d2d26f192a5fd0450e3350799a29..2121a812b0c3148054b241da5e8c0da4c7fc4db0 100644 (file)
@@ -293,6 +293,7 @@ static const struct ad_sigma_delta_info ad7192_sigma_delta_info = {
        .has_registers = true,
        .addr_shift = 3,
        .read_mask = BIT(6),
+       .irq_flags = IRQF_TRIGGER_FALLING,
 };
 
 static const struct ad_sd_calib_data ad7192_calib_arr[8] = {
index 42bb952f47388abc9ab34fe15db200b3258ba914..b6e8c8abf6f4cdac9d357c78630a9186b68f8cb8 100644 (file)
@@ -203,7 +203,7 @@ static const struct ad_sigma_delta_info ad7780_sigma_delta_info = {
        .set_mode = ad7780_set_mode,
        .postprocess_sample = ad7780_postprocess_sample,
        .has_registers = false,
-       .irq_flags = IRQF_TRIGGER_LOW,
+       .irq_flags = IRQF_TRIGGER_FALLING,
 };
 
 #define _AD7780_CHANNEL(_bits, _wordsize, _mask_all)           \
index ef3e2d3ecb0c6d015a7c3456a3e6e5a6947f3551..0e7ab3fb072a961ecb6a0aaa60f36fa6110f4045 100644 (file)
@@ -206,7 +206,7 @@ static const struct ad_sigma_delta_info ad7793_sigma_delta_info = {
        .has_registers = true,
        .addr_shift = 3,
        .read_mask = BIT(6),
-       .irq_flags = IRQF_TRIGGER_LOW,
+       .irq_flags = IRQF_TRIGGER_FALLING,
 };
 
 static const struct ad_sd_calib_data ad7793_calib_arr[6] = {
index 19efaa41bc344b6def9d03bc59efbe62c6e64d82..34ec0c28b2dff6b145445e1aabf5fc89c20ac363 100644 (file)
@@ -183,6 +183,7 @@ static int aspeed_adc_probe(struct platform_device *pdev)
 
        data = iio_priv(indio_dev);
        data->dev = &pdev->dev;
+       platform_set_drvdata(pdev, indio_dev);
 
        data->base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(data->base))
index 655ab02d03d8496bf73cabb24898ba7a1b8c37db..b753658bb41ec0f6d5ecb58f9955607cfaae4b58 100644 (file)
@@ -103,7 +103,7 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
                        .sign = 'u',                                    \
                        .realbits = depth,                              \
                        .storagebits = 16,                              \
-                       .shift = 2,                                     \
+                       .shift = (depth == 10) ? 2 : 0,                 \
                        .endianness = IIO_BE,                           \
                },                                                      \
        }
@@ -142,7 +142,6 @@ MODULE_DEVICE_TABLE(of, max1027_adc_dt_ids);
        MAX1027_V_CHAN(11, depth)
 
 #define MAX1X31_CHANNELS(depth)                        \
-       MAX1X27_CHANNELS(depth),                \
        MAX1X29_CHANNELS(depth),                \
        MAX1027_V_CHAN(12, depth),              \
        MAX1027_V_CHAN(13, depth),              \
index 79c1dd68b9092c2449967f12837e0a3314114f70..d4fccd52ef08ba147a3fe3844ea2e31fa4f6fb0a 100644 (file)
@@ -82,6 +82,10 @@ static const struct iio_chan_spec mt6577_auxadc_iio_channels[] = {
        MT6577_AUXADC_CHANNEL(15),
 };
 
+/* For Voltage calculation */
+#define VOLTAGE_FULL_RANGE  1500       /* VA voltage */
+#define AUXADC_PRECISE      4096       /* 12 bits */
+
 static int mt_auxadc_get_cali_data(int rawdata, bool enable_cali)
 {
        return rawdata;
@@ -191,6 +195,10 @@ static int mt6577_auxadc_read_raw(struct iio_dev *indio_dev,
                }
                if (adc_dev->dev_comp->sample_data_cali)
                        *val = mt_auxadc_get_cali_data(*val, true);
+
+               /* Convert adc raw data to voltage: 0 - 1500 mV */
+               *val = *val * VOLTAGE_FULL_RANGE / AUXADC_PRECISE;
+
                return IIO_VAL_INT;
 
        default:
index 9996d5eef2893a4ad3152738064c5531db9b56be..32fbf57c362fa58733df8a576ac6e3481dffe6d0 100644 (file)
@@ -401,7 +401,7 @@ static int rzg2l_adc_hw_init(struct rzg2l_adc *adc)
 exit_hw_init:
        clk_disable_unprepare(adc->pclk);
 
-       return 0;
+       return ret;
 }
 
 static void rzg2l_adc_pm_runtime_disable(void *data)
@@ -570,8 +570,10 @@ static int __maybe_unused rzg2l_adc_pm_runtime_resume(struct device *dev)
                return ret;
 
        ret = clk_prepare_enable(adc->adclk);
-       if (ret)
+       if (ret) {
+               clk_disable_unprepare(adc->pclk);
                return ret;
+       }
 
        rzg2l_adc_pwr(adc, true);
 
index 3143f35a6509aa5b92b6aece0fa1de3ab71118d7..83c1ae07b3e9a1c7db56921f14c91c0f2c40c9d8 100644 (file)
@@ -171,7 +171,13 @@ static int adc128_probe(struct spi_device *spi)
        mutex_init(&adc->lock);
 
        ret = iio_device_register(indio_dev);
+       if (ret)
+               goto err_disable_regulator;
 
+       return 0;
+
+err_disable_regulator:
+       regulator_disable(adc->reg);
        return ret;
 }
 
index 4864c38b8d1c2d6f66c89fbe7a1407ebf9f4073f..769bd9280524a0d016eac827b200253844453c80 100644 (file)
@@ -137,7 +137,7 @@ static int ssp_print_mcu_debug(char *data_frame, int *data_index,
        if (length > received_len - *data_index || length <= 0) {
                ssp_dbg("[SSP]: MSG From MCU-invalid debug length(%d/%d)\n",
                        length, received_len);
-               return length ? length : -EPROTO;
+               return -EPROTO;
        }
 
        ssp_dbg("[SSP]: MSG From MCU - %s\n", &data_frame[*data_index]);
@@ -273,6 +273,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len)
        for (idx = 0; idx < len;) {
                switch (dataframe[idx++]) {
                case SSP_MSG2AP_INST_BYPASS_DATA:
+                       if (idx >= len)
+                               return -EPROTO;
                        sd = dataframe[idx++];
                        if (sd < 0 || sd >= SSP_SENSOR_MAX) {
                                dev_err(SSP_DEV,
@@ -282,10 +284,13 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len)
 
                        if (indio_devs[sd]) {
                                spd = iio_priv(indio_devs[sd]);
-                               if (spd->process_data)
+                               if (spd->process_data) {
+                                       if (idx >= len)
+                                               return -EPROTO;
                                        spd->process_data(indio_devs[sd],
                                                          &dataframe[idx],
                                                          data->timestamp);
+                               }
                        } else {
                                dev_err(SSP_DEV, "no client for frame\n");
                        }
@@ -293,6 +298,8 @@ static int ssp_parse_dataframe(struct ssp_data *data, char *dataframe, int len)
                        idx += ssp_offset_map[sd];
                        break;
                case SSP_MSG2AP_INST_DEBUG_DATA:
+                       if (idx >= len)
+                               return -EPROTO;
                        sd = ssp_print_mcu_debug(dataframe, &idx, len);
                        if (sd) {
                                dev_err(SSP_DEV,
index 2a5ba1b08a1d0af6c6aea10ea016a93a95381781..546a4cf6c5ef8325937b248b883f1663f6ae8a0d 100644 (file)
@@ -350,6 +350,7 @@ static int dac5571_probe(struct i2c_client *client,
                data->dac5571_pwrdwn = dac5571_pwrdwn_quad;
                break;
        default:
+               ret = -EINVAL;
                goto err;
        }
 
index eb48102f94243e41c49b4f4e66864d027fa0dfc3..287fff39a927aacf6a043627c4e0cb78f0ba850a 100644 (file)
@@ -353,10 +353,11 @@ static int adis16475_set_freq(struct adis16475 *st, const u32 freq)
        if (dec > st->info->max_dec)
                dec = st->info->max_dec;
 
-       ret = adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec);
+       ret = __adis_write_reg_16(&st->adis, ADIS16475_REG_DEC_RATE, dec);
        if (ret)
                goto error;
 
+       adis_dev_unlock(&st->adis);
        /*
         * If decimation is used, then gyro and accel data will have meaningful
         * bits on the LSB registers. This info is used on the trigger handler.
index a869a6e52a16bec9eca5e196bd6c2ccef85d8ed7..ed129321a14da1175bb29cfae062a90879056e2c 100644 (file)
@@ -144,6 +144,7 @@ struct adis16480_chip_info {
        unsigned int max_dec_rate;
        const unsigned int *filter_freqs;
        bool has_pps_clk_mode;
+       bool has_sleep_cnt;
        const struct adis_data adis_data;
 };
 
@@ -939,6 +940,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
                .temp_scale = 5650, /* 5.65 milli degree Celsius */
                .int_clk = 2460000,
                .max_dec_rate = 2048,
+               .has_sleep_cnt = true,
                .filter_freqs = adis16480_def_filter_freqs,
                .adis_data = ADIS16480_DATA(16375, &adis16485_timeouts, 0),
        },
@@ -952,6 +954,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
                .temp_scale = 5650, /* 5.65 milli degree Celsius */
                .int_clk = 2460000,
                .max_dec_rate = 2048,
+               .has_sleep_cnt = true,
                .filter_freqs = adis16480_def_filter_freqs,
                .adis_data = ADIS16480_DATA(16480, &adis16480_timeouts, 0),
        },
@@ -965,6 +968,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
                .temp_scale = 5650, /* 5.65 milli degree Celsius */
                .int_clk = 2460000,
                .max_dec_rate = 2048,
+               .has_sleep_cnt = true,
                .filter_freqs = adis16480_def_filter_freqs,
                .adis_data = ADIS16480_DATA(16485, &adis16485_timeouts, 0),
        },
@@ -978,6 +982,7 @@ static const struct adis16480_chip_info adis16480_chip_info[] = {
                .temp_scale = 5650, /* 5.65 milli degree Celsius */
                .int_clk = 2460000,
                .max_dec_rate = 2048,
+               .has_sleep_cnt = true,
                .filter_freqs = adis16480_def_filter_freqs,
                .adis_data = ADIS16480_DATA(16488, &adis16485_timeouts, 0),
        },
@@ -1425,9 +1430,12 @@ static int adis16480_probe(struct spi_device *spi)
        if (ret)
                return ret;
 
-       ret = devm_add_action_or_reset(&spi->dev, adis16480_stop, indio_dev);
-       if (ret)
-               return ret;
+       if (st->chip_info->has_sleep_cnt) {
+               ret = devm_add_action_or_reset(&spi->dev, adis16480_stop,
+                                              indio_dev);
+               if (ret)
+                       return ret;
+       }
 
        ret = adis16480_config_irq_pin(spi->dev.of_node, st);
        if (ret)
index 52963da401a78e9bdbba5bc186455312a1c9c882..1880bd5bb2586c5b9f05b61fa1dda532bc7156d0 100644 (file)
@@ -276,6 +276,8 @@ static int opt3001_get_lux(struct opt3001 *opt, int *val, int *val2)
                ret = wait_event_timeout(opt->result_ready_queue,
                                opt->result_ready,
                                msecs_to_jiffies(OPT3001_RESULT_READY_LONG));
+               if (ret == 0)
+                       return -ETIMEDOUT;
        } else {
                /* Sleep for result ready time */
                timeout = (opt->int_time == OPT3001_INT_TIME_SHORT) ?
@@ -312,9 +314,7 @@ err:
                /* Disallow IRQ to access the device while lock is active */
                opt->ok_to_ignore_lock = false;
 
-       if (ret == 0)
-               return -ETIMEDOUT;
-       else if (ret < 0)
+       if (ret < 0)
                return ret;
 
        if (opt->use_irq) {
index a6d589e89aeb01f171829aa180f0a34f97052baf..f27eba72d646f116d8e6eaf364ed5b7fd8da5391 100644 (file)
@@ -248,7 +248,7 @@ void rtw_hal_update_ra_mask(struct adapter *adapt, u32 mac_id, u8 rssi_level)
 #ifdef CONFIG_88EU_AP_MODE
                struct sta_info *psta = NULL;
                struct sta_priv *pstapriv = &adapt->stapriv;
-               if ((mac_id - 1) > 0)
+               if (mac_id >= 2)
                        psta = pstapriv->sta_aid[(mac_id - 1) - 1];
                if (psta)
                        add_RATid(adapt, psta, 0);/* todo: based on rssi_level*/
index b25369a134525e0c1bf03c45a00fe3b82f964824..967f10b9582a826c8d0101e273f710a1e46bba71 100644 (file)
@@ -182,7 +182,7 @@ create_pagelist(char *buf, char __user *ubuf,
                offset = (uintptr_t)ubuf & (PAGE_SIZE - 1);
        num_pages = DIV_ROUND_UP(count + offset, PAGE_SIZE);
 
-       if (num_pages > (SIZE_MAX - sizeof(struct pagelist) -
+       if ((size_t)num_pages > (SIZE_MAX - sizeof(struct pagelist) -
                         sizeof(struct vchiq_pagelist_info)) /
                        (sizeof(u32) + sizeof(pages[0]) +
                         sizeof(struct scatterlist)))