C++ (Cpp) spin_unlock_irqrestore Examples

C++ (Cpp) spin_unlock_irqrestore - 30 examples found. These are the top rated real world C++ (Cpp) examples of spin_unlock_irqrestore extracted from open source projects. You can rate examples to help us improve the quality of examples.
Example #1
0
/* This function copies the per SPU buffers to the
 * OProfile kernel buffer.
 */
void sync_spu_buff(void)
{
    int spu;
    unsigned long flags;
    int curr_head;

    for (spu = 0; spu < num_spu_nodes; spu++) {
        /* In case there was an issue and the buffer didn't
         * get created skip it.
         */
        if (spu_buff[spu].buff == NULL)
            continue;

        /* Hold the lock to make sure the head/tail
         * doesn't change while spu_buff_add() is
         * deciding if the buffer is full or not.
         * Being a little paranoid.
         */
        spin_lock_irqsave(&buffer_lock, flags);
        curr_head = spu_buff[spu].head;
        spin_unlock_irqrestore(&buffer_lock, flags);

        /* Transfer the current contents to the kernel buffer.
         * data can still be added to the head of the buffer.
         */
        oprofile_put_buff(spu_buff[spu].buff,
                          spu_buff[spu].tail,
                          curr_head, max_spu_buff);

        spin_lock_irqsave(&buffer_lock, flags);
        spu_buff[spu].tail = curr_head;
        spin_unlock_irqrestore(&buffer_lock, flags);
    }

}
Example #2
0
static void
rpcrdma_run_tasklet(unsigned long data)
{
    struct rpcrdma_rep *rep;
    void (*func)(struct rpcrdma_rep *);
    unsigned long flags;

    data = data;
    spin_lock_irqsave(&rpcrdma_tk_lock_g, flags);
    while (!list_empty(&rpcrdma_tasklets_g)) {
        rep = list_entry(rpcrdma_tasklets_g.next,
                         struct rpcrdma_rep, rr_list);
        list_del(&rep->rr_list);
        func = rep->rr_func;
        rep->rr_func = NULL;
        spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags);

        if (func)
            func(rep);
        else
            rpcrdma_recv_buffer_put(rep);

        spin_lock_irqsave(&rpcrdma_tk_lock_g, flags);
    }
    spin_unlock_irqrestore(&rpcrdma_tk_lock_g, flags);
}
Example #3
0
static void pcf_isa_waitforpin(void) {
    DEFINE_WAIT(wait);
    int timeout = 2;
    unsigned long flags;

    if (irq > 0) {
        spin_lock_irqsave(&lock, flags);
        if (pcf_pending == 0) {
            spin_unlock_irqrestore(&lock, flags);
            prepare_to_wait(&pcf_wait, &wait, TASK_INTERRUPTIBLE);
            if (schedule_timeout(timeout*HZ)) {
                spin_lock_irqsave(&lock, flags);
                if (pcf_pending == 1) {
                    pcf_pending = 0;
                }
                spin_unlock_irqrestore(&lock, flags);
            }
            finish_wait(&pcf_wait, &wait);
        } else {
            pcf_pending = 0;
            spin_unlock_irqrestore(&lock, flags);
        }
    } else {
        udelay(100);
    }
}
Example #4
0
static netdev_tx_t
greth_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
    struct greth_private *greth = netdev_priv(dev);
    struct greth_bd *bdp;
    int err = NETDEV_TX_OK;
    u32 status, dma_addr, ctrl;
    unsigned long flags;

    /* Clean TX Ring */
    greth_clean_tx(greth->netdev);

    if (unlikely(greth->tx_free <= 0)) {
        spin_lock_irqsave(&greth->devlock, flags);/*save from poll/irq*/
        ctrl = GRETH_REGLOAD(greth->regs->control);
        /* Enable TX IRQ only if not already in poll() routine */
        if (ctrl & GRETH_RXI)
            GRETH_REGSAVE(greth->regs->control, ctrl | GRETH_TXI);
        netif_stop_queue(dev);
        spin_unlock_irqrestore(&greth->devlock, flags);
        return NETDEV_TX_BUSY;
    }

    if (netif_msg_pktdata(greth))
        greth_print_tx_packet(skb);


    if (unlikely(skb->len > MAX_FRAME_SIZE)) {
        dev->stats.tx_errors++;
        goto out;
    }

    bdp = greth->tx_bd_base + greth->tx_next;
    dma_addr = greth_read_bd(&bdp->addr);

    memcpy((unsigned char *) phys_to_virt(dma_addr), skb->data, skb->len);

    dma_sync_single_for_device(greth->dev, dma_addr, skb->len, DMA_TO_DEVICE);

    status = GRETH_BD_EN | GRETH_BD_IE | (skb->len & GRETH_BD_LEN);
    greth->tx_bufs_length[greth->tx_next] = skb->len & GRETH_BD_LEN;

    /* Wrap around descriptor ring */
    if (greth->tx_next == GRETH_TXBD_NUM_MASK) {
        status |= GRETH_BD_WR;
    }

    greth->tx_next = NEXT_TX(greth->tx_next);
    greth->tx_free--;

    /* Write descriptor control word and enable transmission */
    greth_write_bd(&bdp->stat, status);
    spin_lock_irqsave(&greth->devlock, flags); /*save from poll/irq*/
    greth_enable_tx(greth);
    spin_unlock_irqrestore(&greth->devlock, flags);

