Call pmf_device_register(9) in ahc_attahc() rather than ahc_pci_attach()
since pmf_device_deregister(9) is called from ahc_detach() so that cardbus backend also gets proper pmf(9) calls. PCI backend is tested on on O2, but cardbus is untested.
This commit is contained in:
parent
b9e737479b
commit
1056cb0520
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: aic7xxx_osm.c,v 1.31 2009/05/16 06:44:05 tsutsui Exp $ */
|
||||
/* $NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $ */
|
||||
|
||||
/*
|
||||
* Bus independent FreeBSD shim for the aic7xxx based adaptec SCSI controllers
|
||||
@ -39,7 +39,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.31 2009/05/16 06:44:05 tsutsui Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: aic7xxx_osm.c,v 1.32 2009/09/02 11:10:37 tsutsui Exp $");
|
||||
|
||||
#include <dev/ic/aic7xxx_osm.h>
|
||||
#include <dev/ic/aic7xxx_inline.h>
|
||||
@ -58,6 +58,8 @@ static void ahc_set_recoveryscb(struct ahc_softc *ahc, struct scb *scb);
|
||||
static int ahc_ioctl(struct scsipi_channel *channel, u_long cmd,
|
||||
void *addr, int flag, struct proc *p);
|
||||
|
||||
static bool ahc_pmf_suspend(device_t PMF_FN_PROTO);
|
||||
static bool ahc_pmf_resume(device_t PMF_FN_PROTO);
|
||||
|
||||
|
||||
/*
|
||||
@ -124,10 +126,43 @@ ahc_attach(struct ahc_softc *ahc)
|
||||
if ((ahc->features & AHC_TWIN) && ahc->flags & AHC_RESET_BUS_B)
|
||||
ahc_reset_channel(ahc, 'B', TRUE);
|
||||
|
||||
if (!pmf_device_register(ahc->sc_dev, ahc_pmf_suspend, ahc_pmf_resume))
|
||||
aprint_error_dev(ahc->sc_dev,
|
||||
"couldn't establish power handler\n");
|
||||
|
||||
ahc_unlock(ahc, &s);
|
||||
return (1);
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX we should call the real suspend and resume functions here
|
||||
* but for some reason ahc_suspend() panics on shutdown
|
||||
*/
|
||||
|
||||
static bool
|
||||
ahc_pmf_suspend(device_t dev PMF_FN_ARGS)
|
||||
{
|
||||
struct ahc_softc *sc = device_private(dev);
|
||||
#if 0
|
||||
return (ahc_suspend(sc) == 0);
|
||||
#else
|
||||
ahc_shutdown(sc);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
ahc_pmf_resume(device_t dev PMF_FN_ARGS)
|
||||
{
|
||||
#if 0
|
||||
struct ahc_softc *sc = device_private(dev);
|
||||
|
||||
return (ahc_resume(sc) == 0);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Catch an interrupt from the adapter
|
||||
*/
|
||||
|
@ -39,7 +39,7 @@
|
||||
* IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGES.
|
||||
*
|
||||
* $Id: ahc_pci.c,v 1.66 2009/05/06 09:25:14 cegger Exp $
|
||||
* $Id: ahc_pci.c,v 1.67 2009/09/02 11:10:37 tsutsui Exp $
|
||||
*
|
||||
* //depot/aic7xxx/aic7xxx/aic7xxx_pci.c#57 $
|
||||
*
|
||||
@ -50,7 +50,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.66 2009/05/06 09:25:14 cegger Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: ahc_pci.c,v 1.67 2009/09/02 11:10:37 tsutsui Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -709,9 +709,6 @@ static void ahc_probe_ext_scbram(struct ahc_softc *ahc);
|
||||
|
||||
static void ahc_pci_intr(struct ahc_softc *);
|
||||
|
||||
static bool ahc_pci_suspend(device_t PMF_FN_PROTO);
|
||||
static bool ahc_pci_resume(device_t PMF_FN_PROTO);
|
||||
|
||||
static const struct ahc_pci_identity *
|
||||
ahc_find_pci_device(pcireg_t id, pcireg_t subid, u_int func)
|
||||
{
|
||||
@ -1102,7 +1099,6 @@ ahc_pci_attach(device_t parent, device_t self, void *aux)
|
||||
if (ahc_init(ahc))
|
||||
goto error_out;
|
||||
|
||||
pmf_device_register(self, ahc_pci_suspend, ahc_pci_resume);
|
||||
ahc_attach(ahc);
|
||||
|
||||
return;
|
||||
@ -1112,35 +1108,6 @@ ahc_pci_attach(device_t parent, device_t self, void *aux)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* XXX we should call the real suspend and resume functions here
|
||||
* but for some reason ahc_suspend() panics on shutdown
|
||||
*/
|
||||
|
||||
static bool
|
||||
ahc_pci_suspend(device_t dev PMF_FN_ARGS)
|
||||
{
|
||||
struct ahc_softc *sc = device_private(dev);
|
||||
#if 0
|
||||
return (ahc_suspend(sc) == 0);
|
||||
#else
|
||||
ahc_shutdown(sc);
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
static bool
|
||||
ahc_pci_resume(device_t dev PMF_FN_ARGS)
|
||||
{
|
||||
#if 0
|
||||
struct ahc_softc *sc = device_private(dev);
|
||||
|
||||
return (ahc_resume(sc) == 0);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
CFATTACH_DECL_NEW(ahc_pci, sizeof(struct ahc_softc),
|
||||
ahc_pci_probe, ahc_pci_attach, NULL, NULL);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user