Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Simplify acpi_pcidev_find(): directly return a ...
details: https://anonhg.NetBSD.org/src/rev/535543d84e61
branches: trunk
changeset: 754201:535543d84e61
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Apr 23 15:46:59 2010 +0000
description:
Simplify acpi_pcidev_find(): directly return a pointer to the device node.
diffstat:
sys/dev/acpi/acpi_pci.c | 33 +++++++++++++++------------------
sys/dev/acpi/acpi_pci.h | 12 ++++++------
2 files changed, 21 insertions(+), 24 deletions(-)
diffs (88 lines):
diff -r 0ef59c044f62 -r 535543d84e61 sys/dev/acpi/acpi_pci.c
--- a/sys/dev/acpi/acpi_pci.c Fri Apr 23 15:43:28 2010 +0000
+++ b/sys/dev/acpi/acpi_pci.c Fri Apr 23 15:46:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.9 2010/04/22 21:58:08 jruoho Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.10 2010/04/23 15:46:59 jruoho Exp $ */
/*
* Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.9 2010/04/22 21:58:08 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.10 2010/04/23 15:46:59 jruoho Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -301,31 +301,28 @@
* acpi_pcidev_find:
*
* Finds a PCI device in the ACPI name space.
- * The return status is either:
- * - AE_NOT_FOUND if no such device was found.
- * - AE_OK if one and only one such device was found.
+ *
+ * Returns an ACPI device node on success and NULL on failure.
*/
-ACPI_STATUS
-acpi_pcidev_find(uint16_t segment, uint16_t bus, uint16_t device,
- uint16_t function, struct acpi_devnode **devnodep)
+struct acpi_devnode *
+acpi_pcidev_find(uint16_t segment, uint16_t bus,
+ uint16_t device, uint16_t function)
{
struct acpi_softc *sc = acpi_softc;
struct acpi_devnode *ad;
if (sc == NULL)
- return AE_NOT_FOUND;
+ return NULL;
SIMPLEQ_FOREACH(ad, &sc->ad_head, ad_list) {
- if ((ad->ad_pciinfo != NULL) &&
- (ad->ad_pciinfo->ap_segment == segment) &&
- (ad->ad_pciinfo->ap_bus == bus) &&
- (ad->ad_pciinfo->ap_device == device) &&
- (ad->ad_pciinfo->ap_function == function)) {
- *devnodep = ad;
- return AE_OK;
- }
+ if (ad->ad_pciinfo != NULL &&
+ ad->ad_pciinfo->ap_segment == segment &&
+ ad->ad_pciinfo->ap_bus == bus &&
+ ad->ad_pciinfo->ap_device == device &&
+ ad->ad_pciinfo->ap_function == function)
+ return ad;
}
- return AE_NOT_FOUND;
+ return NULL;
}
diff -r 0ef59c044f62 -r 535543d84e61 sys/dev/acpi/acpi_pci.h
--- a/sys/dev/acpi/acpi_pci.h Fri Apr 23 15:43:28 2010 +0000
+++ b/sys/dev/acpi/acpi_pci.h Fri Apr 23 15:46:59 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.h,v 1.5 2010/04/22 21:58:08 jruoho Exp $ */
+/* $NetBSD: acpi_pci.h,v 1.6 2010/04/23 15:46:59 jruoho Exp $ */
/*
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -31,10 +31,10 @@
#ifndef _SYS_DEV_ACPI_ACPI_PCI_H
#define _SYS_DEV_ACPI_ACPI_PCI_H
-ACPI_STATUS acpi_pcidev_scan(struct acpi_devnode *);
-ACPI_STATUS acpi_pcidev_find(uint16_t, uint16_t, uint16_t, uint16_t,
- struct acpi_devnode **);
-ACPI_STATUS acpi_pcidev_ppb_downbus(uint16_t, uint16_t, uint16_t, uint16_t,
- uint16_t *);
+ACPI_STATUS acpi_pcidev_scan(struct acpi_devnode *);
+struct acpi_devnode *acpi_pcidev_find(uint16_t, uint16_t,
+ uint16_t, uint16_t);
+ACPI_STATUS acpi_pcidev_ppb_downbus(uint16_t, uint16_t, uint16_t,
+ uint16_t, uint16_t *);
#endif /* !_SYS_DEV_ACPI_ACPI_PCI_H */
Home |
Main Index |
Thread Index |
Old Index