您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ DEVICE_ACPI_HANDLE函数代码示例

51自学网 2021-06-01 20:21:11
  C++
这篇教程C++ DEVICE_ACPI_HANDLE函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中DEVICE_ACPI_HANDLE函数的典型用法代码示例。如果您正苦于以下问题:C++ DEVICE_ACPI_HANDLE函数的具体用法?C++ DEVICE_ACPI_HANDLE怎么用?C++ DEVICE_ACPI_HANDLE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了DEVICE_ACPI_HANDLE函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: pciehp_get_hp_hw_control_from_firmware

int pciehp_get_hp_hw_control_from_firmware(struct pci_dev *dev){	acpi_status status;	acpi_handle chandle, handle = DEVICE_ACPI_HANDLE(&(dev->dev));	struct pci_dev *pdev = dev;	u8 *path_name;	/*	 * Per PCI firmware specification, we should run the ACPI _OSC	 * method to get control of hotplug hardware before using it.	 * If an _OSC is missing, we look for an OSHP to do the same thing.	 * To handle different BIOS behavior, we look for _OSC and OSHP	 * within the scope of the hotplug controller and its parents, upto	 * the host bridge under which this controller exists.	 */	while (!handle) {		/*		 * This hotplug controller was not listed in the ACPI name		 * space at all. Try to get acpi handle of parent pci bus.		 */		if (!pdev || !pdev->bus->parent)			break;		dbg("Could not find %s in acpi namespace, trying parent/n",				pci_name(pdev));		if (!pdev->bus->parent->self)			/* Parent must be a host bridge */			handle = acpi_get_pci_rootbridge_handle(					pci_domain_nr(pdev->bus->parent),					pdev->bus->parent->number);		else			handle = DEVICE_ACPI_HANDLE(					&(pdev->bus->parent->self->dev));		pdev = pdev->bus->parent->self;	}	while (handle) {		path_name = acpi_path_name(handle);		dbg("Trying to get hotplug control for %s /n", path_name);		status = pci_osc_control_set(handle,				OSC_PCI_EXPRESS_NATIVE_HP_CONTROL);		if (status == AE_NOT_FOUND)			status = acpi_run_oshp(handle);		if (ACPI_SUCCESS(status)) {			dbg("Gained control for hotplug HW for pci %s (%s)/n",				pci_name(dev), path_name);			return 0;		}		if (is_root_bridge(handle))			break;		chandle = handle;		status = acpi_get_parent(chandle, &handle);		if (ACPI_FAILURE(status))			break;	}	err("Cannot get control of hotplug hardware for pci %s/n",			pci_name(dev));	return -1;}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:58,


示例2: intel_dsm_pci_probe

static bool intel_dsm_pci_probe(struct pci_dev *pdev){    acpi_handle dhandle, intel_handle;    acpi_status status;    int ret;    dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);    if (!dhandle)        return false;    status = acpi_get_handle(dhandle, "_DSM", &intel_handle);    if (ACPI_FAILURE(status)) {        DRM_DEBUG_KMS("no _DSM method for intel device/n");        return false;    }    ret = intel_dsm(dhandle, INTEL_DSM_FN_SUPPORTED_FUNCTIONS, 0);    if (ret < 0) {        DRM_ERROR("failed to get supported _DSM functions/n");        return false;    }    intel_dsm_priv.dhandle = dhandle;    intel_dsm_platform_mux_info();    return true;}
开发者ID:Berrrry,项目名称:SPH-L710_NA_Kernel,代码行数:27,


示例3: DEVICE_ACPI_HANDLE

/** * acpi_dev_pm_get_node - Get ACPI device node for the given physical device. * @dev: Device to get the ACPI node for. */struct acpi_device *acpi_dev_pm_get_node(struct device *dev){	acpi_handle handle = DEVICE_ACPI_HANDLE(dev);	struct acpi_device *adev;	return handle && !acpi_bus_get_device(handle, &adev) ? adev : NULL;}
开发者ID:spacex,项目名称:kernel-centos7,代码行数:11,


示例4: radeon_atpx_get_client_id

