On Wed, Sep 21, 2011 at 02:09:08PM +0300, Michael S. Tsirkin wrote:
On Wed, Sep 21, 2011 at 01:39:22AM -0400, Amos Kong wrote:
----- Original Message -----
How about moving code into functions so that it isn't duplicated for each PCI device. See the patch below as an example (100% untested).
Hmm, I sent patches that did a similar thing but in a slightly more compact way. Message ids: 20110919092932.GB4501@redhat.com 20110919093644.GC4501@redhat.com 20110919100434.GA6764@redhat.com
Did they not reach you or something's wrong with them?
I received them, but when I saw Amos' v2 patch I thought he included them.
/* Bulk generated PCI hotplug devices */
+#define hotplug_func(nr, fn) \
Device (S##nr##fn) { \
Name (_ADR, 0x##nr##000##fn) \
Method (_EJ0, 1) { Return(PCEJ(0x##nr)) } \
Name (_SUN, 0x##nr) \
}
The fundamental question is still why would we have _EJ0 methods in functions >0 when they are not individually hotpluggable. I think only function 0 should have _EJ0.
I don't know the answer to this question.
Maybe we should just collapse the current definitions and then put the fixes and enhancements on top of the collapsed version.
-Kevin