static void remove_sock(struct sock *sk1) { struct sock *sk2; unsigned long flags; if (!sk1->prot) { printk("sock.c: remove_sock: sk1->prot == NULL\n"); return; } /* We can't have this changing out from under us. */ save_flags(flags); cli(); sk2 = sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)]; if (sk2 == sk1) { sk1->prot->inuse -= 1; sk1->prot->sock_array[sk1->num &(SOCK_ARRAY_SIZE -1)] = sk1->next; restore_flags(flags); return; } while(sk2 && sk2->next != sk1) { sk2 = sk2->next; } if (sk2) { sk1->prot->inuse -= 1; sk2->next = sk1->next; restore_flags(flags); return; } restore_flags(flags); }
static void Memhscx_empty_fifo(struct BCState *bcs, int count) { u_char *ptr; struct IsdnCardState *cs = bcs->cs; long flags; int cnt; if ((cs->debug & L1_DEB_HSCX) && !(cs->debug & L1_DEB_HSCX_FIFO)) debugl1(cs, "hscx_empty_fifo"); if (bcs->hw.hscx.rcvidx + count > HSCX_BUFMAX) { if (cs->debug & L1_DEB_WARN) debugl1(cs, "hscx_empty_fifo: incoming packet too large"); MemWriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x80); bcs->hw.hscx.rcvidx = 0; return; } save_flags(flags); cli(); ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx; cnt = count; while (cnt--) *ptr++ = memreadreg(cs->hw.diva.cfg_reg, bcs->hw.hscx.hscx ? 0x40 : 0); MemWriteHSCXCMDR(cs, bcs->hw.hscx.hscx, 0x80); ptr = bcs->hw.hscx.rcvbuf + bcs->hw.hscx.rcvidx; bcs->hw.hscx.rcvidx += count; restore_flags(flags); if (cs->debug & L1_DEB_HSCX_FIFO) { char *t = bcs->blog; t += sprintf(t, "hscx_empty_fifo %c cnt %d", bcs->hw.hscx.hscx ? 'B' : 'A', count); QuickHex(t, ptr, count); debugl1(cs, bcs->blog); } }
static void reset_t163c(struct IsdnCardState *cs) { long flags; printk(KERN_INFO "teles3c: resetting card\n"); cs->hw.hfcD.cirm = HFCD_RESET | HFCD_MEM8K; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CIRM, cs->hw.hfcD.cirm); /* Reset On */ save_flags(flags); sti(); current->state = TASK_INTERRUPTIBLE; schedule_timeout(3); cs->hw.hfcD.cirm = HFCD_MEM8K; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CIRM, cs->hw.hfcD.cirm); /* Reset Off */ current->state = TASK_INTERRUPTIBLE; schedule_timeout(1); cs->hw.hfcD.cirm |= HFCD_INTB; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CIRM, cs->hw.hfcD.cirm); /* INT B */ cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CLKDEL, 0x0e); cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_TEST, HFCD_AUTO_AWAKE); /* S/T Auto awake */ cs->hw.hfcD.ctmt = HFCD_TIM25 | HFCD_AUTO_TIMER; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_CTMT, cs->hw.hfcD.ctmt); cs->hw.hfcD.int_m2 = HFCD_IRQ_ENABLE; cs->hw.hfcD.int_m1 = HFCD_INTS_B1TRANS | HFCD_INTS_B2TRANS | HFCD_INTS_DTRANS | HFCD_INTS_B1REC | HFCD_INTS_B2REC | HFCD_INTS_DREC | HFCD_INTS_L1STATE; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_INT_M1, cs->hw.hfcD.int_m1); cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_INT_M2, cs->hw.hfcD.int_m2); cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_STATES, HFCD_LOAD_STATE | 2); /* HFC ST 2 */ udelay(10); cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_STATES, 2); /* HFC ST 2 */ cs->hw.hfcD.mst_m = 0; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_MST_MODE, HFCD_MASTER); /* HFC Master */ cs->hw.hfcD.sctrl = 0; cs->BC_Write_Reg(cs, HFCD_DATA, HFCD_SCTRL, cs->hw.hfcD.sctrl); restore_flags(flags); }
static void test_new_size() { size_t flag_value; save_flags(); // If NewSize is set on the command line, it should be used // for both min and initial young size if less than min heap. flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_min(flag_value); set_basic_flag_values(); FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_initial(flag_value); // If NewSize is set on command line, but is larger than the min // heap size, it should only be used for initial young size. flag_value = 80 * M; set_basic_flag_values(); FLAG_SET_CMDLINE(size_t, NewSize, flag_value); verify_young_initial(flag_value); // If NewSize has been ergonomically set, the collector policy // should use it for min but calculate the initial young size // using NewRatio. flag_value = 20 * M; set_basic_flag_values(); FLAG_SET_ERGO(size_t, NewSize, flag_value); verify_young_min(flag_value); set_basic_flag_values(); FLAG_SET_ERGO(size_t, NewSize, flag_value); verify_scaled_young_initial(InitialHeapSize); restore_flags(); }
static inline int amiga_insert_irq(irq_node_t **list, irq_node_t *node) { unsigned long flags; irq_node_t *cur; if (!node->dev_id) printk("%s: Warning: dev_id of %s is zero\n", __FUNCTION__, node->devname); save_flags(flags); cli(); cur = *list; if (node->flags & SA_INTERRUPT) { if (node->flags & SA_SHIRQ) return -EBUSY; /* * There should never be more than one */ while (cur && cur->flags & SA_INTERRUPT) { list = &cur->next; cur = cur->next; } } else { while (cur) { list = &cur->next; cur = cur->next; } } node->next = cur; *list = node; restore_flags(flags); return 0; }
static void isac_empty_fifo(struct IsdnCardState *sp, int count) { u_char *ptr; long flags; if ((sp->debug & L1_DEB_ISAC) && !(sp->debug & L1_DEB_ISAC_FIFO)) if (sp->debug & L1_DEB_ISAC) debugl1(sp, "isac_empty_fifo"); if ((sp->rcvidx + count) >= MAX_DFRAME_LEN) { if (sp->debug & L1_DEB_WARN) { char tmp[40]; sprintf(tmp, "isac_empty_fifo overrun %d", sp->rcvidx + count); debugl1(sp, tmp); } writereg(sp->isac, ISAC_CMDR, 0x80); sp->rcvidx = 0; return; } ptr = sp->rcvbuf + sp->rcvidx; sp->rcvidx += count; save_flags(flags); cli(); read_fifo(sp->isac, ptr, count); writereg(sp->isac, ISAC_CMDR, 0x80); restore_flags(flags); if (sp->debug & L1_DEB_ISAC_FIFO) { char tmp[128]; char *t = tmp; t += sprintf(t, "isac_empty_fifo cnt %d", count); QuickHex(t, ptr, count); debugl1(sp, tmp); } }
void amiga_insert_irq(irq_node_t **list, irq_node_t *node) { unsigned long flags; irq_node_t *cur; if (!node->dev_id) printk("%s: Warning: dev_id of %s is zero\n", __FUNCTION__, node->devname); save_flags(flags); cli(); cur = *list; if (node->flags & IRQ_FLG_FAST) { node->flags &= ~IRQ_FLG_SLOW; while (cur && cur->flags & IRQ_FLG_FAST) { list = &cur->next; cur = cur->next; } } else if (node->flags & IRQ_FLG_SLOW) { while (cur) { list = &cur->next; cur = cur->next; } } else { while (cur && !(cur->flags & IRQ_FLG_SLOW)) { list = &cur->next; cur = cur->next; } } node->next = cur; *list = node; restore_flags(flags); }
/* Clean up after an error. The caller should usually call do_request() after this function returns. It can be called from an IRQ handler or the normal kernel context. */ void handle_error(const char *from) { u_long flags; if(current_req == NULL) return; save_flags(flags); cli(); kprintf("\nfd: %s (%s): Error (retry number %d)\n", from, REQ_FD_DEV(current_req)->name, current_req->retries); dump_stat(); fd_intr = NULL; if(current_req->retries++ < MAX_RETRIES) { #if 0 if((current_req->retries % RESET_FREQ) == 0) reset_pending = TRUE; #endif if((current_req->retries % RECAL_FREQ) == 0) REQ_FD_DEV(current_req)->recalibrate = TRUE; /* Retry the current request, this simply means stacking it on the front of the queue and calling do_request(). */ prepend_node(&fd_reqs, ¤t_req->node); current_req = NULL; DB(("fd:handle_error: Retrying request %p\n", current_req)); } else { #if 0 reset_pending = TRUE; #endif REQ_FD_DEV(current_req)->recalibrate = TRUE; DB(("\nfd: handle_error: Request %p has no more retries available.\n", current_req)); fd_end_request(-1); } load_flags(flags); }
static int SelFiFo(struct IsdnCardState *cs, u_char FiFo) { u_char cip; long flags; if (cs->hw.hfcD.fifo == FiFo) return(1); save_flags(flags); cli(); switch(FiFo) { case 0: cip = HFCB_FIFO | HFCB_Z1 | HFCB_SEND | HFCB_B1; break; case 1: cip = HFCB_FIFO | HFCB_Z1 | HFCB_REC | HFCB_B1; break; case 2: cip = HFCB_FIFO | HFCB_Z1 | HFCB_SEND | HFCB_B2; break; case 3: cip = HFCB_FIFO | HFCB_Z1 | HFCB_REC | HFCB_B2; break; case 4: cip = HFCD_FIFO | HFCD_Z1 | HFCD_SEND; break; case 5: cip = HFCD_FIFO | HFCD_Z1 | HFCD_REC; break; default: restore_flags(flags); debugl1(cs, "SelFiFo Error"); return(0); } cs->hw.hfcD.fifo = FiFo; WaitNoBusy(cs); cs->BC_Write_Reg(cs, HFCD_DATA, cip, 0); sti(); WaitForBusy(cs); restore_flags(flags); return(2); }
void *memset_shmem(int card, void *dest, int c, size_t n) { unsigned long flags; unsigned char ch; void *ret; if(!IS_VALID_CARD(card)) { pr_debug("Invalid param: %d is not a valid card id\n", card); return NULL; } if(n > SRAM_PAGESIZE) { return NULL; } /* * determine the page to load from the address */ ch = (unsigned long) dest / SRAM_PAGESIZE; pr_debug("%s: loaded page %d\n",adapter[card]->devicename,ch); /* * Block interrupts and load the page */ save_flags(flags); cli(); outb(((adapter[card]->shmem_magic + ch * SRAM_PAGESIZE) >> 14) | 0x80, adapter[card]->ioport[adapter[card]->shmem_pgport]); pr_debug("%s: set page to %#x\n",adapter[card]->devicename, ((adapter[card]->shmem_magic + ch * SRAM_PAGESIZE)>>14)|0x80); ret = memset_io(adapter[card]->rambase + ((unsigned long) dest % 0x4000), c, n); restore_flags(flags); return ret; }
/* * Insert an sk_buff at the end of a list. */ void skb_queue_tail(struct sk_buff_head *list_, struct sk_buff *newsk) { unsigned long flags; struct sk_buff *list = (struct sk_buff *)list_; save_flags(flags); cli(); if (newsk->next || newsk->prev) printk("Suspicious queue tail: sk_buff on list!\n"); IS_SKB(newsk); IS_SKB_HEAD(list); newsk->next = list; newsk->prev = list->prev; newsk->next->prev = newsk; newsk->prev->next = newsk; newsk->list = list_; list_->qlen++; restore_flags(flags); }
static __inline__ int NCR53c406a_dma_setup (unsigned char *ptr, unsigned int count, unsigned char mode) { unsigned limit; unsigned long flags = 0; VDEB(printk("dma: before count=%d ", count)); if (dma_chan <=3) { if (count > 65536) count = 65536; limit = 65536 - (((unsigned) ptr) & 0xFFFF); } else { if (count > (65536<<1)) count = (65536<<1); limit = (65536<<1) - (((unsigned) ptr) & 0x1FFFF); } if (count > limit) count = limit; VDEB(printk("after count=%d\n", count)); if ((count & 1) || (((unsigned) ptr) & 1)) panic ("NCR53c406a: attempted unaligned DMA transfer\n"); save_flags(flags); cli(); disable_dma(dma_chan); clear_dma_ff(dma_chan); set_dma_addr(dma_chan, (long) ptr); set_dma_count(dma_chan, count); set_dma_mode(dma_chan, mode); enable_dma(dma_chan); restore_flags(flags); return count; }
static void fd_select_drive(int drive) { unsigned long flags; #ifdef DEBUG printk("fd_select_drive:%d\n", drive); #endif /* Hmm - nowhere do we seem to turn the motor on - I'm going to do it here! */ oldlatch_aupdate(LATCHA_MOTOR | LATCHA_INUSE, 0); if (drive == SelectedDrive) return; save_flags(flags); cli(); oldlatch_aupdate(LATCHA_FDSELALL, 0xf - (1 << drive)); restore_flags(flags); /* restore track register to saved value */ FDC1772_WRITE(FDC1772REG_TRACK, unit[drive].track); udelay(25); SelectedDrive = drive; }
/* the main editor function */ void editor_main(player * p, char *str) { if (!p->edit_info) { log("error", "Editor called with no edit_info"); return; } if (*str == '/') { restore_flags(p); match_commands(p, str + 1); save_flags(p); return; } if (*str == '.') { sub_command(p, str + 1, editor_list); if (p->edit_info) do_prompt(p, "+"); return; } insert_line(p, str); do_prompt(p, "+"); }
void savegame(struct memfile *mf) { int count = 0; xchar ltmp; /* no tag useful here as store_version adds one */ store_version(mf); /* Place flags, player info & moves at the beginning of the save. This makes it possible to read them in nh_get_savegame_status without parsing all the dungeon and level data */ save_flags(mf); save_you(mf, &u); mwrite32(mf, moves); /* no tag useful here; you is fixed-length */ save_mon(mf, &youmonst); /* store dungeon layout */ save_dungeon(mf); savelevchn(mf); /* store levels */ mtag(mf, 0, MTAG_LEVELS); for (ltmp = 1; ltmp <= maxledgerno(); ltmp++) if (levels[ltmp]) count++; mwrite32(mf, count); for (ltmp = 1; ltmp <= maxledgerno(); ltmp++) { if (!levels[ltmp]) continue; mtag(mf, ltmp, MTAG_LEVELS); mwrite8(mf, ltmp); /* level number */ savelev(mf, ltmp); /* actual level */ } savegamestate(mf); }
int ax25_listen_register(ax25_address *callsign, struct device *dev) { struct listen_struct *listen; unsigned long flags; if (ax25_listen_mine(callsign, dev)) return 0; if ((listen = (struct listen_struct *)kmalloc(sizeof(*listen), GFP_ATOMIC)) == NULL) return 0; listen->callsign = *callsign; listen->dev = dev; save_flags(flags); cli(); listen->next = listen_list; listen_list = listen; restore_flags(flags); return 1; }
static void reset_netjet_u(struct IsdnCardState *cs) { long flags; save_flags(flags); sti(); cs->hw.njet.ctrl_reg = 0xff; /* Reset On */ byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ cs->hw.njet.ctrl_reg = 0x40; /* Reset Off and status read clear */ /* now edge triggered for TJ320 GE 13/07/00 */ byteout(cs->hw.njet.base + NETJET_CTRL, cs->hw.njet.ctrl_reg); set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout((10*HZ)/1000); /* Timeout 10ms */ restore_flags(flags); cs->hw.njet.auxd = 0xC0; cs->hw.njet.dmactrl = 0; byteout(cs->hw.njet.auxa, 0); byteout(cs->hw.njet.base + NETJET_AUXCTRL, ~NETJET_ISACIRQ); byteout(cs->hw.njet.base + NETJET_IRQMASK1, NETJET_ISACIRQ); byteout(cs->hw.njet.auxa, cs->hw.njet.auxd); }
/***************************************************************************** Function name : inia100AppendSRBToQueue Description : This function will push current request into save list Input : pSRB - Pointer to SCSI request block. pHCB - Pointer to host adapter structure Output : None. Return : None. *****************************************************************************/ static void inia100AppendSRBToQueue(ORC_HCS * pHCB, Scsi_Cmnd * pSRB) { ULONG flags; #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95) spin_lock_irqsave(&(pHCB->pSRB_lock), flags); #else save_flags(flags); cli(); #endif pSRB->next = NULL; /* Pointer to next */ if (pHCB->pSRB_head == NULL) pHCB->pSRB_head = pSRB; else pHCB->pSRB_tail->next = pSRB; /* Pointer to next */ pHCB->pSRB_tail = pSRB; #if LINUX_VERSION_CODE >= CVT_LINUX_VERSION(2,1,95) spin_unlock_irqrestore(&(pHCB->pSRB_lock), flags); #else restore_flags(flags); #endif return; }
/* * Place a packet after a given packet in a list. */ void skb_append(struct sk_buff *old, struct sk_buff *newsk) { unsigned long flags; IS_SKB(old); IS_SKB(newsk); if(!old->next || !old->prev) printk("append before unlisted item!\n"); if(newsk->next || newsk->prev) printk("append item is already on a list.\n"); save_flags(flags); cli(); newsk->prev = old; newsk->next = old->next; newsk->next->prev = newsk; old->next = newsk; newsk->list = old->list; newsk->list->qlen++; restore_flags(flags); }
static void rose_remove_neigh(struct rose_neigh *rose_neigh) { struct rose_neigh *s; unsigned long flags; rose_stop_ftimer(rose_neigh); rose_stop_t0timer(rose_neigh); skb_queue_purge(&rose_neigh->queue); save_flags(flags); cli(); if ((s = rose_neigh_list) == rose_neigh) { rose_neigh_list = rose_neigh->next; restore_flags(flags); if (rose_neigh->digipeat != NULL) kfree(rose_neigh->digipeat); kfree(rose_neigh); return; } while (s != NULL && s->next != NULL) { if (s->next == rose_neigh) { s->next = rose_neigh->next; restore_flags(flags); if (rose_neigh->digipeat != NULL) kfree(rose_neigh->digipeat); kfree(rose_neigh); return; } s = s->next; } restore_flags(flags); }
int pdc_console_wait_key(struct console *co) { int ch = 'X'; int status; /* Bail if no console input device. */ if (!PAGE0->mem_kbd.iodc_io) return 0; /* wait for a keyboard (rs232)-input */ do { unsigned long flags; save_flags(flags); cli(); status = real32_call(PAGE0->mem_kbd.iodc_io, (unsigned long)PAGE0->mem_kbd.hpa, ENTRY_IO_CIN, PAGE0->mem_kbd.spa, __pa(PAGE0->mem_kbd.dp.layers), __pa(iodc_retbuf), 0, __pa(iodc_dbuf), 1, 0); restore_flags(flags); ch = *iodc_dbuf; /* save the character directly to ch */ } while (*iodc_retbuf == 0); /* wait for a key */ return ch; }
void gs_flush_buffer(struct tty_struct *tty) { struct gs_port *port; unsigned long flags; func_enter (); if (!tty) return; port = tty->driver_data; if (!port) return; /* XXX Would the write semaphore do? */ save_flags(flags); cli(); port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; restore_flags(flags); wake_up_interruptible(&tty->write_wait); if ((tty->flags & (1 << TTY_DO_WRITE_WAKEUP)) && tty->ldisc.write_wakeup) (tty->ldisc.write_wakeup)(tty); func_exit (); }
/* * Remove an sk_buff from its list. Works even without knowing the list it * is sitting on, which can be handy at times. It also means that THE LIST * MUST EXIST when you unlink. Thus a list must have its contents unlinked * _FIRST_. */ void skb_unlink(struct sk_buff *skb) { unsigned long flags; save_flags(flags); cli(); IS_SKB(skb); if(skb->list) { skb->list->qlen--; skb->next->prev = skb->prev; skb->prev->next = skb->next; skb->next = NULL; skb->prev = NULL; skb->list = NULL; } #ifdef PARANOID_BUGHUNT_MODE /* This is legal but we sometimes want to watch it */ else printk("skb_unlink: not a linked element\n"); #endif restore_flags(flags); }
void M68EZ328_insert_irq(irq_node_t **list, irq_node_t *node) { unsigned long flags; irq_node_t *cur; if (!node->dev_id) printk("%s: Warning: dev_id of %s is zero\n", __FUNCTION__, node->devname); save_flags(flags); cli(); cur = *list; while (cur) { list = &cur->next; cur = cur->next; } node->next = cur; *list = node; restore_flags(flags); }
void modem_l2l1(struct PStack *st, int pr, void *arg) { struct sk_buff *skb = arg; long flags; if (pr == (PH_DATA | REQUEST)) { save_flags(flags); cli(); if (st->l1.bcs->tx_skb) { skb_queue_tail(&st->l1.bcs->squeue, skb); restore_flags(flags); } else { st->l1.bcs->tx_skb = skb; test_and_set_bit(BC_FLG_BUSY, &st->l1.bcs->Flag); st->l1.bcs->hw.hscx.count = 0; restore_flags(flags); write_modem(st->l1.bcs); } } else if (pr == (PH_ACTIVATE | REQUEST)) { test_and_set_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); st->l1.l1l2(st, PH_ACTIVATE | CONFIRM, NULL); set_arcofi(st->l1.bcs->cs, st->l1.bc); mstartup(st->l1.bcs->cs); modem_set_dial(st->l1.bcs->cs, test_bit(FLG_ORIG, &st->l2.flag)); st->l1.bcs->cs->hw.elsa.MFlag=2; } else if (pr == (PH_DEACTIVATE | REQUEST)) { test_and_clear_bit(BC_FLG_ACTIV, &st->l1.bcs->Flag); st->l1.bcs->cs->dc.isac.arcofi_bc = st->l1.bc; arcofi_fsm(st->l1.bcs->cs, ARCOFI_START, &ARCOFI_XOP_0); interruptible_sleep_on(&st->l1.bcs->cs->dc.isac.arcofi_wait); st->l1.bcs->cs->hw.elsa.MFlag=1; } else { printk(KERN_WARNING"ElsaSer: unknown pr %x\n", pr); } }
static void lirc_close(struct inode *node, struct file *file) #endif { unsigned long flags; save_flags(flags);cli(); #ifndef CONFIG_COLDFIRE /* Set DLAB 0. */ soutp(UART_LCR, sinp(UART_LCR) & (~UART_LCR_DLAB)); /* First of all, disable all interrupts */ soutp(UART_IER, sinp(UART_IER)& (~(UART_IER_MSI|UART_IER_RLSI|UART_IER_THRI|UART_IER_RDI))); #else #ifndef LIRC_PORT { volatile unsigned long *icrp; icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1); *icrp = 0x80000000; /* INT1 ipl cleared */ } #else soutp(MCFUART_UIMR, 0); /* disable UART interrupts */ #endif #endif restore_flags(flags); free_irq(irq, NULL); # ifdef DEBUG printk(KERN_INFO LIRC_DRIVER_NAME ": freed IRQ %d\n", irq); # endif MOD_DEC_USE_COUNT; #ifdef KERNEL_2_1 return 0; #endif }
/* * This routine is invoked from ide.c to prepare for access to a given drive. */ static void ht6560b_selectproc (ide_drive_t *drive) { byte t; unsigned long flags; static byte current_select = 0; static byte current_timing = 0; byte select = ht6560b_selects[HWIF(drive)->index][drive->select.b.unit]; byte timing = ht6560b_timings[HWIF(drive)->index][drive->select.b.unit]; if (select != current_select || timing != current_timing) { current_select = select; current_timing = timing; save_flags (flags); cli(); (void) inb(HT_SELECT_PORT); (void) inb(HT_SELECT_PORT); (void) inb(HT_SELECT_PORT); /* * Note: input bits are reversed to output bits!! */ t = inb(HT_SELECT_PORT) ^ 0x3f; t &= (~0x21); t |= (current_select & 0x21); outb(t, HT_SELECT_PORT); /* * Set timing for this drive: */ outb (timing, IDE_SELECT_REG); (void) inb (IDE_STATUS_REG); restore_flags (flags); #ifdef DEBUG printk("ht6560b: %s: select=%#x timing=%#x\n", drive->name, t, timing); #endif } OUT_BYTE(drive->select.all,IDE_SELECT_REG); }
static void arp_check_expire(unsigned long dummy) { int i; unsigned long now = jiffies; unsigned long flags; save_flags(flags); cli(); for (i = 0; i < FULL_ARP_TABLE_SIZE; i++) { struct arp_table *entry; struct arp_table **pentry = &arp_tables[i]; while ((entry = *pentry) != NULL) { if ((now - entry->last_used) > ARP_TIMEOUT && !(entry->flags & ATF_PERM)) { *pentry = entry->next; /* remove from list */ del_timer(&entry->timer); /* Paranoia */ kfree_s(entry, sizeof(struct arp_table)); } else pentry = &entry->next; /* go to next entry */ } } restore_flags(flags); /* * Set the timer again. */ del_timer(&arp_timer); arp_timer.expires = ARP_CHECK_INTERVAL; add_timer(&arp_timer); }
static void add_tx_queue(struct r3964_info *pInfo, struct r3964_block_header *pHeader) { unsigned long flags; save_flags(flags); cli(); pHeader->next = NULL; if(pInfo->tx_last == NULL) { pInfo->tx_first = pInfo->tx_last = pHeader; } else { pInfo->tx_last->next = pHeader; pInfo->tx_last = pHeader; } restore_flags(flags); TRACE_Q("add_tx_queue %x, length %d, tx_first = %x", (int)pHeader, pHeader->length, (int)pInfo->tx_first ); }
void ivpnss_out(void *bus, u32 val, u32 port, s32 sz) { unsigned long flags; #ifdef DEBUG printk("ivpnss_out(bus=%x,val=%x,port=%x,sz=%x)\n", (int)bus, val, port, sz); #endif if (port >= IVPNSS_IO_OFFSET) port -= IVPNSS_IO_OFFSET; save_flags(flags); cli(); ivpnss_enable_io(); if (sz == 0) writeb(val, ivpnss_8bit + port); else if (sz == 1) writew(val, ivpnss_16bit + port); else if (sz == 2) writel(val, ivpnss_16bit + port); else printk("%s(%d): bad size, sz=%x\n", __FILE__, __LINE__, sz); restore_flags(flags); }