本文整理汇总了C++中device_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ device_lock函数的具体用法?C++ device_lock怎么用?C++ device_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了device_lock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: uuid_store
static ssize_t uuid_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
struct nd_btt *nd_btt = to_nd_btt(dev);
ssize_t rc;
device_lock(dev);
rc = nd_uuid_store(dev, &nd_btt->uuid, buf, len);
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
device_unlock(dev);
return rc ? rc : len;
}
开发者ID:suntodai,项目名称:prd,代码行数:14,代码来源:btt_devs.c
示例2: report_error_detected
static int report_error_detected(struct pci_dev *dev, void *data)
{
pci_ers_result_t vote;
const struct pci_error_handlers *err_handler;
struct aer_broadcast_data *result_data;
result_data = (struct aer_broadcast_data *) data;
device_lock(&dev->dev);
dev->error_state = result_data->state;
if (!dev->driver ||
!dev->driver->err_handler ||
!dev->driver->err_handler->error_detected) {
if (result_data->state == pci_channel_io_frozen &&
!(dev->hdr_type & PCI_HEADER_TYPE_BRIDGE)) {
/*
* In case of fatal recovery, if one of down-
* stream device has no driver. We might be
* unable to recover because a later insmod
* of a driver for this device is unaware of
* its hw state.
*/
dev_printk(KERN_DEBUG, &dev->dev, "device has %s\n",
dev->driver ?
"no AER-aware driver" : "no driver");
}
/*
* If there's any device in the subtree that does not
* have an error_detected callback, returning
* PCI_ERS_RESULT_NO_AER_DRIVER prevents calling of
* the subsequent mmio_enabled/slot_reset/resume
* callbacks of "any" device in the subtree. All the
* devices in the subtree are left in the error state
* without recovery.
*/
if (!(dev->hdr_type & PCI_HEADER_TYPE_BRIDGE))
vote = PCI_ERS_RESULT_NO_AER_DRIVER;
else
vote = PCI_ERS_RESULT_NONE;
} else {
err_handler = dev->driver->err_handler;
vote = err_handler->error_detected(dev, result_data->state);
}
result_data->result = merge_result(result_data->result, vote);
device_unlock(&dev->dev);
return 0;
}
开发者ID:7799,项目名称:linux,代码行数:50,代码来源:aerdrv_core.c
示例3: store_ehci_power
static ssize_t store_ehci_power(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct platform_device *pdev = to_platform_device(dev);
struct s5p_ehci_platdata *pdata = pdev->dev.platform_data;
struct s5p_ehci_hcd *s5p_ehci = platform_get_drvdata(pdev);
struct usb_hcd *hcd = s5p_ehci->hcd;
int power_on;
int irq;
int retval;
if (sscanf(buf, "%d", &power_on) != 1)
return -EINVAL;
device_lock(dev);
pm_runtime_get_sync(dev);
if (!power_on && s5p_ehci->power_on) {
printk(KERN_DEBUG "%s: EHCI turns off\n", __func__);
s5p_ehci->power_on = 0;
usb_remove_hcd(hcd);
if (pdata && pdata->phy_exit)
pdata->phy_exit(pdev, S5P_USB_PHY_HSIC);
} else if (power_on) {
printk(KERN_DEBUG "%s: EHCI turns on\n", __func__);
if (s5p_ehci->power_on) {
usb_remove_hcd(hcd);
}
if (pdata && pdata->phy_init)
pdata->phy_init(pdev, S5P_USB_PHY_HSIC);
s5p_ehci_configurate(hcd);
irq = platform_get_irq(pdev, 0);
retval = usb_add_hcd(hcd, irq,
IRQF_DISABLED | IRQF_SHARED);
if (retval < 0) {
dev_err(dev, "Power On Fail\n");
goto exit;
}
s5p_ehci->power_on = 1;
}
exit:
pm_runtime_put_sync(dev);
device_unlock(dev);
return count;
}
开发者ID:amuxtux,项目名称:exynos4210,代码行数:50,代码来源:ehci-s5p.c
示例4: namespace_store
static ssize_t namespace_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
ssize_t rc;
nvdimm_bus_lock(dev);
device_lock(dev);
rc = __namespace_store(dev, attr, buf, len);
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
device_unlock(dev);
nvdimm_bus_unlock(dev);
return rc;
}
开发者ID:suntodai,项目名称:prd,代码行数:15,代码来源:btt_devs.c
示例5: ar9170_usb_firmware_failed
static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
{
struct device *parent = aru->udev->dev.parent;
complete(&aru->firmware_loading_complete);
/* unbind anything failed */
if (parent)
device_lock(parent);
device_release_driver(&aru->udev->dev);
if (parent)
device_unlock(parent);
usb_put_dev(aru->udev);
}
开发者ID:kronenpj,项目名称:samsung-s3c6410-android.2.0,代码行数:15,代码来源:usb.c
示例6: autosuspend_delay_ms_store
static ssize_t autosuspend_delay_ms_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
long delay;
if (!dev->power.use_autosuspend)
return -EIO;
if (kstrtol(buf, 10, &delay) != 0 || delay != (int) delay)
return -EINVAL;
device_lock(dev);
pm_runtime_set_autosuspend_delay(dev, delay);
device_unlock(dev);
return n;
}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:16,代码来源:sysfs.c
示例7: floppy_request
static int floppy_request(vnode *node, int cmd, ULONG sector, ULONG count, char *buffer)
{
if (sector>=FLOPPY_SECTOR_COUNT) return -EINVAL;
device_lock(node);
if (sector+count>=FLOPPY_SECTOR_COUNT)
count=FLOPPY_SECTOR_COUNT-sector;
switch (cmd) {
case REQUEST_READ:
fdc_read_block(sector,buffer,count);
break;
case REQUEST_WRITE:
fdc_rw(sector,buffer,0,count);
break;
}
device_unlock(node);
return count;
}
开发者ID:BackupTheBerlios,项目名称:nupkux-svn,代码行数:17,代码来源:fdc_lib.c
示例8: align_store
static ssize_t align_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
struct nd_pfn *nd_pfn = to_nd_pfn_safe(dev);
ssize_t rc;
device_lock(dev);
nvdimm_bus_lock(dev);
rc = nd_size_select_store(dev, buf, &nd_pfn->align,
nd_pfn_supported_alignments());
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
nvdimm_bus_unlock(dev);
device_unlock(dev);
return rc ? rc : len;
}
开发者ID:SantoshShilimkar,项目名称:linux,代码行数:17,代码来源:pfn_devs.c
示例9: fimc_md_register_platform_entity
static int fimc_md_register_platform_entity(struct fimc_md *fmd,
struct platform_device *pdev,
int plat_entity)
{
struct device *dev = &pdev->dev;
int ret = -EPROBE_DEFER;
void *drvdata;
/* Lock to ensure dev->driver won't change. */
device_lock(dev);
if (!dev->driver || !try_module_get(dev->driver->owner))
goto dev_unlock;
drvdata = dev_get_drvdata(dev);
/* Some subdev didn't probe successfully id drvdata is NULL */
if (drvdata) {
switch (plat_entity) {
case IDX_FIMC:
ret = register_fimc_entity(fmd, drvdata);
break;
case IDX_FLITE:
ret = register_fimc_lite_entity(fmd, drvdata);
break;
case IDX_CSIS:
ret = register_csis_entity(fmd, pdev, drvdata);
break;
case IDX_IS_ISP:
ret = register_fimc_is_entity(fmd, drvdata);
break;
default:
ret = -ENODEV;
}
}
module_put(dev->driver->owner);
dev_unlock:
device_unlock(dev);
if (ret == -EPROBE_DEFER)
dev_info(&fmd->pdev->dev, "deferring %s device registration\n",
dev_name(dev));
else if (ret < 0)
dev_err(&fmd->pdev->dev, "%s device registration failed (%d)\n",
dev_name(dev), ret);
return ret;
}
开发者ID:020gzh,项目名称:linux,代码行数:46,代码来源:media-dev.c
示例10: sector_size_store
static ssize_t sector_size_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
struct nd_btt *nd_btt = to_nd_btt(dev);
ssize_t rc;
device_lock(dev);
nvdimm_bus_lock(dev);
rc = nd_sector_size_store(dev, buf, &nd_btt->lbasize,
btt_lbasize_supported);
dev_dbg(dev, "%s: result: %zd wrote: %s%s", __func__,
rc, buf, buf[len - 1] == '\n' ? "" : "\n");
nvdimm_bus_unlock(dev);
device_unlock(dev);
return rc ? rc : len;
}
开发者ID:suntodai,项目名称:prd,代码行数:17,代码来源:btt_devs.c
示例11: report_resume
static int report_resume(struct pci_dev *dev, void *data)
{
const struct pci_error_handlers *err_handler;
device_lock(&dev->dev);
dev->error_state = pci_channel_io_normal;
if (!dev->driver ||
!dev->driver->err_handler ||
!dev->driver->err_handler->resume)
goto out;
err_handler = dev->driver->err_handler;
err_handler->resume(dev);
out:
device_unlock(&dev->dev);
return 0;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:18,代码来源:aerdrv_core.c
示例12: alt_name_store
static ssize_t alt_name_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t len)
{
struct nd_region *nd_region = to_nd_region(dev->parent);
ssize_t rc;
device_lock(dev);
nvdimm_bus_lock(dev);
wait_nvdimm_bus_probe_idle(dev);
rc = __alt_name_store(dev, buf, len);
if (rc >= 0)
rc = nd_namespace_label_update(nd_region, dev);
dev_dbg(dev, "%s: %s(%zd)\n", __func__, rc < 0 ? "fail " : "", rc);
nvdimm_bus_unlock(dev);
device_unlock(dev);
return rc < 0 ? rc : len;
}
开发者ID:Kirill2013,项目名称:kasan,代码行数:18,代码来源:namespace_devs.c
示例13: control_store
static ssize_t control_store(struct device * dev, struct device_attribute *attr,
const char * buf, size_t n)
{
char *cp;
int len = n;
cp = memchr(buf, '\n', n);
if (cp)
len = cp - buf;
device_lock(dev);
if (len == sizeof ctrl_auto - 1 && strncmp(buf, ctrl_auto, len) == 0)
pm_runtime_allow(dev);
else if (len == sizeof ctrl_on - 1 && strncmp(buf, ctrl_on, len) == 0)
pm_runtime_forbid(dev);
else
n = -EINVAL;
device_unlock(dev);
return n;
}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:19,代码来源:sysfs.c
示例14: gpp_wppart_set
static ssize_t gpp_wppart_set(struct device *dev,
struct device_attribute *attr, const char *buf, size_t n)
{
long part;
struct mmc_card *card = mmc_dev_to_card(dev);
if (card == NULL)
return -ENODEV;
if (kstrtol(buf, 10, &part) != 0 || part != (u32)part)
return -EINVAL;
if (part > EXT_CSD_GPP_NUM || part <= 0)
return -EINVAL;
if (!card->ext_csd.gpp_sz[part - 1])
return -EINVAL;
device_lock(dev);
/* make GPP number recognized by eMMC device */
gpp_wppart = part + EXT_CSD_PART_CONFIG_ACC_GP0 - 1;
device_unlock(dev);
return n;
}
开发者ID:TheSSJ,项目名称:android_kernel_asus_moorefield,代码行数:20,代码来源:mmc.c
示例15: report_slot_reset
static int report_slot_reset(struct pci_dev *dev, void *data)
{
pci_ers_result_t vote;
const struct pci_error_handlers *err_handler;
struct aer_broadcast_data *result_data;
result_data = (struct aer_broadcast_data *) data;
device_lock(&dev->dev);
if (!dev->driver ||
!dev->driver->err_handler ||
!dev->driver->err_handler->slot_reset)
goto out;
err_handler = dev->driver->err_handler;
vote = err_handler->slot_reset(dev);
result_data->result = merge_result(result_data->result, vote);
out:
device_unlock(&dev->dev);
return 0;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:20,代码来源:aerdrv_core.c
示例16: device_attach
/**
* device_attach - try to attach device to a driver.
* @dev: device.
*
* Walk the list of drivers that the bus has and call
* driver_probe_device() for each pair. If a compatible
* pair is found, break out and return.
*
* Returns 1 if the device was bound to a driver;
* 0 if no matching driver was found;
* -ENODEV if the device is not registered.
*
* When called for a USB interface, @dev->parent lock must be held.
*/
int device_attach(struct device *dev)
{
int ret = 0;
device_lock(dev);
if (dev->driver) {
ret = device_bind_driver(dev);
if (ret == 0)
ret = 1;
else {
dev->driver = NULL;
ret = 0;
}
} else {
pm_runtime_get_noresume(dev);
ret = bus_for_each_drv(dev->bus, NULL, dev, __device_attach);
pm_runtime_put_sync(dev);
}
device_unlock(dev);
return ret;
}
开发者ID:A2109devs,项目名称:lenovo_a2109a_kernel,代码行数:35,代码来源:dd.c
示例17: nfc_genl_stop_poll
static int nfc_genl_stop_poll(struct sk_buff *skb, struct genl_info *info)
{
struct nfc_dev *dev;
int rc;
u32 idx;
if (!info->attrs[NFC_ATTR_DEVICE_INDEX])
return -EINVAL;
idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]);
dev = nfc_get_device(idx);
if (!dev)
return -ENODEV;
device_lock(&dev->dev);
if (!dev->polling) {
device_unlock(&dev->dev);
return -EINVAL;
}
device_unlock(&dev->dev);
mutex_lock(&dev->genl_data.genl_data_mutex);
if (dev->genl_data.poll_req_portid != info->snd_portid) {
rc = -EBUSY;
goto out;
}
rc = nfc_stop_poll(dev);
dev->genl_data.poll_req_portid = 0;
out:
mutex_unlock(&dev->genl_data.genl_data_mutex);
nfc_put_device(dev);
return rc;
}
开发者ID:AllenDou,项目名称:linux,代码行数:39,代码来源:netlink.c
示例18: filename
void ImageManager::device_free_image(Device *, ImageDataType type, int slot)
{
Image *img = images[type][slot];
if(img) {
if(osl_texture_system && !img->builtin_data) {
#ifdef WITH_OSL
ustring filename(images[type][slot]->filename);
((OSL::TextureSystem*)osl_texture_system)->invalidate(filename);
#endif
}
if(img->mem) {
thread_scoped_lock device_lock(device_mutex);
delete img->mem;
}
delete img;
images[type][slot] = NULL;
--tex_num_images[type];
}
}
开发者ID:mgschwan,项目名称:blensor,代码行数:22,代码来源:image.cpp
示例19: store_mipi_lli_control
static ssize_t store_mipi_lli_control(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct mipi_lli *lli = dev_get_drvdata(dev);
int command;
if (sscanf(buf, "%10d", &command) != 1)
return -EINVAL;
device_lock(dev);
if (command == 0)
lli->driver->debug_info(lli);
else if (command == 1)
lli->driver->init(lli);
else if (command == 2)
lli->driver->set_master(lli, true);
else if (command == 3)
lli->driver->link_startup_mount(lli);
else if (command == 4)
lli->driver->exit(lli);
else if (command == 5)
mipi_lli_send_signal_test(lli);
else if (command == 6)
lli->driver->loopback_test(lli);
else if (command == 98)
print_hex_dump(KERN_INFO, "llimem: ", DUMP_PREFIX_OFFSET, 16, 1,
g_lli->shdmem_addr + SZ_1K, 512, true);
else if (command == 99)
print_hex_dump(KERN_INFO, "llimem: ", DUMP_PREFIX_OFFSET, 16, 1,
g_lli->shdmem_addr + SZ_1K + 512, 512, true);
else
dev_err(dev, "Un-support control command\n");
device_unlock(dev);
return count;
}
开发者ID:djvoleur,项目名称:V_920P_AOE2,代码行数:39,代码来源:mipi-lli.c
示例20: smbus_do_alert
static int smbus_do_alert(struct device *dev, void *addrp)
{
struct i2c_client *client = i2c_verify_client(dev);
struct alert_data *data = addrp;
if (!client || client->addr != data->addr)
return 0;
if (client->flags & I2C_CLIENT_TEN)
return 0;
device_lock(dev);
if (client->driver) {
if (client->driver->alert)
client->driver->alert(client, data->flag);
else
dev_warn(&client->dev, "no driver alert()!\n");
} else
dev_dbg(&client->dev, "alert with no driver\n");
device_unlock(dev);
return -EBUSY;
}
开发者ID:DirtyDroidX,项目名称:android_kernel_htc_m8ul,代码行数:23,代码来源:i2c-smbus.c
注:本文中的device_lock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论