/** * radeon_atpx_get_client_id - get the client id * * @pdev: pci device * * look up whether we are the integrated or discrete GPU (all asics). * Returns the client id. */static int radeon_atpx_get_client_id(struct pci_dev *pdev){	if (radeon_atpx_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev))		return VGA_SWITCHEROO_IGD;	else		return VGA_SWITCHEROO_DIS;}
开发者ID:0x000000FF,项目名称:Linux4Edison,代码行数:15,


示例5: nouveau_dsm_get_client_id

static int nouveau_dsm_get_client_id(struct pci_dev *pdev){	if (nouveau_dsm_priv.dhandle == DEVICE_ACPI_HANDLE(&pdev->dev))		return VGA_SWITCHEROO_IGD;	else		return VGA_SWITCHEROO_DIS;}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:7,


示例6: nouveau_acpi_edid

intnouveau_acpi_edid(struct drm_device *dev, struct drm_connector *connector){	struct nouveau_connector *nv_connector = nouveau_connector(connector);	struct acpi_device *acpidev;	acpi_handle handle;	int type, ret;	void *edid;	switch (connector->connector_type) {	case DRM_MODE_CONNECTOR_LVDS:	case DRM_MODE_CONNECTOR_eDP:		type = ACPI_VIDEO_DISPLAY_LCD;		break;	default:		return -EINVAL;	}	handle = DEVICE_ACPI_HANDLE(&dev->pdev->dev);	if (!handle)		return -ENODEV;	ret = acpi_bus_get_device(handle, &acpidev);	if (ret)		return -ENODEV;	ret = acpi_video_get_edid(acpidev, type, -1, &edid);	if (ret < 0)		return ret;	nv_connector->edid = edid;	return 0;}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:33,


示例7: meh_show

static int meh_show(struct seq_file *seqfp, void *p) {	struct pci_dev *pdev = NULL;	while ((pdev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, pdev)) != NULL) {		struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };		acpi_handle handle;#ifdef ACPI_HANDLE		/* since Linux 3.8 */		handle = ACPI_HANDLE(&pdev->dev);#else		/* removed since Linux 3.13 */		handle = DEVICE_ACPI_HANDLE(&pdev->dev);#endif		seq_printf(seqfp, "%s ", dev_name(&pdev->dev));		seq_printf(seqfp, "%06x ", pdev->class);		if (handle) {			acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);			seq_printf(seqfp, "%s/n", (char *)buf.pointer);		} else {			seq_printf(seqfp, "/n");		}	}	return 0;}
开发者ID:wmealing,项目名称:acpi-stuff,代码行数:25,


示例8: usb_acpi_find_device

static int usb_acpi_find_device(struct device *dev, acpi_handle *handle){	struct usb_device *udev;	struct device *parent;	acpi_handle *parent_handle;	if (!is_usb_device(dev))		return -ENODEV;	udev = to_usb_device(dev);	parent = dev->parent;	parent_handle = DEVICE_ACPI_HANDLE(parent);	if (!parent_handle)		return -ENODEV;	*handle = acpi_get_child(parent_handle, udev->portnum);	if (!*handle)		return -ENODEV;	/*	 * PLD will tell us whether a port is removable to the user or	 * not. If we don't get an answer from PLD (it's not present	 * or it's malformed) then try to infer it from UPC. If a	 * device isn't connectable then it's probably not removable.	 */	if (usb_acpi_check_pld(udev, *handle) != 0)		usb_acpi_check_upc(udev, *handle);	return 0;}
开发者ID:ARMWorks,项目名称:FA_2451_Linux_Kernel,代码行数:32,


示例9: find_slot_number_acpi

