[PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition

David Lechner posted 1 patch 2 weeks ago
drivers/iio/pressure/cros_ec_baro.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
[PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
Posted by David Lechner 2 weeks ago
Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
manually filling in the struct iio_chan_spec fields. This makes the code
less verbose and mistake-prone.

Also drop obvious comment while we're at it.

Signed-off-by: David Lechner <dlechner@baylibre.com>
---
 drivers/iio/pressure/cros_ec_baro.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/iio/pressure/cros_ec_baro.c b/drivers/iio/pressure/cros_ec_baro.c
index c6b950c596c1..6cbde48d5be3 100644
--- a/drivers/iio/pressure/cros_ec_baro.c
+++ b/drivers/iio/pressure/cros_ec_baro.c
@@ -170,14 +170,8 @@ static int cros_ec_baro_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	/* Timestamp */
 	channel++;
-	channel->type = IIO_TIMESTAMP;
-	channel->channel = -1;
-	channel->scan_index = 1;
-	channel->scan_type.sign = 's';
-	channel->scan_type.realbits = 64;
-	channel->scan_type.storagebits = 64;
+	*channel = IIO_CHAN_SOFT_TIMESTAMP(1);
 
 	indio_dev->channels = state->channels;
 	indio_dev->num_channels = CROS_EC_BARO_MAX_CHANNELS;
-- 
2.43.0
Re: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
Posted by kernel test robot 1 week, 4 days ago
Hi David,

kernel test robot noticed the following build errors:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on linus/master v7.1-rc5 next-20260527]
[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#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/David-Lechner/iio-pressure-cros_ec_baro-simplify-timestamp-channel-definition/20260525-134550
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
patch link:    https://lore.kernel.org/r/20260525014654.2399354-1-dlechner%40baylibre.com
patch subject: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20260528/202605281432.a64fe4iY-lkp@intel.com/config)
compiler: m68k-linux-gcc (GCC) 15.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281432.a64fe4iY-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202605281432.a64fe4iY-lkp@intel.com/

All errors (new ones prefixed by >>):

   In file included from include/linux/iio/buffer.h:10,
                    from drivers/iio/pressure/cros_ec_baro.c:9:
   drivers/iio/pressure/cros_ec_baro.c: In function 'cros_ec_baro_probe':
>> include/linux/iio/iio.h:356:38: error: expected expression before '{' token
     356 | #define IIO_CHAN_SOFT_TIMESTAMP(_si) {                                  \
         |                                      ^
   drivers/iio/pressure/cros_ec_baro.c:174:20: note: in expansion of macro 'IIO_CHAN_SOFT_TIMESTAMP'
     174 |         *channel = IIO_CHAN_SOFT_TIMESTAMP(1);
         |                    ^~~~~~~~~~~~~~~~~~~~~~~


vim +356 include/linux/iio/iio.h

00c5f80c2fad53 include/linux/iio/iio.h   Peter Rosin      2016-11-08  355  
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12 @356  #define IIO_CHAN_SOFT_TIMESTAMP(_si) {					\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  357  	.type = IIO_TIMESTAMP,						\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  358  	.channel = -1,							\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  359  	.scan_index = _si,						\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  360  	.scan_type = {							\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  361  		.sign = 's',						\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  362  		.realbits = 64,					\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  363  		.storagebits = 64,					\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  364  		},							\
07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  365  }
1d892719e70e47 drivers/staging/iio/iio.h Jonathan Cameron 2011-05-18  366  

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
Posted by Jonathan Cameron 1 week, 4 days ago
On Thu, 28 May 2026 14:40:51 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi David,
> 
> kernel test robot noticed the following build errors:
> 
For the record, this is a side effect of some email trouble David had.
It's meant to be in a series with the patch that makes that macro
a compound literal.

> [auto build test ERROR on jic23-iio/togreg]
> [also build test ERROR on linus/master v7.1-rc5 next-20260527]
> [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#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/David-Lechner/iio-pressure-cros_ec_baro-simplify-timestamp-channel-definition/20260525-134550
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> patch link:    https://lore.kernel.org/r/20260525014654.2399354-1-dlechner%40baylibre.com
> patch subject: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
> config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20260528/202605281432.a64fe4iY-lkp@intel.com/config)
> compiler: m68k-linux-gcc (GCC) 15.2.0
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260528/202605281432.a64fe4iY-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202605281432.a64fe4iY-lkp@intel.com/
> 
> All errors (new ones prefixed by >>):
> 
>    In file included from include/linux/iio/buffer.h:10,
>                     from drivers/iio/pressure/cros_ec_baro.c:9:
>    drivers/iio/pressure/cros_ec_baro.c: In function 'cros_ec_baro_probe':
> >> include/linux/iio/iio.h:356:38: error: expected expression before '{' token  
>      356 | #define IIO_CHAN_SOFT_TIMESTAMP(_si) {                                  \
>          |                                      ^
>    drivers/iio/pressure/cros_ec_baro.c:174:20: note: in expansion of macro 'IIO_CHAN_SOFT_TIMESTAMP'
>      174 |         *channel = IIO_CHAN_SOFT_TIMESTAMP(1);
>          |                    ^~~~~~~~~~~~~~~~~~~~~~~
> 
> 
> vim +356 include/linux/iio/iio.h
> 
> 00c5f80c2fad53 include/linux/iio/iio.h   Peter Rosin      2016-11-08  355  
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12 @356  #define IIO_CHAN_SOFT_TIMESTAMP(_si) {					\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  357  	.type = IIO_TIMESTAMP,						\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  358  	.channel = -1,							\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  359  	.scan_index = _si,						\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  360  	.scan_type = {							\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  361  		.sign = 's',						\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  362  		.realbits = 64,					\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  363  		.storagebits = 64,					\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  364  		},							\
> 07d4655b410a4d include/linux/iio/iio.h   Jonathan Cameron 2013-11-12  365  }
> 1d892719e70e47 drivers/staging/iio/iio.h Jonathan Cameron 2011-05-18  366  
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
Re: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
Posted by David Lechner 2 weeks ago
On 5/24/26 8:46 PM, David Lechner wrote:
> Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
> manually filling in the struct iio_chan_spec fields. This makes the code
> less verbose and mistake-prone.
> 
FYI, there was a server error when doing b4 send, so this last patch
didn't get sent with the rest. I missed the [PATCH v2 9/9] when editing
it manually to send again.
Re: [PATCH] iio: pressure: cros_ec_baro: simplify timestamp channel definition
Posted by Jonathan Cameron 1 week, 6 days ago
On Sun, 24 May 2026 20:49:11 -0500
David Lechner <dlechner@baylibre.com> wrote:

> On 5/24/26 8:46 PM, David Lechner wrote:
> > Use IIO_CHAN_SOFT_TIMESTAMP() to define the timestamp channel instead of
> > manually filling in the struct iio_chan_spec fields. This makes the code
> > less verbose and mistake-prone.
> >   
> FYI, there was a server error when doing b4 send, so this last patch
> didn't get sent with the rest. I missed the [PATCH v2 9/9] when editing
> it manually to send again.
> 
> 

New and exciting way to confuse b4 :)  Anyhow easy to work around
with a -v 2 for the first lot and then it thinks this one is v3 anyway.

Applied.

Thanks,

Jonathan