]> git.hungrycats.org Git - linux/commitdiff
v2.5.0.5 -> v2.5.0.6
authorLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 07:58:31 +0000 (23:58 -0800)
committerLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 07:58:31 +0000 (23:58 -0800)
- Jens Axboe: more bio stuff
- Coda compile fixes
- Nathan Laredo: stradis driver update

57 files changed:
CREDITS
MAINTAINERS
Makefile
arch/i386/kernel/dmi_scan.c
drivers/block/Makefile
drivers/block/blkpg.c
drivers/block/block_ioctl.c [new file with mode: 0644]
drivers/block/cciss.c
drivers/block/cpqarray.c
drivers/block/elevator.c
drivers/block/floppy.c
drivers/block/genhd.c
drivers/block/ida_cmd.h
drivers/block/ll_rw_blk.c
drivers/block/nbd.c
drivers/block/paride/pcd.c
drivers/block/paride/pd.c
drivers/block/paride/pf.c
drivers/block/rd.c
drivers/cdrom/cdrom.c
drivers/ide/ide-cd.c
drivers/ide/ide-disk.c
drivers/ide/ide-dma.c
drivers/ide/ide.c
drivers/isdn/avmb1/capi.c
drivers/isdn/divert/divert_procfs.c
drivers/isdn/eicon/common.c
drivers/isdn/eicon/eicon_mod.c
drivers/isdn/hisax/hisax_fcpcipnp.c
drivers/isdn/hisax/hisax_isac.c
drivers/isdn/hisax/hisax_isac.h
drivers/isdn/hisax/st5481_b.c
drivers/isdn/hisax/st5481_d.c
drivers/isdn/hisax/st5481_usb.c
drivers/isdn/hysdn/hysdn_procfs.c [deleted file]
drivers/media/video/saa7146.h
drivers/media/video/stradis.c
drivers/scsi/ide-scsi.c
drivers/scsi/scsi_lib.c
drivers/scsi/scsi_merge.c
drivers/scsi/sd.c
drivers/scsi/sr.c
fs/bio.c
fs/coda/cache.c
fs/coda/cnode.c
fs/coda/dir.c
fs/coda/file.c
fs/coda/inode.c
fs/coda/pioctl.c
fs/coda/psdev.c
fs/coda/sysctl.c
fs/coda/upcall.c
fs/partitions/ldm.c
include/linux/bio.h
include/linux/blk.h
include/linux/blkdev.h
include/linux/coda_linux.h

diff --git a/CREDITS b/CREDITS
index c92d35c068aa98bf0e161cf4418545b287ec1963..b8a641a6546562c309af05ffd1ea2aeb55c128b7 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -1149,6 +1149,16 @@ S: 77 Clarence Mews
 S: London SE16 1GD
 S: United Kingdom
 
+N: Jan Harkes
+E: jaharkes@cs.cmu.edu
+W: http://www.coda.cs.cmu.edu/
+D: Coda file system
+S: Computer Science Department
+S: Carnegie Mellon University
+S: 5000 Forbes Avenue
+S: Pittsburgh, Pennsylvania 15213
+S: USA
+
 N: Kai Harrekilde-Petersen
 E: kai.harrekilde@get2net.dk
 D: Original author of the ftape-HOWTO, i82078 fdc detection code.
index 58385199a55f7d5410e0be1b7741b7010dce8157..09602e326c75c1dd0ff96d6258435d39126a85e2 100644 (file)
@@ -285,6 +285,14 @@ P: Nils Faerber (port to kernel 2.4)
 M:     Nils Faerber <nils@kernelconcepts.de>
 S:     Maintained
 
+CODA FILE SYSTEM
+P:     Jan Harkes
+M:     jaharkes@cs.cmu.edu
+M:     coda@cs.cmu.edu
+L:     codalist@coda.cs.cmu.edu
+W:     http://www.coda.cs.cmu.edu/
+S:     Maintained
+
 COMPAQ FIBRE CHANNEL 64-bit/66MHz PCI non-intelligent HBA
 P:      Amy Vanzant-Hodge 
 M:      Amy Vanzant-Hodge (fibrechannel@compaq.com)
index 5e0990beec4ec3be8f6eccf866485112c9dd44f1..098baecc6dde3ed00aa01c93020fde68c6158d02 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 5
 SUBLEVEL = 1
-EXTRAVERSION =-pre5
+EXTRAVERSION =-pre6
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
index 2431c35a1769e969865a28224de20068964e0381..a82a03fcb44d5cafef37436139c44af22c89154e 100644 (file)
@@ -525,6 +525,12 @@ static __initdata struct dmi_blacklist dmi_blacklist[]={
                        MATCH(DMI_BIOS_DATE, "05/11/00"), NO_MATCH
                        } },
 
