Skip to content

Don't rename the already registered PCI-device#87

Merged
hao-yao merged 1 commit into
intel:masterfrom
jwrdegoede:ipu6-remove-dev_set_name
Feb 14, 2023
Merged

Don't rename the already registered PCI-device#87
hao-yao merged 1 commit into
intel:masterfrom
jwrdegoede:ipu6-remove-dev_set_name

Conversation

@jwrdegoede

Copy link
Copy Markdown
Contributor

Devices must not be renamed after they have already been added to the device hierarchy.

dev_set_name() MUST only be called before dev_add() and the pci_dev passed to ipu_pci_probe() has been added long before ipu_pci_probe() runs, so it must not rename it.

Renaming it is confusing udevd which now all of a sudden sees a device it already knows about change name.

This is causing udev rules to not work properly with the ipu6-driver. Drop the clearly wrong dev_set_name() call.

@hao-yao

hao-yao commented Feb 10, 2023

Copy link
Copy Markdown
Contributor

Hi @jwrdegoede ,

Would you mind adding this change to your commit?

diff --git a/drivers/media/pci/intel/ipu.c b/drivers/media/pci/intel/ipu.c
index c9968fd38..1bd8f4dd7 100644
--- a/drivers/media/pci/intel/ipu.c
+++ b/drivers/media/pci/intel/ipu.c
@@ -299,7 +299,7 @@ static int ipu_init_debugfs(struct ipu_device *isp)
        struct dentry *file;
        struct dentry *dir;
 
-       dir = debugfs_create_dir(pci_name(isp->pdev), NULL);
+       dir = debugfs_create_dir(IPU_NAME, NULL);
        if (!dir)
                return -ENOMEM;

devices must not be renamed after they have already been
added to the device hierarchy.

dev_set_name() MUST only be called before dev_add()
and the pci_dev passed to ipu_pci_probe() has been
added long before ipu_pci_probe() runs, so it must
not rename it.

Renaming it is confusing udevd which now all of a sudden sees
a device it already knows about change name.

This is causing udev rules to not work properly with
the ipu6-driver. Drop the clearly wrong dev_set_name() call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
@jwrdegoede
jwrdegoede force-pushed the ipu6-remove-dev_set_name branch from 897a15d to 2d1b1ad Compare February 13, 2023 14:30
@jwrdegoede

Copy link
Copy Markdown
Contributor Author

Hi @jwrdegoede ,

Would you mind adding this change to your commit?

diff --git a/drivers/media/pci/intel/ipu.c b/drivers/media/pci/intel/ipu.c
index c9968fd38..1bd8f4dd7 100644
--- a/drivers/media/pci/intel/ipu.c
+++ b/drivers/media/pci/intel/ipu.c
@@ -299,7 +299,7 @@ static int ipu_init_debugfs(struct ipu_device *isp)
        struct dentry *file;
        struct dentry *dir;
 
-       dir = debugfs_create_dir(pci_name(isp->pdev), NULL);
+       dir = debugfs_create_dir(IPU_NAME, NULL);
        if (!dir)
                return -ENOMEM;

Done, good catch.

Note this changes the debugfs dir-name from "intel-ipu" to "intel-ipu6" though. Let me know if that is undesirable and I'll change IPU_NAME to "intel-ipu".

@hao-yao

hao-yao commented Feb 14, 2023

Copy link
Copy Markdown
Contributor

Note this changes the debugfs dir-name from "intel-ipu" to "intel-ipu6" though. Let me know if that is undesirable and I'll change IPU_NAME to "intel-ipu".

After we removed the set_dev_name, debugfs dir is the only affected part. We finally decided to change that to IPU_NAME ("intel-ipu6"), which is clearer, instead of "intel-ipu". So now this patch is exactly we need. Thanks @jwrdegoede !

@hao-yao
hao-yao merged commit fb6d5e6 into intel:master Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants