本文整理汇总了C++中create_workqueue函数的典型用法代码示例。如果您正苦于以下问题:C++ create_workqueue函数的具体用法?C++ create_workqueue怎么用?C++ create_workqueue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_workqueue函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lge_hsd_init
static int __init lge_hsd_init(void)
{
int ret;
HSD_DBG("enter\n");
#ifdef CONFIG_MAX1462X_USE_LOCAL_WORK_QUEUE
local_max1462x_workqueue = create_workqueue("max1462x") ;
if(!local_max1462x_workqueue)
return -ENOMEM;
#endif
HSD_DBG("wake_lock_init\n");
wake_lock_init(&ear_hook_wake_lock, WAKE_LOCK_SUSPEND, "ear_hook");
ret = platform_driver_register(&lge_hsd_driver);
if (ret) {
HSD_ERR("Fail to register platform driver\n");
}
return ret;
}
开发者ID:JSkernel,项目名称:G_pro2_msm8974_JSKernel,代码行数:21,代码来源:hds_max1462x.c
示例2: headset_init
/**********************************************************
** Function: Headset driver init function
** Parameter: none
** Return value: none
**
************************************************************/
static int __init headset_init(void)
{
printk(KERN_INFO "%s+ #####\n", __func__);
int ret;
printk("HEADSET: Headset detection init\n");
hs_data = kzalloc(sizeof(struct headset_data), GFP_KERNEL);
if (!hs_data)
return -ENOMEM;
hs_data->debouncing_time = ktime_set(0, 100000000); /* 100 ms */
hs_data->sdev.name = "h2w";
hs_data->sdev.print_name = headset_name_show;
hs_data->sdev.print_state = headset_state_show;
ret = switch_dev_register(&hs_data->sdev);
if (ret < 0)
goto err_switch_dev_register;
g_detection_work_queue = create_workqueue("detection");
hrtimer_init(&hs_data->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
hs_data->timer.function = detect_event_timer_func;
printk("HEADSET: Headset detection mode\n");
btn_config_gpio();/*Config hook detection GPIO*/
jack_config_gpio();/*Config jack detection GPIO*/
INIT_WORK(&lineout_work, lineout_work_queue);
lineout_config_gpio();
printk(KERN_INFO "%s- #####\n", __func__);
return 0;
err_switch_dev_register:
printk(KERN_ERR "Headset: Failed to register driver\n");
return ret;
}
开发者ID:bigbiff,项目名称:kernel_asus_tf700t,代码行数:46,代码来源:headset.c
示例3: init_module
int init_module(void)
{
int ret;
my_wq = create_workqueue("my_queue");
if (my_wq) {
work1 = (my_work_t*) kmalloc(sizeof(my_work_t), GFP_KERNEL);
if (work1) {
INIT_WORK((struct work_struct*) work1, my_wq_function);
work1->x = 1;
ret = queue_work(my_wq, (struct work_struct*)work1);
}
work2 = (my_work_t*)kmalloc(sizeof(my_work_t), GFP_KERNEL);
if (work2) {
INIT_WORK((struct work_struct*)work2, my_wq_function);
work2->x = 2;
ret = queue_work(my_wq, (struct work_struct*) work2);
}
}
return 0;
}
开发者ID:efernandesng,项目名称:linux,代码行数:22,代码来源:workqueue.c
示例4: init_module
int init_module(void) {
int ret;
my_wq = create_workqueue("my_queue");
if (my_wq) {
//--Queue some work(item 1)--
work = (my_work_t *) kmalloc(sizeof(my_work_t), GFP_KERNEL);
if (work) {
INIT_WORK((struct work_struct *)work, my_wq_function);
work->x = 1;
ret = queue_work(my_wq, (struct work_struct *)work);
}
//--Queue some additional work(item 2)--
work2 = (my_work_t *) kmalloc(sizeof(my_work_t), GFP_KERNEL);
if (work2) {
INIT_WORK((struct work_struct *)work2, my_wq_function);
work2->x = 2;
ret = queue_work(my_wq, (struct work_struct *)work2);
}
}
return 0;
}
开发者ID:lyle-chung,项目名称:skel,代码行数:22,代码来源:linux_workqueue_skel.c
示例5: _mali_osk_pm_dev_enable
void _mali_osk_pm_dev_enable(void)
{
_mali_osk_atomic_init(&mali_pm_ref_count, 0);
_mali_osk_atomic_init(&mali_suspend_called, 0);
pm_timer = _mali_osk_timer_init();
_mali_osk_timer_setcallback(pm_timer, _mali_pm_callback, NULL);
pm_lock = _mali_osk_mutex_init(_MALI_OSK_LOCKFLAG_ORDERED, 0);
#if MALI_LICENSE_IS_GPL
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)
mali_pm_wq = alloc_workqueue("mali_pm", WQ_UNBOUND, 0);
#else
mali_pm_wq = create_workqueue("mali_pm");
#endif
if(NULL == mali_pm_wq)
{
MALI_PRINT_ERROR(("Unable to create Mali pm workqueue\n"));
}
#endif
INIT_WORK( &mali_pm_wq_work_handle, mali_bottom_half_pm );
}
开发者ID:Elnter,项目名称:j608_kernel,代码行数:22,代码来源:mali_osk_pm.c
示例6: apds9130_resume
}
static int apds9130_resume(struct i2c_client *client)
{
#if 1
#else
struct apds9130_data *data = i2c_get_clientdata(client);
int ret;
int err = 0;
if(apds9130_workqueue == NULL) {
apds9130_workqueue = create_workqueue("proximity");
if(NULL == apds9130_workqueue)
return -ENOMEM;
}
printk(KERN_INFO"apds9190_resume \n");
if(data->sw_mode == PROX_STAT_OPERATING)
return 0;
enable_irq(client->irq);
mdelay(50);
err = apds9130_set_enable(client, 0x2D);
if(err < 0){
printk(KERN_INFO "%s, enable set Fail\n",__func__);
return -1;
}
data->sw_mode = PROX_STAT_OPERATING;
ret = irq_set_irq_wake(client->irq, 1);
if(ret)
irq_set_irq_wake(client->irq, 0);
apds9130_set_command(client, 0);
#endif
开发者ID:SinxOner,项目名称:android_kernel_lge_p710,代码行数:39,代码来源:apds9130.c
示例7: module_init_ddbridge
static __init int module_init_ddbridge(void)
{
int stat = -1;
pr_info("Digital Devices PCIE bridge driver "
DDBRIDGE_VERSION
", Copyright (C) 2010-14 Digital Devices GmbH\n");
if (ddb_class_create() < 0)
return -1;
ddb_wq = create_workqueue("ddbridge");
if (ddb_wq == NULL)
goto exit1;
stat = pci_register_driver(&ddb_pci_driver);
if (stat < 0)
goto exit2;
return stat;
exit2:
destroy_workqueue(ddb_wq);
exit1:
ddb_class_destroy();
return stat;
}
开发者ID:flensrocker,项目名称:dddvb,代码行数:22,代码来源:ddbridge.c
示例8: irq_init
int
irq_init (void)
{
int retval = 0;
unsigned long irqflags = 0;
memset (&mouse_info_ctx, 0, sizeof (CDD_MOUSE_INFO_T));
do {
mouse_info_ctx.mutex_lock = (struct semaphore *) kmalloc(sizeof (struct semaphore), GFP_ATOMIC);
if (mouse_info_ctx.mutex_lock == NULL) {
break;
}
mouse_info_ctx.wq = create_workqueue(QUEUE_NAME);
if (mouse_info_ctx.wq == NULL) {
break;
}
irqflags = IRQF_SHARED;
#if 0
if (!can_request_irq(CDD_MOUSE_IRQ, irqflags)) {
/* Clean up if cannot requset the IRQ */
free_irq(CDD_MOUSE_IRQ, (void *) &dev_id);
}
#endif
retval = request_irq(CDD_MOUSE_IRQ,
(irq_handler_t) irq_handler,
irqflags,
(char *) "CDD Mouse IRQ handler",
(void *) &dev_id);
} while(0);
return retval;
}
开发者ID:andrewma83,项目名称:UCSCEX,代码行数:38,代码来源:interrupt_handler.c
示例9: wm8971_probe
static int wm8971_probe(struct snd_soc_codec *codec)
{
struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
int ret = 0;
u16 reg;
ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8971->control_type);
if (ret < 0) {
printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret);
return ret;
}
INIT_DELAYED_WORK(&codec->dapm.delayed_work, wm8971_work);
wm8971_workq = create_workqueue("wm8971");
if (wm8971_workq == NULL)
return -ENOMEM;
wm8971_reset(codec);
/* charge output caps - set vmid to 5k for quick power up */
reg = snd_soc_read(codec, WM8971_PWR1) & 0xfe3e;
snd_soc_write(codec, WM8971_PWR1, reg | 0x01c0);
codec->dapm.bias_level = SND_SOC_BIAS_STANDBY;
queue_delayed_work(wm8971_workq, &codec->dapm.delayed_work,
msecs_to_jiffies(1000));
/* set the update bits */
snd_soc_update_bits(codec, WM8971_LDAC, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_RDAC, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_LOUT1V, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_ROUT1V, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_LOUT2V, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_ROUT2V, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_LINVOL, 0x0100, 0x0100);
snd_soc_update_bits(codec, WM8971_RINVOL, 0x0100, 0x0100);
return ret;
}
开发者ID:AllenDou,项目名称:linux,代码行数:38,代码来源:wm8971.c
示例10: acpi_thermal_init
static int __init acpi_thermal_init(void)
{
int result = 0;
dmi_check_system(thermal_dmi_table);
if (off) {
pr_notice(PREFIX "thermal control disabled\n");
return -ENODEV;
}
acpi_thermal_pm_queue = create_workqueue("acpi_thermal_pm");
if (!acpi_thermal_pm_queue)
return -ENODEV;
result = acpi_bus_register_driver(&acpi_thermal_driver);
if (result < 0) {
destroy_workqueue(acpi_thermal_pm_queue);
return -ENODEV;
}
return 0;
}
开发者ID:ParrotSec,项目名称:linux-psec,代码行数:23,代码来源:thermal.c
示例11: init_work_queue
int init_work_queue(char *q_name, int qid, int thread_type, int nthreads,
int qlen, unsigned int mask)
{
char buf[MSGQ_NAME_MAX_LEN];
int *q_num = kmalloc(sizeof(int), GFP_ATOMIC);
*q_num = qid;
strncpy(msgq_struct[qid].name, q_name, MSGQ_NAME_MAX_LEN);
memset(buf, 0, sizeof(buf));
snprintf(buf, sizeof(buf), "%s_%s",
MSGQ_STR_PREFIX, msgq_struct[qid].name);
msgq_struct[qid].msg_queue = create_workqueue(buf);
if (!msgq_struct[qid].msg_queue) {
printk(KERN_ERR "%s: Unable to create kernel thread\n", __func__);
return -1;
}
add_work_to_queue(qid, (void *)test_func, test_string, q_num, 0);
return 0;
}
开发者ID:asantosh,项目名称:kernel-modules,代码行数:23,代码来源:msgq.c
示例12: button_input_open
static int button_input_open(struct input_dev *dev)
{
if (down_interruptible(&button_sem))
{
dprintk(0, "[BTN] ERROR workqueue already running\n");
return 1;
}
bad_polling = 1;
fpwq = create_workqueue("button");
if(queue_work(fpwq, &button_obj))
{
dprintk(5, "[BTN] queue_work successful ...\n");
}
else
{
dprintk(5, "[BTN] queue_work not successful, exiting ...\n");
return 1;
}
return 0;
}
开发者ID:Niptok,项目名称:tdt-amiko,代码行数:23,代码来源:aotom_main.c
示例13: line6_init
/*
Module initialization.
*/
static int __init line6_init(void)
{
int i, retval;
printk(KERN_INFO "%s driver version %s%s\n",
DRIVER_NAME, DRIVER_VERSION, DRIVER_REVISION);
line6_workqueue = create_workqueue(DRIVER_NAME);
if (line6_workqueue == NULL) {
err("couldn't create workqueue");
return -EINVAL;
}
for (i = LINE6_MAX_DEVICES; i--;)
line6_devices[i] = NULL;
retval = usb_register(&line6_driver);
if (retval)
err("usb_register failed. Error number %d", retval);
return retval;
}
开发者ID:AppEngine,项目名称:linux-2.6,代码行数:26,代码来源:driver.c
示例14: init_module
/*
* Initialize the module - register the IRQ handler
*/
int init_module()
{
my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME);
/*
* Since the keyboard handler won't co-exist with another handler,
* such as us, we have to disable it (free its IRQ) before we do
* anything. Since we don't know where it is, there's no way to
* reinstate it later - so the computer will have to be rebooted
* when we're done.
*/
free_irq(1, NULL);
/*
* Request IRQ 1, the keyboard IRQ, to go to our irq_handler.
* SA_SHIRQ means we're willing to have othe handlers on this IRQ.
* SA_INTERRUPT can be used to make the handler into a fast interrupt.
*/
return request_irq(1, /* The number of the keyboard IRQ on PCs */
irq_handler, /* our handler */
SA_SHIRQ, "test_keyboard_irq_handler",
(void *)(irq_handler));
}
开发者ID:ZhangZhenhua,项目名称:experiment-coding,代码行数:26,代码来源:intrpt.c
示例15: gspi_intf_start
static void gspi_intf_start(PADAPTER padapter)
{
PGSPI_DATA pgspi;
if (padapter == NULL) {
DBG_871X(KERN_ERR "%s: padapter is NULL!\n", __FUNCTION__);
return;
}
pgspi = &adapter_to_dvobj(padapter)->intf_data;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
pgspi->priv_wq = alloc_workqueue("spi_wq", 0, 0);
#else
pgspi->priv_wq = create_workqueue("spi_wq");
#endif
INIT_DELAYED_WORK(&pgspi->irq_work, (void*)spi_irq_work);
enable_irq(oob_irq);
//hal dep
rtw_hal_enable_interrupt(padapter);
}
开发者ID:32743069,项目名称:amlogic_common_3050,代码行数:23,代码来源:gspi_intf.c
示例16: seh_probe
static int seh_probe(struct platform_device *dev)
{
int ret;
ENTER();
seh_int_wq = create_workqueue("seh_rx_wq");
INIT_WORK(&seh_int_request, seh_int_handler_high);
seh_dev = (struct seh_dev*)kzalloc(sizeof(struct seh_dev), GFP_KERNEL);
if (seh_dev == NULL)
{
ERRMSG("seh_probe: unable to allocate memory\n");
return -ENOMEM;
}
init_waitqueue_head(&(seh_dev->readq));
sema_init(&seh_dev->read_sem, 1);
seh_dev->dev = (struct device *)dev;
ret = misc_register(&seh_miscdev);
if (ret)
ERRMSG("seh_probe: failed to call misc_register\n");
wake_lock_init(&seh_wakeup, WAKE_LOCK_SUSPEND, "seh_wakeups");
ret = request_irq(IRQ_COMM_WDT_ID, seh_int_handler_low, IRQF_DISABLED,
seh_name, NULL);
if (ret)
{
ERRMSG("seh_probe: cannot register the COMM WDT interrupt\n");
return ret;
}
LEAVE();
return ret;
}
开发者ID:maxfu,项目名称:android_kernel_armada_pxa1088,代码行数:37,代码来源:seh_linux.c
示例17: gpioed_init
/*** init&exit ***/
static int __init gpioed_init(void)
{
my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME);
proc_intf = create_proc_entry(procfs_name, 0644, NULL);
if (proc_intf == NULL) {
remove_proc_entry(procfs_name, &proc_root);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
procfs_name);
return -ENOMEM;
}
proc_intf->read_proc = procfile_read;
proc_intf->write_proc = procfile_write;
proc_intf->owner = THIS_MODULE;
proc_intf->mode = S_IFREG | S_IRUGO;
proc_intf->uid = 0;
proc_intf->gid = 0;
proc_intf->size = 37;
printk(KERN_INFO "/proc/%s created\n", procfs_name);
return 0;
}
开发者ID:fourks,项目名称:tools,代码行数:25,代码来源:gpioed.c
示例18: autok_module_init
static int autok_module_init(void)
{
s_proc = proc_create(PROC_AUTOK_NAME, 0660, NULL, &autok_fops);
if (s_proc == NULL) {
remove_proc_entry(PROC_AUTOK_NAME, NULL);
printk(KERN_ALERT "Error: Could not initialize /proc/%s\n",
PROC_AUTOK_NAME);
return -ENOMEM;
}
s_proc->gid = 1000;
printk(KERN_INFO "/proc/%s created\n", PROC_AUTOK_NAME);
#ifdef USE_KERNEL_THREAD
//task = kthread_create(&autok_thread_func,(void *)(&g_autok_thread_data),"autokp");
#else // USE_KERNEL_THREAD
g_autok_wq = create_workqueue("autok_queue");
INIT_DELAYED_WORK((struct delayed_work *)(&g_autok_thread_data), autok_thread_func);
#endif // USE_KERNEL_THREAD
return 0; /* everything is ok */
}
开发者ID:Swapnil133609,项目名称:Zeus_exp,代码行数:24,代码来源:sdio_autok_proc.c
示例19: sweep2wake_init
static int __init sweep2wake_init(void)
{
int rc = 0;
printk(KERN_INFO "sweep2sleep: %s version %s\n", DRIVER_DESCRIPTION,
DRIVER_VERSION);
printk(KERN_INFO "sweep2sleep: by %s\n", DRIVER_AUTHOR);
sweep2wake_pwrdev = input_allocate_device();
input_set_capability(sweep2wake_pwrdev, EV_KEY, KEY_POWER);
sweep2wake_pwrdev->name = "s2s_pwrkey";
sweep2wake_pwrdev->phys = "s2s_pwrkey/input0";
rc = input_register_device(sweep2wake_pwrdev);
s2s_input_wq = create_workqueue("s2siwq");
INIT_WORK(&s2s_input_work, s2s_input_callback);
rc = input_register_handler(&s2s_input_handler);
return 0;
}
开发者ID:davidmueller13,项目名称:m9-sweep2sleep,代码行数:24,代码来源:s2s_mod.c
示例20: RETURN_NULL_UNLESS
/*! otg_task_init
*@brief Create otg task structure, create workqueue, initialize it.
*@param name - name of task or workqueue
*@param proc - handler
*@param data - parameter pointer for handler
*@param tag-
*@return initialized otg_task instance pointer
*/
struct otg_task *otg_task_init2(char *name, otg_task_proc_t proc, otg_task_arg_t data, otg_tag_t tag)
{
struct otg_task *task;
//TRACE_STRING(tag, "INIT: %s", name);
RETURN_NULL_UNLESS((task = CKMALLOC(sizeof (struct otg_task))));
task->tag = tag;
task->data = data;
task->name = name;
task->proc = proc;
#if defined(OTG_TASK_WORK)
task->terminated = task->terminate = TRUE;
#else /* defined(OTG_TASK_WORK) */
task->terminated = task->terminate = FALSE;
#if defined(LINUX26)
THROW_UNLESS((task->work_queue = create_singlethread_workqueue(name)), error);
#else /* LINUX26 */
THROW_UNLESS((task->work_queue = create_workqueue(name)), error);
#endif /* LINUX26 */
init_MUTEX_LOCKED(&task->admin_sem);
init_MUTEX_LOCKED(&task->work_sem);
#endif /* defined(OTG_TASK_WORK) */
INIT_WORK(&task->work, otg_task_proc, task);
return task;
CATCH(error) {
printk(KERN_INFO"%s: ERROR\n", __FUNCTION__);
if (task) LKFREE(task);
return NULL;
}
}
开发者ID:R0-Developers,项目名称:YP-R0_Kernel,代码行数:44,代码来源:otg-linux.c
注:本文中的create_workqueue函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论