Skip to contentSkip to conversation

media: mei_csi/mei_ace: Fix driver modalias not matching device modalias

PATCH In review Hans de Goede 2 participants 5 messages Oct 24, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover media: mei_csi/mei_ace: Fix driver modalias not matching device modalias

Hi All,

This fixes an issue with the mei device-id matching which I noticed while debugging an out of tree IPU6 driver issue which a Fedora user was seeing with kernels >= 6.5 on a Dell Precision 5470 which uses the VSC chip.

Note the root cause there was a different issue and these patches have been compile tested only, please test.

Regards,

Hans

Hans de Goede (2):
media: mei_csi: Fix driver modalias not matching device modalias
media: mei_ace: Fix driver modalias not matching device modalias

 drivers/media/pci/intel/ivsc/mei_ace.c | 2 +-
 drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/2 media: mei_csi: Fix driver modalias not matching device modalias

The name field of struct mei_cl_device_id is only intended for use with NFC devices where different devices share the same GUID, see drivers/misc/mei/bus-fixup.c which sets the name field to "microread" or "pn544".

For all other mei devices the name field is unset and specifying it in the drivers mei_cl_device_id MODULE_DEVICE_TABLE() leads to the driver not properly being autoloaded by modprobe since it causes the module's alias to not match:

cat .../spi-INTC1094:00-92335fcf-3203-4472-af93-7b4453ac29da/modalias mei::92335fcf-3203-4472-af93-7b4453ac29da:01:

modinfo mei_csi | grep alias mei:vsc_csi:92335fcf-3203-4472-af93-7b4453ac29da:*:*

Things still work when manually loading the module because mei_cl_device_find() only matches the name when the *device* has a name set, so setting it in the id_table of the driver does not matter.

Drop setting the name in mei_csi_tbl[] so that modprobe will properly autoload the module.

This makes the mei_cl_device_id use identical to all the other non NFC mei drivers:
drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c drivers/misc/mei/hdcp/mei_hdcp.c drivers/misc/mei/pxp/mei_pxp.c drivers/watchdog/mei_wdt.c

---
 drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ivsc/mei_csi.c +1 -1
index 00ba611e0f68..dab89b0f417e 100644
@@ -804,7 +804,7 @@ static void mei_csi_remove(struct mei_cl_device *cldev)
 			     0xAF, 0x93, 0x7b, 0x44, 0x53, 0xAC, 0x29, 0xDA)
 
 static const struct mei_cl_device_id mei_csi_tbl[] = {
-	{ MEI_CSI_DRIVER_NAME, MEI_CSI_UUID, MEI_CL_VERSION_ANY },
+	{ .uuid = MEI_CSI_UUID, .version = MEI_CL_VERSION_ANY },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(mei, mei_csi_tbl);
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/2 media: mei_ace: Fix driver modalias not matching device modalias

In reply to Hans de Goede

The name field of struct mei_cl_device_id is only intended for use with NFC devices where different devices share the same GUID, see drivers/misc/mei/bus-fixup.c which sets the name field to "microread" or "pn544".

For all other mei devices the name field is unset and specifying it in the drivers mei_cl_device_id MODULE_DEVICE_TABLE() leads to the driver not properly being autoloaded by modprobe since it causes the module's alias to not match:

cat .../spi-INTC1094:00-5db76cf6-0a68-4ed6-9b78-0361635e2447/modalias mei::5db76cf6-0a68-4ed6-9b78-0361635e2447:01:

modinfo mei_ace | grep alias mei:vsc_ace:5db76cf6-0a68-4ed6-9b78-0361635e2447:*:*

Things still work when manually loading the module because mei_cl_device_find() only matches the name when the *device* has a name set, so setting it in the id_table of the driver does not matter.

Drop setting the name in mei_ace_tbl[] so that modprobe will properly autoload the module.

This makes the mei_cl_device_id use identical to all the other non NFC mei drivers:
drivers/misc/mei/gsc_proxy/mei_gsc_proxy.c drivers/misc/mei/hdcp/mei_hdcp.c drivers/misc/mei/pxp/mei_pxp.c drivers/watchdog/mei_wdt.c

---
 drivers/media/pci/intel/ivsc/mei_ace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/pci/intel/ivsc/mei_ace.c +1 -1
index a0491f307831..e0a4deb9dc16 100644
@@ -554,7 +554,7 @@ static const struct dev_pm_ops mei_ace_pm_ops = {
 			     0x9B, 0x78, 0x03, 0x61, 0x63, 0x5E, 0x24, 0x47)
 
 static const struct mei_cl_device_id mei_ace_tbl[] = {
-	{ MEI_ACE_DRIVER_NAME, MEI_ACE_UUID, MEI_CL_VERSION_ANY },
+	{ .uuid = MEI_ACE_UUID, .version = MEI_CL_VERSION_ANY },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(mei, mei_ace_tbl);
Signature · 1 line
2.41.0
#3 lore raw
In reply to Hans de Goede

Hi Hans,

Thanks for your patch, but I think this has been fixed by below commit
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/media/pci/intel/ivsc/mei_csi.c?id=18e35ba0d89f89bdda8001c6b34b18f62917d10d
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/media/pci/intel/ivsc/mei_ace.c?id=6b6f41791b443e9d141ae254ec0de833841497a9

BR,
Wentong

Quoted 26 lines

From: Hans de Goede <hdegoede>

Hi All,

This fixes an issue with the mei device-id matching which I noticed while debugging an out of tree IPU6 driver issue which a Fedora user was seeing with kernels >= 6.5 on a Dell Precision 5470 which uses the VSC chip.

Note the root cause there was a different issue and these patches have been compile tested only, please test.

Regards,

Hans

Hans de Goede (2):
media: mei_csi: Fix driver modalias not matching device modalias
media: mei_ace: Fix driver modalias not matching device modalias

 drivers/media/pci/intel/ivsc/mei_ace.c | 2 +-
drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.41.0

#4 lore raw

Hi,

Quoted 5 lines · Wentong

Hi Hans,

Thanks for your patch, but I think this has been fixed by below commit
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/media/pci/intel/ivsc/mei_csi.c?id=18e35ba0d89f89bdda8001c6b34b18f62917d10d
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/drivers/media/pci/intel/ivsc/mei_ace.c?id=6b6f41791b443e9d141ae254ec0de833841497a9

Ah right it looks like this is already fixed, so this patch series can be dropped.

Regards,

Hans

Quoted 27 lines
Quoted 26 lines

From: Hans de Goede <hdegoede>

Hi All,

This fixes an issue with the mei device-id matching which I noticed while debugging an out of tree IPU6 driver issue which a Fedora user was seeing with kernels >= 6.5 on a Dell Precision 5470 which uses the VSC chip.

Note the root cause there was a different issue and these patches have been compile tested only, please test.

Regards,

Hans

Hans de Goede (2):
media: mei_csi: Fix driver modalias not matching device modalias
media: mei_ace: Fix driver modalias not matching device modalias

 drivers/media/pci/intel/ivsc/mei_ace.c | 2 +-
drivers/media/pci/intel/ivsc/mei_csi.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

--
2.41.0