iio: Unify __packed use and fix a hidden regression
v2 cover iio: Unify __packed use and fix a hidden regression
While checking the Sparse errors on IIO subsystem (to make it sparse-error-free) I noticed a one issue in ssp_sensors driver which appears to be a regression that is fixed in patch 1. Patches 2 and 3 to unify the style of __packed use over IIO subsystem.
In v2:
- added patches 2 & 3
- rewrote commit message of patch 1 (Jonathan, Sashiko)
Andy Shevchenko (3):
iio: common: ssp_sensors: Use __packed instead of __packed__
iio: chemical: ccs811: Use __packed shortcut for compiler attribute
iio: chemical: sgp30: Use __packed shortcut for compiler attribute
drivers/iio/chemical/ccs811.c | 2 +- drivers/iio/chemical/sgp30.c | 2 +- drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.50.1
PATCH v2 1/3 iio: common: ssp_sensors: Use __packed instead of __packed__
Sparse can't recognise __packed__ as compiler attribute:
.../ssp_sensors/ssp_dev.c:30:3: warning: symbol '__packed__' was not declared. Should it be static?
Moreover it appears that the culprit commit (see Fixes tag below) mistakenly used the non-existed keyword replacing the compiler attribute with the exported variable named '__packed__'.
Use __packed instead of __packed__ to fix the regression and make sparse happy.
--- drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/common/ssp_sensors/ssp_dev.c +1 -1
@@ -27,7 +27,7 @@ struct ssp_instruction {__le32 a;__le32 b;u8 c; -}__packed__ ; +} __packed;static const u8 ssp_magnitude_table[] = {110 ,85 ,171 ,71 ,203 ,195 ,0 ,67 ,208 ,56 ,175 ,244 ,206 ,213 ,0 ,92 ,250 ,0 ,55 ,48 ,189 ,252 ,171 ,
Signature · 1 line
2.50.1
PATCH v2 2/3 iio: chemical: ccs811: Use __packed shortcut for compiler attribute
In reply to Andy ShevchenkoUse __packed shortcut for __packed__ compiler attribute as it's a common style in IIO subsystem and Linux kernel in general.
--- drivers/iio/chemical/ccs811.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/ccs811.c +1 -1
@@ -70,7 +70,7 @@ struct ccs811_reading {u8 status;u8 error;__be16 raw_data; -} __attribute__((__packed__)); +} __packed;struct ccs811_data {struct i2c_client *client;
Signature · 1 line
2.50.1
PATCH v2 3/3 iio: chemical: sgp30: Use __packed shortcut for compiler attribute
In reply to Andy ShevchenkoUse __packed shortcut for __packed__ compiler attribute as it's a common style in IIO subsystem and Linux kernel in general.
--- drivers/iio/chemical/sgp30.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/chemical/sgp30.c +1 -1
@@ -82,7 +82,7 @@ struct sgp_version {struct sgp_crc_word {__be16 value;u8 crc8; -} __attribute__((__packed__ )); +} __packed;union sgp_reading {u8 start;
Signature · 1 line
2.50.1
Quoted 5 lines · On Mon, 30 Nov 2026 18:01:10 +0100 Andy Shevchenko…
While checking the Sparse errors on IIO subsystem (to make it sparse-error-free) I noticed a one issue in
ssp_sensorsdriver which appears to be a regression that is fixed in patch 1. Patches 2 and 3 to unify the style of__packeduse over IIO subsystem.
Applied patch 1 to the fixes-togreg branch of iio.git and 2-3 to the testing branch of iio.git.
Patches 2 and 3 actually so closely matched patches from Adi Nata earlier in the year that b4 picked up tags given for those. They didn't merge due to some minor comments and process issues.
I didn't carry the tags for these as the source was not a conventional one.
Thanks,
Jonathan
Quoted 15 lines
In v2:
- added patches 2 & 3
- rewrote commit message of patch 1 (Jonathan, Sashiko)Andy Shevchenko (3):
iio: common:ssp_sensors: Use__packedinstead of__packed__
iio: chemical: ccs811: Use__packedshortcut for compiler attribute
iio: chemical: sgp30: Use__packedshortcut for compiler attributedrivers/iio/chemical/ccs811.c | 2 +- drivers/iio/chemical/sgp30.c | 2 +- drivers/iio/common/ssp_sensors/ssp_dev.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Mon, 30 Nov 2026 18:01:10 +0100 Andy Shevchenko…
While checking the Sparse errors on IIO subsystem (to make it sparse-error-free) I noticed a one issue in
ssp_sensorsdriver which appears to be a regression that is fixed in patch 1. Patches 2 and 3 to unify the style of__packeduse over IIO subsystem.
Quoted 6 lines
Applied patch 1 to the fixes-togreg branch of iio.git and 2-3 to the testing branch of iio.git.
Patches 2 and 3 actually so closely matched patches from Adi Nata earlier in the year that b4 picked up tags given for those. They didn't merge due to some minor comments and process issues.
Ah, interesting, never thought that there were already attempts to address this.
Quoted 2 lines
I didn't carry the tags for these as the source was not a conventional one.
Fine by me, thanks!
Signature · 2 lines
With Best Regards, Andy Shevchenko