本文整理汇总了C++中cancel_delayed_work_sync函数的典型用法代码示例。如果您正苦于以下问题:C++ cancel_delayed_work_sync函数的具体用法?C++ cancel_delayed_work_sync怎么用?C++ cancel_delayed_work_sync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cancel_delayed_work_sync函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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);
}
开发者ID:LiquidSmooth-Devices,项目名称:Deathly_Kernel_D2,代码行数:75,代码来源:rt2x00dev.c
示例2: dwc3_otg_init
/**
* dwc3_otg_init - Initializes otg related registers
* @dwc: Pointer to out controller context structure
*
* Returns 0 on success otherwise negative errno.
*/
int dwc3_otg_init(struct dwc3 *dwc)
{
u32 reg;
int ret = 0;
struct dwc3_otg *dotg;
dev_dbg(dwc->dev, "dwc3_otg_init\n");
/* Allocate and init otg instance */
dotg = devm_kzalloc(dwc->dev, sizeof(struct dwc3_otg), GFP_KERNEL);
if (!dotg) {
dev_err(dwc->dev, "unable to allocate dwc3_otg\n");
return -ENOMEM;
}
dotg->otg.phy = devm_kzalloc(dwc->dev, sizeof(struct usb_phy),
GFP_KERNEL);
if (!dotg->otg.phy) {
dev_err(dwc->dev, "unable to allocate dwc3_otg.phy\n");
return -ENOMEM;
}
dotg->otg.phy->otg = &dotg->otg;
dotg->otg.phy->dev = dwc->dev;
dotg->otg.phy->set_power = dwc3_otg_set_power;
dotg->otg.set_peripheral = dwc3_otg_set_peripheral;
dotg->otg.set_host = dwc3_otg_set_host;
dotg->otg.phy->state = OTG_STATE_UNDEFINED;
/*
* GHWPARAMS6[10] bit is SRPSupport.
* This bit also reflects DWC_USB3_EN_OTG
*/
reg = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6);
if (!(reg & DWC3_GHWPARAMS6_SRP_SUPPORT)) {
/*
* No OTG support in the HW core.
* We return 0 to indicate no error, since this is acceptable
* situation, just continue probe the dwc3 driver without otg.
*/
dev_dbg(dwc->dev, "dwc3_otg address space is not supported\n");
return 0;
}
/* DWC3 has separate IRQ line for OTG events (ID/BSV etc.) */
dotg->irq = platform_get_irq_byname(to_platform_device(dwc->dev),
"otg_irq");
if (dotg->irq < 0) {
dev_err(dwc->dev, "%s: missing OTG IRQ\n", __func__);
return -ENODEV;
}
dotg->regs = dwc->regs;
/* This reference is used by dwc3 modules for checking otg existance */
dwc->dotg = dotg;
dotg->dwc = dwc;
dotg->otg.phy->dev = dwc->dev;
init_completion(&dotg->dwc3_xcvr_vbus_init);
INIT_DELAYED_WORK(&dotg->sm_work, dwc3_otg_sm_work);
ret = request_irq(dotg->irq, dwc3_otg_interrupt, IRQF_SHARED,
"dwc3_otg", dotg);
if (ret) {
dev_err(dotg->otg.phy->dev, "failed to request irq #%d --> %d\n",
dotg->irq, ret);
goto err1;
}
pm_runtime_get(dwc->dev);
return 0;
err1:
cancel_delayed_work_sync(&dotg->sm_work);
dwc->dotg = NULL;
return ret;
}
开发者ID:AD5GB,项目名称:kernel_n5_3.10-experimental,代码行数:87,代码来源:dwc3_otg.c
示例3: blk_sync_queue
void blk_sync_queue(struct request_queue *q)
{
del_timer_sync(&q->timeout);
cancel_delayed_work_sync(&q->delay_work);
}
开发者ID:CaptainThrowback,项目名称:android_kernel_htc_hiae,代码行数:5,代码来源:blk-core.c
示例4: max8903_charger_probe
//.........这里部分代码省略.........
gpio_direction_output(mc->max8903_gpio_chg_iusb, CHG_IUSB_SELECT_500mA);
/*USUS control*/
if (gpio_request(mc->max8903_gpio_chg_usus, MAX8903_TOKEN_GPIO_CHG_USUS) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_usus\n");
goto exit6;
}
gpio_direction_output(mc->max8903_gpio_chg_usus, DISABLED); // leave USUS disabled until we connect
/*~CEN control */
if (gpio_request(mc->max8903_gpio_chg_en, MAX8903_TOKEN_GPIO_CHG_EN) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_en\n");
goto exit7;
}
gpio_direction_output(mc->max8903_gpio_chg_en, DISABLED);
if (gpio_request(mc->max8903_gpio_chg_ilm, MAX8903_TOKEN_GPIO_CHG_ILM) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_ilm\n");
goto exit8;
}
gpio_direction_output(mc->max8903_gpio_chg_ilm, CHG_ILM_SELECT_USB); /* set to USB current limit by default */
if (gpio_request(mc->max8903_gpio_chg_flt, MAX8903_TOKEN_GPIO_CHG_FLT) < 0) {
printk(KERN_ERR "Can't get GPIO for max8903 chg_flt\n");
goto exit9;
}
gpio_direction_input(mc->max8903_gpio_chg_flt);
/*~FLT status*/
mc->flt_irq= gpio_to_irq(mc->max8903_gpio_chg_flt) ;
ret = request_irq( mc->flt_irq,
max8903_fault_interrupt,
IRQF_TRIGGER_RISING|IRQF_TRIGGER_FALLING|IRQF_DISABLED,
"max8903-fault-irq",
mc);
printk("MAX8903: Request CHARGER FLT IRQ successfully!\n");
if (ret < 0) {
printk(KERN_ERR "MAX8903: Can't Request IRQ for max8903 flt_irq\n");
goto exita;
}
/*
create sysfs for manufacture testing coverage on charging
the operator should be able to write 1 to turn on the charging and 0 to
turn off the charging to verify the charging circuit is functioning
*/
ret = sysfs_create_group(&pdev->dev.kobj, &max8903_attr_group);
if (ret){
printk(KERN_ERR "MAX8903: Can't Create Sysfs Entry for FTM\n");
goto exitd;
}
// Register charger work and notification callback.
INIT_DELAYED_WORK_DEFERRABLE(&mc->usb_work, max8903_usb_charger_work);
mc->nb.notifier_call = twl6030_usb_notifier_call;
mc->otg = otg_get_transceiver();
if (!mc->otg) {
dev_err(&pdev->dev, "otg_get_transceiver() failed\n");
goto exitn;
}
ret = otg_register_notifier(mc->otg, &mc->nb);
if (ret) {
dev_err(&pdev->dev, "otg register notifier failed %d\n", ret);
goto exitn;
}
max8903_usb_charger_atboot(mc);
return 0;
exitn:
cancel_delayed_work_sync(&mc->usb_work);
sysfs_remove_group(&pdev->dev.kobj, &max8903_attr_group);
exitd:
free_irq(mc->flt_irq,mc);
exita:
gpio_free(mc->max8903_gpio_chg_flt);
exit9:
gpio_free(mc->max8903_gpio_chg_ilm);
exit8:
gpio_free(mc->max8903_gpio_chg_en);
exit7:
gpio_free(mc->max8903_gpio_chg_usus);
exit6:
gpio_free(mc->max8903_gpio_chg_iusb);
exit5:
gpio_free(mc->max8903_gpio_chg_uok);
exit3:
gpio_free(mc->max8903_gpio_chg_dok);
exit2:
power_supply_unregister(&mc->usb);
exit1:
power_supply_unregister(&mc->adapter);
exit0:
kfree(mc);
return ret;
}
开发者ID:LeaderRider,项目名称:kernel3NookTablet,代码行数:101,代码来源:max8903_charger.c
示例5: isert_conn_alloc
int isert_conn_alloc(struct iscsi_session *session,
struct iscsi_kern_conn_info *info,
struct iscsi_conn **new_conn,
struct iscsit_transport *t)
{
int res = 0;
struct isert_conn_dev *dev;
struct iscsi_conn *conn;
struct iscsi_cmnd *cmnd;
struct file *filp = fget(info->fd);
TRACE_ENTRY();
lockdep_assert_held(&session->target->target_mutex);
if (unlikely(!filp)) {
res = -EBADF;
goto out;
}
dev = filp->private_data;
cmnd = dev->login_rsp;
sBUG_ON(cmnd == NULL);
dev->login_rsp = NULL;
*new_conn = dev->conn;
res = isert_set_session_params(dev->conn, &session->sess_params,
&session->tgt_params);
if (!res)
set_bit(ISERT_CONN_PASSED, &dev->flags);
fput(filp);
conn = *new_conn;
if (unlikely(res))
goto cleanup_conn;
conn->transport = t;
res = iscsi_init_conn(session, info, conn);
if (unlikely(res))
goto cleanup_conn;
conn->rd_state = 1;
isert_del_timer(dev);
isert_dev_release(dev);
isert_set_priv(conn, NULL);
res = isert_login_rsp_tx(cmnd, true, false);
vunmap(dev->sg_virt);
dev->sg_virt = NULL;
if (unlikely(res))
goto cleanup_iscsi_conn;
#ifndef CONFIG_SCST_PROC
res = conn_sysfs_add(conn);
if (unlikely(res))
goto cleanup_iscsi_conn;
#endif
list_add_tail(&conn->conn_list_entry, &session->conn_list);
goto out;
cleanup_iscsi_conn:
conn->rd_state = 0;
if (conn->nop_in_interval > 0)
cancel_delayed_work_sync(&conn->nop_in_delayed_work);
cleanup_conn:
conn->session = NULL;
isert_close_connection(conn);
out:
TRACE_EXIT_RES(res);
return res;
}
开发者ID:artio0610,项目名称:EnterpriseStorageBox,代码行数:80,代码来源:isert_login.c
示例6: da9055_onkey_probe
static int da9055_onkey_probe(struct platform_device *pdev)
{
struct da9055 *da9055 = dev_get_drvdata(pdev->dev.parent);
struct da9055_onkey *onkey;
struct input_dev *input_dev;
int irq, err;
irq = platform_get_irq_byname(pdev, "ONKEY");
if (irq < 0) {
dev_err(&pdev->dev,
"Failed to get an IRQ for input device, %d\n", irq);
return -EINVAL;
}
onkey = devm_kzalloc(&pdev->dev, sizeof(*onkey), GFP_KERNEL);
if (!onkey) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
return -ENOMEM;
}
input_dev = input_allocate_device();
if (!input_dev) {
dev_err(&pdev->dev, "Failed to allocate memory\n");
return -ENOMEM;
}
onkey->input = input_dev;
onkey->da9055 = da9055;
input_dev->name = "da9055-onkey";
input_dev->phys = "da9055-onkey/input0";
input_dev->dev.parent = &pdev->dev;
input_dev->evbit[0] = BIT_MASK(EV_KEY);
__set_bit(KEY_POWER, input_dev->keybit);
INIT_DELAYED_WORK(&onkey->work, da9055_onkey_work);
err = request_threaded_irq(irq, NULL, da9055_onkey_irq,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
"ONKEY", onkey);
if (err < 0) {
dev_err(&pdev->dev,
"Failed to register ONKEY IRQ %d, error = %d\n",
irq, err);
goto err_free_input;
}
err = input_register_device(input_dev);
if (err) {
dev_err(&pdev->dev, "Unable to register input device, %d\n",
err);
goto err_free_irq;
}
platform_set_drvdata(pdev, onkey);
return 0;
err_free_irq:
free_irq(irq, onkey);
cancel_delayed_work_sync(&onkey->work);
err_free_input:
input_free_device(input_dev);
return err;
}
开发者ID:020gzh,项目名称:linux,代码行数:66,代码来源:da9055_onkey.c
示例7: boost_mig_sync_thread
static int boost_mig_sync_thread(void *data)
{
int dest_cpu = (int) data;
int src_cpu, ret;
struct cpu_sync *s = &per_cpu(sync_info, dest_cpu);
struct cpufreq_policy dest_policy;
struct cpufreq_policy src_policy;
unsigned long flags;
while (1) {
wait_event_interruptible(s->sync_wq,
s->pending || kthread_should_stop());
if (kthread_should_stop())
break;
spin_lock_irqsave(&s->lock, flags);
s->pending = false;
src_cpu = s->src_cpu;
spin_unlock_irqrestore(&s->lock, flags);
ret = cpufreq_get_policy(&src_policy, src_cpu);
if (ret)
continue;
ret = cpufreq_get_policy(&dest_policy, dest_cpu);
if (ret)
continue;
if (src_policy.cur == src_policy.cpuinfo.min_freq) {
pr_debug("No sync. Source CPU%[email protected]%dKHz at min freq\n",
src_cpu, src_policy.cur);
continue;
}
cancel_delayed_work_sync(&s->boost_rem);
if (sync_threshold) {
if (src_policy.cur >= sync_threshold)
s->boost_min = sync_threshold;
else
s->boost_min = src_policy.cur;
} else {
s->boost_min = src_policy.cur;
}
/* Force policy re-evaluation to trigger adjust notifier. */
get_online_cpus();
if (cpu_online(src_cpu))
/*
* Send an unchanged policy update to the source
* CPU. Even though the policy isn't changed from
* its existing boosted or non-boosted state
* notifying the source CPU will let the governor
* know a boost happened on another CPU and that it
* should re-evaluate the frequency at the next timer
* event without interference from a min sample time.
*/
cpufreq_update_policy(src_cpu);
if (cpu_online(dest_cpu)) {
cpufreq_update_policy(dest_cpu);
queue_delayed_work_on(dest_cpu, cpu_boost_wq,
&s->boost_rem, msecs_to_jiffies(boost_ms));
} else {
s->boost_min = 0;
}
put_online_cpus();
}
return 0;
}
开发者ID:michaelspeed,项目名称:EntityMobile_hammerhead_kernel,代码行数:69,代码来源:cpu-boost.c
示例8: smp_suspend
void smp_suspend(struct early_suspend *h)
{
cancel_delayed_work_sync(&cpuup_work);
if (num_online_cpus() > 1)
disable_nonboot_cpus();
}
开发者ID:bgtwoigu,项目名称:kernel-inwatch,代码行数:6,代码来源:smp.c
示例9: tm6000_ir_stop
static void tm6000_ir_stop(void *priv)
{
struct tm6000_IR *ir = priv;
cancel_delayed_work_sync(&ir->work);
}
开发者ID:3sOx,项目名称:asuswrt-merlin,代码行数:6,代码来源:tm6000-input.c
示例10: exynos_drd_switch_init
//.........这里部分代码省略.........
dev_dbg(drd->dev, "cannot find ID irq\n");
init_timer(&drd_switch->id_db_timer);
drd_switch->id_db_timer.data = (unsigned long) drd_switch;
drd_switch->id_db_timer.function = exynos_drd_switch_debounce;
/* VBus pin gpio IRQ */
drd_switch->vbus_irq = pdata->vbus_irq;
if (drd_switch->vbus_irq < 0)
dev_dbg(drd->dev, "cannot find VBUS irq\n");
init_timer(&drd_switch->vbus_db_timer);
drd_switch->vbus_db_timer.data = (unsigned long) drd_switch;
drd_switch->vbus_db_timer.function = exynos_drd_switch_debounce;
irq_flags = pdata->irq_flags;
drd_switch->otg.set_peripheral = exynos_drd_switch_set_peripheral;
drd_switch->otg.set_host = exynos_drd_switch_set_host;
/* Save for using by host and peripheral */
drd->core.otg = &drd_switch->otg;
drd_switch->otg.phy = devm_kzalloc(drd->dev, sizeof(struct usb_phy),
GFP_KERNEL);
if (!drd_switch->otg.phy) {
dev_err(drd->dev, "cannot allocate OTG phy\n");
return -ENOMEM;
}
drd_switch->otg.phy->otg = &drd_switch->otg;
drd_switch->otg.phy->dev = drd->dev;
#if 0
/*
* TODO: we need to have support for multiple transceivers here.
* Kernel > 3.5 should already have it. Now it works only for one
* drd channel.
*/
ret = usb_set_transceiver(drd_switch->otg.phy);
if (ret) {
dev_err(drd->dev,
"failed to set transceiver, already exists\n",
__func__);
goto err2;
}
#endif
spin_lock_init(&drd_switch->lock);
wake_lock_init(&drd_switch->wakelock,
WAKE_LOCK_SUSPEND, "drd_switch");
exynos_drd_switch_reset(drd, 0);
drd_switch->wq = create_freezable_workqueue("drd_switch");
if (!drd_switch->wq) {
dev_err(drd->dev, "cannot create workqueue\n");
ret = -ENOMEM;
goto err_wq;
}
INIT_DELAYED_WORK(&drd_switch->work, exynos_drd_switch_work);
if (drd_switch->id_irq >= 0) {
ret = devm_request_irq(drd->dev, drd_switch->id_irq,
exynos_drd_switch_id_interrupt, irq_flags,
"drd_switch_id", drd_switch);
if (ret) {
dev_err(drd->dev, "cannot claim ID irq\n");
goto err_irq;
}
}
if (drd_switch->vbus_irq >= 0) {
ret = devm_request_irq(drd->dev, drd_switch->vbus_irq,
exynos_drd_switch_vbus_interrupt, irq_flags,
"drd_switch_vbus", drd_switch);
if (ret) {
dev_err(drd->dev, "cannot claim VBUS irq\n");
goto err_irq;
}
}
ret = sysfs_create_group(&drd->dev->kobj, &exynos_drd_switch_attr_group);
if (ret) {
dev_err(drd->dev, "cannot create switch attributes\n");
goto err_irq;
}
dev_dbg(drd->dev, "DRD switch initialization finished normally\n");
return 0;
err_irq:
cancel_delayed_work_sync(&drd_switch->work);
destroy_workqueue(drd_switch->wq);
err_wq:
wake_lock_destroy(&drd_switch->wakelock);
return ret;
}
开发者ID:cm-3470,项目名称:android_kernel_samsung_degaslte,代码行数:101,代码来源:exynos-drd-switch.c
示例11: smp_distribute_keys
int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
{
struct smp_cmd_pairing *req, *rsp;
struct smp_chan *smp = conn->smp_chan;
__u8 *keydist;
BT_DBG("conn %p force %d", conn, force);
if (!test_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags))
return 0;
rsp = (void *) &smp->prsp[1];
/* The responder sends its keys first */
if (!force && conn->hcon->out && (rsp->resp_key_dist & 0x07))
return 0;
req = (void *) &smp->preq[1];
if (conn->hcon->out) {
keydist = &rsp->init_key_dist;
*keydist &= req->init_key_dist;
} else {
keydist = &rsp->resp_key_dist;
*keydist &= req->resp_key_dist;
}
BT_DBG("keydist 0x%x", *keydist);
if (*keydist & SMP_DIST_ENC_KEY) {
struct smp_cmd_encrypt_info enc;
struct smp_cmd_master_ident ident;
struct hci_conn *hcon = conn->hcon;
u8 authenticated;
__le16 ediv;
get_random_bytes(enc.ltk, sizeof(enc.ltk));
get_random_bytes(&ediv, sizeof(ediv));
get_random_bytes(ident.rand, sizeof(ident.rand));
smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
hci_add_ltk(conn->hcon->hdev, conn->dst, hcon->dst_type,
HCI_SMP_LTK_SLAVE, 1, authenticated,
enc.ltk, smp->enc_key_size, ediv, ident.rand);
ident.ediv = ediv;
smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident);
*keydist &= ~SMP_DIST_ENC_KEY;
}
if (*keydist & SMP_DIST_ID_KEY) {
struct smp_cmd_ident_addr_info addrinfo;
struct smp_cmd_ident_info idinfo;
/* Send a dummy key */
get_random_bytes(idinfo.irk, sizeof(idinfo.irk));
smp_send_cmd(conn, SMP_CMD_IDENT_INFO, sizeof(idinfo), &idinfo);
/* Just public address */
memset(&addrinfo, 0, sizeof(addrinfo));
bacpy(&addrinfo.bdaddr, conn->src);
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
&addrinfo);
*keydist &= ~SMP_DIST_ID_KEY;
}
if (*keydist & SMP_DIST_SIGN) {
struct smp_cmd_sign_info sign;
/* Send a dummy key */
get_random_bytes(sign.csrk, sizeof(sign.csrk));
smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign);
*keydist &= ~SMP_DIST_SIGN;
}
if (conn->hcon->out || force) {
clear_bit(HCI_CONN_LE_SMP_PEND, &conn->hcon->flags);
cancel_delayed_work_sync(&conn->security_timer);
smp_chan_destroy(conn);
}
return 0;
}
开发者ID:GetOcean,项目名称:ocean-linux-patches,代码行数:93,代码来源:smp.c
示例12: msm_otg_sm_work
static void msm_otg_sm_work(struct work_struct *w)
{
struct msm_otg *motg = container_of(w, struct msm_otg, sm_work);
struct usb_otg *otg = motg->phy.otg;
switch (otg->state) {
case OTG_STATE_UNDEFINED:
dev_dbg(otg->phy->dev, "OTG_STATE_UNDEFINED state\n");
msm_otg_reset(otg->phy);
msm_otg_init_sm(motg);
otg->state = OTG_STATE_B_IDLE;
/* FALL THROUGH */
case OTG_STATE_B_IDLE:
dev_dbg(otg->phy->dev, "OTG_STATE_B_IDLE state\n");
if (!test_bit(ID, &motg->inputs) && otg->host) {
/* disable BSV bit */
writel(readl(USB_OTGSC) & ~OTGSC_BSVIE, USB_OTGSC);
msm_otg_start_host(otg->phy, 1);
otg->state = OTG_STATE_A_HOST;
} else if (test_bit(B_SESS_VLD, &motg->inputs)) {
switch (motg->chg_state) {
case USB_CHG_STATE_UNDEFINED:
msm_chg_detect_work(&motg->chg_work.work);
break;
case USB_CHG_STATE_DETECTED:
switch (motg->chg_type) {
case USB_DCP_CHARGER:
msm_otg_notify_charger(motg,
IDEV_CHG_MAX);
break;
case USB_CDP_CHARGER:
msm_otg_notify_charger(motg,
IDEV_CHG_MAX);
msm_otg_start_peripheral(otg->phy, 1);
otg->state
= OTG_STATE_B_PERIPHERAL;
break;
case USB_SDP_CHARGER:
msm_otg_notify_charger(motg, IUNIT);
msm_otg_start_peripheral(otg->phy, 1);
otg->state
= OTG_STATE_B_PERIPHERAL;
break;
default:
break;
}
break;
default:
break;
}
} else {
/*
* If charger detection work is pending, decrement
* the pm usage counter to balance with the one that
* is incremented in charger detection work.
*/
if (cancel_delayed_work_sync(&motg->chg_work)) {
pm_runtime_put_sync(otg->phy->dev);
msm_otg_reset(otg->phy);
}
msm_otg_notify_charger(motg, 0);
motg->chg_state = USB_CHG_STATE_UNDEFINED;
motg->chg_type = USB_INVALID_CHARGER;
}
if (otg->state == OTG_STATE_B_IDLE)
pm_runtime_put_sync(otg->phy->dev);
break;
case OTG_STATE_B_PERIPHERAL:
dev_dbg(otg->phy->dev, "OTG_STATE_B_PERIPHERAL state\n");
if (!test_bit(B_SESS_VLD, &motg->inputs) ||
!test_bit(ID, &motg->inputs)) {
msm_otg_notify_charger(motg, 0);
msm_otg_start_peripheral(otg->phy, 0);
motg->chg_state = USB_CHG_STATE_UNDEFINED;
motg->chg_type = USB_INVALID_CHARGER;
otg->state = OTG_STATE_B_IDLE;
msm_otg_reset(otg->phy);
schedule_work(w);
}
break;
case OTG_STATE_A_HOST:
dev_dbg(otg->phy->dev, "OTG_STATE_A_HOST state\n");
if (test_bit(ID, &motg->inputs)) {
msm_otg_start_host(otg->phy, 0);
otg->state = OTG_STATE_B_IDLE;
msm_otg_reset(otg->phy);
schedule_work(w);
}
break;
default:
break;
}
}
开发者ID:pgurenko,项目名称:VAR-SOM-AM33-Kernel-3-14,代码行数:94,代码来源:phy-msm-usb.c
示例13: smp_distribute_keys
//.........这里部分代码省略.........
/* The responder sends its keys first */
if (hcon->out && (smp->remote_key_dist & 0x07))
return 0;
req = (void *) &smp->preq[1];
if (hcon->out) {
keydist = &rsp->init_key_dist;
*keydist &= req->init_key_dist;
} else {
keydist = &rsp->resp_key_dist;
*keydist &= req->resp_key_dist;
}
BT_DBG("keydist 0x%x", *keydist);
if (*keydist & SMP_DIST_ENC_KEY) {
struct smp_cmd_encrypt_info enc;
struct smp_cmd_master_ident ident;
struct smp_ltk *ltk;
u8 authenticated;
__le16 ediv;
__le64 rand;
get_random_bytes(enc.ltk, sizeof(enc.ltk));
get_random_bytes(&ediv, sizeof(ediv));
get_random_bytes(&rand, sizeof(rand));
smp_send_cmd(conn, SMP_CMD_ENCRYPT_INFO, sizeof(enc), &enc);
authenticated = hcon->sec_level == BT_SECURITY_HIGH;
ltk = hci_add_ltk(hdev, &hcon->dst, hcon->dst_type,
HCI_SMP_LTK_SLAVE, authenticated, enc.ltk,
smp->enc_key_size, ediv, rand);
smp->slave_ltk = ltk;
ident.ediv = ediv;
ident.rand = rand;
smp_send_cmd(conn, SMP_CMD_MASTER_IDENT, sizeof(ident), &ident);
*keydist &= ~SMP_DIST_ENC_KEY;
}
if (*keydist & SMP_DIST_ID_KEY) {
struct smp_cmd_ident_addr_info addrinfo;
struct smp_cmd_ident_info idinfo;
memcpy(idinfo.irk, hdev->irk, sizeof(idinfo.irk));
smp_send_cmd(conn, SMP_CMD_IDENT_INFO, sizeof(idinfo), &idinfo);
/* The hci_conn contains the local identity address
* after the connection has been established.
*
* This is true even when the connection has been
* established using a resolvable random address.
*/
bacpy(&addrinfo.bdaddr, &hcon->src);
addrinfo.addr_type = hcon->src_type;
smp_send_cmd(conn, SMP_CMD_IDENT_ADDR_INFO, sizeof(addrinfo),
&addrinfo);
*keydist &= ~SMP_DIST_ID_KEY;
}
if (*keydist & SMP_DIST_SIGN) {
struct smp_cmd_sign_info sign;
struct smp_csrk *csrk;
/* Generate a new random key */
get_random_bytes(sign.csrk, sizeof(sign.csrk));
csrk = kzalloc(sizeof(*csrk), GFP_KERNEL);
if (csrk) {
csrk->master = 0x00;
memcpy(csrk->val, sign.csrk, sizeof(csrk->val));
}
smp->slave_csrk = csrk;
smp_send_cmd(conn, SMP_CMD_SIGN_INFO, sizeof(sign), &sign);
*keydist &= ~SMP_DIST_SIGN;
}
/* If there are still keys to be received wait for them */
if ((smp->remote_key_dist & 0x07))
return 0;
clear_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags);
cancel_delayed_work_sync(&conn->security_timer);
set_bit(SMP_FLAG_COMPLETE, &smp->smp_flags);
smp_notify_keys(conn);
smp_chan_destroy(conn);
return 0;
}
开发者ID:pombredanne,项目名称:mithrandir,代码行数:101,代码来源:smp.c
示例14: dwc3_otg_sm_work
//.........这里部分代码省略.........
* @dwc: Pointer to out controller context structure
*
* Returns 0 on success otherwise negative errno.
*/
int dwc3_otg_init(struct dwc3 *dwc)
{
u32 reg;
int ret = 0;
struct dwc3_otg *dotg;
dev_dbg(dwc->dev, "dwc3_otg_init\n");
/*
* GHWPARAMS6[10] bit is SRPSupport.
* This bit also reflects DWC_USB3_EN_OTG
*/
reg = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6);
if (!(reg & DWC3_GHWPARAMS6_SRP_SUPPORT)) {
/*
* No OTG support in the HW core.
* We return 0 to indicate no error, since this is acceptable
* situation, just continue probe the dwc3 driver without otg.
*/
dev_dbg(dwc->dev, "dwc3_otg address space is not supported\n");
return 0;
}
/* Allocate and init otg instance */
dotg = kzalloc(sizeof(struct dwc3_otg), GFP_KERNEL);
if (!dotg) {
dev_err(dwc->dev, "unable to allocate dwc3_otg\n");
return -ENOMEM;
}
/* DWC3 has separate IRQ line for OTG events (ID/BSV etc.) */
dotg->irq = platform_get_irq_byname(to_platform_device(dwc->dev),
"otg_irq");
if (dotg->irq < 0) {
dev_err(dwc->dev, "%s: missing OTG IRQ\n", __func__);
ret = -ENODEV;
goto err1;
}
dotg->regs = dwc->regs;
dotg->otg.set_peripheral = dwc3_otg_set_peripheral;
dotg->otg.set_host = dwc3_otg_set_host;
/* This reference is used by dwc3 modules for checking otg existance */
dwc->dotg = dotg;
dotg->otg.phy = kzalloc(sizeof(struct usb_phy), GFP_KERNEL);
if (!dotg->otg.phy) {
dev_err(dwc->dev, "unable to allocate dwc3_otg.phy\n");
ret = -ENOMEM;
goto err1;
}
dotg->dwc = dwc;
dotg->otg.phy->otg = &dotg->otg;
dotg->otg.phy->dev = dwc->dev;
dotg->otg.phy->set_power = dwc3_otg_set_power;
dotg->otg.phy->set_suspend = dwc3_otg_set_suspend;
ret = usb_set_transceiver(dotg->otg.phy);
if (ret) {
dev_err(dotg->otg.phy->dev,
"%s: failed to set transceiver, already exists\n",
__func__);
goto err2;
}
dotg->otg.phy->state = OTG_STATE_UNDEFINED;
init_completion(&dotg->dwc3_xcvr_vbus_init);
INIT_DELAYED_WORK(&dotg->sm_work, dwc3_otg_sm_work);
ret = request_irq(dotg->irq, dwc3_otg_interrupt, IRQF_SHARED,
"dwc3_otg", dotg);
if (ret) {
dev_err(dotg->otg.phy->dev, "failed to request irq #%d --> %d\n",
dotg->irq, ret);
goto err3;
}
pm_runtime_get(dwc->dev);
return 0;
err3:
cancel_delayed_work_sync(&dotg->sm_work);
usb_set_transceiver(NULL);
err2:
kfree(dotg->otg.phy);
err1:
dwc->dotg = NULL;
kfree(dotg);
return ret;
}
开发者ID:bangprovn,项目名称:android_stock,代码行数:101,代码来源:dwc3_otg.c
示例15: close_send_current
int close_send_current(void)
{
if (atomic_cmpxchg(&enabled, 1, 0))
cancel_delayed_work_sync(&read_current_work);
return 0;
}
开发者ID:HuaweiHonor4C,项目名称:kernel_hi6210sft_mm,代码行数:6,代码来源:sensor_sys_info.c
示例16: 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);
}
开发者ID:pombredanne,项目名称:mithrandir,代码行数:6,代码来源:hv_kvp.c
示例17: hdmi_streamon
static int hdmi_streamon(struct hdmi_device *hdev)
{
const struct hdmi_timings *conf = hdev->cur_conf;
struct device *dev = hdev->dev;
int ret;
u32 val0, val1, val2;
dev_dbg(dev, "%s\n", __func__);
/* 3D test */
hdmi_set_infoframe(hdev);
/* set packets for audio */
hdmi_set_packets(hdev);
/* init audio */
#if defined(CONFIG_VIDEO_EXYNOS_HDMI_AUDIO_I2S)
hdmi_reg_i2s_audio_init(hdev);
#elif defined(CONFIG_VIDEO_EXYNOS_HDMI_AUDIO_SPDIF)
hdmi_reg_spdif_audio_init(hdev);
#endif
/* enbale HDMI audio */
if (hdev->audio_enable)
hdmi_audio_enable(hdev, 1);
hdmi_set_dvi_mode(hdev);
/* controls the pixel value limitation */
hdmi_reg_set_limits(hdev);
/* setting core registers */
hdmi_timing_apply(hdev, conf);
/* enable HDMI and timing generator */
hdmi_enable(hdev, 1);
hdmi_tg_enable(hdev, 1);
hdev->streaming = HDMI_STREAMING;
/* change the HPD interrupt: External -> Internal */
disable_irq(hdev->ext_irq);
cancel_delayed_work_sync(&hdev->hpd_work_ext);
hdmi_reg_set_int_hpd(hdev);
enable_irq(hdev->int_irq);
dev_info(hdev->dev, "HDMI interrupt changed to internal\n");
/* start HDCP if enabled */
if (hdev->hdcp_info.hdcp_enable) {
ret = hdcp_start(hdev);
if (ret)
return ret;
}
val0 = hdmi_read(hdev, HDMI_ACR_MCTS0);
val1 = hdmi_read(hdev, HDMI_ACR_MCTS1);
val2 = hdmi_read(hdev, HDMI_ACR_MCTS2);
dev_dbg(dev, "HDMI_ACR_MCTS0 : 0x%08x\n", val0);
dev_dbg(dev, "HDMI_ACR_MCTS1 : 0x%08x\n", val1);
dev_dbg(dev, "HDMI_ACR_MCTS2 : 0x%08x\n", val2);
hdmi_dumpregs(hdev, "streamon");
return 0;
}
开发者ID:djmax81,项目名称:android_kernel_samsung_exynos5433_LL,代码行数:63,代码来源:hdmi_drv.c
示例18: zfsctl_mount_snapshot
int
zfsctl_mount_snapshot(struct path *path, int flags)
{
struct dentry *dentry = path->dentry;
struct inode *ip = dentry->d_inode;
zfs_sb_t *zsb = ITOZSB(ip);
char *full_name, *full_path;
zfs_snapentry_t *sep;
zfs_snapentry_t search;
char *argv[] = { "/bin/sh", "-c", NULL, NULL };
char *envp[] = { NULL };
int error;
ZFS_ENTER(zsb);
full_name = kmem_zalloc(MAXNAMELEN, KM_SLEEP);
full_path = kmem_zalloc(PATH_MAX, KM_SLEEP);
error = zfsctl_snapshot_zname(ip, dname(dentry), MAXNAMELEN, full_name);
if (error)
goto error;
error = zfsctl_snapshot_zpath(path, PATH_MAX, full_path);
if (error)
goto error;
/*
* Attempt to mount the snapshot from user space. Normally this
* would be done using the vfs_kern_mount() function, however that
* function is marked GPL-only and cannot be used. On error we
* careful to log the real error to the console and return EISDIR
* to safely abort the automount. This should be very rare.
*/
argv[2] = kmem_asprintf(SET_MOUNT_CMD, full_name, full_path);
error = call_usermodehelper(argv[0], argv, envp, 1);
strfree(argv[2]);
if (error) {
printk("ZFS: Unable to automount %s at %s: %d\n",
full_name, full_path, error);
error = EISDIR;
goto error;
}
mutex_enter(&zsb->z_ctldir_lock);
/*
* Ensure a previous entry does not exist, if it does safely remove
* it any cancel the outstanding expiration. This can occur when a
* snapshot is manually unmounted and then an automount is triggered.
*/
search.se_name = full_name;
sep = avl_find(&zsb->z_ctldir_snaps, &search, NULL);
if (sep) {
avl_remove(&zsb->z_ctldir_snaps, sep);
cancel_delayed_work_sync(&sep->se_work);
zfsctl_sep_free(sep);
}
sep = zfsctl_sep_alloc();
sep->se_name = full_name;
sep->se_path = full_path;
sep->se_inode = ip;
avl_add(&zsb->z_ctldir_snaps, sep);
spl_init_delayed_work(&sep->se_work, zfsctl_expire_snapshot, sep);
schedule_delayed_work(&sep->se_work, zfs_expire_snapshot * HZ);
mutex_exit(&zsb->z_ctldir_lock);
error:
if (error) {
kmem_free(full_name, MAXNAMELEN);
kmem_free(full_path, PATH_MAX);
}
ZFS_EXIT(zsb);
return (error);
}
开发者ID:ColdCanuck,项目名称:zfs,代码行数:78,代码来源:zfs_ctldir.c
示例19: usbhs0_hardware_exit
static void usbhs0_hardware_exit(struct platform_device *pdev)
{
struct usbhs_private *priv = usbhs_get_priv(pdev);
cancel_delayed_work_sync(&priv->work);
}
开发者ID:p500-ics-cm9,项目名称:linaro-android-3.1,代码行数:6,代码来源:board-mackerel.c
示例20: WaitForDelayedWork
static inline void
WaitForDelayedWork(CommOSWork *work)
{
cancel_delayed_work_sync(work);
}
开发者ID:Buckmarble,项目名称:Lunar_kernel_sense_m7,代码行数:5,代码来源:comm_os_linux.c
注:本文中的cancel_delayed_work_sync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论