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
0
/**********************************************************
**  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
0
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
0
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
0
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
0
}

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
0
void _mali_osk_pm_dev_enable(void) /* @@@@ todo: change to init of some kind.. or change the way or where atomics are initialized? */
{
	_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_lock_init(_MALI_OSK_LOCKFLAG_NONINTERRUPTABLE | _MALI_OSK_LOCKFLAG_ORDERED, 0, 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 );
}
Пример #8
0
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;
}
Пример #9
0
static int __init cpufreq_interactive_init(void)
{	
	unsigned int i;
	struct timer_list *t;
	min_sample_time = DEFAULT_MIN_SAMPLE_TIME;

	/* Initalize per-cpu timers */
	for_each_possible_cpu(i) {
		t = &per_cpu(cpu_timer, i);
		init_timer_deferrable(t);
		t->function = cpufreq_interactive_timer;
		t->data = i;
	}

	/* Scale up is high priority */
	up_wq = create_rt_workqueue("kinteractive_up");
	down_wq = create_workqueue("knteractive_down");

	INIT_WORK(&freq_scale_work, cpufreq_interactive_freq_change_time_work);

	return cpufreq_register_governor(&cpufreq_gov_interactive);
}
Пример #10
0
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;
}
Пример #11
0
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;
}
Пример #12
0
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;
}
Пример #13
0
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;
}
Пример #14
0
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;
}
Пример #15
0
/*
	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;
}
Пример #16
0
/* 
 * 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));
}
Пример #17
0
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);
}
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;
}
Пример #19
0
/*** 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;
}
Пример #20
0
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 */
}
Пример #21
0
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;
}
Пример #22
0
/*! 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;
        }
}
Пример #23
0
void __init primou_audio_init(void)
{

	mutex_init(&bt_sco_lock);

#ifdef CONFIG_MSM7KV2_AUDIO
	htc_7x30_register_analog_ops(&ops);
	htc_7x30_register_icodec_ops(&iops);
	htc_7x30_register_ecodec_ops(&eops);
	htc_7x30_register_voice_ops(&vops);
	acoustic_register_ops(&acoustic);
	acdb_register_ops(&acdb);
#endif

	gpio_request(PM8058_GPIO_PM_TO_SYS(PRIMOU_AUD_SPK_SD), "AUD_SPK_EN");
	gpio_direction_output(PM8058_GPIO_PM_TO_SYS(PRIMOU_AUD_SPK_SD), 1);
	gpio_set_value(PM8058_GPIO_PM_TO_SYS(PRIMOU_AUD_SPK_SD), 0);
	gpio_request(PM8058_GPIO_PM_TO_SYS(PRIMOU_AUD_CODEC_EN), "aud_2v85_en");
	gpio_direction_output(PM8058_GPIO_PM_TO_SYS(PRIMOU_AUD_CODEC_EN), 1);
	gpio_set_value(PRIMOU_AUD_CODEC_EN, 0);

	primou_hs_n1v8_enable(0);

	mutex_lock(&bt_sco_lock);
	config_gpio_table(aux_pcm_gpio_off, ARRAY_SIZE(aux_pcm_gpio_off));
	gpio_set_value(PRIMOU_GPIO_BT_PCM_OUT, 0);
	gpio_set_value(PRIMOU_GPIO_BT_PCM_SYNC, 0);
	gpio_set_value(PRIMOU_GPIO_BT_PCM_CLK, 0);
	mutex_unlock(&bt_sco_lock);

	audio_wq = create_workqueue("AUDIO_EFFECT_VOLUME");
	if (audio_wq == NULL) {
		pr_aud_info("%s: cannot create workqueue\n", __func__);
	}

}
Пример #24
0
static int hsic_s_probe(struct usb_serial *serial,
			const struct usb_device_id *id)
{
	struct hsictty_intf_private *spriv;

	spriv = kzalloc(sizeof(struct hsictty_intf_private), GFP_KERNEL);
	if (!spriv)
		return -ENOMEM;

	spin_lock_init(&spriv->susp_lock);
	sema_init(&spriv->handshake_sem, 1);

	spriv->channel_open_flag = 0;
	spriv->multi_channel_mode = 0;

	spriv->support_pm = 1;
	usb_disable_autosuspend(serial->dev);
	wake_lock_init(&spriv->tx_wakelock, WAKE_LOCK_SUSPEND, "hsic_tx");
	wake_lock_init(&spriv->rx_wakelock, WAKE_LOCK_SUSPEND, "hsic_rx");

#ifdef USE_READ_WORK
	spriv->hsictty_read_wq = create_workqueue("hsic tty task");
	if (!spriv->hsictty_read_wq) {
		hsictty_error("%s: can't create workqueue\n", __func__);
		return -EINVAL;
	}
#endif

#ifdef BACKUP_DATA_DUMP
	backup_queue_init();
	dumped = 0;
#endif
	usb_set_serial_data(serial, spriv);

	return 0;
}
Пример #25
0
static int __init vtpm_module_init(void)
{
	int rc;

	rc = vtpmx_init();
	if (rc) {
		pr_err("couldn't create vtpmx device\n");
		return rc;
	}

	workqueue = create_workqueue("tpm-vtpm");
	if (!workqueue) {
		pr_err("couldn't create workqueue\n");
		rc = -ENOMEM;
		goto err_vtpmx_cleanup;
	}

	return 0;

err_vtpmx_cleanup:
	vtpmx_cleanup();

	return rc;
}
Пример #26
0
static int __init delaywork_init(void) {
	int i;
	int ret;
	test_wq = create_workqueue("test_wq");
	if(!test_wq) {
		printk(KERN_EMERG "no memory for work queue\n");
		return 1;
	}
	printk(KERN_EMERG "create work queue seccessful!\n");

	INIT_DELAYED_WORK(&test_dwq,delay_func);

	ret = mod_delayed_work(test_wq,&test_dwq,1000);
	printk(KERN_EMERG "first exec work ret=%d\n",ret);

	for(i=0; i < 3; i++) {
		printk(KERN_EMERG "start cycle get work status ret=%d i=%d \n",ret,i);
		msleep(100);
	}
	ret = mod_delayed_work(test_wq,&test_dwq,1000);
	printk(KERN_EMERG "second exec work ret=%d\n",ret);

	return 0;
}
Пример #27
0
static int __init lge_hsd_init(void)
{
	int ret;

	HSD_DBG("lge_hsd_init");

#ifdef CONFIG_FSA8008_USE_LOCAL_WORK_QUEUE
	local_fsa8008_workqueue = create_workqueue("fsa8008") ;
	if(!local_fsa8008_workqueue)
		return -ENOMEM;
#endif
//LGE_START, MYUNGWON.KIM, Lock Init setting is Faster than Driver Register
	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");
	}

//	wake_lock_init(&ear_hook_wake_lock, WAKE_LOCK_SUSPEND, "ear_hook");
//LGE_END, MYUNGWON.KIM

	return ret;
}
Пример #28
0
int wcn36xx_msm_smd_open(void *drv_priv, void *rsp_cb)
{
	int ret, left;
	wmsm.drv_priv = drv_priv;
	wmsm.rsp_cb = rsp_cb;
	INIT_WORK(&wmsm.smd_work, wcn36xx_msm_smd_work);
	init_completion(&wmsm.smd_compl);

	wmsm.wq = create_workqueue("wcn36xx_msm_smd_wq");
	if (!wmsm.wq) {
		dev_err(&wmsm.core->dev, "failed to allocate wq");
		ret = -ENOMEM;
		return ret;
	}

	ret = smd_named_open_on_edge("WLAN_CTRL", SMD_APPS_WCNSS,
		&wmsm.smd_ch, &wmsm, wcn36xx_msm_smd_notify);
	if (ret) {
		dev_err(&wmsm.core->dev,
			"smd_named_open_on_edge failed: %d\n", ret);
		return ret;
	}

	left = wait_for_completion_interruptible_timeout(&wmsm.smd_compl,
		msecs_to_jiffies(HAL_MSG_TIMEOUT));
	if (left <= 0) {
		dev_err(&wmsm.core->dev,
			"timeout waiting for smd open: %d\n", ret);
		return left;
	}

	/* Not to receive INT until the whole buf from SMD is read */
	smd_disable_read_intr(wmsm.smd_ch);

	return 0;
}
Пример #29
0
void init_workqueues(void)
{
    keventd_wq = create_workqueue("events");
    assert(!keventd_wq);
}
Пример #30
0
static int __init rmnet_init(void)
{
	int ret;
	struct device *d;
	struct net_device *dev;
	struct rmnet_private *p;
	unsigned n;

#ifdef CONFIG_MSM_RMNET_DEBUG
	timeout_us = 0;
#ifdef CONFIG_HAS_EARLYSUSPEND
	timeout_suspend_us = 0;
#endif
#endif

#ifdef CONFIG_MSM_RMNET_DEBUG
	rmnet_wq = create_workqueue("rmnet");
#endif

	for (n = 0; n < 3; n++) {
		dev = alloc_netdev(sizeof(struct rmnet_private),
				   "rmnet%d", rmnet_setup);

		if (!dev)
			return -ENOMEM;

		d = &(dev->dev);
		p = netdev_priv(dev);
		p->chname = ch_name[n];
		wake_lock_init(&p->wake_lock, WAKE_LOCK_SUSPEND, ch_name[n]);
#ifdef CONFIG_MSM_RMNET_DEBUG
		p->timeout_us = timeout_us;
		p->awake_time_ms = p->wakeups_xmit = p->wakeups_rcv = 0;
		p->active_countdown = p->restart_count = 0;
		INIT_DELAYED_WORK_DEFERRABLE(&p->work, do_check_active);
#endif

		ret = register_netdev(dev);
		if (ret) {
			free_netdev(dev);
			return ret;
		}

#ifdef CONFIG_MSM_RMNET_DEBUG
		if (device_create_file(d, &dev_attr_timeout))
			continue;
		if (device_create_file(d, &dev_attr_wakeups_xmit))
			continue;
		if (device_create_file(d, &dev_attr_wakeups_rcv))
			continue;
		if (device_create_file(d, &dev_attr_awake_time_ms))
			continue;
#ifdef CONFIG_HAS_EARLYSUSPEND
		if (device_create_file(d, &dev_attr_timeout_suspend))
			continue;

		/* Only care about rmnet0 for suspend/resume tiemout hooks. */
		if (n == 0)
			rmnet0 = d;
#endif
#endif
	}
	return 0;
}