lkml.org 
[lkml]   [2012]   [Mar]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] edac: move const pci_device_id tables from __devinitdata to __devinitconst.
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),
},
...
};


\
 
 \ /
  Last update: 2012-03-04 23:19    [W:0.064 / U:0.040 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site