Re: [PATCH] edac: move const pci_device_id tables from __devinitdata to __devinitconst.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I also looked at whether PCI_DEVICE and PCI_DEVICE_CLASS could be used more often, and came up with the semantic patch shown below. This should work with the current release of Coccinelle. This affects 40 files, only one of which can use PCI_DEVICE_CLASS. Perhaps it could be useful to generalize it. Again, I don't have time now to look into it in more detail, but can provide the results if somone is interested.

julia

@@
identifier id;
expression dev_class, dev_class_mask;
@@

struct pci_device_id id[] = {
  ...,
  {
-   .class = (dev_class), .class_mask = (dev_class_mask),
-   .vendor = PCI_ANY_ID, .device = PCI_ANY_ID,
-   .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
+   PCI_DEVICE_CLASS(dev_class,dev_class_mask),
  },
  ...
};

@@
identifier id;
declarer name DEFINE_PCI_DEVICE_TABLE;
expression dev_class, dev_class_mask;
@@

DEFINE_PCI_DEVICE_TABLE(id) = {
  ...,
  {
-   .class = (dev_class), .class_mask = (dev_class_mask),
-   .vendor = PCI_ANY_ID, .device = PCI_ANY_ID,
-   .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
+   PCI_DEVICE_CLASS(dev_class,dev_class_mask),
  },
  ...
};

@@
identifier id;
expression vend, dev;
@@

struct pci_device_id id[] = {
  ...,
  {
-   .vendor = (vend), .device = (dev),
-   .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
+   PCI_DEVICE(vend,dev),
  },
  ...
};

@@
identifier id;
expression vend, dev;
@@

DEFINE_PCI_DEVICE_TABLE(id) = {
  ...,
  {
-   .vendor = (vend), .device = (dev),
-   .subvendor = PCI_ANY_ID, .subdevice = PCI_ANY_ID,
+   PCI_DEVICE(vend,dev),
  },
  ...
};
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux