acpi_apm.c (183381) | acpi_apm.c (192442) |
---|---|
1/*- 2 * Copyright (c) 2001 Mitsuru IWASAKI 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2001 Mitsuru IWASAKI 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/i386/acpica/acpi_machdep.c 183381 2008-09-26 14:19:52Z ed $"); | 28__FBSDID("$FreeBSD: head/sys/i386/acpica/acpi_machdep.c 192442 2009-05-20 16:47:40Z imp $"); |
29 30#include <sys/param.h> 31#include <sys/bus.h> 32#include <sys/condvar.h> 33#include <sys/conf.h> 34#include <sys/fcntl.h> 35#include <sys/kernel.h> 36#include <sys/malloc.h> --- 235 unchanged lines hidden (view full) --- 272 273 ACPI_LOCK(acpi); 274 STAILQ_INSERT_TAIL(&acpi_sc->apm_cdevs, clone, entries); 275 ACPI_UNLOCK(acpi); 276 return (clone); 277} 278 279static int | 29 30#include <sys/param.h> 31#include <sys/bus.h> 32#include <sys/condvar.h> 33#include <sys/conf.h> 34#include <sys/fcntl.h> 35#include <sys/kernel.h> 36#include <sys/malloc.h> --- 235 unchanged lines hidden (view full) --- 272 273 ACPI_LOCK(acpi); 274 STAILQ_INSERT_TAIL(&acpi_sc->apm_cdevs, clone, entries); 275 ACPI_UNLOCK(acpi); 276 return (clone); 277} 278 279static int |
280apmopen(struct cdev *dev, int flag, int fmt, d_thread_t *td) | 280apmopen(struct cdev *dev, int flag, int fmt, struct thread *td) |
281{ 282 struct acpi_softc *acpi_sc; 283 struct apm_clone_data *clone; 284 285 acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); 286 clone = apm_create_clone(dev, acpi_sc); 287 dev->si_drv1 = clone; 288 289 /* If the device is opened for write, record that. */ 290 if ((flag & FWRITE) != 0) 291 clone->flags |= ACPI_EVF_WRITE; 292 293 return (0); 294} 295 296static int | 281{ 282 struct acpi_softc *acpi_sc; 283 struct apm_clone_data *clone; 284 285 acpi_sc = devclass_get_softc(devclass_find("acpi"), 0); 286 clone = apm_create_clone(dev, acpi_sc); 287 dev->si_drv1 = clone; 288 289 /* If the device is opened for write, record that. */ 290 if ((flag & FWRITE) != 0) 291 clone->flags |= ACPI_EVF_WRITE; 292 293 return (0); 294} 295 296static int |
297apmclose(struct cdev *dev, int flag, int fmt, d_thread_t *td) | 297apmclose(struct cdev *dev, int flag, int fmt, struct thread *td) |
298{ 299 struct apm_clone_data *clone; 300 struct acpi_softc *acpi_sc; 301 302 clone = dev->si_drv1; 303 acpi_sc = clone->acpi_sc; 304 305 /* We are about to lose a reference so check if suspend should occur */ --- 7 unchanged lines hidden (view full) --- 313 knlist_destroy(&clone->sel_read.si_note); 314 ACPI_UNLOCK(acpi); 315 free(clone, M_APMDEV); 316 destroy_dev_sched(dev); 317 return (0); 318} 319 320static int | 298{ 299 struct apm_clone_data *clone; 300 struct acpi_softc *acpi_sc; 301 302 clone = dev->si_drv1; 303 acpi_sc = clone->acpi_sc; 304 305 /* We are about to lose a reference so check if suspend should occur */ --- 7 unchanged lines hidden (view full) --- 313 knlist_destroy(&clone->sel_read.si_note); 314 ACPI_UNLOCK(acpi); 315 free(clone, M_APMDEV); 316 destroy_dev_sched(dev); 317 return (0); 318} 319 320static int |
321apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, d_thread_t *td) | 321apmioctl(struct cdev *dev, u_long cmd, caddr_t addr, int flag, struct thread *td) |
322{ 323 int error; 324 struct apm_clone_data *clone; 325 struct acpi_softc *acpi_sc; 326 struct apm_info info; 327 struct apm_event_info *ev_info; 328 apm_info_old_t aiop; 329 --- 101 unchanged lines hidden (view full) --- 431 432static int 433apmwrite(struct cdev *dev, struct uio *uio, int ioflag) 434{ 435 return (uio->uio_resid); 436} 437 438static int | 322{ 323 int error; 324 struct apm_clone_data *clone; 325 struct acpi_softc *acpi_sc; 326 struct apm_info info; 327 struct apm_event_info *ev_info; 328 apm_info_old_t aiop; 329 --- 101 unchanged lines hidden (view full) --- 431 432static int 433apmwrite(struct cdev *dev, struct uio *uio, int ioflag) 434{ 435 return (uio->uio_resid); 436} 437 438static int |
439apmpoll(struct cdev *dev, int events, d_thread_t *td) | 439apmpoll(struct cdev *dev, int events, struct thread *td) |
440{ 441 struct apm_clone_data *clone; 442 int revents; 443 444 revents = 0; 445 ACPI_LOCK(acpi); 446 clone = dev->si_drv1; 447 if (clone->acpi_sc->acpi_next_sstate) --- 147 unchanged lines hidden --- | 440{ 441 struct apm_clone_data *clone; 442 int revents; 443 444 revents = 0; 445 ACPI_LOCK(acpi); 446 clone = dev->si_drv1; 447 if (clone->acpi_sc->acpi_next_sstate) --- 147 unchanged lines hidden --- |