diff mbox series

[v2,2/5] proximity: vl53l0x: Prefer already initialized interrupt flags

Message ID 20220511214718.50879-3-markuss.broks@gmail.com (mailing list archive)
State Superseded
Headers show
Series Add support for ToF sensor on Yoshino platform | expand

Commit Message

Markuss Broks May 11, 2022, 9:47 p.m. UTC
On some boards interrupt type might be different than falling edge,
like hardcoded in driver. Leave interrupt flags as they were pre-configured
from the device-tree. If they're not provided, default to falling edge

Signed-off-by: Markuss Broks <markuss.broks@gmail.com>
 drivers/iio/proximity/vl53l0x-i2c.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)


kernel test robot May 12, 2022, 10:32 a.m. UTC | #1
Hi Markuss,

I love your patch! Yet something to improve:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on robh/for-next linux/master linus/master v5.18-rc6 next-20220511]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in

url:    https://github.com/intel-lab-lkp/linux/commits/Markuss-Broks/Add-support-for-ToF-sensor-on-Yoshino-platform/20220512-054917
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: s390-randconfig-r032-20220509 (https://download.01.org/0day-ci/archive/20220512/202205121820.qRBa5PNP-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 18dd123c56754edf62c7042dcf23185c3727610f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install s390 cross compiling tool for clang build
        # apt-get install binutils-s390x-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/b4103f031e2c0265ae4f15f107341bcfc83008f0
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Markuss-Broks/Add-support-for-ToF-sensor-on-Yoshino-platform/20220512-054917
        git checkout b4103f031e2c0265ae4f15f107341bcfc83008f0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/iio/proximity/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/iio/proximity/vl53l0x-i2c.c:60:18: error: call to undeclared function 'irq_get_trigger_type'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
           int irq_flags = irq_get_trigger_type(client->irq);
   1 error generated.

vim +/irq_get_trigger_type +60 drivers/iio/proximity/vl53l0x-i2c.c

    57	static int vl53l0x_configure_irq(struct i2c_client *client,
    58					 struct iio_dev *indio_dev)
    59	{
  > 60		int irq_flags = irq_get_trigger_type(client->irq);
    61		struct vl53l0x_data *data = iio_priv(indio_dev);
    62		int ret;
    64		if (!irq_flags)
    65			irq_flags = IRQF_TRIGGER_FALLING;
    67		ret = devm_request_irq(&client->dev, client->irq, vl53l0x_handle_irq,
    68				irq_flags, indio_dev->name, indio_dev);
    69		if (ret) {
    70			dev_err(&client->dev, "devm_request_irq error: %d\n", ret);
    71			return ret;
    72		}
    74		ret = i2c_smbus_write_byte_data(data->client,
    77		if (ret < 0)
    78			dev_err(&client->dev, "failed to configure IRQ: %d\n", ret);
    80		return ret;
    81	}
diff mbox series


diff --git a/drivers/iio/proximity/vl53l0x-i2c.c b/drivers/iio/proximity/vl53l0x-i2c.c
index 661a79ea200d..ef2c063dfa1c 100644
--- a/drivers/iio/proximity/vl53l0x-i2c.c
+++ b/drivers/iio/proximity/vl53l0x-i2c.c
@@ -57,11 +57,15 @@  static irqreturn_t vl53l0x_handle_irq(int irq, void *priv)
 static int vl53l0x_configure_irq(struct i2c_client *client,
 				 struct iio_dev *indio_dev)
+	int irq_flags = irq_get_trigger_type(client->irq);
 	struct vl53l0x_data *data = iio_priv(indio_dev);
 	int ret;
+	if (!irq_flags)
+		irq_flags = IRQF_TRIGGER_FALLING;
 	ret = devm_request_irq(&client->dev, client->irq, vl53l0x_handle_irq,
-			IRQF_TRIGGER_FALLING, indio_dev->name, indio_dev);
+			irq_flags, indio_dev->name, indio_dev);
 	if (ret) {
 		dev_err(&client->dev, "devm_request_irq error: %d\n", ret);
 		return ret;