+       { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z600NE */
+                       MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
+                       MATCH(DMI_BIOS_VERSION, "WME01Z1"),
+                       MATCH(DMI_BIOS_DATE, "08/11/00"), NO_MATCH
+                       } },
+
        { swab_apm_power_in_minutes, "Sony VAIO", {     /* Handle problems with APM on Sony Vaio PCG-Z505LS */
                        MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies LTD"),
                        MATCH(DMI_BIOS_VERSION, "R0203D0"),
index a780726f7e029b9c5d29cf661bd02f596d7592ce..d072654f1031c5e28e640b22064f6453f365e39a 100644 (file)
@@ -10,9 +10,9 @@
 
 O_TARGET := block.o
 
-export-objs    := elevator.o ll_rw_blk.o blkpg.o loop.o DAC960.o genhd.o
+export-objs    := elevator.o ll_rw_blk.o blkpg.o loop.o DAC960.o genhd.o block_ioctl.o
 
-obj-y  := elevator.o ll_rw_blk.o blkpg.o genhd.o
+obj-y  := elevator.o ll_rw_blk.o blkpg.o genhd.o block_ioctl.o
 
 obj-$(CONFIG_MAC_FLOPPY)       += swim3.o
 obj-$(CONFIG_BLK_DEV_FD)       += floppy.o
index 8051819af63f3b36a040b5f972fce1e1e7946a20..579e2513bf9e8d58d89d82e985b8a93836b8ae7c 100644 (file)
@@ -194,7 +194,7 @@ int blkpg_ioctl(kdev_t dev, struct blkpg_ioctl_arg *arg)
 /*
  * Common ioctl's for block devices
  */
-
+extern int block_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg);
 int blk_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
 {
        request_queue_t *q;
@@ -205,6 +205,10 @@ int blk_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
        if (!dev)
                return -EINVAL;
 
+       intval = block_ioctl(dev, cmd, arg);
+       if (intval != -ENOTTY)
+               return intval;
+
        switch (cmd) {
                case BLKROSET:
                        if (!capable(CAP_SYS_ADMIN))
diff --git a/drivers/block/block_ioctl.c b/drivers/block/block_ioctl.c
new file mode 100644 (file)
index 0000000..dae22fb
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2001 Jens Axboe <axboe@suse.de>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public Licens
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-
+ *
+ */
+#include <linux/sched.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/config.h>
+#include <linux/locks.h>
+#include <linux/swap.h>
+#include <linux/init.h>
+#include <linux/smp_lock.h>
+#include <linux/module.h>
+#include <linux/blk.h>
+
+#include <linux/cdrom.h>
+
+int blk_do_rq(request_queue_t *q, struct request *rq)
+{
+       DECLARE_COMPLETION(wait);
+       int err = 0;
+
+       rq->flags |= REQ_BARRIER;
+       rq->waiting = &wait;
+       elv_add_request(q, rq);
+       generic_unplug_device(q);
+       wait_for_completion(&wait);
+
+       /*
+        * for now, never retry anything
+        */
+       if (rq->errors)
+               err = -EIO;
+
+       return err;
+}
+
+int block_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
+{
+       request_queue_t *q;
+       struct request *rq;
+       int close = 0, err;
+
+       q = blk_get_queue(dev);
+       if (!q)
+               return -ENXIO;
+
+       switch (cmd) {
+               case CDROMCLOSETRAY:
+                       close = 1;
+               case CDROMEJECT:
+                       rq = blk_get_request(q, WRITE, __GFP_WAIT);
+                       rq->flags = REQ_BLOCK_PC;
+                       memset(rq->cmd, 0, sizeof(rq->cmd));
+                       rq->cmd[0] = GPCMD_START_STOP_UNIT;
+                       rq->cmd[4] = 0x02 + (close != 0);
+                       err = blk_do_rq(q, rq);
+                       blk_put_request(rq);
+                       break;
+               default:
+                       err = -ENOTTY;
+       }
+
+       return err;
+}
index 1e92fb02a2af472dc0dab4e0b99ef36478c51c16..e9a0648eeed5576293a1735dd7c438b3dde66597 100644 (file)
@@ -1252,9 +1252,9 @@ queue:
        c->Request.Type.Type =  TYPE_CMD; // It is a command. 
        c->Request.Type.Attribute = ATTR_SIMPLE; 
        c->Request.Type.Direction = 
-               (creq->cmd == READ) ? XFER_READ: XFER_WRITE; 
+               (rq_data_dir(creq) == READ) ? XFER_READ: XFER_WRITE; 
        c->Request.Timeout = 0; // Don't time out       
-       c->Request.CDB[0] = (creq->cmd == READ) ? CCISS_READ : CCISS_WRITE;
+       c->Request.CDB[0] = (rq_data_dir(creq) == READ) ? CCISS_READ : CCISS_WRITE;
        start_blk = creq->sector;
 #ifdef CCISS_DEBUG
        printk(KERN_DEBUG "ciss: sector =%d nr_sectors=%d\n",(int) creq->sector,
@@ -1869,7 +1869,7 @@ static int __init cciss_init_one(struct pci_dev *pdev,
         blk_init_queue(q, do_cciss_request);
         blk_queue_headactive(q, 0);            
        blk_queue_bounce_limit(q, hba[i]->pdev->dma_mask);
-       q->max_segments = MAXSGENTRIES;
+       blk_queue_max_segments(q, MAXSGENTRIES);
        blk_queue_max_sectors(q, 512);
 
        /* fill in the other Kernel structs */
index a36a0b0557917cd82eccbfc8b29df97f6a0f85ca..a62c9c7671ecfd4df6cbf9d4ac3396cbc8ff638e 100644 (file)
@@ -470,7 +470,7 @@ int __init cpqarray_init(void)
                blk_init_queue(q, do_ida_request);
                blk_queue_headactive(q, 0);
                blk_queue_bounce_limit(q, hba[i]->pci_dev->dma_mask);
-               q->max_segments = SG_MAX;
+               blk_queue_max_segments(q, SG_MAX);
                blksize_size[MAJOR_NR+i] = ida_blocksizes + (i*256);
                read_ahead[MAJOR_NR+i] = READ_AHEAD;
 
@@ -898,7 +898,7 @@ DBGPX(
        seg = blk_rq_map_sg(q, creq, tmp_sg);
 
        /* Now do all the DMA Mappings */
-       if (creq->cmd == READ)
+       if (rq_data_dir(creq) == READ)
                dir = PCI_DMA_FROMDEVICE;
        else
                dir = PCI_DMA_TODEVICE;
@@ -913,7 +913,7 @@ DBGPX(
 DBGPX( printk("Submitting %d sectors in %d segments\n", creq->nr_sectors, seg); );
        c->req.hdr.sg_cnt = seg;
        c->req.hdr.blk_cnt = creq->nr_sectors;
-       c->req.hdr.cmd = (creq->cmd == READ) ? IDA_READ : IDA_WRITE;
+       c->req.hdr.cmd = (rq_data_dir(creq) == READ) ? IDA_READ : IDA_WRITE;
        c->type = CMD_RWREQ;
 
        spin_lock_irq(&q->queue_lock);
index 2e03a3d30ecc2a6da87c33b2b865e04b3fb84493..a904e75416548de893a0cc1b48c7a2287abe61e9 100644 (file)
@@ -58,7 +58,7 @@ inline int bio_rq_in_between(struct bio *bio, struct request *rq,
 
        next_rq = list_entry(next, struct request, queuelist);
 
-       BUG_ON(!next_rq->inactive);
+       BUG_ON(next_rq->flags & REQ_STARTED);
 
        /*
         * if the device is different (not a normal case) just check if
@@ -93,14 +93,21 @@ inline int bio_rq_in_between(struct bio *bio, struct request *rq,
 /*
  * can we safely merge with this request?
  */
-inline int elv_rq_merge_ok(request_queue_t *q, struct request *rq,
-                          struct bio *bio)
+inline int elv_rq_merge_ok(struct request *rq, struct bio *bio)
 {
-       if (bio_data_dir(bio) == rq->cmd) {
-               if (rq->rq_dev == bio->bi_dev && !rq->waiting
-                   && !rq->special && rq->inactive)
-                       return 1;
-       }
+       /*
+        * different data direction or already started, don't merge
+        */
+       if (bio_data_dir(bio) != rq_data_dir(rq))
+               return 0;
+       if (rq->flags & REQ_NOMERGE)
+               return 0;
+
+       /*
+        * same device and no special stuff set, merge is ok
+        */
+       if (rq->rq_dev == bio->bi_dev && !rq->waiting && !rq->special)
+               return 1;
 
        return 0;
 }
@@ -124,14 +131,12 @@ int elevator_linus_merge(request_queue_t *q, struct request **req,
                 */
                if (__rq->elevator_sequence-- <= 0)
                        break;
-
-               if (unlikely(__rq->waiting || __rq->special))
-                       continue;
-               if (unlikely(!__rq->inactive))
+               if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
                        break;
+
                if (!*req && bio_rq_in_between(bio, __rq, &q->queue_head))
                        *req = __rq;
-               if (!elv_rq_merge_ok(q, __rq, bio))
+               if (!elv_rq_merge_ok(__rq, bio))
                        continue;
 
                if (__rq->elevator_sequence < count)
@@ -218,11 +223,10 @@ int elevator_noop_merge(request_queue_t *q, struct request **req,
 
                prefetch(list_entry_rq(entry->prev));
 
-               if (unlikely(__rq->waiting || __rq->special))
-                       continue;
-               if (unlikely(!__rq->inactive))
+               if (__rq->flags & (REQ_BARRIER | REQ_STARTED))
                        break;
-               if (!elv_rq_merge_ok(q, __rq, bio))
+
+               if (!elv_rq_merge_ok(__rq, bio))
                        continue;
 
                /*
index 978d5ac0632e84994a2b3dfa866b29b37eb9196b..837587bc5b64371d20b4fc66d3cbe72a587cb14c 100644 (file)
@@ -2319,7 +2319,7 @@ static void request_done(int uptodate)
                        DPRINT("request list destroyed in floppy request done\n");
 
        } else {
-               if (CURRENT->cmd == WRITE) {
+               if (rq_data_dir(CURRENT) == WRITE) {
                        /* record write error information */
                        DRWE->write_errors++;
                        if (DRWE->write_errors == 1) {
@@ -2621,10 +2621,10 @@ static int make_raw_rw_request(void)
        raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_DISK | FD_RAW_NEED_DISK |
                FD_RAW_NEED_SEEK;
        raw_cmd->cmd_count = NR_RW;
-       if (CURRENT->cmd == READ){
+       if (rq_data_dir(CURRENT) == READ) {
                raw_cmd->flags |= FD_RAW_READ;
                COMMAND = FM_MODE(_floppy,FD_READ);
-       } else if (CURRENT->cmd == WRITE){
+       } else if (rq_data_dir(CURRENT) == WRITE){
                raw_cmd->flags |= FD_RAW_WRITE;
                COMMAND = FM_MODE(_floppy,FD_WRITE);
        } else {
@@ -2974,7 +2974,7 @@ static void do_fd_request(request_queue_t * q)
 
        if (usage_count == 0) {
                printk("warning: usage count=0, CURRENT=%p exiting\n", CURRENT);
-               printk("sect=%ld cmd=%d\n", CURRENT->sector, CURRENT->cmd);
+               printk("sect=%ld flags=%lx\n", CURRENT->sector, CURRENT->flags);
                return;
        }
        if (fdc_busy){
index 2ecc7c6d3f01209bc7b85cd8b5c36f3c7e177fb6..5838ff5cea39844e14778aa2c1519dd51ebc4241 100644 (file)
@@ -149,7 +149,8 @@ get_partition_list(char *page, char **start, off_t offset, int count)
        char buf[64];
        int len, n;
 
-       len = sprintf(page, "major minor  #blocks  name\n\n");
+       len = sprintf(page, "major minor   #blocks  start_sect   nr_sects  "
+                       "name\n\n");
        read_lock(&gendisk_lock);
        for (gp = gendisk_head; gp; gp = gp->next) {
                for (n = 0; n < (gp->nr_real << gp->minor_shift); n++) {
@@ -157,8 +158,10 @@ get_partition_list(char *page, char **start, off_t offset, int count)
                                continue;
 
                        len += snprintf(page + len, 63,
-                                       "%4d  %4d %10d %s\n",
+                                       "%4d  %4d %10d  %10lu %10lu  %s\n",
                                        gp->major, n, gp->sizes[n],
+                                       gp->part[n].start_sect,
+                                       gp->part[n].nr_sects,
                                        disk_name(gp, n, buf));
                        if (len < offset)
                                offset -= len, len = 0;
index e5f096e262c4a4c0255ab1d06d4e9e61ac49d6d1..299748f44e4c7805d5d73f5a906e00af655fc393 100644 (file)
@@ -67,7 +67,7 @@ typedef struct {
        __u8    reserved;
 } rhdr_t;
 
-#define SG_MAX                 32
+#define SG_MAX                 31
 typedef struct {
        rhdr_t  hdr;
        sg_t    sg[SG_MAX];
index 89f310cb6d9f5fa83e003cb39d162a501034d2c0..1242a790b3fa83b88402ebe24ea7d14d29c59edb 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/bootmem.h>
 #include <linux/completion.h>
 #include <linux/compiler.h>
+#include <scsi/scsi.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -253,6 +254,68 @@ void blk_queue_segment_boundary(request_queue_t *q, unsigned long mask)
        q->seg_boundary_mask = mask;
 }
 
+static char *rq_flags[] = { "REQ_RW", "REQ_RW_AHEAD", "REQ_BARRIER",
+                          "REQ_CMD", "REQ_NOMERGE", "REQ_STARTED",
+                          "REQ_DONTPREP", "REQ_DRIVE_CMD", "REQ_DRIVE_TASK",
+                          "REQ_PC", "REQ_SENSE", "REQ_SPECIAL" };
+
+void blk_dump_rq_flags(struct request *rq, char *msg)
+{
+       int bit;
+
+       printk("%s: dev %x: ", msg, rq->rq_dev);
+       bit = 0;
+       do {
+               if (rq->flags & (1 << bit))
+                       printk("%s ", rq_flags[bit]);
+               bit++;
+       } while (bit < __REQ_NR_BITS);
+
+       if (rq->flags & REQ_CMD)
+               printk("sector %lu, nr/cnr %lu/%u\n", rq->sector,
+                                                      rq->nr_sectors,
+                                                      rq->current_nr_sectors);
+
+       printk("\n");
+}
+
+/*
+ * standard prep_rq_fn that builds 10 byte cmds
+ */
+static int ll_10byte_cmd_build(request_queue_t *q, struct request *rq)
+{
+       int hard_sect = get_hardsect_size(rq->rq_dev);
+       sector_t block = rq->hard_sector / (hard_sect >> 9);
+       unsigned long blocks = rq->hard_nr_sectors / (hard_sect >> 9);
+
+       if (!(rq->flags & REQ_CMD))
+               return 0;
+
+       if (rq_data_dir(rq) == READ)
+               rq->cmd[0] = READ_10;
+       else 
+               rq->cmd[0] = WRITE_10;
+
+       rq->cmd[1] = 0;
+
+       /*
+        * fill in lba
+        */
+       rq->cmd[2] = (block >> 24) & 0xff;
+       rq->cmd[3] = (block >> 16) & 0xff;
+       rq->cmd[4] = (block >>  8) & 0xff;
+       rq->cmd[5] = block & 0xff;
+       rq->cmd[6] = 0;
+
+       /*
+        * and transfer length
+        */
+       rq->cmd[7] = (blocks >> 8) & 0xff;
+       rq->cmd[8] = blocks & 0xff;
+
+       return 0;
+}
+
 /*
  * can we merge the two segments, or do we need to start a new one?
  */
@@ -284,7 +347,7 @@ int blk_rq_map_sg(request_queue_t *q, struct request *rq, struct scatterlist *sg
        unsigned long long lastend;
        struct bio_vec *bvec;
        struct bio *bio;
-       int nsegs, i, cluster;
+       int nsegs, i, cluster, j;
 
        nsegs = 0;
        bio = rq->bio;
@@ -294,7 +357,9 @@ int blk_rq_map_sg(request_queue_t *q, struct request *rq, struct scatterlist *sg
        /*
         * for each bio in rq
         */
+       j = 0;
        rq_for_each_bio(bio, rq) {
+               j++;
                /*
                 * for each segment in bio
                 */
@@ -319,8 +384,9 @@ int blk_rq_map_sg(request_queue_t *q, struct request *rq, struct scatterlist *sg
                                sg[nsegs - 1].length += nbytes;
                        } else {
 new_segment:
-                               if (nsegs >= q->max_segments) {
+                               if (nsegs > q->max_segments) {
                                        printk("map: %d >= %d\n", nsegs, q->max_segments);
+                                       printk("map %d, %d, bio_sectors %d, vcnt %d\n", i, j, bio_sectors(bio), bio->bi_vcnt);
                                        BUG();
                                }
 
@@ -342,10 +408,11 @@ new_segment:
  * the standard queue merge functions, can be overridden with device
  * specific ones if so desired
  */
-static inline int ll_new_segment(request_queue_t *q, struct request *req)
+static inline int ll_new_segment(request_queue_t *q, struct request *req,
+                                struct bio *bio)
 {
-       if (req->nr_segments < q->max_segments) {
-               req->nr_segments++;
+       if (req->nr_segments + bio->bi_vcnt < q->max_segments) {
+               req->nr_segments += bio->bi_vcnt;
                return 1;
        }
        return 0;
@@ -359,7 +426,7 @@ static int ll_back_merge_fn(request_queue_t *q, struct request *req,
        if (blk_same_segment(q, req->biotail, bio))
                return 1;
 
-       return ll_new_segment(q, req);
+       return ll_new_segment(q, req, bio);
 }
 
 static int ll_front_merge_fn(request_queue_t *q, struct request *req, 
@@ -370,7 +437,7 @@ static int ll_front_merge_fn(request_queue_t *q, struct request *req,
        if (blk_same_segment(q, bio, req->bio))
                return 1;
 
-       return ll_new_segment(q, req);
+       return ll_new_segment(q, req, bio);
 }
 
 static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
@@ -396,7 +463,7 @@ static int ll_merge_requests_fn(request_queue_t *q, struct request *req,
  * This is called with interrupts off and no requests on the queue.
  * (and with the request spinlock acquired)
  */
-static void blk_plug_device(request_queue_t *q)
+void blk_plug_device(request_queue_t *q)
 {
        /*
         * common case
@@ -573,6 +640,7 @@ int blk_init_queue(request_queue_t *q, request_fn_proc *rfn)
        q->back_merge_fn        = ll_back_merge_fn;
        q->front_merge_fn       = ll_front_merge_fn;
        q->merge_requests_fn    = ll_merge_requests_fn;
+       q->prep_rq_fn           = ll_10byte_cmd_build;
        q->plug_tq.sync         = 0;
        q->plug_tq.routine      = &generic_unplug_device;
        q->plug_tq.data         = q;
@@ -604,10 +672,11 @@ static inline struct request *get_request(request_queue_t *q, int rw)
                rq = blkdev_free_rq(&rl->free);
                list_del(&rq->queuelist);
                rl->count--;
-               rq->inactive = 1;
+               rq->flags = 0;
                rq->rq_status = RQ_ACTIVE;
                rq->special = NULL;
                rq->q = q;
+               rq->rl = rl;
        }
 
        return rq;
@@ -638,6 +707,25 @@ static struct request *get_request_wait(request_queue_t *q, int rw)
        return rq;
 }
 
+struct request *blk_get_request(request_queue_t *q, int rw, int gfp_mask)
+{
+       struct request *rq;
+
+       BUG_ON(rw != READ && rw != WRITE);
+
+       rq = get_request(q, rw);
+
+       if (!rq && (gfp_mask & __GFP_WAIT))
+               rq = get_request_wait(q, rw);
+
+       return rq;
+}
+
+void blk_put_request(struct request *rq)
+{
+       blkdev_release_request(rq);
+}
+
 /* RO fail safe mechanism */
 
 static long ro_bits[MAX_BLKDEV][8];
@@ -663,12 +751,13 @@ void set_device_ro(kdev_t dev,int flag)
        else ro_bits[major][minor >> 5] &= ~(1 << (minor & 31));
 }
 
-void drive_stat_acct (kdev_t dev, int rw, unsigned long nr_sectors, int new_io)
+void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
 {
-       unsigned int major = MAJOR(dev);
+       unsigned int major = MAJOR(rq->rq_dev);
+       int rw = rq_data_dir(rq);
        unsigned int index;
 
-       index = disk_index(dev);
+       index = disk_index(rq->rq_dev);
        if ((index >= DK_MAX_DISK) || (major >= DK_MAX_MAJOR))
                return;
 
@@ -691,13 +780,15 @@ void drive_stat_acct (kdev_t dev, int rw, unsigned long nr_sectors, int new_io)
 static inline void add_request(request_queue_t * q, struct request * req,
                               struct list_head *insert_here)
 {
-       drive_stat_acct(req->rq_dev, req->cmd, req->nr_sectors, 1);
+       drive_stat_acct(req, req->nr_sectors, 1);
 
-       {
+       /*
+        * debug stuff...
+        */
+       if (insert_here == &q->queue_head) {
                struct request *__rq = __elv_next_request(q);
 
-               if (__rq && !__rq->inactive && insert_here == &q->queue_head)
-                       BUG();
+               BUG_ON(__rq && (__rq->flags & REQ_STARTED));
        }
 
        /*
@@ -712,21 +803,21 @@ static inline void add_request(request_queue_t * q, struct request * req,
  */
 void blkdev_release_request(struct request *req)
 {
-       request_queue_t *q = req->q;
-       int rw = req->cmd;
+       struct request_list *rl = req->rl;
 
        req->rq_status = RQ_INACTIVE;
        req->q = NULL;
+       req->rl = NULL;
 
        /*
         * Request may not have originated from ll_rw_blk. if not,
-        * assume it has free buffers and check waiters
+        * it didn't come out of our reserved rq pools
         */
-       if (q) {
-               list_add(&req->queuelist, &q->rq[rw].free);
-               if (++q->rq[rw].count >= batch_requests
-                   && waitqueue_active(&q->rq[rw].wait))
-                       wake_up(&q->rq[rw].wait);
+       if (rl) {
+               list_add(&req->queuelist, &rl->free);
+
+               if (++rl->count >= batch_requests &&waitqueue_active(&rl->wait))
+                       wake_up(&rl->wait);
        }
 }
 
@@ -737,13 +828,28 @@ static void attempt_merge(request_queue_t *q, struct request *req)
 {
        struct request *next = blkdev_next_request(req);
 
+       /*
+        * not a rw command
+        */
+       if (!(next->flags & REQ_CMD))
+               return;
+
+       /*
+        * not contigious
+        */
        if (req->sector + req->nr_sectors != next->sector)
                return;
 
-       if (req->cmd != next->cmd
+       /*
+        * don't touch NOMERGE rq, or one that has been started by driver
+        */
+       if (next->flags & (REQ_NOMERGE | REQ_STARTED))
+               return;
+
+       if (rq_data_dir(req) != rq_data_dir(next)
            || req->rq_dev != next->rq_dev
            || req->nr_sectors + next->nr_sectors > q->max_sectors
-           || next->waiting || next->special || !next->inactive)
+           || next->waiting || next->special)
                return;
 
        /*
@@ -760,8 +866,6 @@ static void attempt_merge(request_queue_t *q, struct request *req)
                req->biotail->bi_next = next->bio;
                req->biotail = next->biotail;
 
-               next->bio = next->biotail = NULL;
-
                req->nr_sectors = req->hard_nr_sectors += next->hard_nr_sectors;
 
                blkdev_release_request(next);
@@ -835,8 +939,7 @@ static int __make_request(request_queue_t *q, struct bio *bio)
        spin_lock_prefetch(&q->queue_lock);
 
        latency = elevator_request_latency(elevator, rw);
-
-       barrier = test_bit(BIO_BARRIER, &bio->bi_flags);
+       barrier = test_bit(BIO_RW_BARRIER, &bio->bi_rw);
 
 again:
        req = NULL;
@@ -844,35 +947,22 @@ again:
 
        spin_lock_irq(&q->queue_lock);
 
-       /*
-        * barrier write must not be passed - so insert with 0 latency at
-        * the back of the queue and invalidate the entire existing merge hash
-        * for this device
-        */
-       if (barrier && !freereq)
-               latency = 0;
-
        insert_here = head->prev;
        if (blk_queue_empty(q) || barrier) {
                blk_plug_device(q);
                goto get_rq;
-#if 0
-       } else if (test_bit(QUEUE_FLAG_PLUGGED, &q->queue_flags)) {
-               head = head->next;
-#else
        } else if ((req = __elv_next_request(q))) {
-               if (!req->inactive)
+               if (req->flags & REQ_STARTED)
                        head = head->next;
 
                req = NULL;
-#endif
        }
 
        el_ret = elevator->elevator_merge_fn(q, &req, head, bio);
        switch (el_ret) {
                case ELEVATOR_BACK_MERGE:
-                       if (&req->queuelist == head && !req->inactive)
-                               BUG();
+                       BUG_ON(req->flags & REQ_STARTED);
+                       BUG_ON(req->flags & REQ_NOMERGE);
                        if (!q->back_merge_fn(q, req, bio))
                                break;
                        elevator->elevator_merge_cleanup_fn(q, req, nr_sectors);
@@ -880,13 +970,13 @@ again:
                        req->biotail->bi_next = bio;
                        req->biotail = bio;
                        req->nr_sectors = req->hard_nr_sectors += nr_sectors;
-                       drive_stat_acct(req->rq_dev, req->cmd, nr_sectors, 0);
+                       drive_stat_acct(req, nr_sectors, 0);
                        attempt_back_merge(q, req);
                        goto out;
 
                case ELEVATOR_FRONT_MERGE:
-                       if (&req->queuelist == head && !req->inactive)
-                               BUG();
+                       BUG_ON(req->flags & REQ_STARTED);
+                       BUG_ON(req->flags & REQ_NOMERGE);
                        if (!q->front_merge_fn(q, req, bio))
                                break;
                        elevator->elevator_merge_cleanup_fn(q, req, nr_sectors);
@@ -903,7 +993,7 @@ again:
                        req->hard_cur_sectors = cur_nr_sectors;
                        req->sector = req->hard_sector = sector;
                        req->nr_sectors = req->hard_nr_sectors += nr_sectors;
-                       drive_stat_acct(req->rq_dev, req->cmd, nr_sectors, 0);
+                       drive_stat_acct(req, nr_sectors, 0);
                        attempt_front_merge(q, head, req);
                        goto out;
 
@@ -941,7 +1031,7 @@ get_rq:
                /*
                 * READA bit set
                 */
-               if (bio->bi_rw & RWA_MASK) {
+               if (bio->bi_rw & (1 << BIO_RW_AHEAD)) {
                        set_bit(BIO_RW_BLOCK, &bio->bi_flags);
                        goto end_io;
                }
@@ -954,7 +1044,19 @@ get_rq:
         * fill up the request-info, and add it to the queue
         */
        req->elevator_sequence = latency;
-       req->cmd = rw;
+
+       /*
+        * first three bits are identical in rq->flags and bio->bi_rw,
+        * see bio.h and blkdev.h
+        */
+       req->flags = (bio->bi_rw & 7) | REQ_CMD;
+
+       /*
+        * REQ_BARRIER implies no merging, but lets make it explicit
+        */
+       if (barrier)
+               req->flags |= (REQ_BARRIER | REQ_NOMERGE);
+
        req->errors = 0;
        req->hard_sector = req->sector = sector;
        req->hard_nr_sectors = req->nr_sectors = nr_sectors;
@@ -967,11 +1069,8 @@ get_rq:
        req->rq_dev = bio->bi_dev;
        add_request(q, req, insert_here);
 out:
-       if (freereq) {
-               freereq->bio = freereq->biotail = NULL;
+       if (freereq)
                blkdev_release_request(freereq);
-       }
-
        spin_unlock_irq(&q->queue_lock);
        return 0;
 
@@ -1083,10 +1182,11 @@ end_io:
                }
 
                /*
-                * uh oh, need to split this bio... not implemented yet
+                * this needs to be handled by q->make_request_fn, to just
+                * setup a part of the bio in the request to enable easy
+                * multiple passing
                 */
-               if (bio_sectors(bio) > q->max_sectors)
-                       BUG();
+               BUG_ON(bio_sectors(bio) > q->max_sectors);
 
                /*
                 * If this device has partitions, remap block n
@@ -1108,7 +1208,6 @@ static int end_bio_bh_io_sync(struct bio *bio, int nr_sectors)
 
        bh->b_end_io(bh, test_bit(BIO_UPTODATE, &bio->bi_flags));
        bio_put(bio);
-
        return 0;
 }
 
@@ -1312,7 +1411,7 @@ extern int stram_device_init (void);
 int end_that_request_first(struct request *req, int uptodate, int nr_sectors)
 {
        struct bio *bio, *nxt;
-       int nsect;
+       int nsect, total_nsect = 0;
 
        req->errors = 0;
        if (!uptodate)
@@ -1324,13 +1423,16 @@ next_chunk:
                nsect = bio_iovec(bio)->bv_len >> 9;
 
                nr_sectors -= nsect;
-
-               nxt = bio->bi_next;
-               bio->bi_next = NULL;
-               if (!bio_endio(bio, uptodate, nsect))
-                       req->bio = nxt;
-               else
-                       bio->bi_next = nxt;
+               total_nsect += nsect;
+
+               if (++bio->bi_idx >= bio->bi_vcnt) {
+                       nxt = bio->bi_next;
+                       if (!bio_endio(bio, uptodate, total_nsect)) {
+                               total_nsect = 0;
+                               req->bio = nxt;
+                       } else
+                               BUG();
+               }
 
                if ((bio = req->bio) != NULL) {
                        req->hard_sector += nsect;
@@ -1437,3 +1539,4 @@ EXPORT_SYMBOL(blk_queue_max_segment_size);
 EXPORT_SYMBOL(blk_queue_hardsect_size);
 EXPORT_SYMBOL(blk_rq_map_sg);
 EXPORT_SYMBOL(blk_nohighio);
+EXPORT_SYMBOL(blk_dump_rq_flags);
index 3651608816b4b569044a4f91a9ebbee6c0d43808..acabd014f969479a8f8bc3bc6010e9757a0beb2b 100644 (file)
@@ -149,30 +149,41 @@ static int nbd_xmit(int send, struct socket *sock, char *buf, int size, int msg_
 
 void nbd_send_req(struct socket *sock, struct request *req)
 {
-       int result;
+       int result, rw, i, flags;
        struct nbd_request request;
        unsigned long size = req->nr_sectors << 9;
 
        DEBUG("NBD: sending control, ");
        request.magic = htonl(NBD_REQUEST_MAGIC);
-       request.type = htonl(req->cmd);
+       request.type = htonl(req->flags);
        request.from = cpu_to_be64( (u64) req->sector << 9);
        request.len = htonl(size);
        memcpy(request.handle, &req, sizeof(req));
 
-       result = nbd_xmit(1, sock, (char *) &request, sizeof(request), req->cmd == WRITE ? MSG_MORE : 0);
+       rw = rq_data_dir(req);
+
+       result = nbd_xmit(1, sock, (char *) &request, sizeof(request), rw & WRITE ? MSG_MORE : 0);
        if (result <= 0)
                FAIL("Sendmsg failed for control.");
 
-       if (req->cmd == WRITE) {
-               struct bio *bio = req->bio;
-               DEBUG("data, ");
-               do {
-                       result = nbd_xmit(1, sock, bio_data(bio), bio->bi_size, bio->bi_next == NULL ? 0 : MSG_MORE);
-                       if (result <= 0)
-                               FAIL("Send data failed.");
-                       bio = bio->bi_next;
-               } while(bio);
+       if (rw & WRITE) {
+               struct bio *bio;
+               /*
+                * we are really probing at internals to determine
+                * whether to set MSG_MORE or not...
+                */
+               rq_for_each_bio(bio, req) {
+                       struct bio_vec *bvec;
+                       bio_for_each_segment(bvec, bio, i) {
+                               flags = 0;
+                               if ((i < (bio->bi_vcnt - 1)) || bio->bi_next)
+                                       flags = MSG_MORE;
+                               DEBUG("data, ");
+                               result = nbd_xmit(1, sock, page_address(bvec->bv_page) + bvec->bv_offset, bvec->bv_len, flags);
+                               if (result <= 0)
+                                       FAIL("Send data failed.");
+                       }
+               }
        }
        return;
 
@@ -204,7 +215,7 @@ struct request *nbd_read_stat(struct nbd_device *lo)
                HARDFAIL("Not enough magic.");
        if (ntohl(reply.error))
                FAIL("Other side returned error.");
-       if (req->cmd == READ) {
+       if (rq_data_dir(req) == READ) {
                struct bio *bio = req->bio;
                DEBUG("data, ");
                do {
@@ -321,10 +332,13 @@ static void do_nbd_request(request_queue_t * q)
                if (dev >= MAX_NBD)
                        FAIL("Minor too big.");         /* Probably can not happen */
 #endif
+               if (!(req->flags & REQ_CMD))
+                       goto error_out;
+
                lo = &nbd_dev[dev];
                if (!lo->file)
                        FAIL("Request when not-ready.");
-               if ((req->cmd == WRITE) && (lo->flags & NBD_READ_ONLY))
+               if ((rq_data_dir(req) == WRITE) && (lo->flags & NBD_READ_ONLY))
                        FAIL("Write on read-only");
 #ifdef PARANOIA
                if (lo->magic != LO_MAGIC)
@@ -374,7 +388,7 @@ static int nbd_ioctl(struct inode *inode, struct file *file,
        switch (cmd) {
        case NBD_DISCONNECT:
                printk("NBD_DISCONNECT\n") ;
-                sreq.cmd=2 ; /* shutdown command */
+               sreq.flags = REQ_SPECIAL; /* FIXME: interpet as shutdown cmd */
                 if (!lo->sock) return -EINVAL ;
                 nbd_send_req(lo->sock,&sreq) ;
                 return 0 ;
index db034ed907b9f027f4ba515737c3cd19961020f3..61e50fec569ceca40ab4575e470f7d19f2557538 100644 (file)
@@ -768,7 +768,7 @@ static void do_pcd_request (request_queue_t * q)
         while (1) {
            if (QUEUE_EMPTY || (CURRENT->rq_status == RQ_INACTIVE)) return;
            INIT_REQUEST;
-           if (CURRENT->cmd == READ) {
+           if (rq_data_dir(CURRENT) == READ) {
                unit = MINOR(CURRENT->rq_dev);
                if (unit != pcd_unit) {
                        pcd_bufblk = -1;
index 9efc4f8cd38f1cc5647f80fa9bab21682d83dcd2..1430fcb800109c85d62e7f12b82eb929432021c1 100644 (file)
@@ -858,7 +858,7 @@ repeat:
                 goto repeat;
         }
 
-       pd_cmd = CURRENT->cmd;
+       pd_cmd = rq_data_dir(CURRENT);
         pd_buf = CURRENT->buffer;
         pd_retries = 0;
 
@@ -884,7 +884,7 @@ static void pd_next_buf( int unit )
 /* paranoia */
 
        if (QUEUE_EMPTY ||
-           (CURRENT->cmd != pd_cmd) ||
+           (rq_data_dir(CURRENT) != pd_cmd) ||
            (MINOR(CURRENT->rq_dev) != pd_dev) ||
            (CURRENT->rq_status == RQ_INACTIVE) ||
            (CURRENT->sector != pd_block)) 
index 7ca422ee156b293e40a2b0e044a2af9577203283..d659bbe4408abd595482b7f473969fa8c0c7c40d 100644 (file)
@@ -859,7 +859,7 @@ repeat:
                 goto repeat;
         }
 
-       pf_cmd = CURRENT->cmd;
+       pf_cmd = rq_data_dir(CURRENT);
         pf_buf = CURRENT->buffer;
         pf_retries = 0;
 
@@ -885,7 +885,7 @@ static void pf_next_buf( int unit )
 /* paranoia */
 
        if (QUEUE_EMPTY ||
-           (CURRENT->cmd != pf_cmd) ||
+           (rq_data_dir(CURRENT) != pf_cmd) ||
            (DEVICE_NR(CURRENT->rq_dev) != pf_unit) ||
            (CURRENT->rq_status == RQ_INACTIVE) ||
            (CURRENT->sector != pf_block)) 
index dcf1cd91d8650854f4aee11cfd7688c7e8e3c181..b2135fc5b31954db6a37853188f8b7bc4208258e 100644 (file)
@@ -485,7 +485,6 @@ static struct block_device_operations rd_bd_op = {
        ioctl:          rd_ioctl,
 };
 
-#ifdef MODULE
 /* Before freeing the module, invalidate all of the protected buffers! */
 static void __exit rd_cleanup (void)
 {
@@ -503,7 +502,6 @@ static void __exit rd_cleanup (void)
        unregister_blkdev( MAJOR_NR, "ramdisk" );
        blk_clear(MAJOR_NR);
 }
-#endif
 
 /* This is the registration and initialization section of the RAM disk driver */
 int __init rd_init (void)
index 3665f9eb0e26b2ab65b996a3499dbfc2bdcf6298..ac2d341b7cebc8a2ed4279007e12d879e0cc4226 100644 (file)
 
 /* Define this to remove _all_ the debugging messages */
 /* #define ERRLOGMASK CD_NOTHING */
-#define ERRLOGMASK (CD_WARNING)
+#define ERRLOGMASK CD_WARNING
 /* #define ERRLOGMASK (CD_WARNING|CD_OPEN|CD_COUNT_TRACKS|CD_CLOSE) */
 /* #define ERRLOGMASK (CD_WARNING|CD_REG_UNREG|CD_DO_IOCTL|CD_OPEN|CD_CLOSE|CD_COUNT_TRACKS) */
 
index 1a173ffc7a9bbc0f88e7bc28e52651322c7fa87f..f4729ef8408d54b555fcbce13fc7d29a83e2e8aa 100644 (file)
@@ -533,8 +533,8 @@ static void cdrom_queue_request_sense(ide_drive_t *drive,
        /* stuff the sense request in front of our current request */
        rq = &info->request_sense_request;
        ide_init_drive_cmd(rq);
-       rq->cmd = REQUEST_SENSE_COMMAND;
-       rq->buffer = (char *) pc;
+       rq->flags = REQ_SENSE;
+       rq->special = (char *) pc;
        rq->waiting = wait;
        (void) ide_do_drive_cmd(drive, rq, ide_preempt);
 }
@@ -544,17 +544,17 @@ static void cdrom_end_request (int uptodate, ide_drive_t *drive)
 {
        struct request *rq = HWGROUP(drive)->rq;
 
-       if (rq->cmd == REQUEST_SENSE_COMMAND && uptodate) {
-               struct packet_command *pc = (struct packet_command *) rq->buffer;
+       if ((rq->flags & REQ_SENSE) && uptodate) {
+               struct packet_command *pc = (struct packet_command *) rq->special;
                cdrom_analyze_sense_data(drive,
                        (struct packet_command *) pc->sense,
                        (struct request_sense *) (pc->buffer - pc->c[4]));
        }
-       if (rq->cmd == READ || rq->cmd == WRITE)
-               if (!rq->current_nr_sectors)
-                       uptodate = 1;
 
-       ide_end_request (uptodate, HWGROUP(drive));
+       if ((rq->flags & REQ_CMD) && !rq->current_nr_sectors)
+               uptodate = 1;
+
+       ide_end_request(uptodate, HWGROUP(drive));
 }
 
 
@@ -584,21 +584,20 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
                return 1;
        }
 
-       if (rq->cmd == REQUEST_SENSE_COMMAND) {
+       if (rq->flags & REQ_SENSE) {
                /* We got an error trying to get sense info
                   from the drive (probably while trying
                   to recover from a former error).  Just give up. */
 
-               pc = (struct packet_command *) rq->buffer;
+               pc = (struct packet_command *) rq->special;
                pc->stat = 1;
                cdrom_end_request (1, drive);
                *startstop = ide_error (drive, "request sense failure", stat);
                return 1;
-
-       } else if (rq->cmd == PACKET_COMMAND) {
+       } else if (rq->flags & REQ_PC) {
                /* All other functions, except for READ. */
                struct completion *wait = NULL;
-               pc = (struct packet_command *) rq->buffer;
+               pc = (struct packet_command *) rq->special;
 
                /* Check for tray open. */
                if (sense_key == NOT_READY) {
@@ -632,7 +631,7 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
 
                if ((stat & ERR_STAT) != 0)
                        cdrom_queue_request_sense(drive, wait, pc->sense, pc);
-       } else {
+       } else if (rq->flags & REQ_CMD) {
                /* Handle errors from READ and WRITE requests. */
 
                if (sense_key == NOT_READY) {
@@ -671,7 +670,8 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
                   queue a request sense command. */
                if ((stat & ERR_STAT) != 0)
                        cdrom_queue_request_sense(drive, NULL, NULL, NULL);
-       }
+       } else
+               blk_dump_rq_flags(rq, "ide-cd bad flags");
 
        /* Retry, or handle the next request. */
        *startstop = ide_stopped;
@@ -681,7 +681,6 @@ static int cdrom_decode_status (ide_startstop_t *startstop, ide_drive_t *drive,
 static int cdrom_timer_expiry(ide_drive_t *drive)
 {
        struct request *rq = HWGROUP(drive)->rq;
-       struct packet_command *pc = (struct packet_command *) rq->buffer;
        unsigned long wait = 0;
 
        /*
@@ -690,7 +689,7 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
         * this, but not all commands/drives support that. Let
         * ide_timer_expiry keep polling us for these.
         */
-       switch (pc->c[0]) {
+       switch (rq->cmd[0]) {
                case GPCMD_BLANK:
                case GPCMD_FORMAT_UNIT:
                case GPCMD_RESERVE_RZONE_TRACK:
@@ -700,6 +699,7 @@ static int cdrom_timer_expiry(ide_drive_t *drive)
                        wait = 0;
                        break;
        }
+
        return wait;
 }
 
@@ -1116,11 +1116,7 @@ static ide_startstop_t cdrom_start_read_continuation (ide_drive_t *drive)
                (65534 / CD_FRAMESIZE) : 65535);
 
        /* Set up the command */
-       memset (&pc.c, 0, sizeof (pc.c));
-       pc.c[0] = GPCMD_READ_10;
-       pc.c[7] = (nframes >> 8);
-       pc.c[8] = (nframes & 0xff);
-       put_unaligned(cpu_to_be32(frame), (unsigned int *) &pc.c[2]);
+       memcpy(pc.c, rq->cmd, sizeof(pc.c));
        pc.timeout = WAIT_CMD;
 
        /* Send the command to the drive and return. */
@@ -1170,7 +1166,7 @@ static ide_startstop_t cdrom_start_seek_continuation (ide_drive_t *drive)
                sector -= nskip;
        frame = sector / SECTORS_PER_FRAME;
 
-       memset (&pc.c, 0, sizeof (pc.c));
+       memset(rq->cmd, 0, sizeof(rq->cmd));
        pc.c[0] = GPCMD_SEEK;
        put_unaligned(cpu_to_be32(frame), (unsigned int *) &pc.c[2]);
 
@@ -1188,8 +1184,11 @@ static ide_startstop_t cdrom_start_seek (ide_drive_t *drive, unsigned int block)
        return cdrom_start_packet_command (drive, 0, cdrom_start_seek_continuation);
 }
 
-/* Fix up a possibly partially-processed request so that we can
-   start it over entirely */
+/*
+ * Fix up a possibly partially-processed request so that we can
+ * start it over entirely -- remember to call prep_rq_fn again since we
+ * may have changed the layout
+ */
 static void restore_request (struct request *rq)
 {
        if (rq->buffer != bio_data(rq->bio)) {
@@ -1201,6 +1200,7 @@ static void restore_request (struct request *rq)
        rq->hard_cur_sectors = rq->current_nr_sectors = bio_sectors(rq->bio);
        rq->hard_nr_sectors = rq->nr_sectors;
        rq->hard_sector = rq->sector;
+       rq->q->prep_rq_fn(rq->q, rq);
 }
 
 /*
@@ -1210,18 +1210,7 @@ static ide_startstop_t cdrom_start_read (ide_drive_t *drive, unsigned int block)
 {
        struct cdrom_info *info = drive->driver_data;
        struct request *rq = HWGROUP(drive)->rq;
-       int minor = MINOR (rq->rq_dev);
-
-       /* If the request is relative to a partition, fix it up to refer to the
-          absolute address.  */
-       if (minor & PARTN_MASK) {
-               rq->sector = block;
-               minor &= ~PARTN_MASK;
-               rq->rq_dev = MKDEV(MAJOR(rq->rq_dev), minor);
-       }
 
-       /* We may be retrying this request after an error.  Fix up
-          any weirdness which might be present in the request packet. */
        restore_request(rq);
 
        /* Satisfy whatever we can of this request from our cached sector. */
@@ -1258,7 +1247,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
 {
        int ireason, len, stat, thislen;
        struct request *rq = HWGROUP(drive)->rq;
-       struct packet_command *pc = (struct packet_command *)rq->buffer;
+       struct packet_command *pc = (struct packet_command *) rq->special;
        ide_startstop_t startstop;
 
        /* Check for errors. */
@@ -1354,7 +1343,7 @@ static ide_startstop_t cdrom_pc_intr (ide_drive_t *drive)
 static ide_startstop_t cdrom_do_pc_continuation (ide_drive_t *drive)
 {
        struct request *rq = HWGROUP(drive)->rq;
-       struct packet_command *pc = (struct packet_command *)rq->buffer;
+       struct packet_command *pc = (struct packet_command *) rq->special;
 
        if (!pc->timeout)
                pc->timeout = WAIT_CMD;
@@ -1368,7 +1357,7 @@ static ide_startstop_t cdrom_do_packet_command (ide_drive_t *drive)
 {
        int len;
        struct request *rq = HWGROUP(drive)->rq;
-       struct packet_command *pc = (struct packet_command *)rq->buffer;
+       struct packet_command *pc = (struct packet_command *) rq->special;
        struct cdrom_info *info = drive->driver_data;
 
        info->dma = 0;
@@ -1407,8 +1396,8 @@ int cdrom_queue_packet_command(ide_drive_t *drive, struct packet_command *pc)
        /* Start of retry loop. */
        do {
                ide_init_drive_cmd (&req);
-               req.cmd = PACKET_COMMAND;
-               req.buffer = (char *)pc;
+               req.flags = REQ_PC;
+               req.special = (char *) pc;
                if (ide_do_drive_cmd (drive, &req, ide_wait)) {
                        printk("%s: do_drive_cmd returned stat=%02x,err=%02x\n",
                                drive->name, req.buffer[0], req.buffer[1]);
@@ -1583,18 +1572,10 @@ static ide_startstop_t cdrom_start_write_cont(ide_drive_t *drive)
        nframes = rq->nr_sectors >> 2;
        frame = rq->sector >> 2;
 
-       memset(&pc.c, 0, sizeof(pc.c));
-       /*
-        * we might as well use WRITE_12, but none of the device I have
-        * support the streaming feature anyway, so who cares.
-        */
-       pc.c[0] = GPCMD_WRITE_10;
+       memcpy(pc.c, rq->cmd, sizeof(pc.c));
 #if 0  /* the immediate bit */
        pc.c[1] = 1 << 3;
 #endif
-       pc.c[7] = (nframes >> 8) & 0xff;
-       pc.c[8] = nframes & 0xff;
-       put_unaligned(cpu_to_be32(frame), (unsigned int *)&pc.c[2]);
        pc.timeout = 2 * WAIT_CMD;
 
        return cdrom_transfer_packet_command(drive, &pc, cdrom_write_intr);
@@ -1631,6 +1612,28 @@ static ide_startstop_t cdrom_start_write(ide_drive_t *drive, struct request *rq)
        return cdrom_start_packet_command(drive, 32768, cdrom_start_write_cont);
 }
 
+/*
+ * just wrap this around cdrom_do_packet_command
+ */
+static int cdrom_do_block_pc(ide_drive_t *drive, struct request *rq)
+{
+       struct packet_command pc;
+       ide_startstop_t startstop;
+
+       memset(&pc, 0, sizeof(pc));
+       memcpy(pc.c, rq->cmd, sizeof(pc.c));
+       pc.quiet = 1;
+       pc.timeout = 60 * HZ;
+       rq->special = (char *) &pc;
+
+       startstop = cdrom_do_packet_command(drive);
+       if (pc.stat)
+               rq->errors++;
+
+       return startstop;
+}
+
+
 /****************************************************************************
  * cdrom driver request routine.
  */
@@ -1640,50 +1643,45 @@ ide_do_rw_cdrom (ide_drive_t *drive, struct request *rq, unsigned long block)
        ide_startstop_t action;
        struct cdrom_info *info = drive->driver_data;
 
-       switch (rq->cmd) {
-               case WRITE:
-               case READ: {
-                       if (CDROM_CONFIG_FLAGS(drive)->seeking) {
-                               unsigned long elpased = jiffies - info->start_seek;
-                               int stat = GET_STAT();
-
-                               if ((stat & SEEK_STAT) != SEEK_STAT) {
-                                       if (elpased < IDECD_SEEK_TIMEOUT) {
-                                               ide_stall_queue(drive, IDECD_SEEK_TIMER);
-                                               return ide_stopped;
-                                       }
-                                       printk ("%s: DSC timeout\n", drive->name);
+       if (rq->flags & REQ_CMD) {
+               if (CDROM_CONFIG_FLAGS(drive)->seeking) {
+                       unsigned long elpased = jiffies - info->start_seek;
+                       int stat = GET_STAT();
+
+                       if ((stat & SEEK_STAT) != SEEK_STAT) {
+                               if (elpased < IDECD_SEEK_TIMEOUT) {
+                                       ide_stall_queue(drive, IDECD_SEEK_TIMER);
+                                       return ide_stopped;
                                }
-                               CDROM_CONFIG_FLAGS(drive)->seeking = 0;
+                               printk ("%s: DSC timeout\n", drive->name);
                        }
-                       if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
-                               action = cdrom_start_seek (drive, block);
-                       else {
-                               if (rq->cmd == READ)
-                                       action = cdrom_start_read(drive, block);
-                               else
-                                       action = cdrom_start_write(drive, rq);
-                       }
-                       info->last_block = block;
-                       return action;
-               }
-
-               case PACKET_COMMAND:
-               case REQUEST_SENSE_COMMAND: {
-                       return cdrom_do_packet_command(drive);
-               }
-
-               case RESET_DRIVE_COMMAND: {
-                       cdrom_end_request(1, drive);
-                       return ide_do_reset(drive);
+                       CDROM_CONFIG_FLAGS(drive)->seeking = 0;
                }
-
-               default: {
-                       printk("ide-cd: bad cmd %d\n", rq->cmd);
-                       cdrom_end_request(0, drive);
-                       return ide_stopped;
+               if (IDE_LARGE_SEEK(info->last_block, block, IDECD_SEEK_THRESHOLD) && drive->dsc_overlap)
+                       action = cdrom_start_seek (drive, block);
+               else {
+                       if (rq_data_dir(rq) == READ)
+                               action = cdrom_start_read(drive, block);
+                       else
+                               action = cdrom_start_write(drive, rq);
                }
+               info->last_block = block;
+               return action;
+       } else if (rq->flags & (REQ_PC | REQ_SENSE)) {
+               return cdrom_do_packet_command(drive);
+       } else if (rq->flags & REQ_SPECIAL) {
+               /*
+                * right now this can only be a reset...
+                */
+               cdrom_end_request(1, drive);
+               return ide_do_reset(drive);
+       } else if (rq->flags & REQ_BLOCK_PC) {
+               return cdrom_do_block_pc(drive, rq);
        }
+
+       blk_dump_rq_flags(rq, "ide-cd bad flags");
+       cdrom_end_request(0, drive);
+       return ide_stopped;
 }
 
 
@@ -2151,6 +2149,7 @@ static int ide_cdrom_packet(struct cdrom_device_info *cdi,
        return cgc->stat;
 }
 
+
 static
 int ide_cdrom_dev_ioctl (struct cdrom_device_info *cdi,
                         unsigned int cmd, unsigned long arg)
@@ -2284,7 +2283,7 @@ int ide_cdrom_reset (struct cdrom_device_info *cdi)
        int ret;
 
        ide_init_drive_cmd (&req);
-       req.cmd = RESET_DRIVE_COMMAND;
+       req.flags = REQ_SPECIAL;
        ret = ide_do_drive_cmd(drive, &req, ide_wait);
 
        /*
@@ -2673,6 +2672,7 @@ int ide_cdrom_setup (ide_drive_t *drive)
         */
        set_device_ro(MKDEV(HWIF(drive)->major, minor), 1);
        set_blocksize(MKDEV(HWIF(drive)->major, minor), CD_FRAMESIZE);
+       blk_queue_hardsect_size(&drive->queue, CD_FRAMESIZE);
 
        drive->special.all      = 0;
        drive->ready_stat       = 0;
index 197d99defda2dac89971b51e0df4275c901a8cf0..e50c7b4e7091e750618e97f928de872aa04c3170 100644 (file)
@@ -384,7 +384,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
 #endif /* CONFIG_BLK_DEV_PDC4030 */
 #ifdef DEBUG
                printk("%s: %sing: LBAsect=%ld, sectors=%ld, buffer=0x%08lx\n",
-                       drive->name, (rq->cmd==READ)?"read":"writ",
+                       drive->name, (rq_data_dir(rq)==READ)?"read":"writ",
                        block, rq->nr_sectors, (unsigned long) rq->buffer);
 #endif
                OUT_BYTE(block,IDE_SECTOR_REG);
@@ -403,7 +403,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
                OUT_BYTE(head|drive->select.all,IDE_SELECT_REG);
 #ifdef DEBUG
                printk("%s: %sing: CHS=%d/%d/%d, sectors=%ld, buffer=0x%08lx\n",
-                       drive->name, (rq->cmd==READ)?"read":"writ", cyl,
+                       drive->name, (rq_data_dir(rq)==READ)?"read":"writ", cyl,
                        head, sect, rq->nr_sectors, (unsigned long) rq->buffer);
 #endif
        }
@@ -413,7 +413,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
                return do_pdc4030_io (drive, rq);
        }
 #endif /* CONFIG_BLK_DEV_PDC4030 */
-       if (rq->cmd == READ) {
+       if (rq_data_dir(rq) == READ) {
 #ifdef CONFIG_BLK_DEV_IDEDMA
                if (drive->using_dma && !(HWIF(drive)->dmaproc(ide_dma_read, drive)))
                        return ide_started;
@@ -422,7 +422,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
                OUT_BYTE(drive->mult_count ? WIN_MULTREAD : WIN_READ, IDE_COMMAND_REG);
                return ide_started;
        }
-       if (rq->cmd == WRITE) {
+       if (rq_data_dir(rq) == WRITE) {
                ide_startstop_t startstop;
 #ifdef CONFIG_BLK_DEV_IDEDMA
                if (drive->using_dma && !(HWIF(drive)->dmaproc(ide_dma_write, drive)))
@@ -464,7 +464,7 @@ static ide_startstop_t do_rw_disk (ide_drive_t *drive, struct request *rq, unsig
                }
                return ide_started;
        }
-       printk(KERN_ERR "%s: bad command: %d\n", drive->name, rq->cmd);
+       printk(KERN_ERR "%s: bad command: %lx\n", drive->name, rq->flags);
        ide_end_request(0, HWGROUP(drive));
        return ide_stopped;
 }
index a41542777d87eb02876c76c8644aa5c96ec5c393..cc0d6b992c13bebce2407e5a5dc9770b5c536c3e 100644 (file)
@@ -234,7 +234,7 @@ static int ide_build_sglist (ide_hwif_t *hwif, struct request *rq)
        if (nents > rq->nr_segments)
                printk("ide-dma: received %d segments, build %d\n", rq->nr_segments, nents);
 
-       if (rq->cmd == READ)
+       if (rq_data_dir(rq) == READ)
                hwif->sg_dma_direction = PCI_DMA_FROMDEVICE;
        else
                hwif->sg_dma_direction = PCI_DMA_TODEVICE;
index ec37c069c635e1c080e220ce00cfbd97db45b084..a9ff55e851c1346298273a42e37fecd5e7952416 100644 (file)
 #include <linux/ide.h>
 #include <linux/devfs_fs_kernel.h>
 #include <linux/completion.h>
+#include <linux/cdrom.h>
 
 #include <asm/byteorder.h>
 #include <asm/irq.h>
@@ -562,8 +563,7 @@ inline int __ide_end_request(ide_hwgroup_t *hwgroup, int uptodate, int nr_secs)
        spin_lock_irqsave(&ide_lock, flags);
        rq = hwgroup->rq;
 
-       if (rq->inactive)
-               BUG();
+       BUG_ON(!(rq->flags & REQ_STARTED));
 
        /*
         * small hack to eliminate locking from ide_end_request to grab
@@ -878,7 +878,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err)
        spin_lock_irqsave(&ide_lock, flags);
        rq = HWGROUP(drive)->rq;
 
-       if (rq->cmd == IDE_DRIVE_CMD) {
+       if (rq->flags & REQ_DRIVE_CMD) {
                byte *args = (byte *) rq->buffer;
                rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
                if (args) {
@@ -886,7 +886,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err)
                        args[1] = err;
                        args[2] = IN_BYTE(IDE_NSECTOR_REG);
                }
-       } else if (rq->cmd == IDE_DRIVE_TASK) {
+       } else if (rq->flags & REQ_DRIVE_TASK) {
                byte *args = (byte *) rq->buffer;
                rq->errors = !OK_STAT(stat,READY_STAT,BAD_STAT);
                if (args) {
@@ -901,8 +901,6 @@ void ide_end_drive_cmd (ide_drive_t *drive, byte stat, byte err)
        }
 
        spin_lock(DRIVE_LOCK(drive));
-       if (rq->inactive)
-               BUG();
        blkdev_dequeue_request(rq);
        HWGROUP(drive)->rq = NULL;
        end_that_request_last(rq);
@@ -1010,7 +1008,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat)
        if (drive == NULL || (rq = HWGROUP(drive)->rq) == NULL)
                return ide_stopped;
        /* retry only "normal" I/O: */
-       if (rq->cmd == IDE_DRIVE_CMD || rq->cmd == IDE_DRIVE_TASK) {
+       if (!(rq->flags & REQ_CMD)) {
                rq->errors = 1;
                ide_end_drive_cmd(drive, stat, err);
                return ide_stopped;
@@ -1030,7 +1028,7 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat)
                        else if (err & TRK0_ERR)        /* help it find track zero */
                                rq->errors |= ERROR_RECAL;
                }
-               if ((stat & DRQ_STAT) && rq->cmd != WRITE)
+               if ((stat & DRQ_STAT) && rq_data_dir(rq) == READ)
                        try_to_flush_leftover_data(drive);
        }
        if (GET_STAT() & (BUSY_STAT|DRQ_STAT))
@@ -1177,7 +1175,7 @@ int ide_wait_stat (ide_startstop_t *startstop, ide_drive_t *drive, byte good, by
 static ide_startstop_t execute_drive_cmd (ide_drive_t *drive, struct request *rq)
 {
        byte *args = rq->buffer;
-       if (args && rq->cmd == IDE_DRIVE_TASK) {
+       if (args && (rq->flags & REQ_DRIVE_TASK)) {
                byte sel;
 #ifdef DEBUG
                printk("%s: DRIVE_TASK_CMD data=x%02x cmd=0x%02x fr=0x%02x ns=0x%02x sc=0x%02x lcyl=0x%02x hcyl=0x%02x sel=0x%02x\n",
@@ -1234,8 +1232,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
        unsigned int minor = MINOR(rq->rq_dev), unit = minor >> PARTN_BITS;
        ide_hwif_t *hwif = HWIF(drive);
 
-       if (rq->inactive)
-               BUG();
+       BUG_ON(!(rq->flags & REQ_STARTED));
 
 #ifdef DEBUG
        printk("%s: start_request: current=0x%08lx\n", hwif->name, (unsigned long) rq);
@@ -1259,7 +1256,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
        block    = rq->sector;
 
        /* Strange disk manager remap */
-       if ((rq->cmd == READ || rq->cmd == WRITE) &&
+       if ((rq->flags & REQ_CMD) && 
            (drive->media == ide_disk || drive->media == ide_floppy)) {
                block += drive->sect0;
        }
@@ -1279,9 +1276,9 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
                return startstop;
        }
        if (!drive->special.all) {
-               if (rq->cmd == IDE_DRIVE_CMD || rq->cmd == IDE_DRIVE_TASK) {
+               if (rq->flags & (REQ_DRIVE_CMD | REQ_DRIVE_TASK))
                        return execute_drive_cmd(drive, rq);
-               }
+
                if (drive->driver != NULL) {
                        return (DRIVER(drive)->do_request(drive, rq, block));
                }
@@ -1831,7 +1828,7 @@ ide_drive_t *get_info_ptr (kdev_t i_rdev)
 void ide_init_drive_cmd (struct request *rq)
 {
        memset(rq, 0, sizeof(*rq));
-       rq->cmd = IDE_DRIVE_CMD;
+       rq->flags = REQ_DRIVE_CMD;
 }
 
 /*
@@ -2612,7 +2609,7 @@ int ide_wait_cmd_task (ide_drive_t *drive, byte *buf)
        struct request rq;
 
        ide_init_drive_cmd(&rq);
-       rq.cmd = IDE_DRIVE_TASK;
+       rq.flags = REQ_DRIVE_TASK;
        rq.buffer = buf;
        return ide_do_drive_cmd(drive, &rq, ide_wait);
 }
@@ -2836,6 +2833,13 @@ static int ide_ioctl (struct inode *inode, struct file *file,
                case BLKBSZSET:
                        return blk_ioctl(inode->i_rdev, cmd, arg);
 
+               /*
+                * uniform packet command handling
+                */
+               case CDROMEJECT:
+               case CDROMCLOSETRAY:
+                       return block_ioctl(inode->i_rdev, cmd, arg);
+
                case HDIO_GET_BUSSTATE:
                        if (!capable(CAP_SYS_ADMIN))
                                return -EACCES;
index 963f4f37f93d98996bf76191eda2e6d2b43d4f13..e8b35afd5ed20d60b08637711e21b29d012840d5 100644 (file)
@@ -87,10 +87,10 @@ struct capiminor {
        struct capincci  *nccip;
        unsigned int      minor;
 
-       __u16            applid;
-       __u32            ncci;
-       __u16            datahandle;
-       __u16            msgid;
+       u16              applid;
+       u32              ncci;
+       u16              datahandle;
+       u16              msgid;
 
        struct file      *file;
        struct tty_struct *tty;
@@ -112,7 +112,7 @@ struct capiminor {
        /* transmit path */
        struct datahandle_queue {
                    struct datahandle_queue *next;
-                   __u16                    datahandle;
+                   u16                      datahandle;
        } *ackqueue;
        int nack;
 
@@ -121,7 +121,7 @@ struct capiminor {
 
 struct capincci {
        struct capincci *next;
-       __u32            ncci;
+       u32              ncci;
        struct capidev  *cdev;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
        struct capiminor *minorp;
@@ -131,8 +131,8 @@ struct capincci {
 struct capidev {
        struct capidev *next;
        struct file    *file;
-       __u16           applid;
-       __u16           errcode;
+       u16             applid;
+       u16             errcode;
        unsigned int    minor;
        unsigned        userflags;
 
@@ -166,7 +166,7 @@ static kmem_cache_t *capidh_cachep = 0;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
 /* -------- datahandles --------------------------------------------- */
 
-int capincci_add_ack(struct capiminor *mp, __u16 datahandle)
+static int capincci_add_ack(struct capiminor *mp, u16 datahandle)
 {
        struct datahandle_queue *n, **pp;
 
@@ -184,7 +184,7 @@ int capincci_add_ack(struct capiminor *mp, __u16 datahandle)
        return 0;
 }
 
-int capiminor_del_ack(struct capiminor *mp, __u16 datahandle)
+static int capiminor_del_ack(struct capiminor *mp, u16 datahandle)
 {
        struct datahandle_queue **pp, *p;
 
@@ -200,7 +200,7 @@ int capiminor_del_ack(struct capiminor *mp, __u16 datahandle)
        return -1;
 }
 
-void capiminor_del_all_ack(struct capiminor *mp)
+static void capiminor_del_all_ack(struct capiminor *mp)
 {
        struct datahandle_queue **pp, *p;
 
@@ -216,7 +216,7 @@ void capiminor_del_all_ack(struct capiminor *mp)
 
 /* -------- struct capiminor ---------------------------------------- */
 
-struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
+static struct capiminor *capiminor_alloc(u16 applid, u32 ncci)
 {
        struct capiminor *mp, **pp;
         unsigned int minor = 0;
@@ -257,7 +257,7 @@ struct capiminor *capiminor_alloc(__u16 applid, __u32 ncci)
        return mp;
 }
 
-void capiminor_free(struct capiminor *mp)
+static void capiminor_free(struct capiminor *mp)
 {
        struct capiminor **pp;
 
@@ -283,7 +283,7 @@ void capiminor_free(struct capiminor *mp)
        }
 }
 
-struct capiminor *capiminor_find(unsigned int minor)
+static struct capiminor *capiminor_find(unsigned int minor)
 {
        struct capiminor *p;
        for (p = minors; p && p->minor != minor; p = p->next)
@@ -294,7 +294,7 @@ struct capiminor *capiminor_find(unsigned int minor)
 
 /* -------- struct capincci ----------------------------------------- */
 
-static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
+static struct capincci *capincci_alloc(struct capidev *cdev, u32 ncci)
 {
        struct capincci *np, **pp;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -331,7 +331,7 @@ static struct capincci *capincci_alloc(struct capidev *cdev, __u32 ncci)
         return np;
 }
 
-static void capincci_free(struct capidev *cdev, __u32 ncci)
+static void capincci_free(struct capidev *cdev, u32 ncci)
 {
        struct capincci *np, **pp;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -375,7 +375,7 @@ static void capincci_free(struct capidev *cdev, __u32 ncci)
        }
 }
 
-struct capincci *capincci_find(struct capidev *cdev, __u32 ncci)
+static struct capincci *capincci_find(struct capidev *cdev, u32 ncci)
 {
        struct capincci *p;
 
@@ -426,7 +426,7 @@ static void capidev_free(struct capidev *cdev)
        kmem_cache_free(capidev_cachep, cdev);
 }
 
-static struct capidev *capidev_find(__u16 applid)
+static struct capidev *capidev_find(u16 applid)
 {
        struct capidev *p;
        for (p=capidev_openlist; p; p = p->next) {
@@ -439,13 +439,13 @@ static struct capidev *capidev_find(__u16 applid)
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
 /* -------- handle data queue --------------------------------------- */
 
-struct sk_buff *
+static struct sk_buff *
 gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
 {
        struct sk_buff *nskb;
        nskb = alloc_skb(CAPI_DATA_B3_RESP_LEN, GFP_ATOMIC);
        if (nskb) {
-               __u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
+               u16 datahandle = CAPIMSG_U16(skb->data,CAPIMSG_BASELEN+4+4+2);
                unsigned char *s = skb_put(nskb, CAPI_DATA_B3_RESP_LEN);
                capimsg_setu16(s, 0, CAPI_DATA_B3_RESP_LEN);
                capimsg_setu16(s, 2, mp->applid);
@@ -458,11 +458,11 @@ gen_data_b3_resp_for(struct capiminor *mp, struct sk_buff *skb)
        return nskb;
 }
 
-int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
+static int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
 {
        struct sk_buff *nskb;
        unsigned int datalen;
-       __u16 errcode, datahandle;
+       u16 errcode, datahandle;
 
        datalen = skb->len - CAPIMSG_LEN(skb->data);
        if (mp->tty) {
@@ -538,7 +538,7 @@ int handle_recv_skb(struct capiminor *mp, struct sk_buff *skb)
        return -1;
 }
 
-void handle_minor_recv(struct capiminor *mp)
+static void handle_minor_recv(struct capiminor *mp)
 {
        struct sk_buff *skb;
        while ((skb = skb_dequeue(&mp->inqueue)) != 0) {
@@ -552,13 +552,13 @@ void handle_minor_recv(struct capiminor *mp)
        }
 }
 
-int handle_minor_send(struct capiminor *mp)
+static int handle_minor_send(struct capiminor *mp)
 {
        struct sk_buff *skb;
-       __u16 len;
+       u16 len;
        int count = 0;
-       __u16 errcode;
-       __u16 datahandle;
+       u16 errcode;
+       u16 datahandle;
 
        if (mp->tty && mp->ttyoutstop) {
 #if defined(_DEBUG_DATAFLOW) || defined(_DEBUG_TTYFUNCS)
@@ -569,7 +569,7 @@ int handle_minor_send(struct capiminor *mp)
 
        while ((skb = skb_dequeue(&mp->outqueue)) != 0) {
                datahandle = mp->datahandle;
-               len = (__u16)skb->len;
+               len = (u16)skb->len;
                skb_push(skb, CAPI_DATA_B3_REQ_LEN);
                memset(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
                capimsg_setu16(skb->data, 0, CAPI_DATA_B3_REQ_LEN);
@@ -578,7 +578,7 @@ int handle_minor_send(struct capiminor *mp)
                capimsg_setu8 (skb->data, 5, CAPI_REQ);
                capimsg_setu16(skb->data, 6, mp->msgid++);
                capimsg_setu32(skb->data, 8, mp->ncci); /* NCCI */
-               capimsg_setu32(skb->data, 12, (__u32) skb->data); /* Data32 */
+               capimsg_setu32(skb->data, 12, (u32) skb->data); /* Data32 */
                capimsg_setu16(skb->data, 16, len);     /* Data length */
                capimsg_setu16(skb->data, 18, datahandle);
                capimsg_setu16(skb->data, 20, 0);       /* Flags */
@@ -620,16 +620,16 @@ int handle_minor_send(struct capiminor *mp)
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
 /* -------- function called by lower level -------------------------- */
 
-static void capi_signal(__u16 applid, void *param)
+static void capi_signal(u16 applid, void *param)
 {
        struct capidev *cdev = (struct capidev *)param;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
        struct capiminor *mp;
-       __u16 datahandle;
+       u16 datahandle;
 #endif /* CONFIG_ISDN_CAPI_MIDDLEWARE */
        struct capincci *np;
        struct sk_buff *skb = 0;
-       __u32 ncci;
+       u32 ncci;
 
        (void) (*capifuncs->capi_get_message) (applid, &skb);
        if (!skb) {
@@ -758,7 +758,7 @@ capi_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
        struct capidev *cdev = (struct capidev *)file->private_data;
        struct sk_buff *skb;
        int retval;
-       __u16 mlen;
+       u16 mlen;
 
         if (ppos != &file->f_pos)
                return -ESPIPE;
@@ -998,7 +998,7 @@ capi_ioctl(struct inode *inode, struct file *file,
                                                sizeof(ncci));
                        if (retval)
                                return -EFAULT;
-                       nccip = capincci_find(cdev, (__u32) ncci);
+                       nccip = capincci_find(cdev, (u32) ncci);
                        if (!nccip)
                                return 0;
 #ifdef CONFIG_ISDN_CAPI_MIDDLEWARE
@@ -1023,7 +1023,7 @@ capi_ioctl(struct inode *inode, struct file *file,
                                                sizeof(ncci));
                        if (retval)
                                return -EFAULT;
-                       nccip = capincci_find(cdev, (__u32) ncci);
+                       nccip = capincci_find(cdev, (u32) ncci);
                        if (!nccip || (mp = nccip->minorp) == 0)
                                return -ESRCH;
                        return mp->minor;
@@ -1268,7 +1268,7 @@ static struct file_operations capinc_raw_fops =
 
 /* -------- tty_operations for capincci ----------------------------- */
 
-int capinc_tty_open(struct tty_struct * tty, struct file * file)
+static int capinc_tty_open(struct tty_struct * tty, struct file * file)
 {
        struct capiminor *mp;
 
@@ -1296,7 +1296,7 @@ int capinc_tty_open(struct tty_struct * tty, struct file * file)
        return 0;
 }
 
-void capinc_tty_close(struct tty_struct * tty, struct file * file)
+static void capinc_tty_close(struct tty_struct * tty, struct file * file)
 {
        struct capiminor *mp;
 
@@ -1321,8 +1321,8 @@ void capinc_tty_close(struct tty_struct * tty, struct file * file)
 #endif
 }
 
-int capinc_tty_write(struct tty_struct * tty, int from_user,
-                     const unsigned char *buf, int count)
+static int capinc_tty_write(struct tty_struct * tty, int from_user,
+                           const unsigned char *buf, int count)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
        struct sk_buff *skb;
@@ -1373,7 +1373,7 @@ int capinc_tty_write(struct tty_struct * tty, int from_user,
        return count;
 }
 
-void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
+static void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
        struct sk_buff *skb;
@@ -1410,7 +1410,7 @@ void capinc_tty_put_char(struct tty_struct *tty, unsigned char ch)
        }
 }
 
-void capinc_tty_flush_chars(struct tty_struct *tty)
+static void capinc_tty_flush_chars(struct tty_struct *tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
        struct sk_buff *skb;
@@ -1436,7 +1436,7 @@ void capinc_tty_flush_chars(struct tty_struct *tty)
        (void)handle_minor_recv(mp);
 }
 
-int capinc_tty_write_room(struct tty_struct *tty)
+static int capinc_tty_write_room(struct tty_struct *tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
        int room;
@@ -1454,7 +1454,7 @@ int capinc_tty_write_room(struct tty_struct *tty)
        return room;
 }
 
-int capinc_tty_chars_in_buffer(struct tty_struct *tty)
+static int capinc_tty_chars_in_buffer(struct tty_struct *tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
        if (!mp || !mp->nccip) {
@@ -1472,7 +1472,7 @@ int capinc_tty_chars_in_buffer(struct tty_struct *tty)
        return mp->outbytes;
 }
 
-int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
+static int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
                    unsigned int cmd, unsigned long arg)
 {
        int error = 0;
@@ -1484,14 +1484,14 @@ int capinc_tty_ioctl(struct tty_struct *tty, struct file * file,
        return error;
 }
 
-void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
+static void capinc_tty_set_termios(struct tty_struct *tty, struct termios * old)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_set_termios\n");
 #endif
 }
 
-void capinc_tty_throttle(struct tty_struct * tty)
+static void capinc_tty_throttle(struct tty_struct * tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
 #ifdef _DEBUG_TTYFUNCS
@@ -1501,7 +1501,7 @@ void capinc_tty_throttle(struct tty_struct * tty)
                mp->ttyinstop = 1;
 }
 
-void capinc_tty_unthrottle(struct tty_struct * tty)
+static void capinc_tty_unthrottle(struct tty_struct * tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
 #ifdef _DEBUG_TTYFUNCS
@@ -1513,7 +1513,7 @@ void capinc_tty_unthrottle(struct tty_struct * tty)
        }
 }
 
-void capinc_tty_stop(struct tty_struct *tty)
+static void capinc_tty_stop(struct tty_struct *tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
 #ifdef _DEBUG_TTYFUNCS
@@ -1524,7 +1524,7 @@ void capinc_tty_stop(struct tty_struct *tty)
        }
 }
 
-void capinc_tty_start(struct tty_struct *tty)
+static void capinc_tty_start(struct tty_struct *tty)
 {
        struct capiminor *mp = (struct capiminor *)tty->driver_data;
 #ifdef _DEBUG_TTYFUNCS
@@ -1536,49 +1536,43 @@ void capinc_tty_start(struct tty_struct *tty)
        }
 }
 
-void capinc_tty_hangup(struct tty_struct *tty)
+static void capinc_tty_hangup(struct tty_struct *tty)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_hangup\n");
 #endif
 }
 
-void capinc_tty_break_ctl(struct tty_struct *tty, int state)
+static void capinc_tty_break_ctl(struct tty_struct *tty, int state)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_break_ctl(%d)\n", state);
 #endif
 }
 
-void capinc_tty_flush_buffer(struct tty_struct *tty)
+static void capinc_tty_flush_buffer(struct tty_struct *tty)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_flush_buffer\n");
 #endif
 }
 
-void capinc_tty_set_ldisc(struct tty_struct *tty)
+static void capinc_tty_set_ldisc(struct tty_struct *tty)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_set_ldisc\n");
 #endif
 }
 
-void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
+static void capinc_tty_send_xchar(struct tty_struct *tty, char ch)
 {
 #ifdef _DEBUG_TTYFUNCS
        printk(KERN_DEBUG "capinc_tty_send_xchar(%d)\n", ch);
 #endif
 }
 
-int capinc_tty_read_proc(char *page, char **start, off_t off,
-                         int count, int *eof, void *data)
-{
-       return 0;
-}
-
-int capinc_write_proc(struct file *file, const char *buffer,
-                         unsigned long count, void *data)
+static int capinc_tty_read_proc(char *page, char **start, off_t off,
+                               int count, int *eof, void *data)
 {
        return 0;
 }
@@ -1590,7 +1584,7 @@ static struct tty_struct *capinc_tty_table[CAPINC_NR_PORTS];
 static struct termios *capinc_tty_termios[CAPINC_NR_PORTS];
 static struct termios *capinc_tty_termios_locked[CAPINC_NR_PORTS];
 
-int capinc_tty_init(void)
+static int capinc_tty_init(void)
 {
        struct tty_driver *drv = &capinc_tty_driver;
 
@@ -1648,7 +1642,7 @@ int capinc_tty_init(void)
        return 0;
 }
 
-void capinc_tty_exit(void)
+static void capinc_tty_exit(void)
 {
        struct tty_driver *drv = &capinc_tty_driver;
        int retval;
@@ -1840,7 +1834,7 @@ static int __init alloc_init(void)
        return 0;
 }
 
-static void lower_callback(unsigned int cmd, __u32 contr, void *data)
+static void lower_callback(unsigned int cmd, u32 contr, void *data)
 {
        struct capi_ncciinfo *np;
        struct capidev *cdev;
index 78122d1a3b8c33030209dd7bd37b8651db8d874e..556223f4e080227dbfa976fda9cf98f6145baec3 100644 (file)
@@ -168,7 +168,7 @@ isdn_divert_close(struct inode *ino, struct file *filep)
                        divert_info_head = divert_info_head->next;
                        kfree(inf);
                }
-       spin_unlock_irq( &divert_info_lock, flags );
+       spin_unlock_irqrestore( &divert_info_lock, flags );
        return (0);
 }                              /* isdn_divert_close */
 
@@ -261,6 +261,7 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
 #ifdef CONFIG_PROC_FS
 static struct file_operations isdn_fops =
 {
+       owner:          THIS_MODULE,
        llseek:         no_llseek,
        read:           isdn_divert_read,
        write:          isdn_divert_write,
index f2b4d0452139b3f2b87f92a0372408769ae7cbf5..77d3a50b922a6238816cd28f663f32bc8d7284cb 100644 (file)
@@ -808,7 +808,9 @@ void        DivasDoDpc(void *pData)
        
        while(i--)
        {
-               DivaDoCardDpc(card++);
+            if (card->state == DIA_RUNNING)
+               DivaDoCardDpc(card);
+            card++;
        }
 }
 
index b7c0adb47e3382e4727e0c1732cd5e9d54e2cd95..c0f818d0c5e2cb6c6d3c89955a1afd538fc56630 100644 (file)
@@ -1550,7 +1550,7 @@ int eicon_mca_find_card(int type,          /* type-idx of eicon-card          */
                };
        };
        /* all adapter flavors checked without match, finito with:            */
-        return ENODEV;
+        return -ENODEV;
 };
 
 
@@ -1597,14 +1597,14 @@ int eicon_mca_probe(int slot,  /* slot-nr where the card was detected         */
                                membase = cards_membase;
                        } else {
                                if (membase != cards_membase)
-                                       return ENODEV;
+                                       return -ENODEV;
                        };
                        cards_irq=irq_array[((adf_pos0 & 0xC)>>2)];
                        if (irq == -1) { 
                                irq = cards_irq;
                        } else {
                                if (irq != cards_irq)
-                                       return ENODEV;
+                                       return -ENODEV;
                        };
                        cards_io= 0xC00 + ((adf_pos0>>4)*0x10);
                        type = EICON_CTYPE_ISAPRI; 
@@ -1616,14 +1616,14 @@ int eicon_mca_probe(int slot,  /* slot-nr where the card was detected         */
                                membase = cards_membase;
                        } else {
                                if (membase != cards_membase)
-                                       return ENODEV;
+                                       return -ENODEV;
                        };
                        cards_irq=irq_array[((adf_pos0 & 0xC)>>2)];
                        if (irq == -1) { 
                                irq = cards_irq;
                        } else {
                                if (irq != cards_irq)
-                                       return ENODEV;
+                                       return -ENODEV;
                        };
 
                        cards_io= 0xC00 + ((adf_pos0>>4)*0x10);
@@ -1637,12 +1637,12 @@ int eicon_mca_probe(int slot,  /* slot-nr where the card was detected         */
                                irq = cards_irq;
                        } else {
                                if (irq != cards_irq)
-                                       return ENODEV;
+                                       return -ENODEV;
                        };
                        type = 0; 
                        break;
                default:
-                       return  ENODEV;
+                       return -ENODEV;
        };
        /* matching membase & irq */
        if ( 1 == eicon_addcard(type, membase, irq, id, 0)) { 
@@ -1661,7 +1661,7 @@ int eicon_mca_probe(int slot,  /* slot-nr where the card was detected         */
                        cards->mca_slot+1);
                return  0 ; /* eicon_addcard added a card */
        } else {
-               return ENODEV;
+               return -ENODEV;
        };
 };
 #endif /* CONFIG_MCA */
index 479e18fa8e4de98d9959b1223b87cef08d9378a5..a8359bb8100b0a266be1e6ed1b57175c33bd916e 100644 (file)
@@ -533,7 +533,7 @@ static inline void hdlc_xpr_irq(struct fritz_bcs *bcs)
        dev_kfree_skb_irq(skb);
 }
 
-static void hdlc_irq(struct fritz_bcs *bcs, u32 stat)
+static void hdlc_irq_one(struct fritz_bcs *bcs, u32 stat)
 {
        DBG(0x10, "ch%d stat %#x", bcs->channel, stat);
        if (stat & HDLC_INT_RPR) {
@@ -550,7 +550,7 @@ static void hdlc_irq(struct fritz_bcs *bcs, u32 stat)
        }
 }
 
-static inline void hdlc_interrupt(struct fritz_adapter *adapter)
+static inline void hdlc_irq(struct fritz_adapter *adapter)
 {
        int nr;
        u32 stat;
@@ -559,7 +559,7 @@ static inline void hdlc_interrupt(struct fritz_adapter *adapter)
                stat = adapter->read_hdlc_status(adapter, nr);
                DBG(0x10, "HDLC %c stat %#x", 'A' + nr, stat);
                if (stat & HDLC_INT_MASK)
-                       hdlc_irq(&adapter->bcs[nr], stat);
+                       hdlc_irq_one(&adapter->bcs[nr], stat);
        }
 }
 
@@ -642,10 +642,10 @@ static void fcpci2_irq(int intno, void *dev, struct pt_regs *regs)
                return;
        DBG(2, "STATUS0 %#x", val);
        if (val & AVM_STATUS0_IRQ_ISAC)
-               isacsx_interrupt(&adapter->isac);
+               isacsx_irq(&adapter->isac);
 
        if (val & AVM_STATUS0_IRQ_HDLC)
-               hdlc_interrupt(adapter);
+               hdlc_irq(adapter);
 }
 
 static void fcpci_irq(int intno, void *dev, struct pt_regs *regs)
@@ -659,10 +659,10 @@ static void fcpci_irq(int intno, void *dev, struct pt_regs *regs)
                return;
        DBG(2, "sval %#x", sval);
        if (!(sval & AVM_STATUS0_IRQ_ISAC))
-               isac_interrupt(&adapter->isac);
+               isac_irq(&adapter->isac);
 
        if (!(sval & AVM_STATUS0_IRQ_HDLC))
-               hdlc_interrupt(adapter);
+               hdlc_irq(adapter);
 }
 
 // ----------------------------------------------------------------------
index 9a6a5065b89aeb2c39b0b3187af1cf22e46d80f4..29a96edf399ffb50009ee2e835fcf3c49d6adc19 100644 (file)
@@ -601,7 +601,7 @@ static inline void isac_exi_interrupt(struct isac *isac)
        }
 }
 
-void isac_interrupt(struct isac *isac)
+void isac_irq(struct isac *isac)
 {
        unsigned char val;
 
@@ -741,7 +741,7 @@ static inline void isacsx_icd_interrupt(struct isac *isac)
        }
 }
 
-void isacsx_interrupt(struct isac *isac)
+void isacsx_irq(struct isac *isac)
 {
        unsigned char val;
 
@@ -887,10 +887,10 @@ EXPORT_SYMBOL(isac_init);
 EXPORT_SYMBOL(isac_d_l2l1);
 
 EXPORT_SYMBOL(isacsx_setup);
-EXPORT_SYMBOL(isacsx_interrupt);
+EXPORT_SYMBOL(isacsx_irq);
 
 EXPORT_SYMBOL(isac_setup);
-EXPORT_SYMBOL(isac_interrupt);
+EXPORT_SYMBOL(isac_irq);
 
 module_init(hisax_isac_init);
 module_exit(hisax_isac_exit);
index 6b8d2dfa05d817da70343f960ab4018c94e62284..08890cf4d9239645c78907bf5e7fa525e3be77dd 100644 (file)
@@ -37,9 +37,9 @@ void isac_init(struct isac *isac);
 void isac_d_l2l1(struct hisax_if *hisax_d_if, int pr, void *arg);
 
 void isac_setup(struct isac *isac);
-void isac_interrupt(struct isac *isac);
+void isac_irq(struct isac *isac);
 
 void isacsx_setup(struct isac *isac);
-void isacsx_interrupt(struct isac *isac);
+void isacsx_irq(struct isac *isac);
 
 #endif
index 17b2a4325c3f127f4b054d3d2ae35d6c43f67a3a..0aa033579d6f9f700db0ba085aed0d4acc32640d 100644 (file)
@@ -275,7 +275,7 @@ static int __devinit st5481_setup_b_out(struct st5481_bcs *bcs)
                                      usb_b_out_complete, bcs);
 }
 
-static void __devexit st5481_release_b_out(struct st5481_bcs *bcs)
+static void st5481_release_b_out(struct st5481_bcs *bcs)
 {
        struct st5481_b_out *b_out = &bcs->b_out;
 
@@ -316,7 +316,7 @@ int __devinit st5481_setup_b(struct st5481_bcs *bcs)
 /*
  * Release buffers and URBs for the B channels
  */
-void __devexit st5481_release_b(struct st5481_bcs *bcs)
+void st5481_release_b(struct st5481_bcs *bcs)
 {
        DBG(4,"");
 
index ce751cc46665a772e904821a1c85cf58d2810260..1079bae6eacd7b9d9d2971e1c882d5dad2e10db7 100644 (file)
@@ -673,7 +673,7 @@ static int __devinit st5481_setup_d_out(struct st5481_adapter *adapter)
                                      usb_d_out_complete, adapter);
 }
 
-static void __devexit st5481_release_d_out(struct st5481_adapter *adapter)
+static void st5481_release_d_out(struct st5481_adapter *adapter)
 {
        struct st5481_d_out *d_out = &adapter->d_out;
 
@@ -723,7 +723,7 @@ int __devinit st5481_setup_d(struct st5481_adapter *adapter)
        return retval;
 }
 
-void __devexit st5481_release_d(struct st5481_adapter *adapter)
+void st5481_release_d(struct st5481_adapter *adapter)
 {
        DBG(2,"");
 
index 859c164f5ae9de97c01418d7a0b6d782c4e68e66..a3098071f451f28374c5719333894ffb6fa815a2 100644 (file)
@@ -307,7 +307,7 @@ int __devinit st5481_setup_usb(struct st5481_adapter *adapter)
  * Release buffers and URBs for the interrupt and control
  * endpoint.
  */
-void __devexit st5481_release_usb(struct st5481_adapter *adapter)
+void st5481_release_usb(struct st5481_adapter *adapter)
 {
        struct st5481_intr *intr = &adapter->intr;
        struct st5481_ctrl *ctrl = &adapter->ctrl;
@@ -443,7 +443,7 @@ st5481_setup_isocpipes(struct urb* urb[2], struct usb_device *dev,
        return retval;
 }
 
-void __devexit st5481_release_isocpipes(struct urb* urb[2])
+void st5481_release_isocpipes(struct urb* urb[2])
 {
        int j;
 
@@ -547,7 +547,7 @@ int __devinit st5481_setup_in(struct st5481_in *in)
        return retval;
 }
 
-void __devexit st5481_release_in(struct st5481_in *in)
+void st5481_release_in(struct st5481_in *in)
 {
        DBG(2,"");
 
diff --git a/drivers/isdn/hysdn/hysdn_procfs.c b/drivers/isdn/hysdn/hysdn_procfs.c
deleted file mode 100644 (file)
index 39c7bd8..0000000
+++ /dev/null
@@ -1,471 +0,0 @@
-/* $Id: hysdn_procfs.c,v 1.1 2000/02/10 19:45:18 werner Exp $
-
- * Linux driver for HYSDN cards, /proc/net filesystem log functions.
- * written by Werner Cornelius (werner@titro.de) for Hypercope GmbH
- *
- * Copyright 1999  by Werner Cornelius (werner@titro.de)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Log: hysdn_procfs.c,v $
- * Revision 1.1  2000/02/10 19:45:18  werner
- *
- * Initial release
- *
- *
- */
-
-#define __NO_VERSION__
-#include <linux/module.h>
-#include <linux/version.h>
-#include <linux/poll.h>
-#include <linux/proc_fs.h>
-#include <linux/pci.h>
-#include <linux/smp_lock.h>
-
-#include "hysdn_defs.h"
-
-static char *hysdn_procfs_revision = "$Revision: 1.1 $";
-
-#define INFO_OUT_LEN 80                /* length of info line including lf */
-
-/*************************************************/
-/* structure keeping ascii log for device output */
-/*************************************************/
-struct log_data {
-       struct log_data *next;
-       ulong usage_cnt;        /* number of files still to work */
-       void *proc_ctrl;        /* pointer to own control procdata structure */
-       char log_start[2];      /* log string start (final len aligned by size) */
-};
-
-/**********************************************/
-/* structure holding proc entrys for one card */
-/**********************************************/
-struct procdata {
-       struct proc_dir_entry *log;     /* log entry */
-       char log_name[15];      /* log filename */
-       struct log_data *log_head, *log_tail;   /* head and tail for queue */
-       int if_used;            /* open count for interface */
-       wait_queue_head_t rd_queue;
-};
-
-/********************************************/
-/* put an log buffer into the log queue.    */
-/* This buffer will be kept until all files */
-/* opened for read got the contents.        */
-/* Flushes buffers not longer in use.       */
-/********************************************/
-void
-put_log_buffer(hysdn_card * card, char *cp)
-{
-       struct log_data *ib;
-       struct procdata *pd = card->procfs;
-       int flags;
-
-       if (!pd)
-               return;
-       if (!cp)
-               return;
-       if (!*cp)
-               return;
-       if (pd->if_used <= 0)
-               return;         /* no open file for read */
-
-       if (!(ib = (struct log_data *) kmalloc(sizeof(struct log_data) + strlen(cp), GFP_ATOMIC)))
-                return;        /* no memory */
-       strcpy(ib->log_start, cp);      /* set output string */
-       ib->next = NULL;
-       ib->proc_ctrl = pd;     /* point to own control structure */
-       save_flags(flags);
-       cli();
-       ib->usage_cnt = pd->if_used;
-       if (!pd->log_head)
-               pd->log_head = ib;      /* new head */
-       else
-               pd->log_tail->next = ib;        /* follows existing messages */
-       pd->log_tail = ib;      /* new tail */
-       restore_flags(flags);
-
-       /* delete old entrys */
-       while (pd->log_head->next) {
-               if ((pd->log_head->usage_cnt <= 0) &&
-                   (pd->log_head->next->usage_cnt <= 0)) {
-                       ib = pd->log_head;
-                       pd->log_head = pd->log_head->next;
-                       kfree(ib);
-               } else
-                       break;
-       }                       /* pd->log_head->next */
-       wake_up_interruptible(&(pd->rd_queue));         /* announce new entry */
-}                              /* put_log_buffer */
-
-
-/**********************************/
-/* log file operations and tables */
-/**********************************/
-
-/****************************************/
-/* write log file -> set log level bits */
-/****************************************/
-static ssize_t
-hysdn_log_write(struct file *file, const char *buf, size_t count, loff_t * off)
-{
-       int retval;
-       hysdn_card *card = (hysdn_card *) file->private_data;
-
-       if (&file->f_pos != off)        /* fs error check */
-               return (-ESPIPE);
-
-       if ((retval = pof_boot_write(card, buf, count)) < 0)
-               retval = -EFAULT;       /* an error occurred */
-
-       return (retval);
-}                              /* hysdn_log_write */
-
-/******************/
-/* read log file */
-/******************/
-static ssize_t
-hysdn_log_read(struct file *file, char *buf, size_t count, loff_t * off)
-{
-       struct log_data *inf;
-       int len;
-       word ino;
-       struct procdata *pd;
-       hysdn_card *card;
-
-       if (!*((struct log_data **) file->private_data)) {
-               if (file->f_flags & O_NONBLOCK)
-                       return (-EAGAIN);
-
-               /* sorry, but we need to search the card */
-               ino = file->f_dentry->d_inode->i_ino & 0xFFFF;  /* low-ino */
-               card = card_root;
-               while (card) {
-                       pd = card->procfs;
-                       if (pd->log->low_ino == ino)
-                               break;
-                       card = card->next;      /* search next entry */
-               }
-               if (card)
-                       interruptible_sleep_on(&(pd->rd_queue));
-               else
-                       return (-EAGAIN);
-
-       }
-       if (!(inf = *((struct log_data **) file->private_data)))
-               return (0);
-
-       inf->usage_cnt--;       /* new usage count */
-       (struct log_data **) file->private_data = &inf->next;   /* next structure */
-       if ((len = strlen(inf->log_start)) <= count) {
-               if (copy_to_user(buf, inf->log_start, len))
-                       return -EFAULT;
-               file->f_pos += len;
-               return (len);
-       }
-       return (0);
-}                              /* hysdn_log_read */
-
-/******************/
-/* open log file */
-/******************/
-static int
-hysdn_log_open(struct inode *ino, struct file *filep)
-{
-       hysdn_card *card;
-       struct procdata *pd;
-       ulong flags;
-
-       lock_kernel();
-       card = card_root;
-       while (card) {
-               pd = card->procfs;
-               if (pd->log->low_ino == (ino->i_ino & 0xFFFF))
-                       break;
-               card = card->next;      /* search next entry */
-       }
-       if (!card) {
-               unlock_kernel();
-               return (-ENODEV);       /* device is unknown/invalid */
-       }
-       filep->private_data = card;     /* remember our own card */
-
-       if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
-               /* write only access -> boot pof data */
-               if (pof_boot_open(card)) {
-                       unlock_kernel();
-                       return (-EPERM);        /* no permission this time */
-               }
-       } else if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_READ) {
-
-               /* read access -> log/debug read */
-               save_flags(flags);
-               cli();
-               pd->if_used++;
-               if (pd->log_head)
-                       (struct log_data **) filep->private_data = &(pd->log_tail->next);
-               else
-                       (struct log_data **) filep->private_data = &(pd->log_head);
-               restore_flags(flags);
-
-       } else {                /* simultaneous read/write access forbidden ! */
-               unlock_kernel();
-               return (-EPERM);        /* no permission this time */
-       }
-       unlock_kernel();
-       return (0);
-}                              /* hysdn_log_open */
-
-/*******************************************************************************/
-/* close a cardlog file. If the file has been opened for exclusive write it is */
-/* assumed as pof data input and the pof loader is noticed about.              */
-/* Otherwise file is handled as log output. In this case the interface usage   */
-/* count is decremented and all buffers are noticed of closing. If this file   */
-/* was the last one to be closed, all buffers are freed.                       */
-/*******************************************************************************/
-static int
-hysdn_log_close(struct inode *ino, struct file *filep)
-{
-       struct log_data *inf;
-       struct procdata *pd;
-       hysdn_card *card;
-       int flags, retval = 0;
-
-       lock_kernel();
-       if ((filep->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE) {
-               /* write only access -> write debug completely written */
-               retval = 0;     /* success */
-       } else {
-               /* read access -> log/debug read, mark one further file as closed */
-
-               pd = NULL;
-               save_flags(flags);
-               cli();
-               inf = *((struct log_data **) filep->private_data);      /* get first log entry */
-               if (inf)
-                       pd = (struct procdata *) inf->proc_ctrl;        /* still entries there */
-               else {
-                       /* no info available -> search card */
-                       card = card_root;
-                       while (card) {
-                               pd = card->procfs;
-                               if (pd->log->low_ino == (ino->i_ino & 0xFFFF))
-                                       break;
-                               card = card->next;      /* search next entry */
-                       }
-                       if (card)
-                               pd = card->procfs;      /* pointer to procfs ctrl */
-               }
-               if (pd)
-                       pd->if_used--;  /* decrement interface usage count by one */
-
-               while (inf) {
-                       inf->usage_cnt--;       /* decrement usage count for buffers */
-                       inf = inf->next;
-               }
-               restore_flags(flags);
-
-               if (pd)
-                       if (pd->if_used <= 0)   /* delete buffers if last file closed */
-                               while (pd->log_head) {
-                                       inf = pd->log_head;
-                                       pd->log_head = pd->log_head->next;
-                                       kfree(inf);
-                               }
-       }                       /* read access */
-
-       unlock_kernel();
-       return (retval);
-}                              /* hysdn_log_close */
-
-/*************************************************/
-/* select/poll routine to be able using select() */
-/*************************************************/
-static unsigned int
-hysdn_log_poll(struct file *file, poll_table * wait)
-{
-       unsigned int mask = 0;
-       word ino;
-       hysdn_card *card;
-       struct procdata *pd;
-
-       if ((file->f_mode & (FMODE_READ | FMODE_WRITE)) == FMODE_WRITE)
-               return (mask);  /* no polling for write supported */
-
-       /* we need to search the card */
-       ino = file->f_dentry->d_inode->i_ino & 0xFFFF;  /* low-ino */
-       card = card_root;
-       while (card) {
-               pd = card->procfs;
-               if (pd->log->low_ino == ino)
-                       break;
-               card = card->next;      /* search next entry */
-       }
-       if (!card)
-               return (mask);  /* card not found */
-
-       poll_wait(file, &(pd->rd_queue), wait);
-
-       if (*((struct log_data **) file->private_data))
-               mask |= POLLIN | POLLRDNORM;
-
-       return mask;
-}                              /* hysdn_log_poll */
-
-/**************************************************/
-/* table for log filesystem functions defined above. */
-/**************************************************/
-static struct file_operations log_fops =
-{
-       llseek:         no_llseek,
-       read:           hysdn_log_read,
-       write:          hysdn_log_write,
-       poll:           hysdn_log_poll,
-       open:           hysdn_log_open,
-       release:        hysdn_log_close,
-};
-
-/*****************************************/
-/* Output info data to the cardinfo file */
-/*****************************************/
-static int
-info_read(char *buffer, char **start, off_t offset, int length, int *eof, void *data)
-{
-       char tmp[INFO_OUT_LEN * 11 + 2];
-       int i;
-       char *cp;
-       hysdn_card *card;
-
-       sprintf(tmp, "id bus slot type irq iobase plx-mem    dp-mem     boot device");
-       cp = tmp;               /* start of string */
-       while (*cp)
-               cp++;
-       while (((cp - tmp) % (INFO_OUT_LEN + 1)) != INFO_OUT_LEN)
-               *cp++ = ' ';
-       *cp++ = '\n';
-
-       card = card_root;       /* start of list */
-       while (card) {
-               sprintf(cp, "%d  %3d %4d %4d %3d 0x%04x 0x%08x 0x%08x",
-                       card->myid,
-                       card->bus,
-                       PCI_SLOT(card->devfn),
-                       card->brdtype,
-                       card->irq,
-                       card->iobase,
-                       card->plxbase,
-                       card->membase);
-               card = card->next;
-               while (*cp)
-                       cp++;
-               while (((cp - tmp) % (INFO_OUT_LEN + 1)) != INFO_OUT_LEN)
-                       *cp++ = ' ';
-               *cp++ = '\n';
-       }
-
-       i = cp - tmp;
-       *start = buffer;
-       if (offset + length > i) {
-               length = i - offset;
-               *eof = 1;
-       } else if (offset > i) {
-               length = 0;
-               *eof = 1;
-       }
-       cp = tmp + offset;
-
-       if (length > 0) {
-               /*   start_bh_atomic(); */
-               memcpy(buffer, cp, length);
-               /* end_bh_atomic(); */
-               return length;
-       }
-       return 0;
-}                              /* info_read */
-
-/*****************************/
-/* hysdn subdir in /proc/net */
-/*****************************/
-static struct proc_dir_entry *hysdn_proc_entry = NULL;
-static struct proc_dir_entry *hysdn_info_entry = NULL;
-
-/***************************************************************************************/
-/* hysdn_procfs_init is called when the module is loaded and after the cards have been */
-/* detected. The needed proc dir and card entries are created.                         */
-/***************************************************************************************/
-int
-hysdn_procfs_init(void)
-{
-       struct procdata *pd;
-       hysdn_card *card;
-
-       hysdn_proc_entry = create_proc_entry(PROC_SUBDIR_NAME, S_IFDIR | S_IRUGO | S_IXUGO, proc_net);
-       if (!hysdn_proc_entry) {
-               printk(KERN_ERR "HYSDN: unable to create hysdn subdir\n");
-               return (-1);
-       }
-       hysdn_info_entry = create_proc_entry("cardinfo", 0, hysdn_proc_entry);
-       if (hysdn_info_entry)
-               hysdn_info_entry->read_proc = info_read;        /* read info function */
-
-       /* create all cardlog proc entries */
-
-       card = card_root;       /* start with first card */
-       while (card) {
-               if ((pd = (struct procdata *) kmalloc(sizeof(struct procdata), GFP_KERNEL)) != NULL) {
-                       memset(pd, 0, sizeof(struct procdata));
-
-                       sprintf(pd->log_name, "%s%d", PROC_LOG_BASENAME, card->myid);
-                       if ((pd->log = create_proc_entry(pd->log_name, S_IFREG | S_IRUGO | S_IWUSR, hysdn_proc_entry)) != NULL) {
-                               pd->log->proc_fops = &log_fops; /* set new operations table */
-                               pd->log->owner = THIS_MODULE;
-                       }
-
-                       init_waitqueue_head(&(pd->rd_queue));
-
-                       card->procfs = (void *) pd;     /* remember procfs structure */
-               }
-               card = card->next;      /* point to next card */
-       }
-
-       printk(KERN_NOTICE "HYSDN: procfs Rev. %s initialised\n", hysdn_getrev(hysdn_procfs_revision));
-       return (0);
-}                              /* hysdn_procfs_init */
-
-/***************************************************************************************/
-/* hysdn_procfs_release is called when the module is unloaded and before the cards     */
-/* resources are released. The module counter is assumed to be 0 !                     */
-/***************************************************************************************/
-void
-hysdn_procfs_release(void)
-{
-       struct procdata *pd;
-       hysdn_card *card;
-
-       card = card_root;       /* start with first card */
-       while (card) {
-               if ((pd = (struct procdata *) card->procfs) != NULL) {
-                       if (pd->log)
-                               remove_proc_entry(pd->log_name, hysdn_proc_entry);
-                       kfree(pd);      /* release memory */
-               }
-               card = card->next;      /* point to next card */
-       }
-
-       remove_proc_entry("cardinfo", hysdn_proc_entry);
-       remove_proc_entry(PROC_SUBDIR_NAME, proc_net);
-}                              /* hysdn_procfs_release */
index 481308e6c0cbba8635ace8a717eddea2c88bf3ed..a028f2ed7d2112fcbfe7785d50792552512ff081 100644 (file)
@@ -74,7 +74,6 @@ struct saa7146
         unsigned int nr;
        unsigned long irq;          /* IRQ used by SAA7146 card */
        unsigned short id;
-       struct i2c_bus i2c;
        struct pci_dev *dev;
        unsigned char revision;
        unsigned char boardcfg[64];     /* 64 bytes of config from eeprom */
index 9b099f57966d3785c52276e31cdc0ef011585ab4..ad8250401a89cff9bfd438a7a01f70addf68ae65 100644 (file)
@@ -45,7 +45,6 @@
 #include <asm/uaccess.h>
 #include <linux/vmalloc.h>
 #include <linux/videodev.h>
-#include <linux/i2c-old.h>
 
 #include "saa7146.h"
 #include "saa7146reg.h"
@@ -142,14 +141,13 @@ static void I2CWipe(struct saa7146 *saa)
             !(saaread(SAA7146_MC2) & SAA7146_MC2_UPLD_I2C); i++)
                schedule();
 }
+
 /* read I2C */
-static int I2CRead(struct i2c_bus *bus, unsigned char addr,
+static int I2CRead(struct saa7146 *saa, unsigned char addr,
                   unsigned char subaddr, int dosub)
 {
-       struct saa7146 *saa = (struct saa7146 *) bus->data;
        int i;
 
-
        if (saaread(SAA7146_I2C_STATUS) & 0x3c)
                I2CWipe(saa);
        for (i = 0; i < 1000 &&
@@ -194,17 +192,12 @@ static int I2CRead(struct i2c_bus *bus, unsigned char addr,
                printk("i2c read timeout\n");
        return ((saaread(SAA7146_I2C_TRANSFER) >> 24) & 0xff);
 }
-static int I2CReadOld(struct i2c_bus *bus, unsigned char addr)
-{
-       return I2CRead(bus, addr, 0, 0);
-}
 
 /* set both to write both bytes, reset it to write only b1 */
 
-static int I2CWrite(struct i2c_bus *bus, unsigned char addr, unsigned char b1,
+static int I2CWrite(struct saa7146 *saa, unsigned char addr, unsigned char b1,
                    unsigned char b2, int both)
 {
-       struct saa7146 *saa = (struct saa7146 *) bus->data;
        int i;
        u32 data;
 
@@ -226,15 +219,14 @@ static int I2CWrite(struct i2c_bus *bus, unsigned char addr, unsigned char b1,
        return 0;
 }
 
-static void attach_inform(struct i2c_bus *bus, int id)
+static void attach_inform(struct saa7146 *saa, int id)
 {
-       struct saa7146 *saa = (struct saa7146 *) bus->data;
        int i;
 
        DEBUG(printk(KERN_DEBUG "stradis%d: i2c: device found=%02x\n", saa->nr, id));
        if (id == 0xa0) { /* we have rev2 or later board, fill in info */
                for (i = 0; i < 64; i++)
-                       saa->boardcfg[i] = I2CRead(bus, 0xa0, i, 1);
+                       saa->boardcfg[i] = I2CRead(saa, 0xa0, i, 1);
 #ifdef USE_RESCUE_EEPROM_SDM275
                if (saa->boardcfg[0] != 0) {
                        printk("stradis%d: WARNING: EEPROM STORED VALUES HAVE BEEN IGNORED\n", saa->nr);
@@ -250,35 +242,20 @@ static void attach_inform(struct i2c_bus *bus, int id)
        }
 }
 
-static void detach_inform(struct i2c_bus *bus, int id)
+static void detach_inform(struct saa7146 *saa, int id)
 {
-       struct saa7146 *saa = (struct saa7146 *) bus->data;
        int i;
        i = saa->nr;
 }
 
-static void I2CBusScan(struct i2c_bus *bus)
+static void I2CBusScan(struct saa7146 *saa)
 {
        int i;
        for (i = 0; i < 0xff; i += 2)
-               if ((I2CRead(bus, i, 0, 0)) >= 0)
-                       attach_inform(bus, i);
+               if ((I2CRead(saa, i, 0, 0)) >= 0)
+                       attach_inform(saa, i);
 }
 
-static struct i2c_bus saa7146_i2c_bus_template =
-{
-       "saa7146",
-       I2C_BUSID_BT848,
-       NULL,
-       SPIN_LOCK_UNLOCKED,
-       attach_inform,
-       detach_inform,
-       NULL,
-       NULL,
-       I2CReadOld,
-       I2CWrite,
-};
-
 static int debiwait_maxwait = 0;
 
 static int wait_for_debi_done(struct saa7146 *saa)
@@ -664,10 +641,8 @@ static int ibm_send_command(struct saa7146 *saa,
 
 static void cs4341_setlevel(struct saa7146 *saa, int left, int right)
 {
-       I2CWrite(&(saa->i2c), 0x22, 0x03,
-                left > 94 ? 94 : left, 2);
-       I2CWrite(&(saa->i2c), 0x22, 0x04,
-                right > 94 ? 94 : right, 2);
+       I2CWrite(saa, 0x22, 0x03, left > 94 ? 94 : left, 2);
+       I2CWrite(saa, 0x22, 0x04, right > 94 ? 94 : right, 2);
 }
 
 static void initialize_cs4341(struct saa7146 *saa)
@@ -676,15 +651,15 @@ static void initialize_cs4341(struct saa7146 *saa)
        for (i = 0; i < 200; i++) {
                /* auto mute off, power on, no de-emphasis */
                /* I2S data up to 24-bit 64xFs internal SCLK */
-               I2CWrite(&(saa->i2c), 0x22, 0x01, 0x11, 2);
+               I2CWrite(saa, 0x22, 0x01, 0x11, 2);
                /* ATAPI mixer settings */
-               I2CWrite(&(saa->i2c), 0x22, 0x02, 0x49, 2);
+               I2CWrite(saa, 0x22, 0x02, 0x49, 2);
                /* attenuation left 3db */
-               I2CWrite(&(saa->i2c), 0x22, 0x03, 0x00, 2);
+               I2CWrite(saa, 0x22, 0x03, 0x00, 2);
                /* attenuation right 3db */
-               I2CWrite(&(saa->i2c), 0x22, 0x04, 0x00, 2);
-               I2CWrite(&(saa->i2c), 0x22, 0x01, 0x10, 2);
-               if (I2CRead(&(saa->i2c), 0x22, 0x02, 1) == 0x49)
+               I2CWrite(saa, 0x22, 0x04, 0x00, 2);
+               I2CWrite(saa, 0x22, 0x01, 0x10, 2);
+               if (I2CRead(saa, 0x22, 0x02, 1) == 0x49)
                        break;
                schedule();
        }
@@ -701,10 +676,10 @@ static void initialize_cs8420(struct saa7146 *saa, int pro)
        else
                sequence = mode8420con;
        for (i = 0; i < INIT8420LEN; i++)
-               I2CWrite(&(saa->i2c), 0x20, init8420[i * 2],
+               I2CWrite(saa, 0x20, init8420[i * 2],
                         init8420[i * 2 + 1], 2);
        for (i = 0; i < MODE8420LEN; i++)
-               I2CWrite(&(saa->i2c), 0x20, sequence[i * 2],
+               I2CWrite(saa, 0x20, sequence[i * 2],
                         sequence[i * 2 + 1], 2);
        printk("stradis%d: CS8420 initialized\n", saa->nr);
 }
@@ -722,39 +697,39 @@ static void initialize_saa7121(struct saa7146 *saa, int dopal)
        for (i = 0; i < INIT7121LEN; i++) {
                if (NewCard) {  /* handle new card encoder differences */
                        if (sequence[i*2] == 0x3a)
-                               I2CWrite(&(saa->i2c), 0x88, 0x3a, 0x13, 2);
+                               I2CWrite(saa, 0x88, 0x3a, 0x13, 2);
                        else if (sequence[i*2] == 0x6b)
-                               I2CWrite(&(saa->i2c), 0x88, 0x6b, 0x20, 2);
+                               I2CWrite(saa, 0x88, 0x6b, 0x20, 2);
                        else if (sequence[i*2] == 0x6c)
-                               I2CWrite(&(saa->i2c), 0x88, 0x6c,
+                               I2CWrite(saa, 0x88, 0x6c,
                                         dopal ? 0x09 : 0xf5, 2);
                        else if (sequence[i*2] == 0x6d)
-                               I2CWrite(&(saa->i2c), 0x88, 0x6d,
+                               I2CWrite(saa, 0x88, 0x6d,
                                         dopal ? 0x20 : 0x00, 2);
                        else if (sequence[i*2] == 0x7a)
-                               I2CWrite(&(saa->i2c), 0x88, 0x7a,
+                               I2CWrite(saa, 0x88, 0x7a,
                                         dopal ? (PALFirstActive - 1) :
                                         (NTSCFirstActive - 4), 2);
                        else if (sequence[i*2] == 0x7b)
-                               I2CWrite(&(saa->i2c), 0x88, 0x7b,
+                               I2CWrite(saa, 0x88, 0x7b,
                                         dopal ? PALLastActive :
                                         NTSCLastActive, 2);
-                       else I2CWrite(&(saa->i2c), 0x88, sequence[i * 2],
+                       else I2CWrite(saa, 0x88, sequence[i * 2],
                                 sequence[i * 2 + 1], 2);
                } else {
                        if (sequence[i*2] == 0x6b && mod)
-                               I2CWrite(&(saa->i2c), 0x88, 0x6b, 
+                               I2CWrite(saa, 0x88, 0x6b, 
                                        (sequence[i * 2 + 1] ^ 0x09), 2);
                        else if (sequence[i*2] == 0x7a)
-                               I2CWrite(&(saa->i2c), 0x88, 0x7a,
+                               I2CWrite(saa, 0x88, 0x7a,
                                         dopal ? (PALFirstActive - 1) :
                                         (NTSCFirstActive - 4), 2);
                        else if (sequence[i*2] == 0x7b)
-                               I2CWrite(&(saa->i2c), 0x88, 0x7b,
+                               I2CWrite(saa, 0x88, 0x7b,
                                         dopal ? PALLastActive :
                                         NTSCLastActive, 2);
                        else
-                               I2CWrite(&(saa->i2c), 0x88, sequence[i * 2],
+                               I2CWrite(saa, 0x88, sequence[i * 2],
                                         sequence[i * 2 + 1], 2);
                }
        }
@@ -2060,10 +2035,7 @@ static int configure_saa7146(struct pci_dev *dev, int num)
        if (!saa->saa7146_mem)
                return -EIO;
 
-       memcpy(&(saa->i2c), &saa7146_i2c_bus_template, sizeof(struct i2c_bus));
        memcpy(&saa->video_dev, &saa_template, sizeof(saa_template));
-       sprintf(saa->i2c.name, "stradis%d", num);
-       saa->i2c.data = saa;
        saawrite(0, SAA7146_IER);       /* turn off all interrupts */
        result = request_irq(saa->irq, saa7146_irq,
                       SA_SHIRQ | SA_INTERRUPT, "stradis", (void *) saa);
@@ -2082,10 +2054,6 @@ static int configure_saa7146(struct pci_dev *dev, int num)
                iounmap(saa->saa7146_mem);
                return -1;
        }
-#if 0
-       /* i2c generic interface is currently BROKEN */
-       i2c_register_bus(&saa->i2c);
-#endif
        return 0;
 }
 
@@ -2176,7 +2144,7 @@ static int init_saa7146(int i)
        saawrite(4, SAA7146_PAGE2); /* dma direction: read, no byteswap */
        saawrite(((SAA7146_MC2_UPLD_DMA2) << 16) | SAA7146_MC2_UPLD_DMA2,
                 SAA7146_MC2);
-       I2CBusScan(&(saa->i2c));
+       I2CBusScan(saa);
        return 0;
 }
 
@@ -2194,10 +2162,6 @@ static void release_saa(void)
                saawrite(0, SAA7146_MC2);
                saawrite(0, SAA7146_IER);
                saawrite(0xffffffffUL, SAA7146_ISR);
-#if 0
-               /* unregister i2c_bus */
-               i2c_unregister_bus((&saa->i2c));
-#endif
 
                /* disable PCI bus-mastering */
                pci_read_config_byte(saa->dev, PCI_COMMAND, &command);
index 5f91a8778c3663dede8df1c3aa5f52073b9b5248..18184a2b699970ba36a50dbb05c6947d34bcd3b9 100644 (file)
@@ -267,7 +267,7 @@ static void idescsi_end_request (byte uptodate, ide_hwgroup_t *hwgroup)
        u8 *scsi_buf;
        unsigned long flags;
 
-       if (rq->cmd != IDESCSI_PC_RQ) {
+       if (!(rq->flags & REQ_SPECIAL)) {
                ide_end_request (uptodate, hwgroup);
                return;
        }
@@ -463,10 +463,10 @@ static ide_startstop_t idescsi_do_request (ide_drive_t *drive, struct request *r
        printk (KERN_INFO "sector: %ld, nr_sectors: %ld, current_nr_sectors: %ld\n",rq->sector,rq->nr_sectors,rq->current_nr_sectors);
 #endif /* IDESCSI_DEBUG_LOG */
 
-       if (rq->cmd == IDESCSI_PC_RQ) {
+       if (rq->flags & REQ_SPECIAL) {
                return idescsi_issue_pc (drive, (idescsi_pc_t *) rq->buffer);
        }
-       printk (KERN_ERR "ide-scsi: %s: unsupported command in request queue (%x)\n", drive->name, rq->cmd);
+       blk_dump_rq_flags(rq, "ide-scsi: unsup command");
        idescsi_end_request (0,HWGROUP (drive));
        return ide_stopped;
 }
@@ -804,7 +804,7 @@ int idescsi_queue (Scsi_Cmnd *cmd, void (*done)(Scsi_Cmnd *))
        ide_init_drive_cmd (rq);
        rq->buffer = (char *) pc;
        rq->bio = idescsi_dma_bio (drive, pc);
-       rq->cmd = IDESCSI_PC_RQ;
+       rq->flags = REQ_SPECIAL;
        spin_unlock(&cmd->host->host_lock);
        (void) ide_do_drive_cmd (drive, rq, ide_end);
        spin_lock_irq(&cmd->host->host_lock);
index d764ea26433bf2cf54ca1fbc6af0ff9a15c5472f..f33384ddf33bbd87b99e634b71f07af456d2ae80 100644 (file)
@@ -72,13 +72,12 @@ static void __scsi_insert_special(request_queue_t *q, struct request *rq,
 
        ASSERT_LOCK(&q->queue_lock, 0);
 
-       rq->cmd = SPECIAL;
+       rq->flags = REQ_SPECIAL | REQ_NOMERGE | REQ_BARRIER;
        rq->special = data;
        rq->q = NULL;
        rq->bio = rq->biotail = NULL;
        rq->nr_segments = 0;
        rq->elevator_sequence = 0;
-       rq->inactive = 0;
 
        /*
         * We have the option of inserting the head or the tail of the queue.
@@ -262,6 +261,9 @@ void scsi_queue_next_request(request_queue_t * q, Scsi_Cmnd * SCpnt)
                 * the bad sector.
                 */
                SCpnt->request.special = (void *) SCpnt;
+#if 0
+               SCpnt->request.flags |= REQ_SPECIAL;
+#endif
                list_add(&SCpnt->request.queuelist, &q->queue_head);
        }
 
@@ -544,7 +546,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
                if (bbpnt) {
                        for (i = 0; i < SCpnt->use_sg; i++) {
                                if (bbpnt[i]) {
-                                       if (SCpnt->request.cmd == READ) {
+                                       if (rq_data_dir(req) == READ) {
                                                memcpy(bbpnt[i],
                                                       sgpnt[i].address,
                                                       sgpnt[i].length);
@@ -556,7 +558,7 @@ void scsi_io_completion(Scsi_Cmnd * SCpnt, int good_sectors,
                scsi_free(SCpnt->buffer, SCpnt->sglist_len);
        } else {
                if (SCpnt->buffer != req->buffer) {
-                       if (req->cmd == READ) {
+                       if (rq_data_dir(req) == READ) {
                                unsigned long flags;
                                char *to = bio_kmap_irq(req->bio, &flags);
 
@@ -901,8 +903,7 @@ void scsi_request_fn(request_queue_t * q)
                        break;
 
                /*
-                * get next queueable request. cur_rq would be set if we
-                * previously had to abort for some reason
+                * get next queueable request.
                 */
                req = elv_next_request(q);
 
@@ -916,7 +917,7 @@ void scsi_request_fn(request_queue_t * q)
                 * these two cases differently.  We differentiate by looking
                 * at request.cmd, as this tells us the real story.
                 */
-               if (req->cmd == SPECIAL) {
+               if (req->flags & REQ_SPECIAL) {
                        STpnt = NULL;
                        SCpnt = (Scsi_Cmnd *) req->special;
                        SRpnt = (Scsi_Request *) req->special;
@@ -929,7 +930,7 @@ void scsi_request_fn(request_queue_t * q)
                                scsi_init_cmd_from_req(SCpnt, SRpnt);
                        }
 
-               } else {
+               } else if (req->flags & REQ_CMD) {
                        SRpnt = NULL;
                        STpnt = scsi_get_request_dev(req);
                        if (!STpnt) {
@@ -938,7 +939,7 @@ void scsi_request_fn(request_queue_t * q)
                        /*
                         * Now try and find a command block that we can use.
                         */
-                       if( req->special != NULL ) {
+                       if (req->special) {
                                SCpnt = (Scsi_Cmnd *) req->special;
                                /*
                                 * We need to recount the number of
@@ -959,6 +960,9 @@ void scsi_request_fn(request_queue_t * q)
                         */
                        if (!SCpnt)
                                break;
+               } else {
+                       blk_dump_rq_flags(req, "SCSI bad req");
+                       break;
                }
 
                /*
@@ -997,7 +1001,7 @@ void scsi_request_fn(request_queue_t * q)
                req = NULL;
                spin_unlock_irq(&q->queue_lock);
 
-               if (SCpnt->request.cmd != SPECIAL) {
+               if (SCpnt->request.flags & REQ_CMD) {
                        /*
                         * This will do a couple of things:
                         *  1) Fill in the actual SCSI command.
@@ -1010,9 +1014,9 @@ void scsi_request_fn(request_queue_t * q)
                         * some kinds of consistency checking may cause the     
                         * request to be rejected immediately.
                         */
-                       if (STpnt == NULL) {
-                               STpnt = scsi_get_request_dev(req);
-                       }
+                       if (STpnt == NULL)
+                               STpnt = scsi_get_request_dev(&SCpnt->request);
+
                        /* 
                         * This sets up the scatter-gather table (allocating if
                         * required).  Hosts that need bounce buffers will also
index fe5ad86e0af05a469e907b30b60e4d2324194e23..3bd435cf094b233b9d4ca68b2aa198f8fbbe86ba 100644 (file)
@@ -225,7 +225,7 @@ static inline int scsi_new_mergeable(request_queue_t * q,
 
 static inline int scsi_new_segment(request_queue_t * q,
                                   struct request * req,
-                                  struct Scsi_Host *SHpnt)
+                                  struct bio *bio)
 {
        /*
         * pci_map_sg won't be able to map these two
@@ -234,11 +234,11 @@ static inline int scsi_new_segment(request_queue_t * q,
         */
        if (req->nr_hw_segments >= q->max_segments)
                return 0;
-       else if (req->nr_segments >= q->max_segments)
+       else if (req->nr_segments + bio->bi_vcnt > q->max_segments)
                return 0;
 
-       req->nr_hw_segments++;
-       req->nr_segments++;
+       req->nr_hw_segments += bio->bi_vcnt;
+       req->nr_segments += bio->bi_vcnt;
        return 1;
 }
 
@@ -246,16 +246,16 @@ static inline int scsi_new_segment(request_queue_t * q,
 
 static inline int scsi_new_segment(request_queue_t * q,
                                   struct request * req,
-                                  struct Scsi_Host *SHpnt)
+                                  struct bio *bio)
 {
-       if (req->nr_segments >= q->max_segments)
+       if (req->nr_segments + bio->bi_vcnt > q->max_segments)
                return 0;
 
        /*
         * This will form the start of a new segment.  Bump the 
         * counter.
         */
-       req->nr_segments++;
+       req->nr_segments += bio->bi_vcnt;
        return 1;
 }
 #endif
@@ -297,8 +297,6 @@ __inline static int __scsi_back_merge_fn(request_queue_t * q,
                                         struct bio *bio,
                                         int dma_host)
 {
-       Scsi_Device *SDpnt = q->queuedata;
-
        if (req->nr_sectors + bio_sectors(bio) > q->max_sectors)
                return 0;
        else if (!BIO_SEG_BOUNDARY(q, req->biotail, bio))
@@ -306,9 +304,9 @@ __inline static int __scsi_back_merge_fn(request_queue_t * q,
 
 #ifdef DMA_CHUNK_SIZE
        if (MERGEABLE_BUFFERS(req->biotail, bio))
-               return scsi_new_mergeable(q, req, SDpnt->host);
+               return scsi_new_mergeable(q, req, q->queuedata);
 #endif
-       return scsi_new_segment(q, req, SDpnt->host);
+       return scsi_new_segment(q, req, bio);
 }
 
 __inline static int __scsi_front_merge_fn(request_queue_t * q,
@@ -316,8 +314,6 @@ __inline static int __scsi_front_merge_fn(request_queue_t * q,
                                          struct bio *bio,
                                          int dma_host)
 {
-       Scsi_Device *SDpnt = q->queuedata;
-
        if (req->nr_sectors + bio_sectors(bio) > q->max_sectors)
                return 0;
        else if (!BIO_SEG_BOUNDARY(q, bio, req->bio))
@@ -325,9 +321,9 @@ __inline static int __scsi_front_merge_fn(request_queue_t * q,
 
 #ifdef DMA_CHUNK_SIZE
        if (MERGEABLE_BUFFERS(bio, req->bio))
-               return scsi_new_mergeable(q, req, SDpnt->host);
+               return scsi_new_mergeable(q, req, q->queuedata);
 #endif
-       return scsi_new_segment(q, req, SDpnt->host);
+       return scsi_new_segment(q, req, bio);
 }
 
 /*
@@ -686,10 +682,9 @@ __inline static int __init_io(Scsi_Cmnd * SCpnt,
                                }
                                break;
                        }
-                       if (req->cmd == WRITE) {
+                       if (rq_data_dir(req) == WRITE)
                                memcpy(sgpnt[i].address, bbpnt[i],
                                       sgpnt[i].length);
-                       }
                }
        }
        return 1;
@@ -778,7 +773,7 @@ __inline static int __init_io(Scsi_Cmnd * SCpnt,
                                        return 0;
                                }
                        }
-                       if (req->cmd == WRITE) {
+                       if (rq_data_dir(req) == WRITE) {
                                unsigned long flags;
                                char *buf = bio_kmap_irq(bio, &flags);
                                memcpy(buff, buf, this_count << 9);
index 585b4b55081b5f40c33c6d9b8404658df9b29133..c3b38e308c20f8c0f590529d3920405f60b632f8 100644 (file)
@@ -354,21 +354,17 @@ static int sd_init_command(Scsi_Cmnd * SCpnt)
                        this_count = this_count >> 3;
                }
        }
-       switch (SCpnt->request.cmd) {
-       case WRITE:
+       if (rq_data_dir(&SCpnt->request) == WRITE) {
                if (!dpnt->device->writeable) {
                        return 0;
                }
                SCpnt->cmnd[0] = WRITE_6;
                SCpnt->sc_data_direction = SCSI_DATA_WRITE;
-               break;
-       case READ:
+       } else if (rq_data_dir(&SCpnt->request) == READ) {
                SCpnt->cmnd[0] = READ_6;
                SCpnt->sc_data_direction = SCSI_DATA_READ;
-               break;
-       default:
-               panic("Unknown sd command %d\n", SCpnt->request.cmd);
-       }
+       } else
+               panic("Unknown sd command %lx\n", SCpnt->request.flags);
 
        SCSI_LOG_HLQUEUE(2, printk("%s : %s %d/%ld 512 byte blocks.\n",
                                   nbuff,
index 30a8a23d3991e4c9b5f13694071775f1bdc918c0..1d1c2714149a64982cb97ac299ea50f82583de7b 100644 (file)
@@ -388,7 +388,12 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
                return 0;
        }
 
-       if ((SCpnt->request.cmd == WRITE) && !scsi_CDs[dev].device->writeable)
+       if (!(SCpnt->request.flags & REQ_CMD)) {
+               blk_dump_rq_flags(&SCpnt->request, "sr unsup command");
+               return 0;
+       }
+
+       if (rq_data_dir(&SCpnt->request) == WRITE && !scsi_CDs[dev].device->writeable)
                return 0;
 
        /*
@@ -408,7 +413,18 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
                return 0;
        }
 
-       block = SCpnt->request.sector / (s_size >> 9);
+       if (rq_data_dir(&SCpnt->request) == WRITE) {
+               if (!scsi_CDs[dev].device->writeable)
+                       return 0;
+               SCpnt->cmnd[0] = WRITE_10;
+               SCpnt->sc_data_direction = SCSI_DATA_WRITE;
+       } else if (rq_data_dir(&SCpnt->request) == READ) {
+               SCpnt->cmnd[0] = READ_10;
+               SCpnt->sc_data_direction = SCSI_DATA_READ;
+       } else {
+               blk_dump_rq_flags(&SCpnt->request, "Unknown sr command");
+               return 0;
+       }
 
        /*
         * request doesn't start on hw block boundary, add scatter pads
@@ -419,19 +435,6 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
 
        this_count = (SCpnt->request_bufflen >> 9) / (s_size >> 9);
 
-       switch (SCpnt->request.cmd) {
-       case WRITE:
-               SCpnt->cmnd[0] = WRITE_10;
-               SCpnt->sc_data_direction = SCSI_DATA_WRITE;
-               break;
-       case READ:
-               SCpnt->cmnd[0] = READ_10;
-               SCpnt->sc_data_direction = SCSI_DATA_READ;
-               break;
-       default:
-               printk("Unknown sr command %d\n", SCpnt->request.cmd);
-               return 0;
-       }
 
        SCSI_LOG_HLQUEUE(2, printk("sr%d : %s %d/%ld 512 byte blocks.\n",
                                    devm,
@@ -441,6 +444,8 @@ static int sr_init_command(Scsi_Cmnd * SCpnt)
        SCpnt->cmnd[1] = (SCpnt->device->scsi_level <= SCSI_2) ?
                         ((SCpnt->lun << 5) & 0xe0) : 0;
 
+       block = SCpnt->request.sector / (s_size >> 9);
+
        if (this_count > 0xffff)
                this_count = 0xffff;
 
index 171a7477ba90d4670568a7ce1b79bd87d7c4a293..09080065709941ff15b5e5b59383544689c8ddc7 100644 (file)
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -74,7 +74,7 @@ static inline struct bio *__bio_pool_get(void)
        struct bio *bio;
 
        if ((bio = bio_pool)) {
-               BUG_ON(bio_pool_free <= 0);
+               BIO_BUG_ON(bio_pool_free <= 0);
                bio_pool = bio->bi_next;
                bio->bi_next = NULL;
                bio_pool_free--;
@@ -90,7 +90,7 @@ static inline struct bio *bio_pool_get(void)
 
        spin_lock_irqsave(&bio_lock, flags);
        bio = __bio_pool_get();
-       BUG_ON(!bio && bio_pool_free);
+       BIO_BUG_ON(!bio && bio_pool_free);
        spin_unlock_irqrestore(&bio_lock, flags);
 
        return bio;
@@ -121,8 +121,7 @@ static inline void bio_pool_put(struct bio *bio)
        }
 }
 
-#define BIO_CAN_WAIT(gfp_mask) \
-       (((gfp_mask) & (__GFP_WAIT | __GFP_IO)) == (__GFP_WAIT | __GFP_IO))
+#define BIO_CAN_WAIT(gfp_mask) ((gfp_mask) & __GFP_WAIT)
 
 static inline struct bio_vec *bvec_alloc(int gfp_mask, int nr, int *idx)
 {
@@ -198,13 +197,15 @@ void bio_destructor(struct bio *bio)
 {
        struct biovec_pool *bp = &bvec_list[bio->bi_max];
 
-       BUG_ON(bio->bi_max >= BIOVEC_NR_POOLS);
+       BIO_BUG_ON(bio->bi_max >= BIOVEC_NR_POOLS);
 
        /*
         * cloned bio doesn't own the veclist
         */
-       if (!(bio->bi_flags & (1 << BIO_CLONED)))
+       if (!(bio->bi_flags & (1 << BIO_CLONED))) {
                kmem_cache_free(bp->bp_cachep, bio->bi_io_vec);
+               wake_up_nr(&bp->bp_wait, 1);
+       }
 
        bio_pool_put(bio);
 }
@@ -212,13 +213,13 @@ void bio_destructor(struct bio *bio)
 inline void bio_init(struct bio *bio)
 {
        bio->bi_next = NULL;
-       atomic_set(&bio->bi_cnt, 1);
        bio->bi_flags = 0;
        bio->bi_rw = 0;
        bio->bi_vcnt = 0;
        bio->bi_idx = 0;
        bio->bi_size = 0;
        bio->bi_end_io = NULL;
+       atomic_set(&bio->bi_cnt, 1);
 }
 
 static inline struct bio *__bio_alloc(int gfp_mask, bio_destructor_t *dest)
@@ -301,6 +302,7 @@ struct bio *bio_alloc(int gfp_mask, int nr_iovecs)
  */
 static inline void bio_free(struct bio *bio)
 {
+       bio->bi_next = NULL;
        bio->bi_destructor(bio);
 }
 
@@ -314,16 +316,13 @@ static inline void bio_free(struct bio *bio)
  **/
 void bio_put(struct bio *bio)
 {
-       BUG_ON(!atomic_read(&bio->bi_cnt));
+       BIO_BUG_ON(!atomic_read(&bio->bi_cnt));
 
        /*
         * last put frees it
         */
-       if (atomic_dec_and_test(&bio->bi_cnt)) {
-               BUG_ON(bio->bi_next);
-
+       if (atomic_dec_and_test(&bio->bi_cnt))
                bio_free(bio);
-       }
 }
 
 /**
@@ -459,33 +458,10 @@ static int bio_end_io_page(struct bio *bio)
 static int bio_end_io_kio(struct bio *bio, int nr_sectors)
 {
        struct kiobuf *kio = (struct kiobuf *) bio->bi_private;
-       int uptodate, done;
-
-       done = 0;
-       uptodate = test_bit(BIO_UPTODATE, &bio->bi_flags);
-       do {
-               int sectors = bio->bi_io_vec[bio->bi_idx].bv_len >> 9;
-
-               nr_sectors -= sectors;
-
-               bio->bi_idx++;
-
-               done = !end_kio_request(kio, uptodate);
-
-               if (bio->bi_idx == bio->bi_vcnt)
-                       done = 1;
 
-       } while (!done && nr_sectors > 0);
-
-       /*
-        * all done
-        */
-       if (done) {
-               bio_put(bio);
-               return 0;
-       }
-
-       return 1;
+       end_kio_request(kio, test_bit(BIO_UPTODATE, &bio->bi_flags));
+       bio_put(bio);
+       return 0;
 }
 
 /*
@@ -553,7 +529,7 @@ void ll_rw_kio(int rw, struct kiobuf *kio, kdev_t dev, sector_t sector)
        max_bytes = get_max_sectors(dev) << 9;
        max_segments = get_max_segments(dev);
        if ((max_bytes >> PAGE_SHIFT) < (max_segments + 1))
-               max_segments = (max_bytes >> PAGE_SHIFT) + 1;
+               max_segments = (max_bytes >> PAGE_SHIFT);
 
        if (max_segments > BIO_MAX_PAGES)
                max_segments = BIO_MAX_PAGES;
@@ -566,14 +542,12 @@ void ll_rw_kio(int rw, struct kiobuf *kio, kdev_t dev, sector_t sector)
        offset = kio->offset & ~PAGE_MASK;
        size = kio->length;
 
-       /*
-        * set I/O count to number of pages for now
-        */
-       atomic_set(&kio->io_count, total_nr_pages);
+       atomic_set(&kio->io_count, 1);
 
        map_i = 0;
 
 next_chunk:
+       atomic_inc(&kio->io_count);
        if ((nr_pages = total_nr_pages) > max_segments)
                nr_pages = max_segments;
 
@@ -638,6 +612,8 @@ queue_io:
 out:
        if (err)
                kio->errno = err;
+
+       end_kio_request(kio, !err);
 }
 
 int bio_endio(struct bio *bio, int uptodate, int nr_sectors)
index 65d1cb0e969f7f8c7d690c2d51e0130c14948346..2d8386310d0d0d469b375e89e21c85a99709711a 100644 (file)
@@ -29,7 +29,6 @@
 void coda_cache_enter(struct inode *inode, int mask)
 {
        struct coda_inode_info *cii = ITOC(inode);
-        ENTRY;
 
         if ( !coda_cred_ok(&cii->c_cached_cred) ) {
                 coda_load_creds(&cii->c_cached_cred);
@@ -42,7 +41,6 @@ void coda_cache_enter(struct inode *inode, int mask)
 void coda_cache_clear_inode(struct inode *inode)
 {
        struct coda_inode_info *cii = ITOC(inode);
-       ENTRY;
         cii->c_cached_perm = 0;
 }
 
@@ -53,7 +51,6 @@ void coda_cache_clear_all(struct super_block *sb, struct coda_cred *cred)
         struct coda_inode_info *cii;
         struct list_head *tmp;
 
-        ENTRY;
         sbi = coda_sbp(sb);
         if (!sbi) BUG();
 
@@ -119,7 +116,6 @@ void coda_flag_inode_children(struct inode *inode, int flag)
 {
        struct dentry *alias_de;
 
-       ENTRY;
        if ( !inode || !S_ISDIR(inode->i_mode)) 
                return; 
 
index ff426ff29fce51c1bfafee10e2d2d262f527fcc1..a3ddd60b1a3828d0fc6fd60d2de1f1baf4020ee8 100644 (file)
@@ -102,8 +102,6 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
         struct coda_vattr attr;
         int error;
         
-        ENTRY;
-
        /* We get inode numbers from Venus -- see venus source */
        error = venus_getattr(sb, fid, &attr);
        if ( error ) {
@@ -111,21 +109,18 @@ int coda_cnode_make(struct inode **inode, ViceFid *fid, struct super_block *sb)
                   "coda_cnode_make: coda_getvattr returned %d for %s.\n", 
                   error, coda_f2s(fid));
            *inode = NULL;
-           EXIT;
            return error;
        } 
 
        *inode = coda_iget(sb, fid, &attr);
        if ( IS_ERR(*inode) ) {
                printk("coda_cnode_make: coda_iget failed\n");
-               EXIT;
                 return PTR_ERR(*inode);
         }
 
        CDEBUG(D_DOWNCALL, "Done making inode: ino %ld, count %d with %s\n",
                (*inode)->i_ino, atomic_read(&(*inode)->i_count), 
                coda_f2s(&ITOC(*inode)->c_fid));
-        EXIT;
        return 0;
 }
 
@@ -154,7 +149,6 @@ struct inode *coda_fid_to_inode(ViceFid *fid, struct super_block *sb)
        ino_t nr;
        struct inode *inode;
        struct coda_inode_info *cii;
-       ENTRY;
 
        if ( !sb ) {
                printk("coda_fid_to_inode: no sb!\n");
index d5b60d2260422d07e2665b6b2f8e4cdc54097e91..782f017ff7d05e15eb164bd2cf4b57794505deb1 100644 (file)
@@ -103,8 +103,6 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry)
        const char *name = entry->d_name.name;
        size_t length = entry->d_name.len;
        
-        ENTRY;
-
        if ( length > CODA_MAXNAMLEN ) {
                printk("name too long: lookup, %s (%*s)\n", 
                       coda_i2s(dir), (int)length, name);
@@ -154,7 +152,6 @@ exit:
                d_drop(entry);
                coda_flag_inode(res_inode, C_VATTR);
        }
-        EXIT;
         return NULL;
 }
 
@@ -163,7 +160,6 @@ int coda_permission(struct inode *inode, int mask)
 {
         int error;
  
-        ENTRY;
        coda_vfs_stat.permission++;
 
         if ( mask == 0 )
@@ -217,7 +213,6 @@ static int coda_create(struct inode *dir, struct dentry *de, int mode)
        struct ViceFid newfid;
        struct coda_vattr attrs;
 
-       ENTRY;
        coda_vfs_stat.create++;
 
        CDEBUG(D_INODE, "name: %s, length %d, mode %o\n", name, length, mode);
@@ -300,7 +295,6 @@ static int coda_mkdir(struct inode *dir, struct dentry *de, int mode)
        int error;
        struct ViceFid newfid;
 
-       ENTRY;
        coda_vfs_stat.mkdir++;
 
        if (coda_isroot(dir) && coda_iscontrol(name, len))
@@ -344,7 +338,6 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
        int len = de->d_name.len;
        int error;
 
-        ENTRY;
        coda_vfs_stat.link++;
 
        if (coda_isroot(dir_inode) && coda_iscontrol(name, len))
@@ -368,7 +361,6 @@ static int coda_link(struct dentry *source_de, struct inode *dir_inode,
         
 out:
        CDEBUG(D_INODE, "link result %d\n",error);
-       EXIT;
        return(error);
 }
 
@@ -381,7 +373,6 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de,
        int symlen;
         int error=0;
         
-        ENTRY;
        coda_vfs_stat.symlink++;
 
        if (coda_isroot(dir_inode) && coda_iscontrol(name, len))
@@ -406,7 +397,6 @@ static int coda_symlink(struct inode *dir_inode, struct dentry *de,
                coda_dir_changed(dir_inode, 0);
 
         CDEBUG(D_INODE, "in symlink result %d\n",error);
-        EXIT;
         return error;
 }
 
@@ -417,7 +407,6 @@ int coda_unlink(struct inode *dir, struct dentry *de)
        const char *name = de->d_name.name;
        int len = de->d_name.len;
 
-       ENTRY;
        coda_vfs_stat.unlink++;
 
         CDEBUG(D_INODE, " %s in %s, dirino %ld\n", name , 
@@ -441,7 +430,6 @@ int coda_rmdir(struct inode *dir, struct dentry *de)
        int len = de->d_name.len;
         int error;
 
-       ENTRY;
        coda_vfs_stat.rmdir++;
 
        if (!d_unhashed(de))
@@ -471,7 +459,6 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
         int link_adjust = 0;
         int error;
 
-       ENTRY;
        coda_vfs_stat.rename++;
 
         CDEBUG(D_INODE, "old: %s, (%d length), new: %s"
@@ -499,7 +486,6 @@ static int coda_rename(struct inode *old_dir, struct dentry *old_dentry,
 
        CDEBUG(D_INODE, "result %d\n", error); 
 
-       EXIT;
        return error;
 }
 
@@ -513,7 +499,6 @@ int coda_readdir(struct file *file, void *dirent,  filldir_t filldir)
        struct file *cfile, fakefile;
        struct coda_inode_info *cii = ITOC(inode);
 
-        ENTRY;
        coda_vfs_stat.readdir++;
 
         cfile = cii->c_container;
@@ -534,7 +519,6 @@ int coda_readdir(struct file *file, void *dirent,  filldir_t filldir)
                result = vfs_readdir(file, filldir, dirent);
         }
 
-        EXIT;
        return result;
 }
 
@@ -549,6 +533,7 @@ static void coda_prepare_fakefile(struct file *coda_file,
        fake_file->f_pos = coda_file->f_pos;
        fake_file->f_version = coda_file->f_version;
        fake_file->f_op = cont_dentry->d_inode->i_fop;
+       fake_file->f_flags = coda_file->f_flags;
        return ;
 }
 
@@ -577,8 +562,6 @@ static int coda_venus_readdir(struct file *filp, void *getdent,
         int string_offset = (int) (&((struct venus_dirent *)(0))->d_name);
        int i;
 
-        ENTRY;        
-
         CODA_ALLOC(buff, char *, DIR_BUFSIZE);
         if ( !buff ) { 
                 printk("coda_venus_readdir: out of memory.\n");
@@ -664,7 +647,6 @@ static int coda_dentry_revalidate(struct dentry *de, int flags)
 {
        struct inode *inode = de->d_inode;
        struct coda_inode_info *cii;
-       ENTRY;
 
        if (!inode)
                return 1;
@@ -740,7 +722,6 @@ int coda_revalidate_inode(struct dentry *dentry)
        struct inode *inode = dentry->d_inode;
        struct coda_inode_info *cii = ITOC(inode);
 
-       ENTRY;
        CDEBUG(D_INODE, "revalidating: %*s/%*s\n", 
               dentry->d_name.len, dentry->d_name.name,
               dentry->d_parent->d_name.len, dentry->d_parent->d_name.name);
index fa1d150e32d0d1bd690a54590f12f2197e5659ef..6a655a2438832e00ff5c6c93eefde97503a05550 100644 (file)
@@ -102,7 +102,6 @@ int coda_open(struct inode *i, struct file *f)
        struct coda_inode_info *cii;
 
        lock_kernel();
-       ENTRY;
        coda_vfs_stat.open++;
 
        CDEBUG(D_SPECIAL, "OPEN inode number: %ld, count %d, flags %o.\n", 
@@ -140,7 +139,6 @@ int coda_open(struct inode *i, struct file *f)
               fh->f_dentry->d_inode->i_ino,
               atomic_read(&fh->f_dentry->d_inode->i_count),
                fh->f_dentry->d_inode->i_op);
-       EXIT;
        unlock_kernel();
        return 0;
 }
@@ -155,7 +153,6 @@ int coda_flush(struct file *file)
        struct inode *cinode, *inode;
        int err = 0, fcnt;
 
-       ENTRY;
        coda_vfs_stat.flush++;
 
        /* No need to make an upcall when we have not made any modifications
@@ -200,7 +197,6 @@ int coda_release(struct inode *i, struct file *f)
        int err = 0;
 
        lock_kernel();
-       ENTRY;
        coda_vfs_stat.release++;
  
        if (!use_coda_close) {
@@ -244,7 +240,6 @@ int coda_fsync(struct file *file, struct dentry *dentry, int datasync)
        struct inode *cinode, *inode = dentry->d_inode;
        struct coda_inode_info *cii = ITOC(inode);
        int err = 0;
-       ENTRY;
 
        if (!(S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode) ||
              S_ISLNK(inode->i_mode)))
index fad286d0e326feabaff0a68c3d77b8824f8ebcf0..c7d890a37bcb939c6c7b5d7c0869d859d4cb5b39 100644 (file)
@@ -99,7 +99,6 @@ static struct super_block * coda_read_super(struct super_block *sb,
         ViceFid fid;
         int error;
        int idx;
-       ENTRY;
 
        idx = get_device_index((struct coda_mount_data *) data);
 
@@ -112,19 +111,16 @@ static struct super_block * coda_read_super(struct super_block *sb,
        vc = &coda_comms[idx];
        if (!vc->vc_inuse) {
                printk("coda_read_super: No pseudo device\n");
-               EXIT;  
                return NULL;
        }
 
         if ( vc->vc_sb ) {
                printk("coda_read_super: Device already mounted\n");
-               EXIT;  
                return NULL;
        }
 
        sbi = kmalloc(sizeof(struct coda_sb_info), GFP_KERNEL);
        if(!sbi) {
-               EXIT;  
                return NULL;
        }
 
@@ -159,11 +155,9 @@ static struct super_block * coda_read_super(struct super_block *sb,
        printk("coda_read_super: rootinode is %ld dev %d\n", 
               root->i_ino, root->i_dev);
        sb->s_root = d_alloc_root(root);
-       EXIT;  
         return sb;
 
  error:
-       EXIT;  
        if (sbi) {
                kfree(sbi);
                if(vc)
@@ -179,16 +173,12 @@ static void coda_put_super(struct super_block *sb)
 {
         struct coda_sb_info *sbi;
 
-        ENTRY;
-
        sbi = coda_sbp(sb);
        sbi->sbi_vcomm->vc_sb = NULL;
         list_del_init(&sbi->sbi_cihead);
 
        printk("Coda: Bye bye.\n");
        kfree(sbi);
-
-       EXIT;
 }
 
 /* all filling in of inodes postponed until lookup */
@@ -196,7 +186,6 @@ static void coda_read_inode(struct inode *inode)
 {
        struct coda_sb_info *sbi = coda_sbp(inode->i_sb);
        struct coda_inode_info *cii;
-       ENTRY;
 
         if (!sbi) BUG();
 
@@ -229,7 +218,6 @@ static void coda_clear_inode(struct inode *inode)
 {
        struct coda_inode_info *cii = ITOC(inode);
 
-        ENTRY;
         CDEBUG(D_SUPER, " inode->ino: %ld, count: %d\n", 
               inode->i_ino, atomic_read(&inode->i_count));        
        CDEBUG(D_DOWNCALL, "clearing inode: %ld, %x\n", inode->i_ino, cii->c_flags);
@@ -244,8 +232,6 @@ static void coda_clear_inode(struct inode *inode)
        cii_free(inode->u.generic_ip);
        inode->u.generic_ip = NULL;
 #endif
-
-       EXIT;
 }
 
 int coda_notify_change(struct dentry *de, struct iattr *iattr)
@@ -254,7 +240,6 @@ int coda_notify_change(struct dentry *de, struct iattr *iattr)
         struct coda_vattr vattr;
         int error;
        
-       ENTRY;
         memset(&vattr, 0, sizeof(vattr)); 
 
         coda_iattr_to_vattr(iattr, &vattr);
@@ -270,7 +255,6 @@ int coda_notify_change(struct dentry *de, struct iattr *iattr)
        }
        CDEBUG(D_SUPER, "inode.i_mode %o, error %d\n", inode->i_mode, error);
 
-       EXIT;
        return error;
 }
 
index 6deeb927c0ee6d9321c1df7c0a20c22765c0ce87..e011c89536b66488d4b5f49f6a2b14ce3d21940e 100644 (file)
@@ -45,8 +45,6 @@ struct file_operations coda_ioctl_operations = {
 /* the coda pioctl inode ops */
 static int coda_ioctl_permission(struct inode *inode, int mask)
 {
-        ENTRY;
-
         return 0;
 }
 
@@ -59,7 +57,6 @@ static int coda_pioctl(struct inode * inode, struct file * filp,
         struct inode *target_inode = NULL;
         struct coda_inode_info *cnp;
 
-        ENTRY;
         /* get the Pioctl data arguments from user space */
         if (copy_from_user(&data, (int *)user_data, sizeof(data))) {
            return -EINVAL;
index 2fe942f7cad94fefc483e9fa4bef5b2287c344b3..023ce45b508473b39540961e2d6b0f56964cbc97 100644 (file)
@@ -292,7 +292,6 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
 {
         struct venus_comm *vcp;
        int idx;
-        ENTRY;
 
        lock_kernel();
        idx = MINOR(inode->i_rdev);
@@ -319,7 +318,6 @@ static int coda_psdev_open(struct inode * inode, struct file * file)
 
        CDEBUG(D_PSDEV, "device %i - inuse: %d\n", idx, vcp->vc_inuse);
 
-       EXIT;
        unlock_kernel();
         return 0;
 }
@@ -330,7 +328,6 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
         struct venus_comm *vcp = (struct venus_comm *) file->private_data;
         struct upc_req *req;
        struct list_head *lh, *next;
-       ENTRY;
 
        lock_kernel();
        if ( !vcp->vc_inuse ) {
@@ -371,7 +368,6 @@ static int coda_psdev_release(struct inode * inode, struct file * file)
         }
        CDEBUG(D_PSDEV, "Done.\n");
 
-       EXIT;
        unlock_kernel();
        return 0;
 }
@@ -410,6 +406,7 @@ static int init_coda_psdev(void)
 
 
 MODULE_AUTHOR("Peter J. Braam <braam@cs.cmu.edu>");
+MODULE_LICENSE("GPL");
 
 static int __init init_coda(void)
 {
@@ -436,8 +433,6 @@ static void __exit exit_coda(void)
 {
         int err;
 
-        ENTRY;
-
        err = unregister_filesystem(&coda_fs_type);
         if ( err != 0 ) {
                 printk("coda: failed to unregister filesystem\n");
index e2b8673107f32595c5acb3ad4c31a95ab1b201c7..9e60aa99467cad97b00c726e519472e6fc2b7705 100644 (file)
@@ -359,7 +359,6 @@ int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset,
        char tmpbuf[80];
        int tmplen = 0;
 
-       ENTRY;
        /* this works as long as we are below 1024 characters! */
        if ( offset < 80 ) 
                len += sprintf( buffer,"%-79s\n",       "Coda upcall statistics");
@@ -392,7 +391,7 @@ int coda_upcall_stats_get_info( char * buffer, char ** start, off_t offset,
                len = length;
        if ( len < 0 )
                len = 0;
-       EXIT;
+
        return len;
 }
 
index e21829beb27c4a2f89dcb997b81474a5c5c5e7e3..cf01630c6832ef83a2b9514d5e6a106926b4ca1e 100644 (file)
@@ -80,7 +80,6 @@ int venus_rootfid(struct super_block *sb, ViceFid *fidp)
         union inputArgs *inp;
         union outputArgs *outp;
         int insize, outsize, error;
-       ENTRY;
 
         insize = SIZE(root);
         UPARG(CODA_ROOT);
@@ -96,7 +95,6 @@ int venus_rootfid(struct super_block *sb, ViceFid *fidp)
        }
 
        CODA_FREE(inp, insize);
-        EXIT;
        return error;
 }
 
@@ -106,7 +104,6 @@ int venus_getattr(struct super_block *sb, struct ViceFid *fid,
         union inputArgs *inp;
         union outputArgs *outp;
         int insize, outsize, error;
-       ENTRY;
 
         insize = SIZE(getattr); 
        UPARG(CODA_GETATTR);
@@ -117,7 +114,6 @@ int venus_getattr(struct super_block *sb, struct ViceFid *fid,
        *attr = outp->coda_getattr.attr;
 
        CODA_FREE(inp, insize);
-        EXIT;
         return error;
 }
 
@@ -432,7 +428,6 @@ int venus_readlink(struct super_block *sb, struct ViceFid *fid,
        }
         
         CDEBUG(D_INODE, " result %d\n",error);
-        EXIT;
         CODA_FREE(inp, insize);
         return error;
 }
@@ -462,7 +457,6 @@ int venus_link(struct super_block *sb, struct ViceFid *fid,
         error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
 
         CDEBUG(D_INODE, " result %d\n",error);
-        EXIT;
        CODA_FREE(inp, insize);
         return error;
 }
@@ -499,7 +493,6 @@ int venus_symlink(struct super_block *sb, struct ViceFid *fid,
        error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
 
         CDEBUG(D_INODE, " result %d\n",error);
-        EXIT;
        CODA_FREE(inp, insize);
         return error;
 }
@@ -536,7 +529,6 @@ int venus_access(struct super_block *sb, struct ViceFid *fid, int mask)
        error = coda_upcall(coda_sbp(sb), insize, &outsize, inp);
 
        CODA_FREE(inp, insize);
-        EXIT;
        return error;
 }
 
@@ -633,7 +625,6 @@ int venus_statfs(struct super_block *sb, struct statfs *sfs)
        }
 
         CDEBUG(D_INODE, " result %d\n",error);
-        EXIT;
         CODA_FREE(inp, insize);
         return error;
 }
@@ -722,8 +713,6 @@ static int coda_upcall(struct coda_sb_info *sbi,
        struct upc_req *req;
        int error = 0;
 
-       ENTRY;
-
        vcommp = sbi->sbi_vcomm;
        if ( !vcommp->vc_inuse ) {
                printk("No pseudo device in upcall comms at %p\n", vcommp);
index 8d77aca6ece794319be590134c9ec5a62ee43973..8a7a27cb03a204729a1829fd8af40e4afe4fc91f 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/types.h>
 #include <asm/unaligned.h>
 #include <asm/byteorder.h>
+#include <linux/pagemap.h>
 #include <linux/genhd.h>
 #include <linux/blkdev.h>
 #include <linux/slab.h>
index fc6335642dfbf896193a3893fe8d811da969dff4..550679134fd81312ea412627d9a9d580045e0796 100644 (file)
@@ -37,6 +37,13 @@ struct bio_vec {
        unsigned int    bv_offset;
 };
 
+/*
+ * weee, c forward decl...
+ */
+struct bio;
+typedef int (bio_end_io_t) (struct bio *, int);
+typedef void (bio_destructor_t) (struct bio *);
+
 /*
  * main unit of I/O for the block layer and lower layers (ie drivers and
  * stacking drivers)
@@ -44,14 +51,13 @@ struct bio_vec {
 struct bio {
        sector_t                bi_sector;
        struct bio              *bi_next;       /* request queue link */
-       atomic_t                bi_cnt;         /* pin count */
        kdev_t                  bi_dev;         /* will be block device */
        unsigned long           bi_flags;       /* status, command, etc */
        unsigned long           bi_rw;          /* bottom bits READ/WRITE,
                                                 * top bits priority
                                                 */
 
-       unsigned int            bi_vcnt;        /* how may bio_vec's */
+       unsigned int            bi_vcnt;        /* how many bio_vec's */
        unsigned int            bi_idx;         /* current index into bvl_vec */
        unsigned int            bi_size;        /* total size in bytes */
        unsigned int            bi_max;         /* max bvl_vecs we can hold,
@@ -59,10 +65,12 @@ struct bio {
 
        struct bio_vec          *bi_io_vec;     /* the actual vec list */
 
-       int (*bi_end_io)(struct bio *bio, int nr_sectors);
+       bio_end_io_t            *bi_end_io;
+       atomic_t                bi_cnt;         /* pin count */
+
        void                    *bi_private;
 
-       void (*bi_destructor)(struct bio *);    /* destructor */
+       bio_destructor_t        *bi_destructor; /* destructor */
 };
 
 /*
@@ -83,13 +91,13 @@ struct bio {
  */
 #define BIO_RW         0
 #define BIO_RW_AHEAD   1
-#define BIO_BARRIER    2
+#define BIO_RW_BARRIER 2
 
 /*
  * various member access, note that bio_data should of course not be used
  * on highmem page vectors
  */
-#define bio_iovec_idx(bio, idx)        (&((bio)->bi_io_vec[(bio)->bi_idx]))
+#define bio_iovec_idx(bio, idx)        (&((bio)->bi_io_vec[(idx)]))
 #define bio_iovec(bio)         bio_iovec_idx((bio), (bio)->bi_idx)
 #define bio_page(bio)          bio_iovec((bio))->bv_page
 #define __bio_offset(bio, idx) bio_iovec_idx((bio), (idx))->bv_offset
@@ -118,17 +126,14 @@ struct bio {
 /*
  * merge helpers etc
  */
-#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_idx - 1)
+#define __BVEC_END(bio) bio_iovec_idx((bio), (bio)->bi_vcnt - 1)
 #define BIO_CONTIG(bio, nxt) \
-       (bvec_to_phys(__BVEC_END((bio)) + (bio)->bi_size) == bio_to_phys((nxt)))
+       (bvec_to_phys(__BVEC_END((bio))) + (bio)->bi_size == bio_to_phys((nxt)))
 #define __BIO_SEG_BOUNDARY(addr1, addr2, mask) \
        (((addr1) | (mask)) == (((addr2) - 1) | (mask)))
 #define BIO_SEG_BOUNDARY(q, b1, b2) \
        __BIO_SEG_BOUNDARY(bvec_to_phys(__BVEC_END((b1))), bio_to_phys((b2)) + (b2)->bi_size, (q)->seg_boundary_mask)
 
-typedef int (bio_end_io_t) (struct bio *, int);
-typedef void (bio_destructor_t) (struct bio *);
-
 #define bio_io_error(bio) bio_endio((bio), 0, bio_sectors((bio)))
 
 #define bio_for_each_segment(bvl, bio, i)                              \
index 71712cbc66199bf2ba1c23e6432f190163159a76..29db6a337ef54b61cfc774311df80702dfbcb4d3 100644 (file)
@@ -8,56 +8,12 @@
 #include <linux/compiler.h>
 
 /*
- * Initialization functions.
+ * get rid of this next...
  */
-extern int isp16_init(void);
-extern int cdu31a_init(void);
-extern int acsi_init(void);
-extern int mcd_init(void);
-extern int mcdx_init(void);
-extern int sbpcd_init(void);
-extern int aztcd_init(void);
-extern int sony535_init(void);
-extern int gscd_init(void);
-extern int cm206_init(void);
-extern int optcd_init(void);
-extern int sjcd_init(void);
-extern int cdi_init(void);
-extern int hd_init(void);
 extern int ide_init(void);
-extern int xd_init(void);
-extern int mfm_init(void);
-extern int loop_init(void);
-extern int md_init(void);
-extern int ap_init(void);
-extern int ddv_init(void);
-extern int z2_init(void);
-extern int swim3_init(void);
-extern int swimiop_init(void);
-extern int amiga_floppy_init(void);
-extern int atari_floppy_init(void);
-extern int ez_init(void);
-extern int bpcd_init(void);
-extern int ps2esdi_init(void);
-extern int jsfd_init(void);
-extern int viodasd_init(void);
-extern int viocd_init(void);
-
-#if defined(CONFIG_ARCH_S390)
-extern int dasd_init(void);
-extern int xpram_init(void);
-extern int tapeblock_init(void);
-#endif /* CONFIG_ARCH_S390 */
 
 extern void set_device_ro(kdev_t dev,int flag);
-void add_blkdev_randomness(int major);
-
-extern int floppy_init(void);
-extern void rd_load(void);
-extern int rd_init(void);
-extern int rd_doload;          /* 1 = load ramdisk, 0 = don't load */
-extern int rd_prompt;          /* 1 = prompt for ramdisk, 0 = don't prompt */
-extern int rd_image_start;     /* starting block # of image */
+extern void add_blkdev_randomness(int major);
 
 #ifdef CONFIG_BLK_DEV_INITRD
 
@@ -69,8 +25,6 @@ extern int initrd_below_start_ok; /* 1 if it is not an error if initrd_start < m
 void initrd_init(void);
 
 #endif
-
-                
 /*
  * end_request() and friends. Must be called with the request queue spinlock
  * acquired. All functions called within end_request() _must_be_ atomic.
@@ -81,13 +35,50 @@ void initrd_init(void);
  * code duplication in drivers.
  */
 
+extern int end_that_request_first(struct request *, int, int);
+extern void end_that_request_last(struct request *);
+
 static inline void blkdev_dequeue_request(struct request *req)
 {
        list_del(&req->queuelist);
 }
 
-int end_that_request_first(struct request *, int uptodate, int nr_sectors);
-void end_that_request_last(struct request *);
+#define __elv_next_request(q)  (q)->elevator.elevator_next_req_fn((q))
+
+extern inline struct request *elv_next_request(request_queue_t *q)
+{
+       struct request *rq;
+
+       while ((rq = __elv_next_request(q))) {
+               rq->flags |= REQ_STARTED;
+
+               if ((rq->flags & REQ_DONTPREP) || !q->prep_rq_fn)
+                       break;
+
+               /*
+                * all ok, break and return it
+                */
+               if (!q->prep_rq_fn(q, rq))
+                       break;
+
+               /*
+                * prep said no-go, kill it
+                */
+               blkdev_dequeue_request(rq);
+               if (end_that_request_first(rq, 0, rq->nr_sectors))
+                       BUG();
+
+               end_that_request_last(rq);
+       }
+
+       return rq;
+}
+
+extern inline void elv_add_request(request_queue_t *q, struct request *rq)
+{
+       blk_plug_device(q);
+       q->elevator.elevator_add_req_fn(q, rq, q->queue_head.prev);
+}
 
 #if defined(MAJOR_NR) || defined(IDE_DRIVER)
 
@@ -364,15 +355,15 @@ static void (DEVICE_REQUEST)(request_queue_t *);
 #define CLEAR_INTR
 #endif
 
-#define INIT_REQUEST \
-       if (QUEUE_EMPTY) { \
-               CLEAR_INTR; \
-               return;  \
-       } \
-       if (MAJOR(CURRENT->rq_dev) != MAJOR_NR) \
-               panic(DEVICE_NAME ": request list destroyed"); \
-       if (!CURRENT->bio) \
-               panic(DEVICE_NAME ": no bio"); \
+#define INIT_REQUEST                                           \
+       if (QUEUE_EMPTY) {                                      \
+               CLEAR_INTR;                                     \
+               return;                                         \
+       }                                                       \
+       if (MAJOR(CURRENT->rq_dev) != MAJOR_NR)                 \
+               panic(DEVICE_NAME ": request list destroyed");  \
+       if (!CURRENT->bio)                                      \
+               panic(DEVICE_NAME ": no bio");                  \
 
 #endif /* !defined(IDE_DRIVER) */
 
index c061ce0130367860a2354b39b16dd8646d54f7cc..e9e0cf21005acf61c95a8ea12e4c939580ee7318 100644 (file)
@@ -15,21 +15,32 @@ typedef struct request_queue request_queue_t;
 struct elevator_s;
 typedef struct elevator_s elevator_t;
 
+struct request_list {
+       unsigned int count;
+       struct list_head free;
+       wait_queue_head_t wait;
+};
+
 struct request {
        struct list_head queuelist; /* looking for ->queue? you must _not_
                                     * access it directly, use
                                     * blkdev_dequeue_request! */
        int elevator_sequence;
 
-       int inactive; /* driver hasn't seen it yet */
+       unsigned char cmd[16];
+
+       unsigned long flags;            /* see REQ_ bits below */
 
        int rq_status;  /* should split this into a few status bits */
        kdev_t rq_dev;
-       int cmd;                /* READ or WRITE */
        int errors;
        sector_t sector;
        unsigned long nr_sectors;
-       unsigned long hard_sector, hard_nr_sectors;
+       unsigned long hard_sector;      /* the hard_* are block layer
+                                        * internals, no driver should
+                                        * touch them
+                                        */
+       unsigned long hard_nr_sectors;
        unsigned short nr_segments;
        unsigned short nr_hw_segments;
        unsigned int current_nr_sectors;
@@ -39,8 +50,49 @@ struct request {
        struct completion *waiting;
        struct bio *bio, *biotail;
        request_queue_t *q;
+       struct request_list *rl;
 };
 
+/*
+ * first three bits match BIO_RW* bits, important
+ */
+enum rq_flag_bits {
+       __REQ_RW,       /* not set, read. set, write */
+       __REQ_RW_AHEAD, /* READA */
+       __REQ_BARRIER,  /* may not be passed */
+       __REQ_CMD,      /* is a regular fs rw request */
+       __REQ_NOMERGE,  /* don't touch this for merging */
+       __REQ_STARTED,  /* drive already may have started this one */
+       __REQ_DONTPREP, /* don't call prep for this one */
+       /*
+        * for IDE
+       */
+       __REQ_DRIVE_CMD,
+       __REQ_DRIVE_TASK,
+
+       __REQ_PC,       /* packet command (special) */
+       __REQ_BLOCK_PC, /* queued down pc from block layer */
+       __REQ_SENSE,    /* sense retrival */
+
+       __REQ_SPECIAL,  /* driver special command */
+
+       __REQ_NR_BITS,  /* stops here */
+};
+
+#define REQ_RW         (1 << __REQ_RW)
+#define REQ_RW_AHEAD   (1 << __REQ_RW_AHEAD)
+#define REQ_BARRIER    (1 << __REQ_BARRIER)
+#define REQ_CMD                (1 << __REQ_CMD)
+#define REQ_NOMERGE    (1 << __REQ_NOMERGE)
+#define REQ_STARTED    (1 << __REQ_STARTED)
+#define REQ_DONTPREP   (1 << __REQ_DONTPREP)
+#define REQ_DRIVE_CMD  (1 << __REQ_DRIVE_CMD)
+#define REQ_DRIVE_TASK (1 << __REQ_DRIVE_TASK)
+#define REQ_PC         (1 << __REQ_PC)
+#define REQ_SENSE      (1 << __REQ_SENSE)
+#define REQ_BLOCK_PC   (1 << __REQ_BLOCK_PC)
+#define REQ_SPECIAL    (1 << __REQ_SPECIAL)
+
 #include <linux/elevator.h>
 
 typedef int (merge_request_fn) (request_queue_t *, struct request *,
@@ -50,6 +102,7 @@ typedef int (merge_requests_fn) (request_queue_t *, struct request *,
 typedef void (request_fn_proc) (request_queue_t *q);
 typedef request_queue_t * (queue_proc) (kdev_t dev);
 typedef int (make_request_fn) (request_queue_t *q, struct bio *bio);
+typedef int (prep_rq_fn) (request_queue_t *, struct request *);
 typedef void (unplug_device_fn) (void *q);
 
 enum blk_queue_state {
@@ -63,12 +116,6 @@ enum blk_queue_state {
  */
 #define QUEUE_NR_REQUESTS      8192
 
-struct request_list {
-       unsigned int count;
-       struct list_head free;
-       wait_queue_head_t wait;
-};
-
 struct request_queue
 {
        /*
@@ -82,17 +129,18 @@ struct request_queue
        struct list_head        queue_head;
        elevator_t              elevator;
 
-       request_fn_proc         * request_fn;
-       merge_request_fn        * back_merge_fn;
-       merge_request_fn        * front_merge_fn;
-       merge_requests_fn       * merge_requests_fn;
-       make_request_fn         * make_request_fn;
+       request_fn_proc         *request_fn;
+       merge_request_fn        *back_merge_fn;
+       merge_request_fn        *front_merge_fn;
+       merge_requests_fn       *merge_requests_fn;
+       make_request_fn         *make_request_fn;
+       prep_rq_fn              *prep_rq_fn;
 
        /*
         * The queue owner gets to use this for whatever they like.
         * ll_rw_blk doesn't touch it.
         */
-       void                    * queuedata;
+       void                    *queuedata;
 
        /*
         * queue needs bounce pages for pages above this limit
@@ -138,13 +186,12 @@ struct request_queue
 #define QUEUE_FLAG_CLUSTER     2       /* cluster several segments into 1 */
 
 #define blk_queue_plugged(q)   test_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
-
 #define blk_mark_plugged(q)    set_bit(QUEUE_FLAG_PLUGGED, &(q)->queue_flags)
-
 #define blk_queue_empty(q)     elv_queue_empty(q)
-
 #define list_entry_rq(ptr)     list_entry((ptr), struct request, queuelist)
 
+#define rq_data_dir(rq)                ((rq)->flags & 1)
+
 /*
  * noop, requests are automagically marked as active/inactive by I/O
  * scheduler -- see elv_next_request
@@ -153,20 +200,6 @@ struct request_queue
 
 extern unsigned long blk_max_low_pfn, blk_max_pfn;
 
-#define __elv_next_request(q)  (q)->elevator.elevator_next_req_fn((q))
-
-extern inline struct request *elv_next_request(request_queue_t *q)
-{
-       struct request *rq = __elv_next_request(q);
-
-       if (rq) {
-               rq->inactive = 0;
-               wmb();
-       }
-
-       return rq;
-}
-
 #define BLK_BOUNCE_HIGH        (blk_max_low_pfn << PAGE_SHIFT)
 #define BLK_BOUNCE_ANY (blk_max_pfn << PAGE_SHIFT)
 
@@ -186,7 +219,8 @@ extern inline void blk_queue_bounce(request_queue_t *q, struct bio **bio)
 #endif /* CONFIG_HIGHMEM */
 
 #define rq_for_each_bio(bio, rq)       \
-       for (bio = (rq)->bio; bio; bio = bio->bi_next)
+       if ((rq->bio))                  \
+               for (bio = (rq)->bio; bio; bio = bio->bi_next)
 
 struct blk_dev_struct {
        /*
@@ -219,6 +253,11 @@ extern void generic_make_request(struct bio *bio);
 extern inline request_queue_t *blk_get_queue(kdev_t dev);
 extern void blkdev_release_request(struct request *);
 extern void blk_attempt_remerge(request_queue_t *, struct request *);
+extern struct request *blk_get_request(request_queue_t *, int, int);
+extern void blk_put_request(struct request *);
+extern void blk_plug_device(request_queue_t *);
+
+extern int block_ioctl(kdev_t, unsigned int, unsigned long);
 
 /*
  * Access functions for manipulating queue properties
@@ -233,6 +272,7 @@ extern void blk_queue_max_segment_size(request_queue_t *q, unsigned int);
 extern void blk_queue_hardsect_size(request_queue_t *q, unsigned short);
 extern void blk_queue_segment_boundary(request_queue_t *q, unsigned long);
 extern int blk_rq_map_sg(request_queue_t *, struct request *, struct scatterlist *);
+extern void blk_dump_rq_flags(struct request *, char *);
 extern void generic_unplug_device(void *);
 
 extern int * blk_size[MAX_BLKDEV];
@@ -256,8 +296,7 @@ extern int * max_readahead[MAX_BLKDEV];
 #define blkdev_next_request(req) blkdev_entry_to_request((req)->queuelist.next)
 #define blkdev_prev_request(req) blkdev_entry_to_request((req)->queuelist.prev)
 
-extern void drive_stat_acct (kdev_t dev, int rw,
-                                       unsigned long nr_sectors, int new_io);
+extern void drive_stat_acct(struct request *, int, int);
 
 extern inline void blk_clear(int major)
 {
index 9b221556097ff7f6f4b7a9dc1b1d399079817995..d514f908a3a59bd0b2b794253383664def3c6ef3 100644 (file)
@@ -92,12 +92,6 @@ void coda_sysctl_clean(void);
     printk(format, ## a); }                                       \
 } while (0)
 
-#define ENTRY    \
-    if(coda_print_entry) printk("Process %d entered %s\n",current->pid,__FUNCTION__)
-
-#define EXIT    \
-    if(coda_print_entry) printk("Process %d leaving %s\n",current->pid,__FUNCTION__)
-
 #define CODA_ALLOC(ptr, cast, size)                                       \
 do {                                                                      \
     if (size < PAGE_SIZE) {                                               \