Merge branch 'core/xen' into x86/xen
[safe/jmp/linux-2.6] / drivers / block / pktcdvd.c
index 674cd66..29b7a64 100644 (file)
@@ -302,7 +302,9 @@ static struct kobj_type kobj_pkt_type_wqueue = {
 static void pkt_sysfs_dev_new(struct pktcdvd_device *pd)
 {
        if (class_pktcdvd) {
-               pd->dev = device_create(class_pktcdvd, NULL, pd->pkt_dev, "%s", pd->name);
+               pd->dev = device_create_drvdata(class_pktcdvd, NULL,
+                                               pd->pkt_dev, NULL,
+                                               "%s", pd->name);
                if (IS_ERR(pd->dev))
                        pd->dev = NULL;
        }
@@ -776,8 +778,6 @@ static int pkt_generic_packet(struct pktcdvd_device *pd, struct packet_command *
 
        rq->cmd_len = COMMAND_SIZE(cgc->cmd[0]);
        memcpy(rq->cmd, cgc->cmd, CDROM_PACKET_SIZE);
-       if (sizeof(rq->cmd) > CDROM_PACKET_SIZE)
-               memset(rq->cmd + CDROM_PACKET_SIZE, 0, sizeof(rq->cmd) - CDROM_PACKET_SIZE);
 
        rq->timeout = 60*HZ;
        rq->cmd_type = REQ_TYPE_BLOCK_PC;
@@ -849,7 +849,8 @@ static int pkt_flush_cache(struct pktcdvd_device *pd)
 /*
  * speed is given as the normal factor, e.g. 4 for 4x
  */
-static int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
+static noinline_for_stack int pkt_set_speed(struct pktcdvd_device *pd,
+                               unsigned write_speed, unsigned read_speed)
 {
        struct packet_command cgc;
        struct request_sense sense;
@@ -1776,7 +1777,8 @@ static int pkt_get_track_info(struct pktcdvd_device *pd, __u16 track, __u8 type,
        return pkt_generic_packet(pd, &cgc);
 }
 
-static int pkt_get_last_written(struct pktcdvd_device *pd, long *last_written)
+static noinline_for_stack int pkt_get_last_written(struct pktcdvd_device *pd,
+                                               long *last_written)
 {
        disc_information di;
        track_information ti;
@@ -1813,7 +1815,7 @@ static int pkt_get_last_written(struct pktcdvd_device *pd, long *last_written)
 /*
  * write mode select package based on pd->settings
  */
-static int pkt_set_write_settings(struct pktcdvd_device *pd)
+static noinline_for_stack int pkt_set_write_settings(struct pktcdvd_device *pd)
 {
        struct packet_command cgc;
        struct request_sense sense;
@@ -1972,7 +1974,7 @@ static int pkt_writable_disc(struct pktcdvd_device *pd, disc_information *di)
        return 1;
 }
 
-static int pkt_probe_settings(struct pktcdvd_device *pd)
+static noinline_for_stack int pkt_probe_settings(struct pktcdvd_device *pd)
 {
        struct packet_command cgc;
        unsigned char buf[12];
@@ -2071,14 +2073,14 @@ static int pkt_probe_settings(struct pktcdvd_device *pd)
 /*
  * enable/disable write caching on drive
  */
-static int pkt_write_caching(struct pktcdvd_device *pd, int set)
+static noinline_for_stack int pkt_write_caching(struct pktcdvd_device *pd,
+                                               int set)
 {
        struct packet_command cgc;
        struct request_sense sense;
        unsigned char buf[64];
        int ret;
 
-       memset(buf, 0, sizeof(buf));
        init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_READ);
        cgc.sense = &sense;
        cgc.buflen = pd->mode_offset + 12;
@@ -2116,7 +2118,8 @@ static int pkt_lock_door(struct pktcdvd_device *pd, int lockflag)
 /*
  * Returns drive maximum write speed
  */
-static int pkt_get_max_speed(struct pktcdvd_device *pd, unsigned *write_speed)
+static noinline_for_stack int pkt_get_max_speed(struct pktcdvd_device *pd,
+                                               unsigned *write_speed)
 {
        struct packet_command cgc;
        struct request_sense sense;
@@ -2124,7 +2127,6 @@ static int pkt_get_max_speed(struct pktcdvd_device *pd, unsigned *write_speed)
        unsigned char *cap_buf;
        int ret, offset;
 
-       memset(buf, 0, sizeof(buf));
        cap_buf = &buf[sizeof(struct mode_page_header) + pd->mode_offset];
        init_cdrom_command(&cgc, buf, sizeof(buf), CGC_DATA_UNKNOWN);
        cgc.sense = &sense;
@@ -2177,7 +2179,8 @@ static char us_clv_to_speed[16] = {
 /*
  * reads the maximum media speed from ATIP
  */
-static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed)
+static noinline_for_stack int pkt_media_speed(struct pktcdvd_device *pd,
+                                               unsigned *speed)
 {
        struct packet_command cgc;
        struct request_sense sense;
@@ -2249,7 +2252,7 @@ static int pkt_media_speed(struct pktcdvd_device *pd, unsigned *speed)
        }
 }
 
-static int pkt_perform_opc(struct pktcdvd_device *pd)
+static noinline_for_stack int pkt_perform_opc(struct pktcdvd_device *pd)
 {
        struct packet_command cgc;
        struct request_sense sense;
@@ -2630,11 +2633,12 @@ end_io:
 
 
 
-static int pkt_merge_bvec(struct request_queue *q, struct bio *bio, struct bio_vec *bvec)
+static int pkt_merge_bvec(struct request_queue *q, struct bvec_merge_data *bmd,
+                         struct bio_vec *bvec)
 {
        struct pktcdvd_device *pd = q->queuedata;
-       sector_t zone = ZONE(bio->bi_sector, pd);
-       int used = ((bio->bi_sector - zone) << 9) + bio->bi_size;
+       sector_t zone = ZONE(bmd->bi_sector, pd);
+       int used = ((bmd->bi_sector - zone) << 9) + bmd->bi_size;
        int remaining = (pd->settings.size << 9) - used;
        int remaining2;
 
@@ -2642,7 +2646,7 @@ static int pkt_merge_bvec(struct request_queue *q, struct bio *bio, struct bio_v
         * A bio <= PAGE_SIZE must be allowed. If it crosses a packet
         * boundary, pkt_make_request() will split the bio.
         */
-       remaining2 = PAGE_SIZE - bio->bi_size;
+       remaining2 = PAGE_SIZE - bmd->bi_size;
        remaining = max(remaining, remaining2);
 
        BUG_ON(remaining < 0);
@@ -2739,7 +2743,6 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
        int i;
        int ret = 0;
        char b[BDEVNAME_SIZE];
-       struct proc_dir_entry *proc;
        struct block_device *bdev;
 
        if (pd->pkt_dev == dev) {
@@ -2783,11 +2786,7 @@ static int pkt_new_dev(struct pktcdvd_device *pd, dev_t dev)
                goto out_mem;
        }
 
-       proc = create_proc_entry(pd->name, 0, pkt_proc);
-       if (proc) {
-               proc->data = pd;
-               proc->proc_fops = &pkt_proc_fops;
-       }
+       proc_create_data(pd->name, 0, pkt_proc, &pkt_proc_fops, pd);
        DPRINTK(DRIVER_NAME": writer %s mapped to %s\n", pd->name, bdevname(bdev, b));
        return 0;
 
@@ -3096,7 +3095,7 @@ static int __init pkt_init(void)
                goto out_misc;
        }
 
-       pkt_proc = proc_mkdir(DRIVER_NAME, proc_root_driver);
+       pkt_proc = proc_mkdir("driver/"DRIVER_NAME, NULL);
 
        return 0;
 
@@ -3112,7 +3111,7 @@ out2:
 
 static void __exit pkt_exit(void)
 {
-       remove_proc_entry(DRIVER_NAME, proc_root_driver);
+       remove_proc_entry("driver/"DRIVER_NAME, NULL);
        misc_deregister(&pkt_misc);
 
        pkt_debugfs_cleanup();