status = acpi_bus_add(&child, parent, chandle, type); if (ACPI_FAILURE(status)) continue; 
if (ops->acpi_op_add) status = acpi_add_single_object(&child, parent, chandle, type); else status = acpi_bus_get_device(chandle, &child);  if (ACPI_FAILURE(status)) continue;  if (ops->acpi_op_start) { status = acpi_start_single_object(child); if (ACPI_FAILURE(status)) continue; } 
int acpi_bus_scan (struct acpi_device	*start){	acpi_status		status = AE_OK;	struct acpi_device	*parent = NULL;	struct acpi_device	*child = NULL;	acpi_handle		phandle = NULL;	acpi_handle		chandle = NULL;	acpi_object_type	type = 0;	u32			level = 1;	ACPI_FUNCTION_TRACE("acpi_bus_scan");	if (!start)		return_VALUE(-EINVAL);	parent = start;	phandle = start->handle;		/*	 * Parse through the ACPI namespace, identify all 'devices', and	 * create a new 'struct acpi_device' for each.	 */	while ((level > 0) && parent) {		status = acpi_get_next_object(ACPI_TYPE_ANY, phandle,			chandle, &chandle);		/*		 * If this scope is exhausted then move our way back up.		 */		if (ACPI_FAILURE(status)) {			level--;			chandle = phandle;			acpi_get_parent(phandle, &phandle);			if (parent->parent)				parent = parent->parent;			continue;		}		status = acpi_get_type(chandle, &type);		if (ACPI_FAILURE(status))			continue;		/*		 * If this is a scope object then parse it (depth-first).		 */		if (type == ACPI_TYPE_LOCAL_SCOPE) {			level++;			phandle = chandle;			chandle = NULL;			continue;		}		/*		 * We're only interested in objects that we consider 'devices'.		 */		switch (type) {		case ACPI_TYPE_DEVICE:			type = ACPI_BUS_TYPE_DEVICE;			break;		case ACPI_TYPE_PROCESSOR:			type = ACPI_BUS_TYPE_PROCESSOR;			break;		case ACPI_TYPE_THERMAL:			type = ACPI_BUS_TYPE_THERMAL;			break;		case ACPI_TYPE_POWER:			type = ACPI_BUS_TYPE_POWER;			break;		default:			continue;		}		status = acpi_bus_add(&child, parent, chandle, type);		if (ACPI_FAILURE(status))			continue;		/*		 * If the device is present, enabled, and functioning then		 * parse its scope (depth-first).  Note that we need to		 * represent absent devices to facilitate PnP notifications		 * -- but only the subtree head (not all of its children,		 * which will be enumerated when the parent is inserted).		 *		 * TBD: Need notifications and other detection mechanisms		 *	in place before we can fully implement this.		 */		if (child->status.present) {			status = acpi_get_next_object(ACPI_TYPE_ANY, chandle,						      NULL, NULL);			if (ACPI_SUCCESS(status)) {				level++;				phandle = chandle;				chandle = NULL;				parent = child;			}		}	}	return_VALUE(0);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/3fb02738b0fd36f47710a2bf207129efd2f5daa2/scan.c/buggy/drivers/acpi/scan.c