Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Jul 2017 14:58:01 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321792 - head/sys/dev/iicbus
Message-ID:  <201707311458.v6VEw1nj083758@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Mon Jul 31 14:58:01 2017
New Revision: 321792
URL: https://svnweb.freebsd.org/changeset/base/321792

Log:
  Add a detach() method.

Modified:
  head/sys/dev/iicbus/ds1307.c

Modified: head/sys/dev/iicbus/ds1307.c
==============================================================================
--- head/sys/dev/iicbus/ds1307.c	Mon Jul 31 14:57:02 2017	(r321791)
+++ head/sys/dev/iicbus/ds1307.c	Mon Jul 31 14:58:01 2017	(r321792)
@@ -78,14 +78,14 @@ static int
 ds1307_read1(device_t dev, uint8_t reg, uint8_t *data)
 {
 
-	return(iicdev_readfrom(dev, reg, data, 1, IIC_INTRWAIT));
+	return (iicdev_readfrom(dev, reg, data, 1, IIC_INTRWAIT));
 }
 
 static int
 ds1307_write1(device_t dev, uint8_t reg, uint8_t data)
 {
 
-	return(iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT));
+	return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT));
 }
 
 static int
@@ -255,6 +255,14 @@ ds1307_attach(device_t dev)
 	return (0);
 }
 
+static int
+ds1307_detach(device_t dev)
+{
+
+	clock_unregister(dev);
+	return (0);
+}
+
 static void
 ds1307_start(void *xdev)
 {
@@ -387,6 +395,7 @@ ds1307_settime(device_t dev, struct timespec *ts)
 static device_method_t ds1307_methods[] = {
 	DEVMETHOD(device_probe,		ds1307_probe),
 	DEVMETHOD(device_attach,	ds1307_attach),
+	DEVMETHOD(device_detach,	ds1307_detach),
 
 	DEVMETHOD(clock_gettime,	ds1307_gettime),
 	DEVMETHOD(clock_settime,	ds1307_settime),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707311458.v6VEw1nj083758>