[PARPORT] linux-2.4.2 pd.c patch - driver was untested??? (this patch too, I have no PARIDE HW ;-( )

From: Sergij Kolisnyk (kolk@ukr.net)
Date: Tue Jun 26 2001 - 14:34:59 EDT

  • Next message: Sergij Kolisnyk: "[PARPORT] Re: linux-2.4.2 pd.c patch - driver was untested??? (this patch too, I have no PARIDE HW ;-( )"

     

    --- ./linux-2.4.2/drivers/block/paride/pd.c Sun Feb 4 20:05:29 2001
    +++ ./linux-2.4.2-paride/drivers/block/paride/pd.c Tue Jun 26 20:41:14 2001
    @@ -287,6 +287,7 @@
     static struct hd_struct pd_hd[PD_DEVS];
     static int pd_sizes[PD_DEVS];
     static int pd_blocksizes[PD_DEVS];
    +static int pd_maxsectors[PD_DEVS];
     
     #define PD_NAMELEN 8
     
    @@ -385,56 +386,6 @@
             }
     }
     
    -static inline int pd_new_segment(request_queue_t *q, struct request *req, int max_segments)
    -{
    - if (max_segments > cluster)
    - max_segments = cluster;
    -
    - if (req->nr_segments < max_segments) {
    - req->nr_segments++;
    - return 1;
    - }
    - return 0;
    -}
    -
    -static int pd_back_merge_fn(request_queue_t *q, struct request *req,
    - struct buffer_head *bh, int max_segments)
    -{
    - if (req->bhtail->b_data + req->bhtail->b_size == bh->b_data)
    - return 1;
    - return pd_new_segment(q, req, max_segments);
    -}
    -
    -static int pd_front_merge_fn(request_queue_t *q, struct request *req,
    - struct buffer_head *bh, int max_segments)
    -{
    - if (bh->b_data + bh->b_size == req->bh->b_data)
    - return 1;
    - return pd_new_segment(q, req, max_segments);
    -}
    -
    -static int pd_merge_requests_fn(request_queue_t *q, struct request *req,
    - struct request *next, int max_segments)
    -{
    - int total_segments = req->nr_segments + next->nr_segments;
    - int same_segment;
    -
    - if (max_segments > cluster)
    - max_segments = cluster;
    -
    - same_segment = 0;
    - if (req->bhtail->b_data + req->bhtail->b_size == next->bh->b_data) {
    - total_segments--;
    - same_segment = 1;
    - }
    -
    - if (total_segments > max_segments)
    - return 0;
    -
    - req->nr_segments = total_segments;
    - return 1;
    -}
    -
     int pd_init (void)
     
     { int i;
    @@ -448,9 +399,6 @@
             }
             q = BLK_DEFAULT_QUEUE(MAJOR_NR);
             blk_init_queue(q, DEVICE_REQUEST);
    - q->back_merge_fn = pd_back_merge_fn;
    - q->front_merge_fn = pd_front_merge_fn;
    - q->merge_requests_fn = pd_merge_requests_fn;
             read_ahead[MAJOR_NR] = 8; /* 8 sector (4kB) read ahead */
             
             pd_gendisk.major = major;
    @@ -460,6 +408,9 @@
     
             for(i=0;i<PD_DEVS;i++) pd_blocksizes[i] = 1024;
             blksize_size[MAJOR_NR] = pd_blocksizes;
    +
    + for(i=0;i<PD_DEVS;i++) pd_maxsectors[i] = cluster;
    + max_sectors[MAJOR_NR] = pd_maxsectors;
     
             printk("%s: %s version %s, major %d, cluster %d, nice %d\n",
                     name,name,PD_VERSION,major,cluster,nice);

    -- To unsubscribe, send mail to: linux-parport-request@torque.net --
    -- with the single word "unsubscribe" in the body of the message. --



    This archive was generated by hypermail 2b29 : Tue Jun 26 2001 - 16:18:01 EDT