Subject: Re: acpi_pci_link: WARNING: powerhook_establish is deprecated
To: Thomas Klausner <wiz@NetBSD.org>
From: Jared D. McNeill <jmcneill@invisible.ca>
List: current-users
Date: 12/11/2007 08:57:45
On Tue, 11 Dec 2007, Thomas Klausner wrote:
> +com0: WARNING: powerhook_establish is deprecated

This should be pretty easy:

  1. In sys/ic/com.c:
 	Convert the existing powerhook to a pmf handler. No suspend
 	handler is required, and the following function should do for the
 	resume handler:

 	bool
 	com_resume(device_t dev)
 	{
 		struct com_softc *sc = device_private(dev);

 		mutex_spin_enter(&sc->sc_lock);
 		com_loadchannelregs(sc);
 		mutex_spin_exit(&sc->sc_lock);

 		return true;
 	}

  2. In the bus frontends (isa, acpi, etc) on attach:

 	if (!pmf_device_register(self, NULL, com_resume))
 		aprint_error_dev(self, "couldn't establish power handler\n");

     On detach:

 	pmf_device_deregister(self);

Hope this helps!

Cheers,
Jared