aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/iicbus/iiconf.c
diff options
context:
space:
mode:
authorIan Lepore <ian@FreeBSD.org>2020-01-02 17:51:49 +0000
committerIan Lepore <ian@FreeBSD.org>2020-01-02 17:51:49 +0000
commit422d05da14fe063e5d187d81a328fa7b362d069f (patch)
tree361e764a342b33f158c412e02621377bceaa3341 /sys/dev/iicbus/iiconf.c
parent84e404763fa5a7e00105ff86e6caff5aebe0e55e (diff)
Notes
Diffstat (limited to 'sys/dev/iicbus/iiconf.c')
-rw-r--r--sys/dev/iicbus/iiconf.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/sys/dev/iicbus/iiconf.c b/sys/dev/iicbus/iiconf.c
index 052de61506716..6f24119660ab0 100644
--- a/sys/dev/iicbus/iiconf.c
+++ b/sys/dev/iicbus/iiconf.c
@@ -137,6 +137,7 @@ iicbus_poll(struct iicbus_softc *sc, int how)
int
iicbus_request_bus(device_t bus, device_t dev, int how)
{
+ struct iic_reqbus_data reqdata;
struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
int error = 0;
@@ -175,8 +176,11 @@ iicbus_request_bus(device_t bus, device_t dev, int how)
*/
IICBUS_UNLOCK(sc);
/* Ask the underlying layers if the request is ok */
+ reqdata.dev = dev;
+ reqdata.bus = bus;
+ reqdata.flags = how | IIC_REQBUS_DEV;
error = IICBUS_CALLBACK(device_get_parent(bus),
- IIC_REQUEST_BUS, (caddr_t)&how);
+ IIC_REQUEST_BUS, (caddr_t)&reqdata);
IICBUS_LOCK(sc);
if (error != 0) {
@@ -201,6 +205,7 @@ iicbus_request_bus(device_t bus, device_t dev, int how)
int
iicbus_release_bus(device_t bus, device_t dev)
{
+ struct iic_reqbus_data reqdata;
struct iicbus_softc *sc = (struct iicbus_softc *)device_get_softc(bus);
IICBUS_LOCK(sc);
@@ -213,7 +218,11 @@ iicbus_release_bus(device_t bus, device_t dev)
if (--sc->owncount == 0) {
/* Drop the lock while informing the low-level driver. */
IICBUS_UNLOCK(sc);
- IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS, NULL);
+ reqdata.dev = dev;
+ reqdata.bus = bus;
+ reqdata.flags = IIC_REQBUS_DEV;
+ IICBUS_CALLBACK(device_get_parent(bus), IIC_RELEASE_BUS,
+ (caddr_t)&reqdata);
IICBUS_LOCK(sc);
sc->owner = NULL;
wakeup_one(sc);