static uint8_t find_slot_number_acpi(const struct pci_dev *pcidev){#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)    unsigned long sun = 0;#else    unsigned long long sun = 0;#endif#ifdef DEVICE_ACPI_HANDLE    const struct device *dev = &pcidev->dev;    // Walk the tree to get a slot number, just in case we are behind a bridge. (ie ioDUO)    while (dev && !sun)    {        acpi_handle handle = DEVICE_ACPI_HANDLE(dev);        if (handle)        {            // Use the ACPI method _SUN to get the slot number. See ACPI spec.            acpi_evaluate_integer(handle, "_SUN", NULL, &sun);        }        dev = dev->parent;    }#endif    return (uint8_t)sun;}
开发者ID:promisejohn,项目名称:fio-driver,代码行数:26,


示例10: nouveau_dsm_pci_probe

static int nouveau_dsm_pci_probe(struct pci_dev *pdev){	acpi_handle dhandle, nvidia_handle;	acpi_status status;	int ret, retval = 0;	uint32_t result;	dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);	if (!dhandle)		return false;	status = acpi_get_handle(dhandle, "_DSM", &nvidia_handle);	if (ACPI_FAILURE(status)) {		return false;	}	ret = nouveau_dsm(dhandle, NOUVEAU_DSM_SUPPORTED,			  NOUVEAU_DSM_SUPPORTED_FUNCTIONS, &result);	if (ret == 0)		retval |= NOUVEAU_DSM_HAS_MUX;	ret = nouveau_optimus_dsm(dhandle, 0, 0, &result);	if (ret == 0)		retval |= NOUVEAU_DSM_HAS_OPT;	if (retval)		nouveau_dsm_priv.dhandle = dhandle;	return retval;}
开发者ID:1111saeid,项目名称:jb_kernel_3.0.16_htc_golfu,代码行数:30,


示例11: bbswitch_init

static int __init bbswitch_init(void) {    struct proc_dir_entry *acpi_entry;    struct pci_dev *pdev = NULL;    int class = PCI_CLASS_DISPLAY_VGA << 8;    while ((pdev = pci_get_class(class, pdev)) != NULL) {        struct acpi_buffer buf = { ACPI_ALLOCATE_BUFFER, NULL };        acpi_handle handle;        handle = DEVICE_ACPI_HANDLE(&pdev->dev);        if (!handle)            continue;        if (pdev->vendor != PCI_VENDOR_ID_INTEL) {            dis_dev = pdev;            dis_handle = handle;            acpi_get_name(handle, ACPI_FULL_PATHNAME, &buf);            printk(KERN_INFO "bbswitch: Found discrete VGA device %s: %s/n",                dev_name(&pdev->dev), (char *)buf.pointer);        }        kfree(buf.pointer);    }    if (dis_dev == NULL) {        printk(KERN_ERR "bbswitch: No discrete VGA device found/n");        return -ENODEV;    }    if (has_dsm_func(acpi_optimus_dsm_muid, 0x100, 0x1A)) {        dsm_type = DSM_TYPE_OPTIMUS;        printk(KERN_INFO "bbswitch: detected an Optimus _DSM function/n");    } else if (has_dsm_func(acpi_nvidia_dsm_muid, 0x102, 0x3)) {        dsm_type = DSM_TYPE_NVIDIA;        printk(KERN_INFO "bbswitch: detected a nVidia _DSM function/n");    } else {        printk(KERN_ERR "bbswitch: No suitable _DSM call found./n");        return -ENODEV;    }    acpi_entry = create_proc_entry("bbswitch", 0660, acpi_root_dir);    if (acpi_entry == NULL) {        printk(KERN_ERR "bbswitch: Couldn't create proc entry/n");        return -ENOMEM;    }    printk(KERN_INFO "bbswitch: Succesfully loaded. Discrete card %s is %s/n",        dev_name(&dis_dev->dev), is_card_disabled() ? "off" : "on");    acpi_entry->write_proc = bbswitch_write;    acpi_entry->read_proc = bbswitch_read;    nb.notifier_call = &bbswitch_pm_handler;    register_pm_notifier(&nb);    return 0;}
开发者ID:TheFrozenFire,项目名称:bumblebeed,代码行数:56,


示例12: acpi_pci_set_power_state

static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state){	acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);	acpi_handle tmp;	static const u8 state_conv[] = {		[PCI_D0] = ACPI_STATE_D0,		[PCI_D1] = ACPI_STATE_D1,		[PCI_D2] = ACPI_STATE_D2,		[PCI_D3hot] = ACPI_STATE_D3,		[PCI_D3cold] = ACPI_STATE_D3	};
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:11,


