On 12/13/2024 5:35 PM, Lizhi Hou wrote:
On 12/13/24 13:33, Jeffrey Hugo wrote:
-static struct qaic_device *create_qdev(struct pci_dev *pdev, const
struct pci_device_id *id)
+static struct qaic_device *create_qdev(struct pci_dev *pdev,
+ const struct qaic_device_config *config)
{
struct device *dev = &pdev->dev;
struct qaic_drm_device *qddev;
@@ -365,12 +391,10 @@ static struct qaic_device *create_qdev(struct
pci_dev *pdev, const struct pci_de
return NULL;
qdev->dev_state = QAIC_OFFLINE;
- if (id->device == PCI_DEV_AIC080 || id->device == PCI_DEV_AIC100) {
- qdev->num_dbc = 16;
- qdev->dbc = devm_kcalloc(dev, qdev->num_dbc,
sizeof(*qdev->dbc), GFP_KERNEL);
- if (!qdev->dbc)
- return NULL;
- }
+ qdev->num_dbc = 16;
Is it better to put num_dbc in qaic_device_config?
I think there is no clear "right answer". All known devices use 16.
There may be a future device which has a different value, at which point
I think this needs to be in qaic_device_config. For this patch, I was
conservative and only included items in qaic_device_config which do vary
between the known devices.
I'll think in this a bit more.
Thanks,
Lizhi