--- tme/generic/bus-device.c 2018/04/24 16:38:32 1.1.1.2 +++ tme/generic/bus-device.c 2018/04/24 16:41:10 1.1.1.4 @@ -1,4 +1,4 @@ -/* $Id: bus-device.c,v 1.1.1.2 2018/04/24 16:38:32 root Exp $ */ +/* $Id: bus-device.c,v 1.1.1.4 2018/04/24 16:41:10 root Exp $ */ /* generic/bus-device.c - implementation of a generic bus device support: */ @@ -34,11 +34,14 @@ */ #include -_TME_RCSID("$Id: bus-device.c,v 1.1.1.2 2018/04/24 16:38:32 root Exp $"); +_TME_RCSID("$Id: bus-device.c,v 1.1.1.4 2018/04/24 16:41:10 root Exp $"); /* includes: */ #include +/* include the automatically-generated bus-device functions: */ +#include "bus-device-auto.c" + /* this scores a connection: */ int tme_bus_device_connection_score(struct tme_connection *conn, unsigned int *_score) @@ -57,8 +60,10 @@ tme_bus_device_connection_score(struct t /* a simple bus device can have multiple connections, but they all must be from the same bus. the only way we check that is by comparing elements: */ - conn_bus_other_old = TME_ATOMIC_READ(struct tme_bus_connection *, - device->tme_bus_device_connection); + conn_bus_other_old + = tme_memory_atomic_pointer_read(struct tme_bus_connection *, + device->tme_bus_device_connection, + &device->tme_bus_device_connection_rwlock); conn_bus_other_new = (struct tme_bus_connection *) conn->tme_connection_other; if (conn_bus_other_old != NULL && (conn_bus_other_old->tme_bus_connection.tme_connection_element @@ -95,9 +100,10 @@ tme_bus_device_connection_make(struct tm if (state == TME_CONNECTION_FULL) { /* save our connection: */ - TME_ATOMIC_WRITE(struct tme_bus_connection *, - device->tme_bus_device_connection, - (struct tme_bus_connection *) conn->tme_connection_other); + tme_memory_atomic_pointer_write(struct tme_bus_connection *, + device->tme_bus_device_connection, + (struct tme_bus_connection *) conn->tme_connection_other, + &device->tme_bus_device_connection_rwlock); } return (TME_OK);