Remove unreferenced global function imx_gpt_get_timerfreq() and do some

cleanups enabled by that:

 - The only thing left in imx_gptvar.h was the softc, which IMO never
   should have been in there at all.  Move it into the driver, and
   delete the header file.

 - Remove several unneeded #includes from the driver.

 - Change imx_gpt_softc from global to static (it's used by DELAY()), and
   don't redundantly static-initialize it to NULL.
This commit is contained in:
ian 2017-03-19 04:03:39 +00:00
parent c1d420f628
commit 3c479318cd
2 changed files with 15 additions and 66 deletions

View File

@ -35,24 +35,18 @@ __FBSDID("$FreeBSD$");
#include <sys/bus.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/malloc.h>
#include <sys/rman.h>
#include <sys/timeet.h>
#include <sys/timetc.h>
#include <sys/watchdog.h>
#include <machine/bus.h>
#include <machine/cpu.h>
#include <machine/intr.h>
#include <dev/ofw/openfirm.h>
#include <dev/ofw/ofw_bus.h>
#include <dev/ofw/ofw_bus_subr.h>
#include <arm/freescale/imx/imx_gptvar.h>
#include <arm/freescale/imx/imx_gptreg.h>
#include <sys/kdb.h>
#include <arm/freescale/imx/imx_ccmvar.h>
#include <arm/freescale/imx/imx_gptreg.h>
#define WRITE4(_sc, _r, _v) \
bus_space_write_4((_sc)->sc_iot, (_sc)->sc_ioh, (_r), (_v))
@ -80,8 +74,20 @@ static struct timecounter imx_gpt_timecounter = {
.tc_quality = 1000,
};
struct imx_gpt_softc {
device_t sc_dev;
struct resource * res[2];
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void * sc_ih; /* interrupt handler */
uint32_t sc_period;
uint32_t sc_clksrc;
uint32_t clkfreq;
struct eventtimer et;
};
/* Global softc pointer for use in DELAY(). */
struct imx_gpt_softc *imx_gpt_sc = NULL;
static struct imx_gpt_softc *imx_gpt_sc;
/*
* Hand-calibrated delay-loop counter. This was calibrated on an i.MX6 running
@ -311,13 +317,6 @@ imx_gpt_timer_stop(struct eventtimer *et)
return (0);
}
int
imx_gpt_get_timerfreq(struct imx_gpt_softc *sc)
{
return (sc->clkfreq);
}
static int
imx_gpt_intr(void *arg)
{

View File

@ -1,50 +0,0 @@
/*-
* Copyright (c) 2012, 2013 The FreeBSD Foundation
* All rights reserved.
*
* This software was developed by Oleksandr Rybalko under sponsorship
* from the FreeBSD Foundation.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD$
*/
#ifndef _IMXGPTVAR_H
#define _IMXGPTVAR_H
struct imx_gpt_softc {
device_t sc_dev;
struct resource *res[2];
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
void *sc_ih; /* interrupt handler */
uint32_t sc_period;
uint32_t sc_clksrc;
uint32_t clkfreq;
struct eventtimer et;
};
extern struct imx_gpt_softc *imx_gpt_sc;
int imx_gpt_get_timerfreq(struct imx_gpt_softc *);
#endif /* _IMXGPTVAR_H */