Use aprint_*_dev(), and device_xname(). Constify a bit.

This commit is contained in:
dyoung 2008-03-21 08:17:30 +00:00
parent 8ce2158b0c
commit 5c37160f8b
4 changed files with 14 additions and 19 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic79xx.c,v 1.37 2007/03/04 06:01:48 christos Exp $ */
/* $NetBSD: aic79xx.c,v 1.38 2008/03/21 08:17:30 dyoung Exp $ */
/*
* Core routines and tables shareable across OS platforms.
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.37 2007/03/04 06:01:48 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.38 2008/03/21 08:17:30 dyoung Exp $");
#include <dev/ic/aic79xx_osm.h>
#include <dev/ic/aic79xx_inline.h>
@ -5150,10 +5150,8 @@ ahd_set_unit(struct ahd_softc *ahd, int unit)
}
void
ahd_set_name(struct ahd_softc *ahd, char *name)
ahd_set_name(struct ahd_softc *ahd, const char *name)
{
if (ahd->name != NULL)
free(ahd->name, M_DEVBUF);
ahd->name = name;
}
@ -5207,8 +5205,6 @@ ahd_free(struct ahd_softc *ahd)
free(ahd->black_hole, M_DEVBUF);
}
#endif
if (ahd->name != NULL)
free(ahd->name, M_DEVBUF);
if (ahd->seep_config != NULL)
free(ahd->seep_config, M_DEVBUF);
if (ahd->saved_stack != NULL)

View File

@ -1,4 +1,4 @@
/* $NetBSD: aic79xx_inline.h,v 1.15 2006/11/16 01:32:50 christos Exp $ */
/* $NetBSD: aic79xx_inline.h,v 1.16 2008/03/21 08:17:30 dyoung Exp $ */
/*
* Inline routines shareable across OS platforms.
@ -51,9 +51,9 @@
#define _AIC79XX_INLINE_H_
/******************************** Debugging ***********************************/
static __inline char *ahd_name(struct ahd_softc *);
static __inline const char *ahd_name(struct ahd_softc *);
static __inline char *
static __inline const char *
ahd_name(struct ahd_softc *ahd)
{
return (ahd->name);

View File

@ -1233,7 +1233,7 @@ struct ahd_softc {
/* Per-Unit descriptive information */
const char *description;
const char *bus_description;
char *name;
const char *name;
int unit;
/* Selection Timer settings */
@ -1378,7 +1378,7 @@ void ahd_pause_and_flushwork(struct ahd_softc *);
int ahd_suspend(struct ahd_softc *);
int ahd_resume(struct ahd_softc *);
void ahd_set_unit(struct ahd_softc *, int);
void ahd_set_name(struct ahd_softc *, char *);
void ahd_set_name(struct ahd_softc *, const char *);
struct scb *ahd_get_scb(struct ahd_softc *, u_int);
void ahd_free_scb(struct ahd_softc *, struct scb *);
int ahd_alloc_scbs(struct ahd_softc *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ahd_pci.c,v 1.26 2008/03/21 07:47:43 dyoung Exp $ */
/* $NetBSD: ahd_pci.c,v 1.27 2008/03/21 08:17:30 dyoung Exp $ */
/*
* Product specific probe and attach routines for:
@ -49,7 +49,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.26 2008/03/21 07:47:43 dyoung Exp $");
__KERNEL_RCSID(0, "$NetBSD: ahd_pci.c,v 1.27 2008/03/21 08:17:30 dyoung Exp $");
#define AHD_PCI_IOADDR PCI_MAPREG_START /* I/O Address */
#define AHD_PCI_MEMADDR (PCI_MAPREG_START + 4) /* Mem I/O Address */
@ -317,7 +317,7 @@ ahd_pci_attach(device_t parent, device_t self, void *aux)
const char *intrstr;
struct ahd_pci_busdata *bd;
ahd_set_name(ahd, ahd->sc_dev.dv_xname);
ahd_set_name(ahd, device_xname(&ahd->sc_dev));
ahd->parent_dmat = pa->pa_dmat;
command = pci_conf_read(pa->pa_pc, pa->pa_tag, PCI_COMMAND_STATUS_REG);
@ -393,8 +393,8 @@ ahd_pci_attach(device_t parent, device_t self, void *aux)
if (!pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIX,
&bd->pcix_off, NULL)) {
if (ahd->chip & AHD_PCIX)
aprint_error("%s: warning: can't find PCI-X capability\n",
ahd->sc_dev.dv_xname);
aprint_error_dev(&ahd->sc_dev,
"warning: can't find PCI-X capability\n");
ahd->chip &= ~AHD_PCIX;
ahd->chip |= AHD_PCI;
ahd->bugs &= ~AHD_PCIX_BUG_MASK;
@ -481,8 +481,7 @@ ahd_pci_attach(device_t parent, device_t self, void *aux)
/* power up chip */
if ((error = pci_activate(pa->pa_pc, pa->pa_tag, self,
pci_activate_null)) && error != EOPNOTSUPP) {
aprint_error("%s: cannot activate %d\n", ahd->sc_dev.dv_xname,
error);
aprint_error_dev(&ahd->sc_dev, "cannot activate %d\n", error);
return;
}
/*