add a function to lookup the i2c controller tag for the specified device_t

This commit is contained in:
jmcneill 2013-01-01 23:20:24 +00:00
parent b4041ccef0
commit 39c8eada8e

View File

@ -1,4 +1,4 @@
/* $NetBSD: omap3_i2c.c,v 1.1 2012/12/31 12:45:49 jmcneill Exp $ */
/* $NetBSD: omap3_i2c.c,v 1.2 2013/01/01 23:20:24 jmcneill Exp $ */
/*-
* Copyright (c) 2012 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: omap3_i2c.c,v 1.1 2012/12/31 12:45:49 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: omap3_i2c.c,v 1.2 2013/01/01 23:20:24 jmcneill Exp $");
#include "opt_omap.h"
@ -88,6 +88,8 @@ static int omap3_i2c_wait(struct omap3_i2c_softc *, uint16_t, uint16_t);
static int omap3_i2c_stat(struct omap3_i2c_softc *);
static int omap3_i2c_flush(struct omap3_i2c_softc *);
i2c_tag_t omap3_i2c_get_tag(device_t);
CFATTACH_DECL2_NEW(omap3_i2c, sizeof(struct omap3_i2c_softc),
omap3_i2c_match, omap3_i2c_attach, NULL, NULL,
omap3_i2c_rescan, omap3_i2c_childdet);
@ -434,3 +436,15 @@ omap3_i2c_flush(struct omap3_i2c_softc *sc)
return 0;
}
i2c_tag_t
omap3_i2c_get_tag(device_t dev)
{
struct omap3_i2c_softc *sc;
if (dev == NULL)
return NULL;
sc = device_private(dev);
return &sc->sc_ic;
}