示例13: get_hp_hw_control_from_firmware

void get_hp_hw_control_from_firmware(struct pci_dev *dev){	/*	 * OSHP is an optional ACPI firmware control method. If present,	 * we need to run it to inform BIOS that we will control SHPC	 * hardware from now on.	 */	acpi_handle handle = DEVICE_ACPI_HANDLE(&(dev->dev));	if (!handle)		return;	acpi_run_oshp(handle);}
开发者ID:ena30,项目名称:snake-os,代码行数:12,


示例14: ide_get_dev_handle

/** * ide_get_dev_handle - finds acpi_handle and PCI device.function * @dev: device to locate * @handle: returned acpi_handle for @dev * @pcidevfn: return PCI device.func for @dev * * Returns the ACPI object handle to the corresponding PCI device. * * Returns 0 on success, <0 on error. */static int ide_get_dev_handle(struct device *dev, acpi_handle *handle,			       acpi_integer *pcidevfn){	struct pci_dev *pdev = to_pci_dev(dev);	unsigned int bus, devnum, func;	acpi_integer addr;	acpi_handle dev_handle;	struct acpi_buffer buffer = {.length = ACPI_ALLOCATE_BUFFER,					.pointer = NULL};	acpi_status status;	struct acpi_device_info	*dinfo = NULL;	int ret = -ENODEV;	bus = pdev->bus->number;	devnum = PCI_SLOT(pdev->devfn);	func = PCI_FUNC(pdev->devfn);	/* ACPI _ADR encoding for PCI bus: */	addr = (acpi_integer)(devnum << 16 | func);	DEBPRINT("ENTER: pci %02x:%02x.%01x/n", bus, devnum, func);	dev_handle = DEVICE_ACPI_HANDLE(dev);	if (!dev_handle) {		DEBPRINT("no acpi handle for device/n");		goto err;	}	status = acpi_get_object_info(dev_handle, &buffer);	if (ACPI_FAILURE(status)) {		DEBPRINT("get_object_info for device failed/n");		goto err;	}	dinfo = buffer.pointer;	if (dinfo && (dinfo->valid & ACPI_VALID_ADR) &&	    dinfo->address == addr) {		*pcidevfn = addr;		*handle = dev_handle;	} else {		DEBPRINT("get_object_info for device has wrong "			" address: %llu, should be %u/n",			dinfo ? (unsigned long long)dinfo->address : -1ULL,			(unsigned int)addr);		goto err;	}	DEBPRINT("for dev=0x%x.%x, addr=0x%llx, *handle=0x%p/n",		 devnum, func, (unsigned long long)addr, *handle);	ret = 0;err:	kfree(dinfo);	return ret;}
开发者ID:Tigrouzen,项目名称:k1099,代码行数:62,


示例15: acpi_pm_device_sleep_state

/** * acpi_pm_device_sleep_state - Get preferred power state of ACPI device. * @dev: Device whose preferred target power state to return. * @d_min_p: Location to store the upper limit of the allowed states range. * @d_max_in: Deepest low-power state to take into consideration. * Return value: Preferred power state of the device on success, -ENODEV * (if there's no 'struct acpi_device' for @dev) or -EINVAL on failure * * The caller must ensure that @dev is valid before using this function. */int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in){	acpi_handle handle = DEVICE_ACPI_HANDLE(dev);	struct acpi_device *adev;	if (!handle || acpi_bus_get_device(handle, &adev)) {		dev_dbg(dev, "ACPI handle without context in %s!/n", __func__);		return -ENODEV;	}	return acpi_device_power_state(dev, adev, acpi_target_system_state(),				       d_max_in, d_min_p);}
开发者ID:AiWinters,项目名称:linux,代码行数:23,


示例16: pci_acpi_find_device

