static void hci_cc_write_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) { __u8 status = *((__u8 *) skb->data); __u16 setting; void *sent; BT_DBG("%s status 0x%x", hdev->name, status); if (status) return; sent = hci_sent_cmd_data(hdev, HCI_OP_WRITE_VOICE_SETTING); if (!sent) return; setting = get_unaligned_le16(sent); if (hdev->voice_setting == setting) return; hdev->voice_setting = setting; BT_DBG("%s voice setting 0x%04x", hdev->name, setting); if (hdev->notify) { tasklet_disable(&hdev->tx_task); hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); tasklet_enable(&hdev->tx_task); } }
static void hci_cc_read_voice_setting(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_rp_read_voice_setting *rp = (void *) skb->data; __u16 setting; BT_DBG("%s status 0x%x", hdev->name, rp->status); if (rp->status) return; setting = __le16_to_cpu(rp->voice_setting); if (hdev->voice_setting == setting) return; hdev->voice_setting = setting; BT_DBG("%s voice setting 0x%04x", hdev->name, setting); if (hdev->notify) { tasklet_disable(&hdev->tx_task); hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); tasklet_enable(&hdev->tx_task); } }
void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif) { struct ath_common *common = ath9k_hw_common(sc->sc_ah); struct ath_vif *avp = (void *)vif->drv_priv; struct ath_buf *bf = avp->av_bcbuf; ath_dbg(common, CONFIG, "Removing interface at beacon slot: %d\n", avp->av_bslot); tasklet_disable(&sc->bcon_tasklet); if (bf && bf->bf_mpdu) { struct sk_buff *skb = bf->bf_mpdu; dma_unmap_single(sc->dev, bf->bf_buf_addr, skb->len, DMA_TO_DEVICE); dev_kfree_skb_any(skb); bf->bf_mpdu = NULL; bf->bf_buf_addr = 0; } avp->av_bcbuf = NULL; sc->beacon.bslot[avp->av_bslot] = NULL; sc->nbcnvifs--; list_add_tail(&bf->list, &sc->beacon.bbuf); tasklet_enable(&sc->bcon_tasklet); }
static void mt76_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_bss_conf *info, u32 changed) { struct mt76_dev *dev = hw->priv; struct mt76_vif *mvif = (struct mt76_vif *) vif->drv_priv; mutex_lock(&dev->mutex); if (changed & BSS_CHANGED_BSSID) mt76_mac_set_bssid(dev, mvif->idx, info->bssid); if (changed & BSS_CHANGED_BEACON_INT) mt76_rmw_field(dev, MT_BEACON_TIME_CFG, MT_BEACON_TIME_CFG_INTVAL, info->beacon_int << 4); if (changed & BSS_CHANGED_BEACON_ENABLED) { tasklet_disable(&dev->pre_tbtt_tasklet); mt76_mac_set_beacon_enable(dev, mvif->idx, info->enable_beacon); tasklet_enable(&dev->pre_tbtt_tasklet); } if (changed & BSS_CHANGED_ERP_SLOT) { int slottime = info->use_short_slot ? 9 : 20; mt76_rmw_field(dev, MT_BKOFF_SLOT_CFG, MT_BKOFF_SLOT_CFG_SLOTTIME, slottime); } mutex_unlock(&dev->mutex); }
static void acm_disconnect(struct usb_interface *intf) { struct acm *acm = usb_get_intfdata(intf); struct usb_device *usb_dev = interface_to_usbdev(intf); int i; if (!acm || !acm->dev) { dbg("disconnect on nonexisting interface"); return; } mutex_lock(&open_mutex); if (!usb_get_intfdata(intf)) { mutex_unlock(&open_mutex); return; } if (acm->country_codes){ device_remove_file(&acm->control->dev, &dev_attr_wCountryCodes); device_remove_file(&acm->control->dev, &dev_attr_iCountryCodeRelDate); } device_remove_file(&acm->control->dev, &dev_attr_bmCapabilities); acm->dev = NULL; usb_set_intfdata(acm->control, NULL); usb_set_intfdata(acm->data, NULL); tasklet_disable(&acm->urb_task); usb_kill_urb(acm->ctrlurb); usb_kill_urb(acm->writeurb); for (i = 0; i < acm->rx_buflimit; i++) usb_kill_urb(acm->ru[i].urb); INIT_LIST_HEAD(&acm->filled_read_bufs); INIT_LIST_HEAD(&acm->spare_read_bufs); tasklet_enable(&acm->urb_task); flush_scheduled_work(); /* wait for acm_softint */ acm_write_buffers_free(acm); usb_buffer_free(usb_dev, acm->ctrlsize, acm->ctrl_buffer, acm->ctrl_dma); for (i = 0; i < acm->rx_buflimit; i++) usb_buffer_free(usb_dev, acm->readsize, acm->rb[i].base, acm->rb[i].dma); usb_driver_release_interface(&acm_driver, intf == acm->control ? acm->data : intf); if (!acm->used) { acm_tty_unregister(acm); mutex_unlock(&open_mutex); return; } mutex_unlock(&open_mutex); if (acm->tty) tty_hangup(acm->tty); }
static int mwl_mac80211_start(struct ieee80211_hw *hw) { struct mwl_priv *priv = hw->priv; int rc; /* Enable TX reclaim and RX tasklets. */ tasklet_enable(&priv->tx_task); tasklet_enable(&priv->rx_task); tasklet_enable(&priv->qe_task); /* Enable interrupts */ mwl_fwcmd_int_enable(hw); rc = mwl_fwcmd_radio_enable(hw); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_set_rate_adapt_mode(hw, 0); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_set_wmm_mode(hw, true); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_ht_guard_interval(hw, GUARD_INTERVAL_AUTO); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_set_dwds_stamode(hw, true); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_set_fw_flush_timer(hw, SYSADPT_AMSDU_FLUSH_TIME); if (rc) goto fwcmd_fail; rc = mwl_fwcmd_set_optimization_level(hw, 1); if (rc) goto fwcmd_fail; ieee80211_wake_queues(hw); return 0; fwcmd_fail: mwl_fwcmd_int_disable(hw); tasklet_disable(&priv->tx_task); tasklet_disable(&priv->rx_task); tasklet_disable(&priv->qe_task); return rc; }
static void mt76x2_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x2_dev *dev = hw->priv; clear_bit(MT76_SCANNING, &dev->mt76.state); tasklet_enable(&dev->pre_tbtt_tasklet); }
static int __init omap_kp_probe(struct device *dev) { int i; /* Disable the interrupt for the MPUIO keyboard */ omap_writew(1, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); if (machine_is_omap_h2() || machine_is_omap_h3()) { keymap = h2_keymap; set_bit(EV_REP, omap_kp_dev.evbit); } else if (machine_is_omap_innovator()) { keymap = innovator_keymap; } else if (machine_is_omap_osk()) { keymap = osk_keymap; } else { keymap = test_keymap; } init_timer(&kp_timer); kp_timer.function = omap_kp_timer; /* get the irq and init timer*/ tasklet_enable(&kp_tasklet); if (request_irq(INT_KEYBOARD, omap_kp_interrupt, 0, "omap-keypad", 0) < 0) return -EINVAL; /* setup input device */ set_bit(EV_KEY, omap_kp_dev.evbit); for (i = 0; keymap[i] != 0; i++) set_bit(keymap[i] & 0x00ffffff, omap_kp_dev.keybit); omap_kp_dev.name = "omap-keypad"; input_register_device(&omap_kp_dev); if (machine_is_omap_h2() || machine_is_omap_h3()) { omap_cfg_reg(F18_1610_KBC0); omap_cfg_reg(D20_1610_KBC1); omap_cfg_reg(D19_1610_KBC2); omap_cfg_reg(E18_1610_KBC3); omap_cfg_reg(C21_1610_KBC4); omap_cfg_reg(G18_1610_KBR0); omap_cfg_reg(F19_1610_KBR1); omap_cfg_reg(H14_1610_KBR2); omap_cfg_reg(E20_1610_KBR3); omap_cfg_reg(E19_1610_KBR4); omap_cfg_reg(N19_1610_KBR5); omap_writew(0xff, OMAP_MPUIO_BASE + OMAP_MPUIO_GPIO_DEBOUNCING); } /* scan current status and enable interrupt */ omap_kp_scan_keypad(keypad_state); omap_writew(0, OMAP_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); return 0; }
static void led_output_handler(unsigned long data) { // We need to make sure that our tasklet is not scheduled again tasklet_disable(&ledtasklet); printk("%s: Takslets executed!\n", __FUNCTION__); // TODO: Set the led buttons here tasklet_enable(&ledtasklet); }
} static void qcnmea_disconnect (struct usb_interface *intf) { struct qcnmea *nmea = usb_get_intfdata(intf); struct usb_device *usb_dev = interface_to_usbdev(intf); int i; if (!nmea || !nmea->usb_dev) { //dbg("disconnect on nonexisting interface"); return; } down(&open_mutex); if (!usb_get_intfdata(intf)) { up(&open_mutex); return; } //device_remove_file(&intf->dev, &dev_attr_bmCapabilities); nmea->usb_dev = NULL; usb_set_intfdata(intf, NULL); tasklet_disable(&nmea->rx_tasklet); usb_kill_urb(nmea->write_urb); for (i = 0; i < QCNMEA_NR; i++) usb_kill_urb(nmea->ru[i].urb); INIT_LIST_HEAD(&nmea->filled_read_bufs); INIT_LIST_HEAD(&nmea->spare_read_bufs); tasklet_enable(&nmea->rx_tasklet); flush_scheduled_work(); /* wait for acm_softint */ qcnmea_write_buf_free(nmea); for (i = 0; i < QCNMEA_NR; i++) usb_buffer_free(usb_dev, nmea->read_size, nmea->rb[i].base, nmea->rb[i].dma); usb_driver_release_interface(&qcnmea_usb_driver, intf); if (!nmea->used) { qcnmea_tty_unregister(nmea); up(&open_mutex); return; } up(&open_mutex); if (nmea->tty) tty_hangup(nmea->tty);
static void rx_tasklet_cleanup(struct net_device *dev) { struct ar2313_private *sp = dev->priv; /* * Tasklet may be scheduled. Need to get it removed from the list * since we're about to free the struct. */ sp->unloading = 1; tasklet_enable(&sp->rx_tasklet); tasklet_kill(&sp->rx_tasklet); }
static void sc92031_enable_interrupts(struct net_device *dev) { struct sc92031_priv *priv = netdev_priv(dev); void __iomem *port_base = priv->port_base; tasklet_enable(&priv->tasklet); atomic_set(&priv->intr_mask, IntrBits); wmb(); iowrite32(IntrBits, port_base + IntrMask); mmiowb(); }
void mt76x02_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { struct mt76x02_dev *dev = hw->priv; clear_bit(MT76_SCANNING, &dev->mt76.state); if (mt76_is_mmio(dev)) tasklet_enable(&dev->pre_tbtt_tasklet); if (dev->cal.gain_init_done) { /* Restore AGC gain and resume calibration after scanning. */ dev->cal.low_gain = -1; ieee80211_queue_delayed_work(hw, &dev->cal_work, 0); } }
static void stop_data_traffic(struct acm *acm) { int i; tasklet_disable(&acm->urb_task); usb_kill_urb(acm->ctrlurb); for(i = 0; i < ACM_NW; i++) usb_kill_urb(acm->wb[i].urb); for (i = 0; i < acm->rx_buflimit; i++) usb_kill_urb(acm->ru[i].urb); tasklet_enable(&acm->urb_task); cancel_work_sync(&acm->work); }
static void acm_port_down(struct acm *acm) { int i, nr = acm->rx_buflimit; if (acm->dev) { usb_autopm_get_interface(acm->control); acm_set_control(acm, acm->ctrlout = 0); usb_kill_urb(acm->ctrlurb); for (i = 0; i < ACM_NW; i++) usb_kill_urb(acm->wb[i].urb); tasklet_disable(&acm->urb_task); for (i = 0; i < nr; i++) usb_kill_urb(acm->ru[i].urb); tasklet_enable(&acm->urb_task); acm->control->needs_remote_wakeup = 0; usb_autopm_put_interface(acm->control); } }
/** void bcm_enable_reentrancy(void); */ void bcm_enable_reentrancy(void) { /** should we use a spinlock?? we can't use spinlocks here because this is a function call from the IPC lib and the spinlock call usually are implemented as macros as they muck with a local flags stack variable. Also, spinlocks is not required here as long as we can provide reentrancy just for the IPC calls, i.e. no need to disable interrupts etc. */ preempt_enable(); local_irq_enable(); if (intr_tasklet_ptr_g) { tasklet_enable(intr_tasklet_ptr_g); } }
static int __init tasklet_enable_disable_init(void) { printk("<0>into tasklet_enable_disable_init\n"); tasklet_init(&tasklet,irq_tasklet_action,data); //初始化一个struct tasklet_struct 变量 tasklet_schedule(&tasklet); //把软件中断放入后台线程 printk("<0>the count value of the tasklet before tasklet_disable is:%d\n",tasklet.count); tasklet_disable(&tasklet); //调用tasklet_disable()使tasklet对应的处理函数不能执行 if(atomic_read(&(tasklet.count)) != 0) //测试当前的count的值 printk("<0>tasklet is disabled.\n"); printk("<0>the count value of the tasklet after tasklet_disable is:%d\n",tasklet.count); tasklet_enable(&tasklet); //调用函数tasklet_enable()使能tasklet if(atomic_read(&(tasklet.count))==0) printk("<0>tasklet is enabled\n"); printk("<0>the count value of the tasklet after tasklet_enable is:%d\n",tasklet.count); tasklet_kill(&tasklet); //等待tasklet被调度 printk("<0>out tasklet_enable_disable_init\n"); return 0; }
static void stop_data_traffic(struct acm *acm) { int i; tasklet_disable(&acm->urb_task); usb_kill_urb(acm->ctrlurb); usb_kill_urb(acm->writeurb); for (i = 0; i < acm->rx_buflimit; i++) usb_kill_urb(acm->ru[i].urb); INIT_LIST_HEAD(&acm->filled_read_bufs); INIT_LIST_HEAD(&acm->spare_read_bufs); tasklet_enable(&acm->urb_task); cancel_work_sync(&acm->work); }
static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) { struct hci_ev_num_comp_pkts *ev = (void *) skb->data; __le16 *ptr; int i; skb_pull(skb, sizeof(*ev)); BT_DBG("%s num_hndl %d", hdev->name, ev->num_hndl); if (skb->len < ev->num_hndl * 4) { BT_DBG("%s bad parameters", hdev->name); return; } tasklet_disable(&hdev->tx_task); for (i = 0, ptr = (__le16 *) skb->data; i < ev->num_hndl; i++) { struct hci_conn *conn; __u16 handle, count; handle = get_unaligned_le16(ptr++); count = get_unaligned_le16(ptr++); conn = hci_conn_hash_lookup_handle(hdev, handle); if (conn) { conn->sent -= count; if (conn->type == ACL_LINK) { hdev->acl_cnt += count; if (hdev->acl_cnt > hdev->acl_pkts) hdev->acl_cnt = hdev->acl_pkts; } else { hdev->sco_cnt += count; if (hdev->sco_cnt > hdev->sco_pkts) hdev->sco_cnt = hdev->sco_pkts; } } } tasklet_schedule(&hdev->tx_task); tasklet_enable(&hdev->tx_task); }
int zd_mac_open(struct net_device *netdev) { struct zd_mac *mac = zd_netdev_mac(netdev); struct zd_chip *chip = &mac->chip; int r; tasklet_enable(&mac->rx_tasklet); r = zd_chip_enable_int(chip); if (r < 0) goto out; r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G); if (r < 0) goto disable_int; r = reset_mode(mac); if (r) goto disable_int; r = zd_chip_switch_radio_on(chip); if (r < 0) goto disable_int; r = zd_chip_set_channel(chip, mac->requested_channel); if (r < 0) goto disable_radio; r = zd_chip_enable_rx(chip); if (r < 0) goto disable_radio; r = zd_chip_enable_hwint(chip); if (r < 0) goto disable_rx; housekeeping_enable(mac); ieee80211softmac_start(netdev); return 0; disable_rx: zd_chip_disable_rx(chip); disable_radio: zd_chip_switch_radio_off(chip); disable_int: zd_chip_disable_int(chip); out: return r; }
/* Number of completed packets */ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *skb) { evt_num_comp_pkts *nc = (evt_num_comp_pkts *) skb->data; __u16 *ptr; int i; skb_pull(skb, EVT_NUM_COMP_PKTS_SIZE); BT_DBG("%s num_hndl %d", hdev->name, nc->num_hndl); if (skb->len < nc->num_hndl * 4) { BT_DBG("%s bad parameters", hdev->name); return; } tasklet_disable(&hdev->tx_task); for (i = 0, ptr = (__u16 *) skb->data; i < nc->num_hndl; i++) { struct hci_conn *conn; __u16 handle, count; handle = __le16_to_cpu(get_unaligned(ptr++)); count = __le16_to_cpu(get_unaligned(ptr++)); conn = conn_hash_lookup_handle(hdev, handle); if (conn) { conn->sent -= count; if (conn->type == SCO_LINK) { if ((hdev->sco_cnt += count) > hdev->sco_pkts) hdev->sco_cnt = hdev->sco_pkts; } else { if ((hdev->acl_cnt += count) > hdev->acl_pkts) hdev->acl_cnt = hdev->acl_pkts; } } } hci_sched_tx(hdev); tasklet_enable(&hdev->tx_task); }
static int mantis_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) { struct dvb_demux *dvbdmx = dvbdmxfeed->demux; struct mantis_pci *mantis = dvbdmx->priv; dprintk(MANTIS_DEBUG, 1, "Mantis DVB Start feed"); if (!dvbdmx->dmx.frontend) { dprintk(MANTIS_DEBUG, 1, "no frontend ?"); return -EINVAL; } mantis->feeds++; dprintk(MANTIS_DEBUG, 1, "mantis start feed, feeds=%d", mantis->feeds); if (mantis->feeds == 1) { dprintk(MANTIS_DEBUG, 1, "mantis start feed & dma"); mantis_dma_start(mantis); tasklet_enable(&mantis->tasklet); } return mantis->feeds; }
static void acm_port_down(struct acm *acm, int drain) { int i, nr = acm->rx_buflimit; if (acm->dev) { usb_autopm_get_interface(acm->control); acm_set_control(acm, acm->ctrlout = 0); /* try letting the last writes drain naturally */ if (drain) { wait_event_interruptible_timeout(acm->drain_wait, (ACM_NW == acm_wb_is_avail(acm)) || !acm->dev, ACM_CLOSE_TIMEOUT * HZ); } usb_kill_urb(acm->ctrlurb); for (i = 0; i < ACM_NW; i++) usb_kill_urb(acm->wb[i].urb); tasklet_disable(&acm->urb_task); for (i = 0; i < nr; i++) usb_kill_urb(acm->ru[i].urb); tasklet_enable(&acm->urb_task); acm->control->needs_remote_wakeup = 0; usb_autopm_put_interface(acm->control); } }
int bnxt_qplib_rcfw_start_irq(struct bnxt_qplib_rcfw *rcfw, int msix_vector, bool need_init) { int rc; if (rcfw->requested) return -EFAULT; rcfw->vector = msix_vector; if (need_init) tasklet_init(&rcfw->worker, bnxt_qplib_service_creq, (unsigned long)rcfw); else tasklet_enable(&rcfw->worker); rc = request_irq(rcfw->vector, bnxt_qplib_creq_irq, 0, "bnxt_qplib_creq", rcfw); if (rc) return rc; rcfw->requested = true; CREQ_DB_REARM(rcfw->creq_bar_reg_iomem, rcfw->creq.cons, rcfw->creq.max_elements); return 0; }
struct net_device *__init c4_add_dev (hdw_info_t * hi, int brdno, unsigned long f0, unsigned long f1, int irq0, int irq1) { struct net_device *ndev; ci_t *ci; ndev = alloc_netdev(sizeof(ci_t), SBE_IFACETMPL, c4_setup); if (!ndev) { pr_warning("%s: no memory for struct net_device !\n", hi->devname); error_flag = ENOMEM; return 0; } ci = (ci_t *)(netdev_priv(ndev)); ndev->irq = irq0; ci->hdw_info = hi; ci->state = C_INIT; /* mark as hardware not available */ ci->next = c4_list; c4_list = ci; ci->brdno = ci->next ? ci->next->brdno + 1 : 0; if (CI == 0) CI = ci; /* DEBUG, only board 0 usage */ strcpy (ci->devname, hi->devname); ci->release = &pmcc4_OSSI_release[0]; /* tasklet */ #if defined(SBE_ISR_TASKLET) tasklet_init (&ci->ci_musycc_isr_tasklet, (void (*) (unsigned long)) musycc_intr_bh_tasklet, (unsigned long) ci); if (atomic_read (&ci->ci_musycc_isr_tasklet.count) == 0) tasklet_disable_nosync (&ci->ci_musycc_isr_tasklet); #elif defined(SBE_ISR_IMMEDIATE) ci->ci_musycc_isr_tq.routine = (void *) (unsigned long) musycc_intr_bh_tasklet; ci->ci_musycc_isr_tq.data = ci; #endif if (register_netdev (ndev) || (c4_init (ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) { OS_kfree (netdev_priv(ndev)); OS_kfree (ndev); error_flag = ENODEV; return 0; } /************************************************************* * int request_irq(unsigned int irq, * void (*handler)(int, void *, struct pt_regs *), * unsigned long flags, const char *dev_name, void *dev_id); * wherein: * irq -> The interrupt number that is being requested. * handler -> Pointer to handling function being installed. * flags -> A bit mask of options related to interrupt management. * dev_name -> String used in /proc/interrupts to show owner of interrupt. * dev_id -> Pointer (for shared interrupt lines) to point to its own * private data area (to identify which device is interrupting). * * extern void free_irq(unsigned int irq, void *dev_id); **************************************************************/ if (request_irq (irq0, &c4_linux_interrupt, IRQF_SHARED, ndev->name, ndev)) { pr_warning("%s: MUSYCC could not get irq: %d\n", ndev->name, irq0); unregister_netdev (ndev); OS_kfree (netdev_priv(ndev)); OS_kfree (ndev); error_flag = EIO; return 0; } #ifdef CONFIG_SBE_PMCC4_NCOMM if (request_irq (irq1, &c4_ebus_interrupt, IRQF_SHARED, ndev->name, ndev)) { pr_warning("%s: EBUS could not get irq: %d\n", hi->devname, irq1); unregister_netdev (ndev); free_irq (irq0, ndev); OS_kfree (netdev_priv(ndev)); OS_kfree (ndev); error_flag = EIO; return 0; } #endif /* setup board identification information */ { u_int32_t tmp; hdw_sn_get (hi, brdno); /* also sets PROM format type (promfmt) * for later usage */ switch (hi->promfmt) { case PROM_FORMAT_TYPE1: memcpy (ndev->dev_addr, (FLD_TYPE1 *) (hi->mfg_info.pft1.Serial), 6); memcpy (&tmp, (FLD_TYPE1 *) (hi->mfg_info.pft1.Id), 4); /* unaligned data * acquisition */ ci->brd_id = cpu_to_be32 (tmp); break; case PROM_FORMAT_TYPE2: memcpy (ndev->dev_addr, (FLD_TYPE2 *) (hi->mfg_info.pft2.Serial), 6); memcpy (&tmp, (FLD_TYPE2 *) (hi->mfg_info.pft2.Id), 4); /* unaligned data * acquisition */ ci->brd_id = cpu_to_be32 (tmp); break; default: ci->brd_id = 0; memset (ndev->dev_addr, 0, 6); break; } #if 1 sbeid_set_hdwbid (ci); /* requires bid to be preset */ #else sbeid_set_bdtype (ci); /* requires hdw_bid to be preset */ #endif } #ifdef CONFIG_PROC_FS sbecom_proc_brd_init (ci); #endif #if defined(SBE_ISR_TASKLET) tasklet_enable (&ci->ci_musycc_isr_tasklet); #endif if ((error_flag = c4_init2 (ci)) != SBE_DRVR_SUCCESS) { #ifdef CONFIG_PROC_FS sbecom_proc_brd_cleanup (ci); #endif unregister_netdev (ndev); free_irq (irq1, ndev); free_irq (irq0, ndev); OS_kfree (netdev_priv(ndev)); OS_kfree (ndev); return 0; /* failure, error_flag is set */ } return ndev; }
/* Command Complete OGF HOST_CTL */ static void hci_cc_host_ctl(struct hci_dev *hdev, __u16 ocf, struct sk_buff *skb) { __u8 status, param; __u16 setting; struct hci_rp_read_voice_setting *vs; void *sent; BT_DBG("%s ocf 0x%x", hdev->name, ocf); switch (ocf) { case OCF_RESET: status = *((__u8 *) skb->data); hci_req_complete(hdev, status); break; case OCF_SET_EVENT_FLT: status = *((__u8 *) skb->data); if (status) { BT_DBG("%s SET_EVENT_FLT failed %d", hdev->name, status); } else { BT_DBG("%s SET_EVENT_FLT succeseful", hdev->name); } break; case OCF_WRITE_AUTH_ENABLE: sent = hci_sent_cmd_data(hdev, OGF_HOST_CTL, OCF_WRITE_AUTH_ENABLE); if (!sent) break; status = *((__u8 *) skb->data); param = *((__u8 *) sent); if (!status) { if (param == AUTH_ENABLED) set_bit(HCI_AUTH, &hdev->flags); else clear_bit(HCI_AUTH, &hdev->flags); } hci_req_complete(hdev, status); break; case OCF_WRITE_ENCRYPT_MODE: sent = hci_sent_cmd_data(hdev, OGF_HOST_CTL, OCF_WRITE_ENCRYPT_MODE); if (!sent) break; status = *((__u8 *) skb->data); param = *((__u8 *) sent); if (!status) { if (param) set_bit(HCI_ENCRYPT, &hdev->flags); else clear_bit(HCI_ENCRYPT, &hdev->flags); } hci_req_complete(hdev, status); break; case OCF_WRITE_CA_TIMEOUT: status = *((__u8 *) skb->data); if (status) { BT_DBG("%s OCF_WRITE_CA_TIMEOUT failed %d", hdev->name, status); } else { BT_DBG("%s OCF_WRITE_CA_TIMEOUT succeseful", hdev->name); } break; case OCF_WRITE_PG_TIMEOUT: status = *((__u8 *) skb->data); if (status) { BT_DBG("%s OCF_WRITE_PG_TIMEOUT failed %d", hdev->name, status); } else { BT_DBG("%s: OCF_WRITE_PG_TIMEOUT succeseful", hdev->name); } break; case OCF_WRITE_SCAN_ENABLE: sent = hci_sent_cmd_data(hdev, OGF_HOST_CTL, OCF_WRITE_SCAN_ENABLE); if (!sent) break; status = *((__u8 *) skb->data); param = *((__u8 *) sent); BT_DBG("param 0x%x", param); if (!status) { clear_bit(HCI_PSCAN, &hdev->flags); clear_bit(HCI_ISCAN, &hdev->flags); if (param & SCAN_INQUIRY) set_bit(HCI_ISCAN, &hdev->flags); if (param & SCAN_PAGE) set_bit(HCI_PSCAN, &hdev->flags); } hci_req_complete(hdev, status); break; case OCF_READ_VOICE_SETTING: vs = (struct hci_rp_read_voice_setting *) skb->data; if (vs->status) { BT_DBG("%s READ_VOICE_SETTING failed %d", hdev->name, vs->status); break; } setting = __le16_to_cpu(vs->voice_setting); if (hdev->voice_setting != setting ) { hdev->voice_setting = setting; BT_DBG("%s: voice setting 0x%04x", hdev->name, setting); if (hdev->notify) { tasklet_disable(&hdev->tx_task); hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); tasklet_enable(&hdev->tx_task); } } break; case OCF_WRITE_VOICE_SETTING: sent = hci_sent_cmd_data(hdev, OGF_HOST_CTL, OCF_WRITE_VOICE_SETTING); if (!sent) break; status = *((__u8 *) skb->data); setting = __le16_to_cpu(get_unaligned((__le16 *) sent)); if (!status && hdev->voice_setting != setting) { hdev->voice_setting = setting; BT_DBG("%s: voice setting 0x%04x", hdev->name, setting); if (hdev->notify) { tasklet_disable(&hdev->tx_task); hdev->notify(hdev, HCI_NOTIFY_VOICE_SETTING); tasklet_enable(&hdev->tx_task); } } hci_req_complete(hdev, status); break; case OCF_HOST_BUFFER_SIZE: status = *((__u8 *) skb->data); if (status) { BT_DBG("%s OCF_BUFFER_SIZE failed %d", hdev->name, status); hci_req_complete(hdev, status); } break; default: BT_DBG("%s Command complete: ogf HOST_CTL ocf %x", hdev->name, ocf); break; } }
static int __devinit omap_kp_probe(struct platform_device *pdev) { struct omap_kp *omap_kp; struct input_dev *input_dev; struct omap_kp_platform_data *pdata = pdev->dev.platform_data; int i, col_idx, row_idx, irq_idx, ret; unsigned int row_shift, keycodemax; if (!pdata->rows || !pdata->cols || !pdata->keymap_data) { printk(KERN_ERR "No rows, cols or keymap_data from pdata\n"); return -EINVAL; } row_shift = get_count_order(pdata->cols); keycodemax = pdata->rows << row_shift; omap_kp = kzalloc(sizeof(struct omap_kp) + keycodemax * sizeof(unsigned short), GFP_KERNEL); input_dev = input_allocate_device(); if (!omap_kp || !input_dev) { kfree(omap_kp); input_free_device(input_dev); return -ENOMEM; } platform_set_drvdata(pdev, omap_kp); omap_kp->input = input_dev; /* Disable the interrupt for the MPUIO keyboard */ if (!cpu_is_omap24xx()) omap_writew(1, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); input_dev->keycode = &omap_kp[1]; input_dev->keycodesize = sizeof(unsigned short); input_dev->keycodemax = keycodemax; if (pdata->rep) __set_bit(EV_REP, input_dev->evbit); if (pdata->delay) omap_kp->delay = pdata->delay; if (pdata->row_gpios && pdata->col_gpios) { row_gpios = pdata->row_gpios; col_gpios = pdata->col_gpios; } omap_kp->rows = pdata->rows; omap_kp->cols = pdata->cols; if (cpu_is_omap24xx()) { /* Cols: outputs */ for (col_idx = 0; col_idx < omap_kp->cols; col_idx++) { if (gpio_request(col_gpios[col_idx], "omap_kp_col") < 0) { printk(KERN_ERR "Failed to request" "GPIO%d for keypad\n", col_gpios[col_idx]); goto err1; } gpio_direction_output(col_gpios[col_idx], 0); } /* Rows: inputs */ for (row_idx = 0; row_idx < omap_kp->rows; row_idx++) { if (gpio_request(row_gpios[row_idx], "omap_kp_row") < 0) { printk(KERN_ERR "Failed to request" "GPIO%d for keypad\n", row_gpios[row_idx]); goto err2; } gpio_direction_input(row_gpios[row_idx]); } } else { col_idx = 0; row_idx = 0; } setup_timer(&omap_kp->timer, omap_kp_timer, (unsigned long)omap_kp); /* get the irq and init timer*/ tasklet_enable(&kp_tasklet); kp_tasklet.data = (unsigned long) omap_kp; ret = device_create_file(&pdev->dev, &dev_attr_enable); if (ret < 0) goto err2; /* setup input device */ __set_bit(EV_KEY, input_dev->evbit); matrix_keypad_build_keymap(pdata->keymap_data, row_shift, input_dev->keycode, input_dev->keybit); input_dev->name = "omap-keypad"; input_dev->phys = "omap-keypad/input0"; input_dev->dev.parent = &pdev->dev; input_dev->id.bustype = BUS_HOST; input_dev->id.vendor = 0x0001; input_dev->id.product = 0x0001; input_dev->id.version = 0x0100; ret = input_register_device(omap_kp->input); if (ret < 0) { printk(KERN_ERR "Unable to register omap-keypad input device\n"); goto err3; } if (pdata->dbounce) omap_writew(0xff, OMAP1_MPUIO_BASE + OMAP_MPUIO_GPIO_DEBOUNCING); /* scan current status and enable interrupt */ omap_kp_scan_keypad(omap_kp, keypad_state); if (!cpu_is_omap24xx()) { omap_kp->irq = platform_get_irq(pdev, 0); if (omap_kp->irq >= 0) { if (request_irq(omap_kp->irq, omap_kp_interrupt, 0, "omap-keypad", omap_kp) < 0) goto err4; } omap_writew(0, OMAP1_MPUIO_BASE + OMAP_MPUIO_KBD_MASKIT); } else { for (irq_idx = 0; irq_idx < omap_kp->rows; irq_idx++) { if (request_irq(gpio_to_irq(row_gpios[irq_idx]), omap_kp_interrupt, IRQF_TRIGGER_FALLING, "omap-keypad", omap_kp) < 0) goto err5; } } return 0; err5: for (i = irq_idx - 1; i >=0; i--) free_irq(row_gpios[i], omap_kp); err4: input_unregister_device(omap_kp->input); input_dev = NULL; err3: device_remove_file(&pdev->dev, &dev_attr_enable); err2: for (i = row_idx - 1; i >=0; i--) gpio_free(row_gpios[i]); err1: for (i = col_idx - 1; i >=0; i--) gpio_free(col_gpios[i]); kfree(omap_kp); input_free_device(input_dev); return -EINVAL; }
/* * Initialize the RC32434 ethernet controller. */ static int rc32434_init(struct net_device *dev) { struct rc32434_local *lp = (struct rc32434_local *)dev->priv; int i, j; /* Disable DMA */ rc32434_abort_tx(dev); rc32434_abort_rx(dev); /* reset ethernet logic */ __raw_writel(0, &lp->eth_regs->ethintfc); while((__raw_readl(&lp->eth_regs->ethintfc) & ETHINTFC_rip_m)) dev->trans_start = jiffies; /* Enable Ethernet Interface */ __raw_writel(ETHINTFC_en_m, &lp->eth_regs->ethintfc); #ifndef CONFIG_IDT_USE_NAPI tasklet_disable(lp->rx_tasklet); #endif tasklet_disable(lp->tx_tasklet); /* Initialize the transmit Descriptors */ for (i = 0; i < RC32434_NUM_TDS; i++) { lp->td_ring[i].control = DMAD_iof_m; lp->td_ring[i].devcs = ETHTX_fd_m | ETHTX_ld_m; lp->td_ring[i].ca = 0; lp->td_ring[i].link = 0; if (lp->tx_skb[i] != NULL) { dev_kfree_skb_any(lp->tx_skb[i]); lp->tx_skb[i] = NULL; } } lp->tx_next_done = lp->tx_chain_head = lp->tx_chain_tail = lp->tx_full = lp->tx_count = 0; lp-> tx_chain_status = empty; /* * Initialize the receive descriptors so that they * become a circular linked list, ie. let the last * descriptor point to the first again. */ for (i=0; i<RC32434_NUM_RDS; i++) { struct sk_buff *skb = lp->rx_skb[i]; if (lp->rx_skb[i] == NULL) { skb = dev_alloc_skb(RC32434_RBSIZE + 2); if (skb == NULL) { ERR("No memory in the system\n"); for (j = 0; j < RC32434_NUM_RDS; j ++) if (lp->rx_skb[j] != NULL) dev_kfree_skb_any(lp->rx_skb[j]); return 1; } else { skb->dev = dev; skb_reserve(skb, 2); lp->rx_skb[i] = skb; lp->rd_ring[i].ca = CPHYSADDR(skb->data); } } lp->rd_ring[i].control = DMAD_iod_m | DMA_COUNT(RC32434_RBSIZE); lp->rd_ring[i].devcs = 0; lp->rd_ring[i].ca = CPHYSADDR(skb->data); lp->rd_ring[i].link = CPHYSADDR(&lp->rd_ring[i+1]); } /* loop back */ lp->rd_ring[RC32434_NUM_RDS-1].link = CPHYSADDR(&lp->rd_ring[0]); lp->rx_next_done = 0; lp->rd_ring[RC32434_NUM_RDS-1].control |= DMAD_cod_m; lp->rx_chain_head = 0; lp->rx_chain_tail = 0; lp->rx_chain_status = empty; __raw_writel(0, &lp->rx_dma_regs->dmas); /* Start Rx DMA */ rc32434_start_rx(lp, &lp->rd_ring[0]); /* Enable F E bit in Tx DMA */ __raw_writel(__raw_readl(&lp->tx_dma_regs->dmasm) & ~(DMASM_f_m | DMASM_e_m), &lp->tx_dma_regs->dmasm); /* Enable D H E bit in Rx DMA */ __raw_writel(__raw_readl(&lp->rx_dma_regs->dmasm) & ~(DMASM_d_m | DMASM_h_m | DMASM_e_m), &lp->rx_dma_regs->dmasm); /* Accept only packets destined for this Ethernet device address */ __raw_writel(ETHARC_ab_m, &lp->eth_regs->etharc); /* Set all Ether station address registers to their initial values */ __raw_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal0); __raw_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah0); __raw_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal1); __raw_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah1); __raw_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal2); __raw_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah2); __raw_writel(STATION_ADDRESS_LOW(dev), &lp->eth_regs->ethsal3); __raw_writel(STATION_ADDRESS_HIGH(dev), &lp->eth_regs->ethsah3); /* Frame Length Checking, Pad Enable, CRC Enable, Full Duplex set */ __raw_writel(ETHMAC2_pe_m | ETHMAC2_cen_m | ETHMAC2_fd_m, &lp->eth_regs->ethmac2); //ETHMAC2_flc_m ETHMAC2_fd_m lp->duplex_mode /* Back to back inter-packet-gap */ __raw_writel(0x15, &lp->eth_regs->ethipgt); /* Non - Back to back inter-packet-gap */ __raw_writel(0x12, &lp->eth_regs->ethipgr); /* Management Clock Prescaler Divisor */ /* Clock independent setting */ __raw_writel(((idt_cpu_freq)/MII_CLOCK+1) & ~1, &lp->eth_regs->ethmcp); /* don't transmit until fifo contains 48b */ __raw_writel(48, &lp->eth_regs->ethfifott); __raw_writel(ETHMAC1_re_m, &lp->eth_regs->ethmac1); #ifndef CONFIG_IDT_USE_NAPI tasklet_enable(lp->rx_tasklet); #endif tasklet_enable(lp->tx_tasklet); netif_start_queue(dev); return 0; }
void rxe_enable_task(struct rxe_task *task) { tasklet_enable(&task->tasklet); }
static int ar2313_init(struct net_device *dev) { struct ar2313_private *sp = dev->priv; int ecode = 0; /* * Allocate descriptors */ if (ar2313_allocate_descriptors(dev)) { printk("%s: %s: ar2313_allocate_descriptors failed\n", dev->name, __FUNCTION__); ecode = -EAGAIN; goto init_error; } /* * Get the memory for the skb rings. */ if (sp->rx_skb == NULL) { sp->rx_skb = kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, GFP_KERNEL); if (!(sp->rx_skb)) { printk("%s: %s: rx_skb kmalloc failed\n", dev->name, __FUNCTION__); ecode = -EAGAIN; goto init_error; } } memset(sp->rx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES); if (sp->tx_skb == NULL) { sp->tx_skb = kmalloc(sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES, GFP_KERNEL); if (!(sp->tx_skb)) { printk("%s: %s: tx_skb kmalloc failed\n", dev->name, __FUNCTION__); ecode = -EAGAIN; goto init_error; } } memset(sp->tx_skb, 0, sizeof(struct sk_buff *) * AR2313_DESCR_ENTRIES); /* * Set tx_csm before we start receiving interrupts, otherwise * the interrupt handler might think it is supposed to process * tx ints before we are up and running, which may cause a null * pointer access in the int handler. */ sp->rx_skbprd = 0; sp->cur_rx = 0; sp->tx_prd = 0; sp->tx_csm = 0; /* * Zero the stats before starting the interface */ memset(&sp->stats, 0, sizeof(sp->stats)); /* * We load the ring here as there seem to be no way to tell the * firmware to wipe the ring without re-initializing it. */ ar2313_load_rx_ring(dev, RX_RING_SIZE); /* * Init hardware */ ar2313_reset_reg(dev); setupADM(dev); /* * Get the IRQ */ ecode = request_irq(dev->irq, &ar2313_interrupt, IRQF_SHARED | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, dev->name, dev); if (ecode) { printk(KERN_WARNING "%s: %s: Requested IRQ %d is busy\n", dev->name, __FUNCTION__, dev->irq); goto init_error; } tasklet_enable(&sp->rx_tasklet); return 0; init_error: ar2313_init_cleanup(dev); return ecode; }