Re: [PATCH v1.3 6/18] arcmsr: precise checking adapter ID

From: Christoph Hellwig
Date: Fri Aug 01 2014 - 08:34:18 EST


> -static void arcmsr_define_adapter_type(struct AdapterControlBlock *acb)
> +static bool arcmsr_define_adapter_type(struct AdapterControlBlock *acb)
> {
> struct pci_dev *pdev = acb->pdev;
> u16 dev_id;
> +
> pci_read_config_word(pdev, PCI_DEVICE_ID, &dev_id);
> acb->dev_id = dev_id;

This is already available through pdev->device.


> acb->adapter_type = ACB_ADAPTER_TYPE_C;

Just store the adapter type in the pci_device_id private data field,
that way you enumerate the type in the same place the ids are added
and you'll never miss adding them to a switch value.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/