svn commit: r199986 - stable/7/sys/dev/acpica

Andriy Gapon avg at FreeBSD.org
Tue Dec 1 06:15:20 UTC 2009


Author: avg
Date: Tue Dec  1 06:15:19 2009
New Revision: 199986
URL: http://svn.freebsd.org/changeset/base/199986

Log:
  MFC r199016: acpi: remove 'magic' ivar
  
  Note that the ivar itself is kept in the stable branches, only its use is
  dropped.

Modified:
  stable/7/sys/dev/acpica/acpi_cpu.c
  stable/7/sys/dev/acpica/acpi_ec.c
  stable/7/sys/dev/acpica/acpi_hpet.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/acpica/acpi_cpu.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi_cpu.c	Tue Dec  1 06:12:31 2009	(r199985)
+++ stable/7/sys/dev/acpica/acpi_cpu.c	Tue Dec  1 06:15:19 2009	(r199986)
@@ -252,7 +252,7 @@ acpi_cpu_probe(device_t dev)
 
     /* Mark this processor as in-use and save our derived id for attach. */
     cpu_softc[cpu_id] = (void *)1;
-    acpi_set_magic(dev, cpu_id);
+    acpi_set_private(dev, (void*)(intptr_t)cpu_id);
     device_set_desc(dev, "ACPI CPU");
 
     return (0);
@@ -283,7 +283,7 @@ acpi_cpu_attach(device_t dev)
     sc = device_get_softc(dev);
     sc->cpu_dev = dev;
     sc->cpu_handle = acpi_get_handle(dev);
-    cpu_id = acpi_get_magic(dev);
+    cpu_id = (int)(intptr_t)acpi_get_private(dev);
     cpu_softc[cpu_id] = sc;
     pcpu_data = pcpu_find(cpu_id);
     pcpu_data->pc_device = dev;

Modified: stable/7/sys/dev/acpica/acpi_ec.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi_ec.c	Tue Dec  1 06:12:31 2009	(r199985)
+++ stable/7/sys/dev/acpica/acpi_ec.c	Tue Dec  1 06:15:19 2009	(r199986)
@@ -127,9 +127,6 @@ struct acpi_ec_params {
     int		uid;
 };
 
-/* Indicate that this device has already been probed via ECDT. */
-#define DEV_ECDT(x)	(acpi_get_magic(x) == (uintptr_t)&acpi_ec_devclass)
-
 /*
  * Driver softc.
  */
@@ -330,7 +327,6 @@ acpi_ec_ecdt_probe(device_t parent)
     params->uid = ecdt->Uid;
     acpi_GetInteger(h, "_GLK", &params->glk);
     acpi_set_private(child, params);
-    acpi_set_magic(child, (uintptr_t)&acpi_ec_devclass);
 
     /* Finish the attach process. */
     if (device_probe_and_attach(child) != 0)
@@ -346,6 +342,7 @@ acpi_ec_probe(device_t dev)
     ACPI_STATUS status;
     device_t	peer;
     char	desc[64];
+    int		ecdt;
     int		ret;
     struct acpi_ec_params *params;
     static char *ec_ids[] = { "PNP0C09", NULL };
@@ -360,11 +357,12 @@ acpi_ec_probe(device_t dev)
      * duplicate probe.
      */
     ret = ENXIO;
-    params = NULL;
+    ecdt = 0;
     buf.Pointer = NULL;
     buf.Length = ACPI_ALLOCATE_BUFFER;
-    if (DEV_ECDT(dev)) {
-	params = acpi_get_private(dev);
+    params = acpi_get_private(dev);
+    if (params != NULL) {
+	ecdt = 1;
 	ret = 0;
     } else if (!acpi_disabled("ec") &&
 	ACPI_ID_PROBE(device_get_parent(dev), dev, ec_ids)) {
@@ -437,7 +435,7 @@ out:
     if (ret == 0) {
 	snprintf(desc, sizeof(desc), "Embedded Controller: GPE %#x%s%s",
 		 params->gpe_bit, (params->glk) ? ", GLK" : "",
-		 DEV_ECDT(dev) ? ", ECDT" : "");
+		 ecdt ? ", ECDT" : "");
 	device_set_desc_copy(dev, desc);
     }
 

Modified: stable/7/sys/dev/acpica/acpi_hpet.c
==============================================================================
--- stable/7/sys/dev/acpica/acpi_hpet.c	Tue Dec  1 06:12:31 2009	(r199985)
+++ stable/7/sys/dev/acpica/acpi_hpet.c	Tue Dec  1 06:15:19 2009	(r199986)
@@ -59,8 +59,6 @@ static void acpi_hpet_test(struct acpi_h
 
 static char *hpet_ids[] = { "PNP0103", NULL };
 
-#define DEV_HPET(x)	(acpi_get_magic(x) == (uintptr_t)&acpi_hpet_devclass)
-
 struct timecounter hpet_timecounter = {
 	.tc_get_timecount =	hpet_get_timecount,
 	.tc_counter_mask =	~0u,
@@ -131,8 +129,6 @@ acpi_hpet_identify(driver_t *driver, dev
 		return;
 	}
 
-	/* Record a magic value so we can detect this device later. */
-	acpi_set_magic(child, (uintptr_t)&acpi_hpet_devclass);
 	bus_set_resource(child, SYS_RES_MEMORY, 0, hpet->Address.Address,
 	    HPET_MEM_WIDTH);
 }
@@ -144,7 +140,7 @@ acpi_hpet_probe(device_t dev)
 
 	if (acpi_disabled("hpet"))
 		return (ENXIO);
-	if (!DEV_HPET(dev) &&
+	if (acpi_get_handle(dev) != NULL &&
 	    (ACPI_ID_PROBE(device_get_parent(dev), dev, hpet_ids) == NULL ||
 	    device_get_unit(dev) != 0))
 		return (ENXIO);


More information about the svn-src-stable-7 mailing list