aboutsummaryrefslogtreecommitdiff
path: root/sys/sparc64/fhc/fhc_nexus.c
diff options
context:
space:
mode:
authorMarius Strobl <marius@FreeBSD.org>2005-03-04 16:01:57 +0000
committerMarius Strobl <marius@FreeBSD.org>2005-03-04 16:01:57 +0000
commit8e1ff29d07cf60c9b857175ab1965a4aae0279bb (patch)
treec2e7170cd185a2d0aa4961032e0801f83f700e30 /sys/sparc64/fhc/fhc_nexus.c
parent30e5ca534034992b8e815e099b462d50668e695c (diff)
downloadsrc-8e1ff29d07cf60c9b857175ab1965a4aae0279bb.tar.gz
src-8e1ff29d07cf60c9b857175ab1965a4aae0279bb.zip
Minor changes:
- Use FBSDID. - Remove unused macro. - Use auto-generated typedefs for the prototypes of the bus and device interface functions. - Terminate the output of device_printf(9) with a newline char. - Honour the return values of malloc(), OF_getprop(), etc. - Use __func__ instead of hardcoded function names. - Print the physical slot number and the board model on attach. MFC after: 1 month
Notes
Notes: svn path=/head/; revision=143129
Diffstat (limited to 'sys/sparc64/fhc/fhc_nexus.c')
-rw-r--r--sys/sparc64/fhc/fhc_nexus.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/sparc64/fhc/fhc_nexus.c b/sys/sparc64/fhc/fhc_nexus.c
index 4943329dea96..0ed97513278e 100644
--- a/sys/sparc64/fhc/fhc_nexus.c
+++ b/sys/sparc64/fhc/fhc_nexus.c
@@ -22,10 +22,11 @@
* 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$
*/
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/bus.h>
@@ -46,8 +47,8 @@
#include <sparc64/fhc/fhcreg.h>
#include <sparc64/fhc/fhcvar.h>
-static int fhc_nexus_probe(device_t dev);
-static int fhc_nexus_attach(device_t dev);
+static device_probe_t fhc_nexus_probe;
+static device_attach_t fhc_nexus_attach;
static device_method_t fhc_nexus_methods[] = {
/* Device interface. */
@@ -114,7 +115,7 @@ fhc_nexus_attach(device_t dev)
reg = nexus_get_reg(dev);
nreg = nexus_get_nreg(dev);
if (nreg != FHC_NREG) {
- device_printf(dev, "wrong number of regs");
+ device_printf(dev, "wrong number of regs\n");
return (ENXIO);
}
for (i = 0; i < nreg; i++) {
@@ -124,12 +125,16 @@ fhc_nexus_attach(device_t dev)
sc->sc_memres[i] = bus_alloc_resource(dev, SYS_RES_MEMORY,
&rid, phys, phys + size - 1, size, RF_ACTIVE);
if (sc->sc_memres[i] == NULL)
- panic("fhc_nexus_attach: can't allocate registers");
+ panic("%s: can't allocate registers", __func__);
sc->sc_bt[i] = rman_get_bustag(sc->sc_memres[i]);
sc->sc_bh[i] = rman_get_bushandle(sc->sc_memres[i]);
}
- OF_getprop(node, "board#", &sc->sc_board, sizeof(sc->sc_board));
+ if (OF_getprop(node, "board#", &sc->sc_board,
+ sizeof(sc->sc_board)) == -1) {
+ device_printf(dev, "could not get board number\n");
+ return (ENXIO);
+ }
return (fhc_attach(dev));
}