Give icee(4) a detach() method so it can be used as a module. Add a

module makefile for it.
This commit is contained in:
Ian Lepore 2017-09-17 22:58:13 +00:00
parent c50df68a08
commit d18915fadb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=323691
3 changed files with 33 additions and 0 deletions

View File

@ -206,9 +206,23 @@ icee_attach(device_t dev)
return (0);
}
static int
icee_detach(device_t dev)
{
struct icee_softc *sc = device_get_softc(dev);
destroy_dev(sc->cdev);
return (0);
}
static int
icee_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
{
struct icee_softc *sc;
sc = CDEV2SOFTC(dev);
if (device_get_state(sc->dev) < DS_BUSY)
device_busy(sc->dev);
return (0);
}
@ -216,7 +230,10 @@ icee_open(struct cdev *dev, int oflags, int devtype, struct thread *td)
static int
icee_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
{
struct icee_softc *sc;
sc = CDEV2SOFTC(dev);
device_unbusy(sc->dev);
return (0);
}
@ -345,6 +362,7 @@ icee_write(struct cdev *dev, struct uio *uio, int ioflag)
static device_method_t icee_methods[] = {
DEVMETHOD(device_probe, icee_probe),
DEVMETHOD(device_attach, icee_attach),
DEVMETHOD(device_detach, icee_detach),
DEVMETHOD_END
};

View File

@ -6,6 +6,7 @@ SUBDIR = \
ds1307 \
ds13rtc \
ds3231 \
icee \
if_ic \
iic \
iicbb \

View File

@ -0,0 +1,14 @@
# $FreeBSD$
.PATH: ${SRCTOP}/sys/dev/iicbus
KMOD= icee
SRCS= icee.c
SRCS+= \
bus_if.h \
device_if.h \
iicbus_if.h \
ofw_bus_if.h \
opt_platform.h \
.include <bsd.kmod.mk>