本文整理汇总了C++中cancel_work_sync函数的典型用法代码示例。如果您正苦于以下问题:C++ cancel_work_sync函数的具体用法?C++ cancel_work_sync怎么用?C++ cancel_work_sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cancel_work_sync函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: i915_driver_unload
int i915_driver_unload(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int ret;
ret = i915_gem_suspend(dev);
if (ret) {
DRM_ERROR("failed to idle hardware: %d\n", ret);
return ret;
}
intel_power_domains_fini(dev_priv);
intel_gpu_ips_teardown();
i915_teardown_sysfs(dev);
WARN_ON(unregister_oom_notifier(&dev_priv->mm.oom_notifier));
unregister_shrinker(&dev_priv->mm.shrinker);
io_mapping_free(dev_priv->gtt.mappable);
arch_phys_wc_del(dev_priv->gtt.mtrr);
acpi_video_unregister();
if (drm_core_check_feature(dev, DRIVER_MODESET))
intel_fbdev_fini(dev);
drm_vblank_cleanup(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
intel_modeset_cleanup(dev);
/*
* free the memory space allocated for the child device
* config parsed from VBT
*/
if (dev_priv->vbt.child_dev && dev_priv->vbt.child_dev_num) {
kfree(dev_priv->vbt.child_dev);
dev_priv->vbt.child_dev = NULL;
dev_priv->vbt.child_dev_num = 0;
}
vga_switcheroo_unregister_client(dev->pdev);
vga_client_register(dev->pdev, NULL, NULL, NULL);
}
/* Free error state after interrupts are fully disabled. */
del_timer_sync(&dev_priv->gpu_error.hangcheck_timer);
cancel_work_sync(&dev_priv->gpu_error.work);
i915_destroy_error_state(dev);
if (dev->pdev->msi_enabled)
pci_disable_msi(dev->pdev);
intel_opregion_fini(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) {
/* Flush any outstanding unpin_work. */
flush_workqueue(dev_priv->wq);
mutex_lock(&dev->struct_mutex);
i915_gem_cleanup_ringbuffer(dev);
i915_gem_context_fini(dev);
mutex_unlock(&dev->struct_mutex);
i915_gem_cleanup_stolen(dev);
}
intel_teardown_gmbus(dev);
intel_teardown_mchbar(dev);
destroy_workqueue(dev_priv->dp_wq);
destroy_workqueue(dev_priv->wq);
pm_qos_remove_request(&dev_priv->pm_qos);
i915_global_gtt_cleanup(dev);
intel_uncore_fini(dev);
if (dev_priv->regs != NULL)
pci_iounmap(dev->pdev, dev_priv->regs);
if (dev_priv->slab)
kmem_cache_destroy(dev_priv->slab);
pci_dev_put(dev_priv->bridge_dev);
kfree(dev_priv);
return 0;
}
示例2: hv_kvp_deinit
void hv_kvp_deinit(void)
{
cn_del_callback(&kvp_id);
cancel_delayed_work_sync(&kvp_work);
cancel_work_sync(&kvp_sendkey_work);
}
示例3: cx18_probe
//.........这里部分代码省略.........
v4l2_std_id std;
fh.cx = cx;
if (test_bit(CX18_F_I_FAILED, &cx->i_flags))
return -ENXIO;
if (test_and_set_bit(CX18_F_I_INITED, &cx->i_flags))
return 0;
while (--fw_retry_count > 0) {
/* load firmware */
if (cx18_firmware_init(cx) == 0)
break;
if (fw_retry_count > 1)
CX18_WARN("Retry loading firmware\n");
}
if (fw_retry_count == 0) {
set_bit(CX18_F_I_FAILED, &cx->i_flags);
return -ENXIO;
}
set_bit(CX18_F_I_LOADED_FW, &cx->i_flags);
/*
* Init the firmware twice to work around a silicon bug
* with the digital TS.
*
* The second firmware load requires us to normalize the APU state,
* or the audio for the first analog capture will be badly incorrect.
*
* I can't seem to call APU_RESETAI and have it succeed without the
* APU capturing audio, so we start and stop it here to do the reset
*/
/* MPEG Encoding, 224 kbps, MPEG Layer II, 48 ksps */
cx18_vapi(cx, CX18_APU_START, 2, CX18_APU_ENCODING_METHOD_MPEG|0xb9, 0);
cx18_vapi(cx, CX18_APU_RESETAI, 0);
cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
fw_retry_count = 3;
while (--fw_retry_count > 0) {
/* load firmware */
if (cx18_firmware_init(cx) == 0)
break;
if (fw_retry_count > 1)
CX18_WARN("Retry loading firmware\n");
}
if (fw_retry_count == 0) {
set_bit(CX18_F_I_FAILED, &cx->i_flags);
return -ENXIO;
}
/*
* The second firmware load requires us to normalize the APU state,
* or the audio for the first analog capture will be badly incorrect.
*
* I can't seem to call APU_RESETAI and have it succeed without the
* APU capturing audio, so we start and stop it here to do the reset
*/
/* MPEG Encoding, 224 kbps, MPEG Layer II, 48 ksps */
cx18_vapi(cx, CX18_APU_START, 2, CX18_APU_ENCODING_METHOD_MPEG|0xb9, 0);
cx18_vapi(cx, CX18_APU_RESETAI, 0);
cx18_vapi(cx, CX18_APU_STOP, 1, CX18_APU_ENCODING_METHOD_MPEG);
/* Init the A/V decoder, if it hasn't been already */
v4l2_subdev_call(cx->sd_av, core, load_fw);
vf.tuner = 0;
vf.type = V4L2_TUNER_ANALOG_TV;
vf.frequency = 6400; /* the tuner 'baseline' frequency */
/* Set initial frequency. For PAL/SECAM broadcasts no
'default' channel exists AFAIK. */
if (cx->std == V4L2_STD_NTSC_M_JP)
vf.frequency = 1460; /* ch. 1 91250*16/1000 */
else if (cx->std & V4L2_STD_NTSC_M)
vf.frequency = 1076; /* ch. 4 67250*16/1000 */
video_input = cx->active_input;
cx->active_input++; /* Force update of input */
cx18_s_input(NULL, &fh, video_input);
/* Let the VIDIOC_S_STD ioctl do all the work, keeps the code
in one place. */
cx->std++; /* Force full standard initialization */
std = (cx->tuner_std == V4L2_STD_ALL) ? V4L2_STD_NTSC_M : cx->tuner_std;
cx18_s_std(NULL, &fh, std);
cx18_s_frequency(NULL, &fh, &vf);
return 0;
}
static void cx18_cancel_in_work_orders(struct cx18 *cx)
{
int i;
for (i = 0; i < CX18_MAX_IN_WORK_ORDERS; i++)
cancel_work_sync(&cx->in_work_order[i].work);
}
示例4: rt2x00lib_remove_dev
void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
{
clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags);
/*
* Stop rfkill polling.
*/
if (!test_bit(REQUIRE_DELAYED_RFKILL, &rt2x00dev->cap_flags))
rt2x00rfkill_unregister(rt2x00dev);
/*
* Disable radio.
*/
rt2x00lib_disable_radio(rt2x00dev);
/*
* Stop all work.
*/
cancel_work_sync(&rt2x00dev->intf_work);
cancel_delayed_work_sync(&rt2x00dev->autowakeup_work);
cancel_work_sync(&rt2x00dev->sleep_work);
if (rt2x00_is_usb(rt2x00dev)) {
hrtimer_cancel(&rt2x00dev->txstatus_timer);
cancel_work_sync(&rt2x00dev->rxdone_work);
cancel_work_sync(&rt2x00dev->txdone_work);
}
if (rt2x00dev->workqueue)
destroy_workqueue(rt2x00dev->workqueue);
/*
* Free the tx status fifo.
*/
kfifo_free(&rt2x00dev->txstatus_fifo);
/*
* Kill the tx status tasklet.
*/
tasklet_kill(&rt2x00dev->txstatus_tasklet);
tasklet_kill(&rt2x00dev->pretbtt_tasklet);
tasklet_kill(&rt2x00dev->tbtt_tasklet);
tasklet_kill(&rt2x00dev->rxdone_tasklet);
tasklet_kill(&rt2x00dev->autowake_tasklet);
/*
* Uninitialize device.
*/
rt2x00lib_uninitialize(rt2x00dev);
/*
* Free extra components
*/
rt2x00debug_deregister(rt2x00dev);
rt2x00leds_unregister(rt2x00dev);
/*
* Free ieee80211_hw memory.
*/
rt2x00lib_remove_hw(rt2x00dev);
/*
* Free firmware image.
*/
rt2x00lib_free_firmware(rt2x00dev);
/*
* Free queue structures.
*/
rt2x00queue_free(rt2x00dev);
/*
* Free the driver data.
*/
if (rt2x00dev->drv_data)
kfree(rt2x00dev->drv_data);
}
示例5: mma8452_probe
//.........这里部分代码省略.........
mma8452->start_count = 0;
mutex_init(&(mma8452->operation_mutex) );
mma8452->status = MMA8452_CLOSE;
mma8452->client = client;
i2c_set_clientdata(client, mma8452);
this_client = client;
devid = mma8452_get_devid(this_client);
if ((MMA8452_DEVID != devid) && (MMA8451_DEVID != devid)) {
pr_info("mma8452: invalid devid\n");
goto exit_invalid_devid;
}
err = mma8452_init_client(client);
if (err < 0) {
mmaprintk(KERN_ERR
"mma8452_probe: mma8452_init_client failed\n");
goto exit_request_gpio_irq_failed;
}
mma8452->input_dev = input_allocate_device();
if (!mma8452->input_dev) {
err = -ENOMEM;
mmaprintk(KERN_ERR
"mma8452_probe: Failed to allocate input device\n");
goto exit_input_allocate_device_failed;
}
set_bit(EV_ABS, mma8452->input_dev->evbit);
/* x-axis acceleration */
input_set_abs_params(mma8452->input_dev, ABS_X, -2000, 2000, 0, 0); //2g full scale range
/* y-axis acceleration */
input_set_abs_params(mma8452->input_dev, ABS_Y, -2000, 2000, 0, 0); //2g full scale range
/* z-axis acceleration */
input_set_abs_params(mma8452->input_dev, ABS_Z, -2000, 2000, 0, 0); //2g full scale range
// mma8452->input_dev->name = "compass";
mma8452->input_dev->name = "gsensor";
mma8452->input_dev->dev.parent = &client->dev;
err = input_register_device(mma8452->input_dev);
if (err < 0) {
mmaprintk(KERN_ERR
"mma8452_probe: Unable to register input device: %s\n",
mma8452->input_dev->name);
goto exit_input_register_device_failed;
}
mma8452_device.parent = &client->dev;
err = misc_register(&mma8452_device);
if (err < 0) {
mmaprintk(KERN_ERR
"mma8452_probe: mmad_device register failed\n");
goto exit_misc_device_register_mma8452_device_failed;
}
err = gsensor_sysfs_init();
if (err < 0) {
mmaprintk(KERN_ERR
"mma8452_probe: gsensor sysfs init failed\n");
goto exit_gsensor_sysfs_init_failed;
}
#ifdef CONFIG_HAS_EARLYSUSPEND
mma8452_early_suspend.suspend = mma8452_suspend;
mma8452_early_suspend.resume = mma8452_resume;
mma8452_early_suspend.level = 0x2;
register_early_suspend(&mma8452_early_suspend);
#endif
printk(KERN_INFO "mma8452 probe ok\n");
#if 0
// mma8452_start_test(this_client);
mma8452_start(client, MMA8452_RATE_12P5);
#endif
return 0;
exit_gsensor_sysfs_init_failed:
misc_deregister(&mma8452_device);
exit_misc_device_register_mma8452_device_failed:
input_unregister_device(mma8452->input_dev);
exit_input_register_device_failed:
input_free_device(mma8452->input_dev);
exit_input_allocate_device_failed:
free_irq(client->irq, mma8452);
exit_request_gpio_irq_failed:
cancel_delayed_work_sync(&mma8452->delaywork);
cancel_work_sync(&mma8452->work);
exit_invalid_devid:
kfree(mma8452);
exit_alloc_data_failed:
;
mmaprintk("%s error\n",__FUNCTION__);
return -1;
}
示例6: adp8860_led_probe
static int __devinit adp8860_led_probe(struct i2c_client *client)
{
struct adp8860_backlight_platform_data *pdata =
client->dev.platform_data;
struct adp8860_bl *data = i2c_get_clientdata(client);
struct adp8860_led *led, *led_dat;
struct led_info *cur_led;
int ret, i;
led = kzalloc(sizeof(*led) * pdata->num_leds, GFP_KERNEL);
if (led == NULL) {
dev_err(&client->dev, "failed to alloc memory\n");
return -ENOMEM;
}
ret = adp8860_write(client, ADP8860_ISCFR, pdata->led_fade_law);
ret = adp8860_write(client, ADP8860_ISCT1,
(pdata->led_on_time & 0x3) << 6);
ret |= adp8860_write(client, ADP8860_ISCF,
FADE_VAL(pdata->led_fade_in, pdata->led_fade_out));
if (ret) {
dev_err(&client->dev, "failed to write\n");
goto err_free;
}
for (i = 0; i < pdata->num_leds; ++i) {
cur_led = &pdata->leds[i];
led_dat = &led[i];
led_dat->id = cur_led->flags & ADP8860_FLAG_LED_MASK;
if (led_dat->id > 7 || led_dat->id < 1) {
dev_err(&client->dev, "Invalid LED ID %d\n",
led_dat->id);
goto err;
}
if (pdata->bl_led_assign & (1 << (led_dat->id - 1))) {
dev_err(&client->dev, "LED %d used by Backlight\n",
led_dat->id);
goto err;
}
led_dat->cdev.name = cur_led->name;
led_dat->cdev.default_trigger = cur_led->default_trigger;
led_dat->cdev.brightness_set = adp8860_led_set;
led_dat->cdev.brightness = LED_OFF;
led_dat->flags = cur_led->flags >> FLAG_OFFT_SHIFT;
led_dat->client = client;
led_dat->new_brightness = LED_OFF;
INIT_WORK(&led_dat->work, adp8860_led_work);
ret = led_classdev_register(&client->dev, &led_dat->cdev);
if (ret) {
dev_err(&client->dev, "failed to register LED %d\n",
led_dat->id);
goto err;
}
ret = adp8860_led_setup(led_dat);
if (ret) {
dev_err(&client->dev, "failed to write\n");
i++;
goto err;
}
}
data->led = led;
return 0;
err:
for (i = i - 1; i >= 0; --i) {
led_classdev_unregister(&led[i].cdev);
cancel_work_sync(&led[i].work);
}
err_free:
kfree(led);
return ret;
}
示例7: rda_hif_sdio_probe
//.........这里部分代码省略.........
goto remove_card;
ret = rda5890_set_link_loss_threshold(priv, WIFI_LINK_LOSS_THRESHOLD);
if(ret < 0)
goto remove_card;
ret = rda5890_init_pm(priv);
if(ret < 0)
goto remove_card;
#ifdef WIFI_TEST_MODE
}
else
{
ret = rda5890_set_test_mode(priv);
if(ret < 0)
goto remove_card;
gCard = card;
}
#endif
#ifdef WIFI_SELECT_CHANNEL
// Add for choose operation band, 3rd parameter indicate which band will be used.
// 0/1: channel1-11, 2:channel1-13, 3:channel1-14, other values: channel1-13
#ifdef CHANNEL_11
if (rda5890_generic_set_uchar(priv, 0x0047, 1) < 0)
#elif defined CHANNEL_14
if (rda5890_generic_set_uchar(priv, 0x0047, 3) < 0)
#else /* CHANNEL_13 && others */
if (rda5890_generic_set_uchar(priv, 0x0047, 2) < 0)
#endif
{
RDA5890_ERRP("set op_band failed!\n");
goto remove_card;
}
else
{
#ifdef CHANNEL_11
channel_nums = 11;
#elif defined CHANNEL_12
channel_nums = 12;
#elif defined CHANNEL_14
channel_nums = 14;
#else /* CHANNEL_13 && others */
channel_nums = 13;
#endif
}
#endif
if (sdio_test_flag) {
unsigned char mac_addr[6];
RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_TRACE,
"SDIO TESTING MODE\n");
ret = rda5890_get_mac_addr(priv, mac_addr);
printk(KERN_INFO "Test rda5890_get_mac_addr %x:%x:%x:%x:%x:%x", mac_addr[0],mac_addr[1],mac_addr[2],mac_addr[3],mac_addr[4],mac_addr[5]);
goto done;
}
ret = rda5890_start_card(priv);
if (ret) {
RDA5890_ERRP("rda5890_start_card fail, ret = %d\n", ret);
goto remove_card;
}
done:
printk(KERN_INFO "RDA5890: SDIO card started\n");
out:
RDA5890_DBGLAP(RDA5890_DA_SDIO, RDA5890_DL_DEBUG,
"%s ret:%d <<<\n", __func__, ret);
return ret;
remove_card:
if (atomic_read(&card->wid_complete_flag) && priv)
{
complete(&priv->wid_done);
printk(KERN_INFO "*****RDA5890: probe send wid complete\n");
}
flush_work(&card->packet_worker);
cancel_work_sync(&card->packet_worker);
#ifdef WIFI_POWER_MANAGER
cancel_delayed_work(&card->sleep_work);
#endif
destroy_workqueue(card->work_thread);
if(priv)
rda5890_remove_card(priv);
while (card->packets) {
packet = card->packets;
card->packets = card->packets->next;
kfree(packet);
}
kfree(card);
gCard = NULL;
goto out;
}
示例8: tty_ldisc_hangup
void tty_ldisc_hangup(struct tty_struct *tty)
{
struct tty_ldisc *ld;
int reset = tty->driver->flags & TTY_DRIVER_RESET_TERMIOS;
int err = 0;
/*
* FIXME! What are the locking issues here? This may me overdoing
* things... This question is especially important now that we've
* removed the irqlock.
*/
ld = tty_ldisc_ref(tty);
if (ld != NULL) {
/* We may have no line discipline at this point */
if (ld->ops->flush_buffer)
ld->ops->flush_buffer(tty);
tty_driver_flush_buffer(tty);
if ((test_bit(TTY_DO_WRITE_WAKEUP, &tty->flags)) &&
ld->ops->write_wakeup)
ld->ops->write_wakeup(tty);
if (ld->ops->hangup)
ld->ops->hangup(tty);
tty_ldisc_deref(ld);
}
/*
* FIXME: Once we trust the LDISC code better we can wait here for
* ldisc completion and fix the driver call race
*/
wake_up_interruptible_poll(&tty->write_wait, POLLOUT);
wake_up_interruptible_poll(&tty->read_wait, POLLIN);
/*
* Shutdown the current line discipline, and reset it to
* N_TTY if need be.
*
* Avoid racing set_ldisc or tty_ldisc_release
*/
mutex_lock(&tty->ldisc_mutex);
/*
* this is like tty_ldisc_halt, but we need to give up
* the BTM before calling cancel_work_sync, which may
* need to wait for another function taking the BTM
*/
clear_bit(TTY_LDISC, &tty->flags);
tty_unlock();
cancel_work_sync(&tty->buf.work);
mutex_unlock(&tty->ldisc_mutex);
tty_lock();
mutex_lock(&tty->ldisc_mutex);
/* At this point we have a closed ldisc and we want to
reopen it. We could defer this to the next open but
it means auditing a lot of other paths so this is
a FIXME */
if (tty->ldisc) { /* Not yet closed */
if (reset == 0) {
if (!tty_ldisc_reinit(tty, tty->termios->c_line))
err = tty_ldisc_open(tty, tty->ldisc);
else
err = 1;
}
/* If the re-open fails or we reset then go to N_TTY. The
N_TTY open cannot fail */
if (reset || err) {
BUG_ON(tty_ldisc_reinit(tty, N_TTY));
WARN_ON(tty_ldisc_open(tty, tty->ldisc));
}
tty_ldisc_enable(tty);
}
mutex_unlock(&tty->ldisc_mutex);
if (reset)
tty_reset_termios(tty);
}
示例9: pm8xxx_tm_probe
static int __devinit pm8xxx_tm_probe(struct platform_device *pdev)
{
const struct pm8xxx_tm_core_data *cdata = pdev->dev.platform_data;
struct thermal_zone_device_ops *tz_ops;
struct pm8xxx_tm_chip *chip;
struct resource *res;
int rc = 0;
if (!cdata) {
pr_err("missing core data\n");
return -EINVAL;
}
chip = kzalloc(sizeof(struct pm8xxx_tm_chip), GFP_KERNEL);
if (chip == NULL) {
pr_err("kzalloc() failed.\n");
return -ENOMEM;
}
chip->dev = &pdev->dev;
memcpy(&(chip->cdata), cdata, sizeof(struct pm8xxx_tm_core_data));
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
chip->cdata.irq_name_temp_stat);
if (res) {
chip->tempstat_irq = res->start;
} else {
pr_err("temp stat IRQ not specified\n");
goto err_free_chip;
}
res = platform_get_resource_byname(pdev, IORESOURCE_IRQ,
chip->cdata.irq_name_over_temp);
if (res) {
chip->overtemp_irq = res->start;
} else {
pr_err("over temp IRQ not specified\n");
goto err_free_chip;
}
/* Select proper thermal zone ops functions based on ADC type. */
if (chip->cdata.adc_type == PM8XXX_TM_ADC_PM8XXX_ADC)
tz_ops = &pm8xxx_thermal_zone_ops_pm8xxx_adc;
else
tz_ops = &pm8xxx_thermal_zone_ops_no_adc;
chip->tz_dev = thermal_zone_device_register(chip->cdata.tm_name,
TRIP_NUM, chip, tz_ops, 0, 0, 0, 0);
if (chip->tz_dev == NULL) {
pr_err("thermal_zone_device_register() failed.\n");
rc = -ENODEV;
goto err_free_chip;
}
rc = pm8xxx_tm_init_reg(chip);
if (rc < 0)
goto err_free_tz;
rc = pm8xxx_tm_shutdown_override(chip, SOFTWARE_OVERRIDE_DISABLED);
if (rc < 0)
goto err_free_tz;
if (chip->cdata.adc_type == PM8XXX_TM_ADC_NONE) {
rc = pm8xxx_tm_init_temp_no_adc(chip);
if (rc < 0)
goto err_free_tz;
}
/* Start in HW control; switch to SW control when user changes mode. */
chip->mode = THERMAL_DEVICE_DISABLED;
thermal_zone_device_update(chip->tz_dev);
INIT_WORK(&chip->irq_work, pm8xxx_tm_work);
rc = request_irq(chip->tempstat_irq, pm8xxx_tm_isr, IRQF_TRIGGER_RISING,
chip->cdata.irq_name_temp_stat, chip);
if (rc < 0) {
pr_err("request_irq(%d) failed: %d\n", chip->tempstat_irq, rc);
goto err_cancel_work;
}
rc = request_irq(chip->overtemp_irq, pm8xxx_tm_isr, IRQF_TRIGGER_RISING,
chip->cdata.irq_name_over_temp, chip);
if (rc < 0) {
pr_err("request_irq(%d) failed: %d\n", chip->overtemp_irq, rc);
goto err_free_irq_tempstat;
}
platform_set_drvdata(pdev, chip);
pr_info("OK\n");
return 0;
err_free_irq_tempstat:
free_irq(chip->tempstat_irq, chip);
err_cancel_work:
cancel_work_sync(&chip->irq_work);
err_free_tz:
thermal_zone_device_unregister(chip->tz_dev);
err_free_chip:
//.........这里部分代码省略.........
示例10: ath9k_htc_config
static int ath9k_htc_config(struct ieee80211_hw *hw, u32 changed)
{
struct ath9k_htc_priv *priv = hw->priv;
struct ath_common *common = ath9k_hw_common(priv->ah);
struct ieee80211_conf *conf = &hw->conf;
bool chip_reset = false;
int ret = 0;
mutex_lock(&priv->mutex);
ath9k_htc_ps_wakeup(priv);
if (changed & IEEE80211_CONF_CHANGE_IDLE) {
mutex_lock(&priv->htc_pm_lock);
priv->ps_idle = !!(conf->flags & IEEE80211_CONF_IDLE);
if (priv->ps_idle)
chip_reset = true;
mutex_unlock(&priv->htc_pm_lock);
}
/*
* Monitor interface should be added before
* IEEE80211_CONF_CHANGE_CHANNEL is handled.
*/
if (changed & IEEE80211_CONF_CHANGE_MONITOR) {
if ((conf->flags & IEEE80211_CONF_MONITOR) &&
!priv->ah->is_monitoring)
ath9k_htc_add_monitor_interface(priv);
else if (priv->ah->is_monitoring)
ath9k_htc_remove_monitor_interface(priv);
}
if ((changed & IEEE80211_CONF_CHANGE_CHANNEL) || chip_reset) {
struct ieee80211_channel *curchan = hw->conf.channel;
int pos = curchan->hw_value;
ath_dbg(common, CONFIG, "Set channel: %d MHz\n",
curchan->center_freq);
ath9k_cmn_update_ichannel(&priv->ah->channels[pos],
hw->conf.channel,
hw->conf.channel_type);
if (ath9k_htc_set_channel(priv, hw, &priv->ah->channels[pos]) < 0) {
ath_err(common, "Unable to set channel\n");
ret = -EINVAL;
goto out;
}
}
if (changed & IEEE80211_CONF_CHANGE_PS) {
if (conf->flags & IEEE80211_CONF_PS) {
ath9k_htc_setpower(priv, ATH9K_PM_NETWORK_SLEEP);
priv->ps_enabled = true;
} else {
priv->ps_enabled = false;
cancel_work_sync(&priv->ps_work);
ath9k_htc_setpower(priv, ATH9K_PM_AWAKE);
}
}
if (changed & IEEE80211_CONF_CHANGE_POWER) {
priv->txpowlimit = 2 * conf->power_level;
ath9k_cmn_update_txpow(priv->ah, priv->curtxpow,
priv->txpowlimit, &priv->curtxpow);
}
out:
ath9k_htc_ps_restore(priv);
mutex_unlock(&priv->mutex);
return ret;
}
示例11: tty_ldisc_halt
static int tty_ldisc_halt(struct tty_struct *tty)
{
clear_bit(TTY_LDISC, &tty->flags);
return cancel_work_sync(&tty->buf.work);
}
示例12: rsnd_dma_stop
void rsnd_dma_stop(struct rsnd_dma *dma)
{
dma->submit_loop = 0;
cancel_work_sync(&dma->work);
dmaengine_terminate_all(dma->chan);
}
示例13: fjes_change_mtu
static int fjes_change_mtu(struct net_device *netdev, int new_mtu)
{
struct fjes_adapter *adapter = netdev_priv(netdev);
bool running = netif_running(netdev);
struct fjes_hw *hw = &adapter->hw;
unsigned long flags;
int ret = -EINVAL;
int idx, epidx;
for (idx = 0; fjes_support_mtu[idx] != 0; idx++) {
if (new_mtu <= fjes_support_mtu[idx]) {
new_mtu = fjes_support_mtu[idx];
if (new_mtu == netdev->mtu)
return 0;
ret = 0;
break;
}
}
if (ret)
return ret;
if (running) {
spin_lock_irqsave(&hw->rx_status_lock, flags);
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
continue;
hw->ep_shm_info[epidx].tx.info->v1i.rx_status &=
~FJES_RX_MTU_CHANGING_DONE;
}
spin_unlock_irqrestore(&hw->rx_status_lock, flags);
netif_tx_stop_all_queues(netdev);
netif_carrier_off(netdev);
cancel_work_sync(&adapter->tx_stall_task);
napi_disable(&adapter->napi);
msleep(1000);
netif_tx_stop_all_queues(netdev);
}
netdev->mtu = new_mtu;
if (running) {
for (epidx = 0; epidx < hw->max_epid; epidx++) {
if (epidx == hw->my_epid)
continue;
spin_lock_irqsave(&hw->rx_status_lock, flags);
fjes_hw_setup_epbuf(&hw->ep_shm_info[epidx].tx,
netdev->dev_addr,
netdev->mtu);
hw->ep_shm_info[epidx].tx.info->v1i.rx_status |=
FJES_RX_MTU_CHANGING_DONE;
spin_unlock_irqrestore(&hw->rx_status_lock, flags);
}
netif_tx_wake_all_queues(netdev);
netif_carrier_on(netdev);
napi_enable(&adapter->napi);
napi_schedule(&adapter->napi);
}
return ret;
}
示例14: hym8563_probe
static int __devinit hym8563_probe(struct i2c_client *client, const struct i2c_device_id *id)
{
int rc = 0;
u8 reg = 0;
struct hym8563 *hym8563;
struct rtc_device *rtc = NULL;
struct rtc_time tm_read, tm = {
.tm_wday = 6,
.tm_year = 111,
.tm_mon = 0,
.tm_mday = 1,
.tm_hour = 12,
.tm_min = 0,
.tm_sec = 0,
};
if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
return -ENODEV;
hym8563 = kzalloc(sizeof(struct hym8563), GFP_KERNEL);
if (!hym8563) {
return -ENOMEM;
}
gClient = client;
hym8563->client = client;
hym8563->alarm.enabled = 0;
mutex_init(&hym8563->mutex);
wake_lock_init(&hym8563->wake_lock, WAKE_LOCK_SUSPEND, "rtc_hym8563");
i2c_set_clientdata(client, hym8563);
hym8563_init_device(client);
hym8563_enable_count(client, 0);
// check power down
hym8563_i2c_read_regs(client,RTC_SEC,®,1);
if (reg&0x80) {
dev_info(&client->dev, "clock/calendar information is no longer guaranteed\n");
hym8563_set_time(client, &tm);
}
hym8563_read_datetime(client, &tm_read); //read time from hym8563
if(((tm_read.tm_year < 70) | (tm_read.tm_year > 137 )) | (tm_read.tm_mon == -1) | (rtc_valid_tm(&tm_read) != 0)) //if the hym8563 haven't initialized
{
hym8563_set_time(client, &tm); //initialize the hym8563
}
if(gpio_request(client->irq, "rtc gpio"))
{
dev_err(&client->dev, "gpio request fail\n");
gpio_free(client->irq);
goto exit;
}
hym8563->irq = gpio_to_irq(client->irq);
gpio_pull_updown(client->irq,GPIOPullUp);
if (request_threaded_irq(hym8563->irq, NULL, hym8563_wakeup_irq, IRQF_TRIGGER_LOW | IRQF_ONESHOT, client->dev.driver->name, hym8563) < 0)
{
printk("unable to request rtc irq\n");
goto exit;
}
enable_irq_wake(hym8563->irq);
rtc = rtc_device_register(client->name, &client->dev,
&hym8563_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) {
rc = PTR_ERR(rtc);
rtc = NULL;
goto exit;
}
hym8563->rtc = rtc;
return 0;
exit:
if (rtc)
rtc_device_unregister(rtc);
if (hym8563) {
wake_lock_destroy(&hym8563->wake_lock);
kfree(hym8563);
}
return rc;
}
static int __devexit hym8563_remove(struct i2c_client *client)
{
struct hym8563 *hym8563 = i2c_get_clientdata(client);
if (hym8563->irq > 0) {
mutex_lock(&hym8563->mutex);
hym8563->exiting = 1;
mutex_unlock(&hym8563->mutex);
free_irq(hym8563->irq, hym8563);
cancel_work_sync(&hym8563->work);
}
rtc_device_unregister(hym8563->rtc);
wake_lock_destroy(&hym8563->wake_lock);
//.........这里部分代码省略.........
示例15: tty_port_destroy
/**
* tty_port_destroy -- destroy inited port
* @port: tty port to be doestroyed
*
* When a port was initialized using tty_port_init, one has to destroy the
* port by this function. Either indirectly by using tty_port refcounting
* (tty_port_put) or directly if refcounting is not used.
*/
void tty_port_destroy(struct tty_port *port)
{
cancel_work_sync(&port->buf.work);
tty_buffer_free_all(port);
}