From 98ec1b8df807427531f5312bdacaa4f6a6f8317c Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 10 Dec 2018 00:31:45 +0000 Subject: [PATCH] Make i2c_acquire_bus() / i2c_release_bus() real symbols. --- sys/dev/i2c/i2c_exec.c | 28 ++++++++++++++++++++++++++-- sys/dev/i2c/i2cvar.h | 9 +++------ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/sys/dev/i2c/i2c_exec.c b/sys/dev/i2c/i2c_exec.c index 611285552be2..ec094f1265e4 100644 --- a/sys/dev/i2c/i2c_exec.c +++ b/sys/dev/i2c/i2c_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: i2c_exec.c,v 1.10 2015/03/07 14:16:51 jmcneill Exp $ */ +/* $NetBSD: i2c_exec.c,v 1.11 2018/12/10 00:31:45 thorpej Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -36,7 +36,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.10 2015/03/07 14:16:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.11 2018/12/10 00:31:45 thorpej Exp $"); #include #include @@ -53,6 +53,30 @@ static uint8_t iic_smbus_pec(int, uint8_t *, uint8_t *); static int i2cexec_modcmd(modcmd_t, void *); +/* + * iic_acquire_bus: + * + * Acquire the I2C bus for use by a client. + */ +int +iic_acquire_bus(i2c_tag_t tag, int flags) +{ + + return (*tag->ic_acquire_bus)(tag->ic_cookie, flags); +} + +/* + * iic_release_bus: + * + * Relese the I2C bus, allowing another client to use it. + */ +void +iic_release_bus(i2c_tag_t tag, int flags) +{ + + (*tag->ic_release_bus)(tag->ic_cookie, flags); +} + /* * iic_exec: * diff --git a/sys/dev/i2c/i2cvar.h b/sys/dev/i2c/i2cvar.h index 80e773091ac5..13b019399847 100644 --- a/sys/dev/i2c/i2cvar.h +++ b/sys/dev/i2c/i2cvar.h @@ -1,4 +1,4 @@ -/* $NetBSD: i2cvar.h,v 1.17 2018/06/26 06:34:55 thorpej Exp $ */ +/* $NetBSD: i2cvar.h,v 1.18 2018/12/10 00:31:45 thorpej Exp $ */ /* * Copyright (c) 2003 Wasabi Systems, Inc. @@ -208,11 +208,8 @@ bool iic_use_direct_match(const struct i2c_attach_args *, const cfdata_t, * Simplified API for clients of the i2c framework. Definitions * in . */ -#define iic_acquire_bus(ic, flags) \ - (*(ic)->ic_acquire_bus)((ic)->ic_cookie, (flags)) -#define iic_release_bus(ic, flags) \ - (*(ic)->ic_release_bus)((ic)->ic_cookie, (flags)) - +int iic_acquire_bus(i2c_tag_t, int); +void iic_release_bus(i2c_tag_t, int); int iic_exec(i2c_tag_t, i2c_op_t, i2c_addr_t, const void *, size_t, void *, size_t, int);