Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Mar 2017 19:25:42 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r315650 - head/sys/arm/freescale/imx
Message-ID:  <201703201925.v2KJPgNB080928@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Mon Mar 20 19:25:42 2017
New Revision: 315650
URL: https://svnweb.freebsd.org/changeset/base/315650

Log:
  Use tc_priv to find the softc in the i.MX timer driver.
  
  Sponsored by:	ABT Systems Ltd

Modified:
  head/sys/arm/freescale/imx/imx_gpt.c

Modified: head/sys/arm/freescale/imx/imx_gpt.c
==============================================================================
--- head/sys/arm/freescale/imx/imx_gpt.c	Mon Mar 20 19:24:16 2017	(r315649)
+++ head/sys/arm/freescale/imx/imx_gpt.c	Mon Mar 20 19:25:42 2017	(r315650)
@@ -271,6 +271,7 @@ imx_gpt_attach(device_t dev)
 
 	/* Register as a timecounter. */
 	imx_gpt_timecounter.tc_frequency = sc->clkfreq;
+	imx_gpt_timecounter.tc_priv = sc;
 	tc_init(&imx_gpt_timecounter);
 
 	/* If this is the first unit, store the softc for use in DELAY. */
@@ -368,14 +369,13 @@ imx_gpt_intr(void *arg)
 	return (FILTER_HANDLED);
 }
 
-u_int
+static u_int
 imx_gpt_get_timecount(struct timecounter *tc)
 {
+	struct imx_gpt_softc *sc;
 
-	if (imx_gpt_sc == NULL)
-		return (0);
-
-	return (READ4(imx_gpt_sc, IMX_GPT_CNT));
+	sc = tc->tc_priv;
+	return (READ4(sc, IMX_GPT_CNT));
 }
 
 static device_method_t imx_gpt_methods[] = {



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