From: viro@parcelfarce.linux.theplanet.co.uk Equivalent transformation: * new function: do_pd_io_start(). Checks pd_cmd and calls do_pd_read_start() or do_pd_write_start(). * do_pd_read() and do_pd_write() merged into do_pd_io(), which schedules execution of do_pd_io_start(). --- 25-akpm/drivers/block/paride/pd.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff -puN drivers/block/paride/pd.c~PI5-do_pd_io-RC1 drivers/block/paride/pd.c --- 25/drivers/block/paride/pd.c~PI5-do_pd_io-RC1 Wed Jan 14 13:46:18 2004 +++ 25-akpm/drivers/block/paride/pd.c Wed Jan 14 13:46:18 2004 @@ -265,9 +265,9 @@ static int pd_ioctl(struct inode *inode, static int pd_release(struct inode *inode, struct file *file); static int pd_revalidate(struct gendisk *p); static int pd_detect(void); -static void do_pd_read(void); +static void do_pd_io(void); +static void do_pd_io_start(void); static void do_pd_read_start(void); -static void do_pd_write(void); static void do_pd_write_start(void); static void do_pd_read_drq(void); static void do_pd_write_done(void); @@ -762,10 +762,8 @@ repeat: pd_buf = pd_req->buffer; pd_retries = 0; - if (pd_cmd == READ) - pi_do_claimed(pd_current->pi, do_pd_read); - else if (pd_cmd == WRITE) - pi_do_claimed(pd_current->pi, do_pd_write); + if (pd_cmd == READ || pd_cmd == WRITE) + pi_do_claimed(pd_current->pi, do_pd_io); else { end_request(pd_req, 0); goto repeat; @@ -809,12 +807,21 @@ static inline void next_request(int succ spin_unlock_irqrestore(&pd_lock, saved_flags); } -static void do_pd_read(void) +static void do_pd_io(void) { - ps_continuation = do_pd_read_start; + ps_continuation = do_pd_io_start; ps_set_intr(); } +static void do_pd_io_start(void) +{ + if (pd_cmd == READ) { + do_pd_read_start(); + } else { + do_pd_write_start(); + } +} + static void do_pd_read_start(void) { pi_connect(pd_current->pi); @@ -859,12 +866,6 @@ static void do_pd_read_drq(void) next_request(1); } -static void do_pd_write(void) -{ - ps_continuation = do_pd_write_start; - ps_set_intr(); -} - static void do_pd_write_start(void) { pi_connect(pd_current->pi); _