out:
    dev_kfree_skb(skb);
    return err;
}
Example #5
0
/* Convert a native(OS) packet to driver packet.
* In the process, native packet is destroyed, there is no copying
* Also, a packettag is zeroed out
*/
#ifdef BCMDBG_PKT
void *
osl_pkt_frmnative(osl_t *osh, void *pkt, int line, char *file)
#else /* BCMDBG_PKT pkt logging for debugging */
void * BCMFASTPATH
osl_pkt_frmnative(osl_t *osh, void *pkt)
#endif /* BCMDBG_PKT */
{
#ifndef WL_UMK
    struct sk_buff *nskb;
    unsigned long flags;
#endif

    if (osh->pub.pkttag)
        bzero((void*)((struct sk_buff *)pkt)->cb, OSL_PKTTAG_SZ);

#ifndef WL_UMK
    /* Increment the packet counter */
    for (nskb = (struct sk_buff *)pkt; nskb; nskb = nskb->next) {
#ifdef BCMDBG_PKT
        spin_lock_irqsave(&osh->pktlist_lock, flags);
        pktlist_add(&(osh->pktlist), (void *) nskb, line, file);
        spin_unlock_irqrestore(&osh->pktlist_lock, flags);
#endif  /* BCMDBG_PKT */
        spin_lock_irqsave(&osh->pktalloc_lock, flags);
        osh->pub.pktalloced++;
        spin_unlock_irqrestore(&osh->pktalloc_lock, flags);
    }
#endif /* WL_UMK */				   
    return (void *)pkt;
}
Example #6
0
int msm_jpeg_core_reset(uint8_t op_mode, void *base, int size)
{
    unsigned long flags;
    int rc = 0;
    int tm = 500; /*500ms*/
    memset(&fe_pingpong_buf, 0, sizeof(fe_pingpong_buf));
    fe_pingpong_buf.is_fe = 1;
    we_pingpong_index = 0;
    memset(&we_pingpong_buf, 0, sizeof(we_pingpong_buf));
    spin_lock_irqsave(&reset_lock, flags);
    reset_done_ack = 0;
    msm_jpeg_hw_reset(base, size);
    spin_unlock_irqrestore(&reset_lock, flags);
    rc = wait_event_interruptible_timeout(
             reset_wait,
             reset_done_ack,
             msecs_to_jiffies(tm));

    if (!reset_done_ack) {
        JPEG_DBG("%s: reset ACK failed %d", __func__, rc);
        return -EBUSY;
    }

    JPEG_DBG("%s: reset_done_ack rc %d", __func__, rc);
    spin_lock_irqsave(&reset_lock, flags);
    reset_done_ack = 0;
    spin_unlock_irqrestore(&reset_lock, flags);

    return 0;
}