/* ACPI bus type */static int pci_acpi_find_device(struct device *dev, acpi_handle *handle){	struct pci_dev * pci_dev;	acpi_integer	addr;	pci_dev = to_pci_dev(dev);	/* Please ref to ACPI spec for the syntax of _ADR */	addr = (PCI_SLOT(pci_dev->devfn) << 16) | PCI_FUNC(pci_dev->devfn);	*handle = acpi_get_child(DEVICE_ACPI_HANDLE(dev->parent), addr);	if (!*handle)		return -ENODEV;	return 0;}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:14,


示例17: radeon_atrm_get_bios

static bool radeon_atrm_get_bios(struct radeon_device *rdev){	int ret;	int size = 256 * 1024;	int i;	struct pci_dev *pdev = NULL;	acpi_handle dhandle, atrm_handle;	acpi_status status;	bool found = false;	/* ATRM is for the discrete card only */	if (rdev->flags & RADEON_IS_IGP)		return false;	while ((pdev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, pdev)) != NULL) {		dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);		if (!dhandle)			continue;		status = acpi_get_handle(dhandle, "ATRM", &atrm_handle);		if (!ACPI_FAILURE(status)) {			found = true;			break;		}	}	if (!found)		return false;	rdev->bios = kmalloc(size, GFP_KERNEL);	if (!rdev->bios) {		DRM_ERROR("Unable to allocate bios/n");		return false;	}	for (i = 0; i < size / ATRM_BIOS_PAGE; i++) {		ret = radeon_atrm_call(atrm_handle,				       rdev->bios,				       (i * ATRM_BIOS_PAGE),				       ATRM_BIOS_PAGE);		if (ret < ATRM_BIOS_PAGE)			break;	}	if (i == 0 || rdev->bios[0] != 0x55 || rdev->bios[1] != 0xaa) {		kfree(rdev->bios);		return false;	}	return true;}
开发者ID:174high,项目名称:dell-driver,代码行数:50,


示例18: acpi_pci_set_power_state

static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state){	acpi_handle handle = DEVICE_ACPI_HANDLE(&dev->dev);	static int state_conv[] = {		[0] = 0,		[1] = 1,		[2] = 2,		[3] = 3,		[4] = 3	};	int acpi_state = state_conv[(int __force) state];	if (!handle)		return -ENODEV;	return acpi_bus_set_power(handle, acpi_state);}
开发者ID:kzlin129,项目名称:tt-gpl,代码行数:16,


示例19: device_has_dsm

static booldevice_has_dsm(struct device *dev){	acpi_handle handle;	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};	handle = DEVICE_ACPI_HANDLE(dev);	if (!handle)		return FALSE;	if (dsm_get_label(handle, DEVICE_LABEL_DSM, &output, NULL,			  ACPI_ATTR_NONE) > 0)		return TRUE;	return FALSE;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:17,


示例20: radeon_atpx_pci_probe_handle

/** * radeon_atpx_pci_probe_handle - look up the ATPX handle * * @pdev: pci device * * Look up the ATPX handles (all asics). * Returns true if the handles are found, false if not. */static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev){	ACPI_HANDLE dhandle, atpx_handle;	ACPI_STATUS status;	dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);	if (!dhandle)		return false;	status = AcpiGetHandle(dhandle, "ATPX", &atpx_handle);	if (ACPI_FAILURE(status))		return false;	radeon_atpx_priv.dhandle = dhandle;	radeon_atpx_priv.atpx.handle = atpx_handle;	return true;}
开发者ID:ele7enxxh,项目名称:dtrace-pf,代码行数:25,


示例21: acpi_pm_device_run_wake

/** * acpi_pm_device_run_wake - Enable/disable remote wakeup for given device. * @dev: Device to enable/disable the platform to wake up. * @enable: Whether to enable or disable the wakeup functionality. */int acpi_pm_device_run_wake(struct device *phys_dev, bool enable){	struct acpi_device *adev;	acpi_handle handle;	if (!device_run_wake(phys_dev))		return -EINVAL;	handle = DEVICE_ACPI_HANDLE(phys_dev);	if (!handle || acpi_bus_get_device(handle, &adev)) {		dev_dbg(phys_dev, "ACPI handle without context in %s!/n",			__func__);		return -ENODEV;	}	return __acpi_device_run_wake(adev, enable);}
开发者ID:spacex,项目名称:kernel-centos7,代码行数:22,


