Commit c6b71ca4 authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390 update (9/27): bottom half removal.

Replace IMMEDIATE_BH bottom half by tasklets in 3215, ctc and iucv driver.
parent 73ba61b9
......@@ -89,7 +89,7 @@ typedef struct _raw3215_info {
int written; /* number of bytes in write requests */
devstat_t devstat; /* device status structure for do_IO */
struct tty_struct *tty; /* pointer to tty structure if present */
struct tq_struct tqueue; /* task queue to bottom half */
struct tasklet_struct tasklet;
raw3215_req *queued_read; /* pointer to queued read requests */
raw3215_req *queued_write; /* pointer to queued write requests */
wait_queue_head_t empty_wait; /* wait queue for flushing */
......@@ -341,7 +341,7 @@ extern inline void raw3215_try_io(raw3215_info *raw)
* The bottom half handler routine for 3215 devices. It tries to start
* the next IO and wakes up processes waiting on the tty.
*/
static void raw3215_softint(void *data)
static void raw3215_tasklet(void *data)
{
raw3215_info *raw;
struct tty_struct *tty;
......@@ -377,12 +377,7 @@ static inline void raw3215_sched_bh(raw3215_info *raw)
if (raw->flags & RAW3215_BH_PENDING)
return; /* already pending */
raw->flags |= RAW3215_BH_PENDING;
INIT_LIST_HEAD(&raw->tqueue.list);
raw->tqueue.sync = 0;
raw->tqueue.routine = raw3215_softint;
raw->tqueue.data = raw;
queue_task(&raw->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_hi_schedule(&raw->tasklet);
}
/*
......@@ -867,8 +862,9 @@ static int tty3215_open(struct tty_struct *tty, struct file * filp)
kfree(raw);
return -ENOMEM;
}
raw->tqueue.routine = raw3215_softint;
raw->tqueue.data = raw;
tasklet_init(&raw->tasklet,
(void (*)(unsigned long)) raw3215_tasklet,
(unsigned long) raw);
init_waitqueue_head(&raw->empty_wait);
raw3215[line] = raw;
}
......@@ -1095,10 +1091,11 @@ void __init con3215_init(void)
raw->inbuf = (char *) alloc_bootmem_low(RAW3215_INBUF_SIZE);
/* Find the first console */
raw->irq = raw3215_find_dev(0);
raw->irq = irq;
raw->flags |= RAW3215_FIXED;
raw->tqueue.routine = raw3215_softint;
raw->tqueue.data = raw;
tasklet_init(&raw->tasklet,
(void (*)(unsigned long)) raw3215_tasklet,
(unsigned long) raw);
init_waitqueue_head(&raw->empty_wait);
/* Request the console irq */
......
......@@ -229,12 +229,12 @@ fs3270_io(tub_t *tubp, ccw1_t *ccwp)
* fs3270_bh(tubp) -- Perform back-half processing
*/
static void
fs3270_bh(void *data)
fs3270_tasklet(unsigned long data)
{
long flags;
tub_t *tubp;
tubp = data;
tubp = (tub_t *) data;
TUBLOCK(tubp->irq, flags);
tubp->flags &= ~TUB_BHPENDING;
......@@ -265,10 +265,9 @@ fs3270_sched_bh(tub_t *tubp)
if (tubp->flags & TUB_BHPENDING)
return;
tubp->flags |= TUB_BHPENDING;
tubp->tqueue.routine = fs3270_bh;
tubp->tqueue.data = tubp;
queue_task(&tubp->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_init(&tubp->tasklet, fs3270_tasklet,
(unsigned long) tubp);
tasklet_schedule(&tubp->tasklet);
}
/*
......
......@@ -234,7 +234,7 @@ typedef struct tub_s {
enum tubstat stat;
enum tubcmd cmd;
int flags; /* See below for values */
struct tq_struct tqueue;
struct tasklet_struct tasklet;
/* Stuff for fs-driver support */
pid_t fs_pid; /* Pid if TBM_FS */
......
......@@ -35,7 +35,7 @@ static int tty3270_write_proc(struct file *, const char *,
unsigned long, void *);
/* tty3270 utility functions */
static void tty3270_bh(void *);
static void tty3270_tasklet(unsigned long);
void tty3270_sched_bh(tub_t *);
static int tty3270_wait(tub_t *, long *);
void tty3270_int(tub_t *, devstat_t *);
......@@ -598,17 +598,18 @@ tty3270_hangup(struct tty_struct *tty)
/*
* tty3270_bh(tubp) -- Perform back-half processing
* tty3270_tasklet(tubp) -- Perform back-half processing
*/
static void
tty3270_bh(void *data)
tty3270_tasklet(unsigned long data)
{
tub_t *tubp;
ioinfo_t *ioinfop;
long flags;
struct tty_struct *tty;
ioinfop = ioinfo[(tubp = data)->irq];
tubp = (tub_t *) data;
ioinfop = ioinfo[tubp->irq];
while (TUBTRYLOCK(tubp->irq, flags) == 0) {
if (ioinfop->ui.flags.unready == 1)
return;
......@@ -663,10 +664,9 @@ tty3270_sched_bh(tub_t *tubp)
if (tubp->flags & TUB_BHPENDING)
return;
tubp->flags |= TUB_BHPENDING;
tubp->tqueue.routine = tty3270_bh;
tubp->tqueue.data = tubp;
queue_task(&tubp->tqueue, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_init(&tubp->tasklet, tty3270_tasklet,
(unsigned long) tubp);
tasklet_schedule(&tubp->tasklet);
}
/*
......
......@@ -86,7 +86,7 @@ typedef struct {
wait_queue_head_t open_wait;
wait_queue_head_t close_wait;
struct semaphore write_sem;
struct tq_struct tq;
struct tasklet_struct tasklet;
struct timer_list stoptimer;
} ctc_tty_info;
......@@ -272,8 +272,7 @@ ctc_tty_netif_rx(struct sk_buff *skb)
*/
skb_queue_tail(&info->rx_queue, skb);
/* Schedule dequeuing */
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
static int
......@@ -390,8 +389,7 @@ ctc_tty_inject(ctc_tty_info *info, char c)
skb_reserve(skb, skb_res);
*(skb_put(skb, 1)) = c;
skb_queue_head(&info->tx_queue, skb);
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
static void
......@@ -400,8 +398,7 @@ ctc_tty_transmit_status(ctc_tty_info *info)
if (ctc_tty_shuttingdown)
return;
info->flags |= CTC_ASYNC_TX_LINESTAT;
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
static void
......@@ -562,8 +559,7 @@ ctc_tty_write(struct tty_struct *tty, int from_user, const u_char * buf, int cou
}
if (skb_queue_len(&info->tx_queue)) {
info->lsr &= ~UART_LSR_TEMT;
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
if (from_user)
up(&info->write_sem);
......@@ -624,8 +620,7 @@ ctc_tty_flush_chars(struct tty_struct *tty)
return;
if (tty->stopped || tty->hw_stopped || (!skb_queue_len(&info->tx_queue)))
return;
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
/*
......@@ -1161,8 +1156,9 @@ ctc_tty_hangup(struct tty_struct *tty)
* the lower levels.
*/
static void
ctc_tty_task(ctc_tty_info *info)
ctc_tty_task(unsigned long arg)
{
ctc_tty_info *info = (void *)arg;
unsigned long saveflags;
int again;
......@@ -1173,8 +1169,7 @@ ctc_tty_task(ctc_tty_info *info)
info->lsr |= UART_LSR_TEMT;
again |= ctc_tty_readmodem(info);
if (again) {
queue_task(&info->tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
tasklet_schedule(&info->tasklet);
}
}
spin_unlock_irqrestore(&ctc_tty_lock, saveflags);
......@@ -1234,14 +1229,8 @@ ctc_tty_init(void)
for (i = 0; i < CTC_TTY_MAX_DEVICES; i++) {
info = &driver->info[i];
init_MUTEX(&info->write_sem);
#if LINUX_VERSION_CODE >= 0x020400
INIT_LIST_HEAD(&info->tq.list);
#else
info->tq.next = NULL;
#endif
info->tq.sync = 0;
info->tq.routine = (void *)(void *)ctc_tty_task;
info->tq.data = info;
tasklet_init(&info->tasklet, ctc_tty_task,
(unsigned long) info);
info->magic = CTC_ASYNC_MAGIC;
info->line = i;
info->tty = 0;
......@@ -1322,10 +1311,6 @@ ctc_tty_cleanup(int final) {
kfree(driver);
driver = NULL;
} else {
int i;
for (i = 0; i < CTC_TTY_MAX_DEVICES; i++)
driver->info[i].tq.routine = NULL;
tty_unregister_driver(&driver->ctc_tty_device);
}
spin_unlock_irqrestore(&ctc_tty_lock, saveflags);
......
......@@ -41,9 +41,9 @@
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/tqueue.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/errno.h>
#include <asm/atomic.h>
#include "iucv.h"
#include <asm/io.h>
......@@ -99,16 +99,14 @@ typedef struct {
static struct list_head iucv_irq_queue;
static spinlock_t iucv_irq_queue_lock = SPIN_LOCK_UNLOCKED;
static struct tq_struct iucv_tq;
static atomic_t iucv_bh_scheduled = ATOMIC_INIT (0);
/*
*Internal function prototypes
*/
static void iucv_bh_handler(void);
static void iucv_tasklet_handler(unsigned long);
static void iucv_irq_handler(struct pt_regs *, __u16);
static DECLARE_TASKLET(iucv_tasklet,iucv_tasklet_handler,0);
/************ FUNCTION ID'S ****************************/
#define ACCEPT 10
......@@ -385,11 +383,6 @@ iucv_init(void)
}
memset(iucv_param_pool, 0, sizeof(iucv_param) * PARAM_POOL_SIZE);
/* Initialize task queue */
INIT_LIST_HEAD(&iucv_tq.list);
iucv_tq.sync = 0;
iucv_tq.routine = (void *)iucv_bh_handler;
/* Initialize irq queue */
INIT_LIST_HEAD(&iucv_irq_queue);
......@@ -2177,7 +2170,7 @@ iucv_sever(__u16 pathid, __u8 user_data[16])
* @code: irq code
*
* Handles external interrupts coming in from CP.
* Places the interrupt buffer on a queue and schedules iucv_bh_handler().
* Places the interrupt buffer on a queue and schedules iucv_tasklet_handler().
*/
static void
iucv_irq_handler(struct pt_regs *regs, __u16 code)
......@@ -2200,10 +2193,7 @@ iucv_irq_handler(struct pt_regs *regs, __u16 code)
list_add_tail(&irqdata->queue, &iucv_irq_queue);
spin_unlock(&iucv_irq_queue_lock);
if (atomic_compare_and_swap (0, 1, &iucv_bh_scheduled) == 0) {
queue_task (&iucv_tq, &tq_immediate);
mark_bh(IMMEDIATE_BH);
}
tasklet_schedule(&iucv_tasklet);
irq_exit();
return;
......@@ -2214,7 +2204,7 @@ iucv_irq_handler(struct pt_regs *regs, __u16 code)
* @int_buf: Pointer to copy of external interrupt buffer
*
* The workhorse for handling interrupts queued by iucv_irq_handler().
* This function is called from the bottom half iucv_bh_handler().
* This function is called from the bottom half iucv_tasklet_handler().
*/
static void
iucv_do_int(iucv_GeneralInterrupt * int_buf)
......@@ -2384,20 +2374,18 @@ iucv_do_int(iucv_GeneralInterrupt * int_buf)
}
/**
* iucv_bh_handler:
* iucv_tasklet_handler:
*
* This function loops over the queue of irq buffers and runs iucv_do_int()
* on every queue element.
*/
static void
iucv_bh_handler(void)
iucv_tasklet_handler(unsigned long ignored)
{
struct list_head head;
struct list_head *next;
ulong flags;
atomic_set(&iucv_bh_scheduled, 0);
spin_lock_irqsave(&iucv_irq_queue_lock, flags);
list_add(&head, &iucv_irq_queue);
list_del_init(&iucv_irq_queue);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment