本文整理汇总了C++中create_workqueue函数的典型用法代码示例。如果您正苦于以下问题:C++ create_workqueue函数的具体用法?C++ create_workqueue怎么用?C++ create_workqueue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_workqueue函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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));
}
示例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);
}