示例22: radeon_atpx_pci_probe_handle

/** * radeon_atpx_pci_probe_handle - look up the ATPX handle * * @pdev: pci device * * Look up the ATPX handles (all asics). * Returns true if the handles are found, false if not. */static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev){	acpi_handle dhandle, atpx_handle;	acpi_status status;	dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);	if (!dhandle)		return false;	status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);	if (ACPI_FAILURE(status))		return false;	radeon_atpx_priv.dhandle = dhandle;	radeon_atpx_priv.atpx.handle = atpx_handle;	return true;}
开发者ID:0x000000FF,项目名称:Linux4Edison,代码行数:25,


示例23: radeon_acpi_init

/* Call all ACPI methods here */int radeon_acpi_init(struct radeon_device *rdev){	acpi_handle handle;	int ret;	/* No need to proceed if we're sure that ATIF is not supported */	if (!ASIC_IS_AVIVO(rdev) || !rdev->bios)		return 0;	/* Get the device handle */	handle = DEVICE_ACPI_HANDLE(&rdev->pdev->dev);	/* Call the ATIF method */	ret = radeon_atif_call(handle);	if (ret)		return ret;	return 0;}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:20,


示例24: nouveau_acpi_rom_supported

bool nouveau_acpi_rom_supported(struct pci_dev *pdev){	acpi_status status;	acpi_handle dhandle, rom_handle;	if (!nouveau_dsm_priv.dsm_detected)		return false;	dhandle = DEVICE_ACPI_HANDLE(&pdev->dev);	if (!dhandle)		return false;	status = acpi_get_handle(dhandle, "_ROM", &rom_handle);	if (ACPI_FAILURE(status))		return false;	nouveau_dsm_priv.rom_handle = rom_handle;	return true;}
开发者ID:1703011,项目名称:asuswrt-merlin,代码行数:19,


示例25: acpi_pm_device_sleep_state

/** * acpi_pm_device_sleep_state - Get preferred power state of ACPI device. * @dev: Device whose preferred target power state to return. * @d_min_p: Location to store the upper limit of the allowed states range. * @d_max_in: Deepest low-power state to take into consideration. * Return value: Preferred power state of the device on success, -ENODEV * if there's no 'struct acpi_device' for @dev, -EINVAL if @d_max_in is * incorrect, or -ENODATA on ACPI method failure. * * The caller must ensure that @dev is valid before using this function. */int acpi_pm_device_sleep_state(struct device *dev, int *d_min_p, int d_max_in){	acpi_handle handle = DEVICE_ACPI_HANDLE(dev);	struct acpi_device *adev;	int ret, d_min, d_max;	if (d_max_in < ACPI_STATE_D0 || d_max_in > ACPI_STATE_D3_COLD)		return -EINVAL;	if (d_max_in > ACPI_STATE_D3_HOT) {		enum pm_qos_flags_status stat;		stat = dev_pm_qos_flags(dev, PM_QOS_FLAG_NO_POWER_OFF);		if (stat == PM_QOS_FLAGS_ALL)			d_max_in = ACPI_STATE_D3_HOT;	}	if (!handle || acpi_bus_get_device(handle, &adev)) {		dev_dbg(dev, "ACPI handle without context in %s!/n", __func__);		return -ENODEV;	}	ret = acpi_dev_pm_get_state(dev, adev, acpi_target_system_state(),				    &d_min, &d_max);	if (ret)		return ret;	if (d_max_in < d_min)		return -EINVAL;	if (d_max > d_max_in) {		for (d_max = d_max_in; d_max > d_min; d_max--) {			if (adev->power.states[d_max].flags.valid)				break;		}	}	if (d_min_p)		*d_min_p = d_min;	return d_max;}
开发者ID:spacex,项目名称:kernel-centos7,代码行数:53,


示例26: acpilabel_show

