On 11/07/2018 19:46, Emanuele wrote: >>> +static void qpci(void) >>> +{ >>> + qos_node_create_interface("pci-bus"); >>> +} >>> + >>> +libqos_init(qpci); >> Why does an interface need to be created? The drivers declare which >> interfaces they support? >> >> I don't think this can be used to detect typoes in the driver's >> qos_node_produces() call since there is no explicit control over the >> order in which libqos_init() functions are called. So the driver may >> call qos_node_produces() before the qos_node_create_interface() is >> called? > The interface is what is actually given to the test, so from there it > can test the functions and fields regardless of which driver is actually > implementing them. > For example, sdhci-test uses the QSDHCI functions, and depending on the > path the generic-sdhci or sdhci-pci functions will be used.
I think Stefan is right, if you adjust qos_node_create_interface so that it is idempotent(*), you can make it static and call it from qos_node_produces and qos_node_consumes. (*) that is, fail like now if the node exists and is not an interface; but, succeed if the node exists and is an interface. Thanks, Paolo