File lincdadrv_module.diff of Package degirum

diff --git a/src/Makefile b/src/Makefile
index 2398f41..337e918 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -89,11 +89,6 @@ endif
 
 postinstall:
 	@sudo -E depmod
-ifneq ($(IS_SYSTEMD_USED),other)
-	@echo $(TARGET_MODULE) | sudo -E tee -i /etc/modules-load.d/cdapci.conf > /dev/null
-else
-	$(warning "No module autostart on reboot")
-endif
 ifeq ($(IS_THERE_CDA_GROUP),no)
 	$(warning "No group dg_orca. Creating it.")
 	@sudo -E groupadd $(DG_GROUP)
diff --git a/src/cdadrv.c b/src/cdadrv.c
index c1c501c..c86c0fd 100644
--- a/src/cdadrv.c
+++ b/src/cdadrv.c
@@ -61,9 +61,9 @@ static struct pci_device_id cda_pci_ids[] = {
 	{ PCI_DEVICE(0x1f0d, 0x8101) },
 	{ PCI_DEVICE(0x1f0d, 0x0101) },
 	{ PCI_DEVICE(0x10ee, 0x8011) },
-	{ PCI_DEVICE(0, 0) },
-	{ PCI_DEVICE(0, 0) },
+	{ }
 };
+MODULE_DEVICE_TABLE(pci, cda_pci_ids);
 
 static struct pci_driver cda_pci = {
 	.name = cda_name,
@@ -363,7 +363,6 @@ static void cdadev_release(struct device *dev)
 static int __init cdadrv_init(void)
 {
 	int ret;
-	size_t pci_id_table_size = ARRAY_SIZE(cda_pci_ids);
 
 	if (test_probe) {
 		pr_info("Test run. Nothing initialized\n");
@@ -378,16 +377,19 @@ static int __init cdadrv_init(void)
 	if (ret)
 		goto err_cls_reg;
 
-	if ((req_pci_did || req_pci_vid) && pci_id_table_size >= 2) {
-		// Last table element is 0,0
-		// Update pre-last item
-		cda_pci_ids[pci_id_table_size-2].vendor = req_pci_vid;
-		cda_pci_ids[pci_id_table_size-2].device = req_pci_did;
-	}
 	ret = pci_register_driver(&cda_pci);
 	if (ret)
 		goto err_pci_reg_drv;
 
+	if (req_pci_did || req_pci_vid) {
+		ret = pci_add_dynid(&cda_pci, req_pci_vid, req_pci_did,
+				    PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0);
+		if (ret)
+			pr_warn("failed to add dynamic ID [%04x:%04x]\n", req_pci_vid, req_pci_did);
+		else
+			pr_info("add [%04x:%04x]\n", req_pci_vid, req_pci_did);
+	}
+
 	return 0;
 
 err_pci_reg_drv:
openSUSE Build Service is sponsored by