Skip to contentSkip to conversation

FAILED: patch "[PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID" failed to apply to 4.19-stable tree

PATCH [email protected] 3 participants 6 messages Jan 19, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

    st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +2 -1
index a7d40c02ce6b..b921dd9e108f 100644
@@ -1301,7 +1301,8 @@ static int st_lsm6dsx_check_whoami(struct st_lsm6dsx_hw *hw, int id,
 
 	for (i = 0; i < ARRAY_SIZE(st_lsm6dsx_sensor_settings); i++) {
 		for (j = 0; j < ST_LSM6DSX_MAX_ID; j++) {
-			if (id == st_lsm6dsx_sensor_settings[i].id[j].hw_id)
+			if (st_lsm6dsx_sensor_settings[i].id[j].name &&
+			    id == st_lsm6dsx_sensor_settings[i].id[j].hw_id)
 				break;
 		}
 		if (j < ST_LSM6DSX_MAX_ID)
maintainer
#1 lore raw
Quoted 37 lines · On Sun, Jan 19, 2020 at 02:33:30PM +0100, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

   st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Quoted 6 lines
Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")

I don't think that this is needed on anything older than 5.4 because they don't have 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO"), the fixes tag might be misleading here a bit.

Signature · 2 lines
Thanks,
Sasha
#2 lore raw
Quoted 45 lines · Sasha Levin
Quoted 37 lines · On Sun, Jan 19, 2020 at 02:33:30PM +0100, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

   st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Quoted 6 lines
Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Quoted 3 lines

I don't think that this is needed on anything older than 5.4 because they don't have 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO"), the fixes tag might be misleading here a bit.

Correct. I didn't want to use 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") as Fixes tag because that commit did not do anything wrong - the problem was introduced earlier, but there is no way to trigger it on older kernels.

This is why I added # 5.5 to the Cc: stable tag.
Are these comments still used in any way?
Or is there a better way to encode this into the commit message?

Thanks,
Stephan

maintainer
#3 lore raw
Quoted 50 lines · Stephan Gerhold
Quoted 45 lines · Sasha Levin
Quoted 37 lines · On Sun, Jan 19, 2020 at 02:33:30PM +0100, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

   st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Quoted 6 lines
Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Quoted 3 lines

I don't think that this is needed on anything older than 5.4 because they don't have 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO"), the fixes tag might be misleading here a bit.

Quoted 8 lines

Correct. I didn't want to use 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") as Fixes tag because that commit did not do anything wrong - the problem was introduced earlier, but there is no way to trigger it on older kernels.

This is why I added # 5.5 to the Cc: stable tag.
Are these comments still used in any way?
Or is there a better way to encode this into the commit message?

Usually if there's a fixes: tag we'll look at that rather than the version appended to the stable tag.

Consider maybe using two "Fixes:" tags to point at the commits that were involved.

Signature · 2 lines
Thanks,
Sasha
#4 lore raw
Quoted 60 lines · Sasha Levin
Quoted 50 lines · Stephan Gerhold
Quoted 45 lines · Sasha Levin
Quoted 37 lines · On Sun, Jan 19, 2020 at 02:33:30PM +0100, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

   st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Quoted 6 lines
Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Quoted 3 lines

I don't think that this is needed on anything older than 5.4 because they don't have 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO"), the fixes tag might be misleading here a bit.

Quoted 8 lines

Correct. I didn't want to use 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") as Fixes tag because that commit did not do anything wrong - the problem was introduced earlier, but there is no way to trigger it on older kernels.

This is why I added # 5.5 to the Cc: stable tag.
Are these comments still used in any way?
Or is there a better way to encode this into the commit message?

Quoted 5 lines

Usually if there's a fixes: tag we'll look at that rather than the version appended to the stable tag.

Consider maybe using two "Fixes:" tags to point at the commits that were involved.

So basically this

Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Fixes 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")

would mean "fixes the combination of these two commits"?

maintainer
#5 lore raw
Quoted 67 lines · Stephan Gerhold
Quoted 60 lines · Sasha Levin
Quoted 50 lines · Stephan Gerhold
Quoted 45 lines · Sasha Levin
Quoted 37 lines · On Sun, Jan 19, 2020 at 02:33:30PM +0100, [email protected] wrote:

The patch below does not apply to the 4.19-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From fb4fbc8904e786537e29329d791147389e1465a2 Mon Sep 17 00:00:00 2001
From: Stephan Gerhold <[email protected]>
Date: Mon, 16 Dec 2019 13:41:20 +0100
Subject: [PATCH] iio: imu: st_lsm6dsx: Fix selection of ST_LSM6DS3_ID

At the moment, attempting to probe a device with ST_LSM6DS3_ID (e.g. using the st,lsm6ds3 compatible) fails with:

   st_lsm6dsx_i2c 1-006b: unsupported whoami [69]

... even though 0x69 is the whoami listed for ST_LSM6DS3_ID.

This happens because st_lsm6dsx_check_whoami() also attempts to match unspecified (zero-initialized) entries in the "id" array. ST_LSM6DS3_ID = 0 will therefore match any entry in st_lsm6dsx_sensor_settings (here: the first), because none of them actually have all 12 entries listed in the "id" array.

Avoid this by additionally checking if "name" is set, which is only set for valid entries in the "id" array.

Note: Although the problem was introduced earlier it did not surface until commit 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1") because ST_LSM6DS3_ID was the first entry in st_lsm6dsx_sensor_settings.

Quoted 6 lines
Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Quoted 3 lines

I don't think that this is needed on anything older than 5.4 because they don't have 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO"), the fixes tag might be misleading here a bit.

Quoted 8 lines

Correct. I didn't want to use 801a6e0af0c6 ("iio: imu: st_lsm6dsx: add support to LSM6DSO") as Fixes tag because that commit did not do anything wrong - the problem was introduced earlier, but there is no way to trigger it on older kernels.

This is why I added # 5.5 to the Cc: stable tag.
Are these comments still used in any way?
Or is there a better way to encode this into the commit message?

Quoted 5 lines

Usually if there's a fixes: tag we'll look at that rather than the version appended to the stable tag.

Consider maybe using two "Fixes:" tags to point at the commits that were involved.

Quoted 6 lines

So basically this

Fixes d068e4a0f921 ("iio: imu: st_lsm6dsx: add support to multiple devices with the same settings")
Fixes 52f4b1f19679 ("iio: imu: st_lsm6dsx: add support for accel/gyro unit of lsm9ds1")

would mean "fixes the combination of these two commits"?

Yup!

Signature · 2 lines
Thanks,
Sasha