static ssize_tacpilabel_show(struct device *dev, struct device_attribute *attr, char *buf){	struct acpi_buffer output = {ACPI_ALLOCATE_BUFFER, NULL};	acpi_handle handle;	int length;	handle = DEVICE_ACPI_HANDLE(dev);	if (!handle)		return -1;	length = dsm_get_label(handle, DEVICE_LABEL_DSM,			       &output, buf, ACPI_ATTR_LABEL_SHOW);	if (length < 1)		return -1;	return length;}
开发者ID:openube,项目名称:android_kernel_sony_c2305,代码行数:20,


示例27: acpi_get_hp_params_from_firmware

/* acpi_get_hp_params_from_firmware * * @bus - the pci_bus of the bus on which the device is newly added * @hpp - allocated by the caller */acpi_status acpi_get_hp_params_from_firmware(struct pci_bus *bus,        struct hotplug_params *hpp){    acpi_status status = AE_NOT_FOUND;    acpi_handle handle, phandle;    struct pci_bus *pbus = bus;    struct pci_dev *pdev;    do {        pdev = pbus->self;        if (!pdev) {            handle = acpi_get_pci_rootbridge_handle(                pci_domain_nr(pbus), pbus->number);            break;        }        handle = DEVICE_ACPI_HANDLE(&(pdev->dev));        pbus = pbus->parent;    } while (!handle);    /*     * _HPP settings apply to all child buses, until another _HPP is     * encountered. If we don't find an _HPP for the input pci dev,     * look for it in the parent device scope since that would apply to     * this pci dev. If we don't find any _HPP, use hardcoded defaults     */    while (handle) {        status = acpi_run_hpx(handle, hpp);        if (ACPI_SUCCESS(status))            break;        status = acpi_run_hpp(handle, hpp);        if (ACPI_SUCCESS(status))            break;        if (acpi_root_bridge(handle))            break;        status = acpi_get_parent(handle, &phandle);        if (ACPI_FAILURE(status))            break;        handle = phandle;    }    return status;}
开发者ID:274914765,项目名称:C,代码行数:46,


示例28: pciehp_get_hp_params_from_firmware

void pciehp_get_hp_params_from_firmware(struct pci_dev *dev,		struct hotplug_params *hpp){	acpi_status status = AE_NOT_FOUND;	struct pci_dev *pdev = dev;	/*	 * _HPP settings apply to all child buses, until another _HPP is	 * encountered. If we don't find an _HPP for the input pci dev,	 * look for it in the parent device scope since that would apply to	 * this pci dev. If we don't find any _HPP, use hardcoded defaults	 */	while (pdev && (ACPI_FAILURE(status))) {		acpi_handle handle = DEVICE_ACPI_HANDLE(&(pdev->dev));		if (!handle)			break;		status = acpi_run_hpp(handle, hpp);		if (!(pdev->bus->parent))			break;		/* Check if a parent object supports _HPP */		pdev = pdev->bus->parent->self;	}}
开发者ID:BackupTheBerlios,项目名称:tew632-brp-svn,代码行数:23,


示例29: acpi_pm_device_sleep_wake

/** * acpi_pm_device_sleep_wake - Enable or disable device to wake up the system. * @dev: Device to enable/desible to wake up the system from sleep states. * @enable: Whether to enable or disable @dev to wake up the system. */int acpi_pm_device_sleep_wake(struct device *dev, bool enable){	acpi_handle handle;	struct acpi_device *adev;	int error;	if (!device_can_wakeup(dev))		return -EINVAL;	handle = DEVICE_ACPI_HANDLE(dev);	if (!handle || acpi_bus_get_device(handle, &adev)) {		dev_dbg(dev, "ACPI handle without context in %s!/n", __func__);		return -ENODEV;	}	error = __acpi_device_sleep_wake(adev, acpi_target_system_state(),					 enable);	if (!error)		dev_info(dev, "System wakeup %s by ACPI/n",				enable ? "enabled" : "disabled");	return error;}
开发者ID:spacex,项目名称:kernel-centos7,代码行数:28,



注:本文中的DEVICE_ACPI_HANDLE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ DEVICE_CLASS函数代码示例
C++ DEVICE函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。