lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202108312318.2KgHauS6-lkp@intel.com>
Date:   Tue, 31 Aug 2021 23:59:28 +0800
From:   kernel test robot <lkp@...el.com>
To:     Roan van Dijk <roan@...tonic.nl>,
        Jonathan Cameron <jic23@...nel.org>
Cc:     kbuild-all@...ts.01.org, Rob Herring <robh+dt@...nel.org>,
        Tomasz Duszynski <tomasz.duszynski@...akon.com>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org, david@...tonic.nl,
        Lars-Peter Clausen <lars@...afoo.de>,
        Roan van Dijk <roan@...tonic.nl>
Subject: Re: [PATCH 3/3] drivers: iio: chemical: Add support for Sensirion
 SCD4x CO2 sensor

Hi Roan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on robh/for-next]
[also build test WARNING on linux/master linus/master v5.14]
[cannot apply to iio/togreg next-20210831]
[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
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Roan-van-Dijk/iio-chemical-Add-support-for-Sensirion-SCD4x-CO2-sensor/20210831-202025
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gcc (GCC) 11.2.0
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
        # https://github.com/0day-ci/linux/commit/605896bbee687d465d4ae58d910878e9b85f0035
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Roan-van-Dijk/iio-chemical-Add-support-for-Sensirion-SCD4x-CO2-sensor/20210831-202025
        git checkout 605896bbee687d465d4ae58d910878e9b85f0035
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=mips 

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

All warnings (new ones prefixed by >>):

>> drivers/iio/chemical/scd4x.c:503:20: warning: no previous prototype for 'scd4x_suspend' [-Wmissing-prototypes]
     503 | int __maybe_unused scd4x_suspend(struct device *dev)
         |                    ^~~~~~~~~~~~~
>> drivers/iio/chemical/scd4x.c:517:20: warning: no previous prototype for 'scd4x_resume' [-Wmissing-prototypes]
     517 | int __maybe_unused scd4x_resume(struct device *dev)
         |                    ^~~~~~~~~~~~
>> drivers/iio/chemical/scd4x.c:613:5: warning: no previous prototype for 'scd4x_probe' [-Wmissing-prototypes]
     613 | int scd4x_probe(struct i2c_client *client, const struct i2c_device_id *id)
         |     ^~~~~~~~~~~


vim +/scd4x_suspend +503 drivers/iio/chemical/scd4x.c

   502	
 > 503	int __maybe_unused scd4x_suspend(struct device *dev)
   504	{
   505		struct iio_dev *indio_dev = dev_get_drvdata(dev);
   506		struct scd4x_state *state  = iio_priv(indio_dev);
   507		int ret;
   508	
   509		ret = scd4x_send_command(state, CMD_STOP_MEAS);
   510		if (ret)
   511			return ret;
   512	
   513		return regulator_disable(state->vdd);
   514	}
   515	EXPORT_SYMBOL(scd4x_suspend);
   516	
 > 517	int __maybe_unused scd4x_resume(struct device *dev)
   518	{
   519		struct iio_dev *indio_dev = dev_get_drvdata(dev);
   520		struct scd4x_state *state = iio_priv(indio_dev);
   521		int ret;
   522	
   523		ret = regulator_enable(state->vdd);
   524		if (ret)
   525			return ret;
   526	
   527		return scd4x_send_command(state, CMD_START_MEAS);
   528	}
   529	EXPORT_SYMBOL(scd4x_resume);
   530	
   531	static void scd4x_stop_meas(void *data)
   532	{
   533		struct scd4x_state *state = data;
   534	
   535		scd4x_send_command(state, CMD_STOP_MEAS);
   536	}
   537	
   538	static void scd4x_disable_regulator(void *data)
   539	{
   540		struct scd4x_state *state = data;
   541	
   542		regulator_disable(state->vdd);
   543	}
   544	
   545	static irqreturn_t scd4x_trigger_handler(int irq, void *p)
   546	{
   547		struct iio_poll_func *pf = p;
   548		struct iio_dev *indio_dev = pf->indio_dev;
   549		struct scd4x_state *state = iio_priv(indio_dev);
   550		struct {
   551			int data[3];
   552			int64_t ts __aligned(8);
   553		} scan;
   554		int ret;
   555	
   556		mutex_lock(&state->lock);
   557		ret = scd4x_read_poll(state);
   558		memset(&scan, 0, sizeof(scan));
   559		memcpy(scan.data, state->meas, sizeof(state->meas));
   560		mutex_unlock(&state->lock);
   561		if (ret)
   562			goto out;
   563	
   564		iio_push_to_buffers_with_timestamp(indio_dev, &scan, iio_get_time_ns(indio_dev));
   565	out:
   566		iio_trigger_notify_done(indio_dev->trig);
   567		return IRQ_HANDLED;
   568	}
   569	
   570	static int scd4x_set_trigger_state(struct iio_trigger *trig, bool state)
   571	{
   572		struct iio_dev *indio_dev = iio_trigger_get_drvdata(trig);
   573		struct scd4x_state *st = iio_priv(indio_dev);
   574	
   575		if (state)
   576			enable_irq(st->irq);
   577		else
   578			disable_irq(st->irq);
   579	
   580		return 0;
   581	}
   582	
   583	static const struct iio_trigger_ops scd4x_trigger_ops = {
   584		.set_trigger_state = scd4x_set_trigger_state,
   585		.validate_device = iio_trigger_validate_own_device,
   586	};
   587	
   588	static int scd4x_setup_trigger(struct iio_dev *indio_dev)
   589	{
   590		struct device *dev = indio_dev->dev.parent;
   591		struct iio_trigger *trig;
   592		int ret;
   593	
   594		trig = devm_iio_trigger_alloc(dev, "%s-dev%d", indio_dev->name,
   595					      iio_device_id(indio_dev));
   596		if (!trig) {
   597			dev_err(dev, "failed to allocate trigger\n");
   598			return -ENOMEM;
   599		}
   600	
   601		trig->ops = &scd4x_trigger_ops;
   602		iio_trigger_set_drvdata(trig, indio_dev);
   603	
   604		ret = devm_iio_trigger_register(dev, trig);
   605		if (ret)
   606			return ret;
   607	
   608		indio_dev->trig = iio_trigger_get(trig);
   609	
   610		return ret;
   611	}
   612	
 > 613	int scd4x_probe(struct i2c_client *client, const struct i2c_device_id *id)
   614	{
   615		static const unsigned long scd4x_scan_masks[] = { 0x07, 0x00 };
   616		struct device *dev = &client->dev;
   617		struct iio_dev *indio_dev;
   618		struct scd4x_state *state;
   619		int ret;
   620	
   621		indio_dev = devm_iio_device_alloc(dev, sizeof(*state));
   622		if (!indio_dev)
   623			return -ENOMEM;
   624	
   625		state = iio_priv(indio_dev);
   626		mutex_init(&state->lock);
   627		state->dev = dev;
   628		crc8_populate_msb(scd4x_crc8_table, SCD4X_CRC8_POLYNOMIAL);
   629	
   630		indio_dev->info = &scd4x_info;
   631		indio_dev->name = client->name;
   632		indio_dev->channels = scd4x_channels;
   633		indio_dev->num_channels = ARRAY_SIZE(scd4x_channels);
   634		indio_dev->modes = INDIO_DIRECT_MODE | INDIO_BUFFER_TRIGGERED;
   635		indio_dev->available_scan_masks = scd4x_scan_masks;
   636	
   637		state->vdd = devm_regulator_get(dev, "vdd");
   638		if (IS_ERR(state->vdd))
   639			return dev_err_probe(dev, PTR_ERR(state->vdd), "failed to get regulator\n");
   640	
   641		ret = regulator_enable(state->vdd);
   642		if (ret)
   643			return ret;
   644	
   645		ret = devm_add_action_or_reset(dev, scd4x_disable_regulator, state);
   646		if (ret)
   647			return ret;
   648	
   649		ret = scd4x_send_command(state, CMD_STOP_MEAS);
   650		if (ret) {
   651			dev_err(dev, "failed to stop measurement: %d\n", ret);
   652			return ret;
   653		}
   654	
   655		/* execution time */
   656		msleep_interruptible(500);
   657	
   658		if (state->irq > 0) {
   659			ret = scd4x_setup_trigger(indio_dev);
   660			if (ret) {
   661				dev_err(dev, "failed to setup trigger: %d\n", ret);
   662				return ret;
   663			}
   664		}
   665	
   666		ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, scd4x_trigger_handler, NULL);
   667		if (ret)
   668			return ret;
   669	
   670		ret = devm_iio_device_register(dev, indio_dev);
   671		if (ret) {
   672			dev_err(dev, "failed to register iio device\n");
   673			return ret;
   674		}
   675	
   676		ret = scd4x_send_command(state, CMD_START_MEAS);
   677		if (ret) {
   678			dev_err(dev, "failed to start measurement: %d\n", ret);
   679			return ret;
   680		}
   681	
   682		ret = devm_add_action_or_reset(dev, scd4x_stop_meas, state);
   683		if (ret)
   684			return ret;
   685	
   686		return 0;
   687	}
   688	EXPORT_SYMBOL(scd4x_probe);
   689	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

Download attachment ".config.gz" of type "application/gzip" (71019 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