media: atomisp: Drop is_valid_device() function
authorHans de Goede <hdegoede@redhat.com>
Tue, 26 Dec 2023 15:32:10 +0000 (16:32 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Thu, 1 Feb 2024 06:02:21 +0000 (07:02 +0100)
Now that a single build supports both the ISP 2400 and the ISP 2401
this function is no longer necessary. The main probe() already
contains a similar switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK)
checking for a known device_id.

Move the revision check into the main probe() and drop
the is_valid_device() function.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_v4l2.c

index 206fdaee595232600a2876d47e2ebd79192e48ab..176b39906d107ddc437927a621fc2f7ef387be7c 100644 (file)
@@ -1192,48 +1192,6 @@ atomisp_load_firmware(struct atomisp_device *isp)
        return fw;
 }
 
-/*
- * Check for flags the driver was compiled with against the PCI
- * device. Always returns true on other than ISP 2400.
- */
-static bool is_valid_device(struct pci_dev *pdev, const struct pci_device_id *id)
-{
-       const char *name;
-       const char *product;
-
-       product = dmi_get_system_info(DMI_PRODUCT_NAME);
-
-       switch (id->device & ATOMISP_PCI_DEVICE_SOC_MASK) {
-       case ATOMISP_PCI_DEVICE_SOC_MRFLD:
-               name = "Merrifield";
-               break;
-       case ATOMISP_PCI_DEVICE_SOC_BYT:
-               name = "Baytrail";
-               break;
-       case ATOMISP_PCI_DEVICE_SOC_ANN:
-               name = "Anniedale";
-               break;
-       case ATOMISP_PCI_DEVICE_SOC_CHT:
-               name = "Cherrytrail";
-               break;
-       default:
-               dev_err(&pdev->dev, "%s: unknown device ID %x04:%x04\n",
-                       product, id->vendor, id->device);
-               return false;
-       }
-
-       if (pdev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) {
-               dev_err(&pdev->dev, "%s revision %d is not unsupported\n",
-                       name, pdev->revision);
-               return false;
-       }
-
-       dev_info(&pdev->dev, "Detected %s version %d (ISP240%c) on %s\n",
-                name, pdev->revision, IS_ISP2401 ? '1' : '0', product);
-
-       return true;
-}
-
 #define ATOM_ISP_PCI_BAR       0
 
 static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -1244,9 +1202,6 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
        int err, val;
        u32 irq;
 
-       if (!is_valid_device(pdev, id))
-               return -ENODEV;
-
        /* Pointer to struct device. */
        atomisp_dev = &pdev->dev;
 
@@ -1386,6 +1341,11 @@ static int atomisp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *i
                goto atomisp_dev_alloc_fail;
        }
 
+       if (pdev->revision <= ATOMISP_PCI_REV_BYT_A0_MAX) {
+               dev_err(&pdev->dev, "revision %d is not unsupported\n", pdev->revision);
+               return -ENODEV;
+       }
+
        dev_info(&pdev->dev, "ISP HPLL frequency base = %d MHz\n", isp->hpll_freq);
 
        isp->max_isr_latency = ATOMISP_MAX_ISR_LATENCY;