Module Name:    src
Committed By:   tsutsui
Date:           Sun Aug  1 02:47:43 UTC 2010

Modified Files:
        src/sys/dev/hpc: bivideo.c

Log Message:
Replace powerhook_establish(9) with pmf(9).


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/hpc/bivideo.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/hpc/bivideo.c
diff -u src/sys/dev/hpc/bivideo.c:1.30 src/sys/dev/hpc/bivideo.c:1.31
--- src/sys/dev/hpc/bivideo.c:1.30	Tue May 12 14:22:39 2009
+++ src/sys/dev/hpc/bivideo.c	Sun Aug  1 02:47:43 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $	*/
+/*	$NetBSD: bivideo.c,v 1.31 2010/08/01 02:47:43 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.30 2009/05/12 14:22:39 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bivideo.c,v 1.31 2010/08/01 02:47:43 tsutsui Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_hpcfb.h"
@@ -88,7 +88,6 @@
 	struct device		sc_dev;
 	struct hpcfb_fbconf	sc_fbconf;
 	struct hpcfb_dspconf	sc_dspconf;
-	void			*sc_powerhook;	/* power management hook */
 	int			sc_powerstate;
 #define PWRSTAT_SUSPEND		(1<<0)
 #define PWRSTAT_VIDEOOFF	(1<<1)
@@ -110,6 +109,8 @@
 static int bivideo_init(struct hpcfb_fbconf *);
 static void bivideo_power(int, void *);
 static void bivideo_update_powerstate(struct bivideo_softc *, int);
+static bool bivideo_suspend(device_t, const pmf_qual_t *);
+static bool bivideo_resume(device_t, const pmf_qual_t *);
 void	bivideo_init_backlight(struct bivideo_softc *, int);
 void	bivideo_init_brightness(struct bivideo_softc *, int);
 void	bivideo_init_contrast(struct bivideo_softc *, int);
@@ -178,10 +179,8 @@
 
 	/* Add a suspend hook to power saving */
 	sc->sc_powerstate = 0;
-	sc->sc_powerhook = powerhook_establish(device_xname(&sc->sc_dev),
-	    bivideo_power, sc);
-	if (sc->sc_powerhook == NULL)
-		aprint_error_dev(&sc->sc_dev, "WARNING: unable to establish power hook\n");
+	if (!pmf_device_register(self, bivideo_suspend, bivideo_resume))
+		aprint_error_dev(self, "unable to establish power handler\n");
 
 	/* initialize backlight brightness and lcd contrast */
 	sc->sc_lcd_inited = 0;
@@ -372,6 +371,24 @@
 			     (sc->sc_powerstate & PWRSTAT_BACKLIGHT)));
 }
 
+static bool
+bivideo_suspend(device_t self, const pmf_qual_t *qual)
+{
+	struct bivideo_softc *sc = device_private(self);
+
+	bivideo_power(PWR_SUSPEND, sc);
+	return true;
+}
+
+static bool
+bivideo_resume(device_t self, const pmf_qual_t *qual)
+{
+	struct bivideo_softc *sc = device_private(self);
+
+	bivideo_power(PWR_RESUME, sc);
+	return true;
+}
+
 int
 bivideo_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
 {

Reply via email to