diff options
Diffstat (limited to 'drivers/block')
-rw-r--r-- | drivers/block/cciss.c | 5 | ||||
-rw-r--r-- | drivers/block/ll_rw_blk.c | 38 | ||||
-rw-r--r-- | drivers/block/paride/pf.c | 22 | ||||
-rw-r--r-- | drivers/block/pktcdvd.c | 4 | ||||
-rw-r--r-- | drivers/block/scsi_ioctl.c | 9 | ||||
-rw-r--r-- | drivers/block/ub.c | 55 |
6 files changed, 53 insertions, 80 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index c56f995aadad..486b6e1c7dfb 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -483,9 +483,6 @@ static int cciss_open(struct inode *inode, struct file *filep) | |||
483 | printk(KERN_DEBUG "cciss_open %s\n", inode->i_bdev->bd_disk->disk_name); | 483 | printk(KERN_DEBUG "cciss_open %s\n", inode->i_bdev->bd_disk->disk_name); |
484 | #endif /* CCISS_DEBUG */ | 484 | #endif /* CCISS_DEBUG */ |
485 | 485 | ||
486 | if (host->busy_initializing) | ||
487 | return -EBUSY; | ||
488 | |||
489 | if (host->busy_initializing || drv->busy_configuring) | 486 | if (host->busy_initializing || drv->busy_configuring) |
490 | return -EBUSY; | 487 | return -EBUSY; |
491 | /* | 488 | /* |
@@ -2991,6 +2988,7 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
2991 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); | 2988 | hba[i]->access.set_intr_mask(hba[i], CCISS_INTR_ON); |
2992 | 2989 | ||
2993 | cciss_procinit(i); | 2990 | cciss_procinit(i); |
2991 | hba[i]->busy_initializing = 0; | ||
2994 | 2992 | ||
2995 | for(j=0; j < NWD; j++) { /* mfm */ | 2993 | for(j=0; j < NWD; j++) { /* mfm */ |
2996 | drive_info_struct *drv = &(hba[i]->drv[j]); | 2994 | drive_info_struct *drv = &(hba[i]->drv[j]); |
@@ -3033,7 +3031,6 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, | |||
3033 | add_disk(disk); | 3031 | add_disk(disk); |
3034 | } | 3032 | } |
3035 | 3033 | ||
3036 | hba[i]->busy_initializing = 0; | ||
3037 | return(1); | 3034 | return(1); |
3038 | 3035 | ||
3039 | clean4: | 3036 | clean4: |
diff --git a/drivers/block/ll_rw_blk.c b/drivers/block/ll_rw_blk.c index 483d71b10cf9..baedac522945 100644 --- a/drivers/block/ll_rw_blk.c +++ b/drivers/block/ll_rw_blk.c | |||
@@ -2373,44 +2373,6 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector) | |||
2373 | 2373 | ||
2374 | EXPORT_SYMBOL(blkdev_issue_flush); | 2374 | EXPORT_SYMBOL(blkdev_issue_flush); |
2375 | 2375 | ||
2376 | /** | ||
2377 | * blkdev_scsi_issue_flush_fn - issue flush for SCSI devices | ||
2378 | * @q: device queue | ||
2379 | * @disk: gendisk | ||
2380 | * @error_sector: error offset | ||
2381 | * | ||
2382 | * Description: | ||
2383 | * Devices understanding the SCSI command set, can use this function as | ||
2384 | * a helper for issuing a cache flush. Note: driver is required to store | ||
2385 | * the error offset (in case of error flushing) in ->sector of struct | ||
2386 | * request. | ||
2387 | */ | ||
2388 | int blkdev_scsi_issue_flush_fn(request_queue_t *q, struct gendisk *disk, | ||
2389 | sector_t *error_sector) | ||
2390 | { | ||
2391 | struct request *rq = blk_get_request(q, WRITE, __GFP_WAIT); | ||
2392 | int ret; | ||
2393 | |||
2394 | rq->flags |= REQ_BLOCK_PC | REQ_SOFTBARRIER; | ||
2395 | rq->sector = 0; | ||
2396 | memset(rq->cmd, 0, sizeof(rq->cmd)); | ||
2397 | rq->cmd[0] = 0x35; | ||
2398 | rq->cmd_len = 12; | ||
2399 | rq->data = NULL; | ||
2400 | rq->data_len = 0; | ||
2401 | rq->timeout = 60 * HZ; | ||
2402 | |||
2403 | ret = blk_execute_rq(q, disk, rq, 0); | ||
2404 | |||
2405 | if (ret && error_sector) | ||
2406 | *error_sector = rq->sector; | ||
2407 | |||
2408 | blk_put_request(rq); | ||
2409 | return ret; | ||
2410 | } | ||
2411 | |||
2412 | EXPORT_SYMBOL(blkdev_scsi_issue_flush_fn); | ||
2413 | |||
2414 | static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) | 2376 | static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) |
2415 | { | 2377 | { |
2416 | int rw = rq_data_dir(rq); | 2378 | int rw = rq_data_dir(rq); |
diff --git a/drivers/block/paride/pf.c b/drivers/block/paride/pf.c index 711d2f314ac3..94af920465b5 100644 --- a/drivers/block/paride/pf.c +++ b/drivers/block/paride/pf.c | |||
@@ -750,6 +750,14 @@ static int pf_ready(void) | |||
750 | 750 | ||
751 | static struct request_queue *pf_queue; | 751 | static struct request_queue *pf_queue; |
752 | 752 | ||
753 | static void pf_end_request(int uptodate) | ||
754 | { | ||
755 | if (pf_req) { | ||
756 | end_request(pf_req, uptodate); | ||
757 | pf_req = NULL; | ||
758 | } | ||
759 | } | ||
760 | |||
753 | static void do_pf_request(request_queue_t * q) | 761 | static void do_pf_request(request_queue_t * q) |
754 | { | 762 | { |
755 | if (pf_busy) | 763 | if (pf_busy) |
@@ -765,7 +773,7 @@ repeat: | |||
765 | pf_count = pf_req->current_nr_sectors; | 773 | pf_count = pf_req->current_nr_sectors; |
766 | 774 | ||
767 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { | 775 | if (pf_block + pf_count > get_capacity(pf_req->rq_disk)) { |
768 | end_request(pf_req, 0); | 776 | pf_end_request(0); |
769 | goto repeat; | 777 | goto repeat; |
770 | } | 778 | } |
771 | 779 | ||
@@ -780,7 +788,7 @@ repeat: | |||
780 | pi_do_claimed(pf_current->pi, do_pf_write); | 788 | pi_do_claimed(pf_current->pi, do_pf_write); |
781 | else { | 789 | else { |
782 | pf_busy = 0; | 790 | pf_busy = 0; |
783 | end_request(pf_req, 0); | 791 | pf_end_request(0); |
784 | goto repeat; | 792 | goto repeat; |
785 | } | 793 | } |
786 | } | 794 | } |
@@ -798,9 +806,11 @@ static int pf_next_buf(void) | |||
798 | if (!pf_count) | 806 | if (!pf_count) |
799 | return 1; | 807 | return 1; |
800 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 808 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
801 | end_request(pf_req, 1); | 809 | pf_end_request(1); |
802 | pf_count = pf_req->current_nr_sectors; | 810 | if (pf_req) { |
803 | pf_buf = pf_req->buffer; | 811 | pf_count = pf_req->current_nr_sectors; |
812 | pf_buf = pf_req->buffer; | ||
813 | } | ||
804 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 814 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
805 | return 1; | 815 | return 1; |
806 | } | 816 | } |
@@ -810,7 +820,7 @@ static inline void next_request(int success) | |||
810 | unsigned long saved_flags; | 820 | unsigned long saved_flags; |
811 | 821 | ||
812 | spin_lock_irqsave(&pf_spin_lock, saved_flags); | 822 | spin_lock_irqsave(&pf_spin_lock, saved_flags); |
813 | end_request(pf_req, success); | 823 | pf_end_request(success); |
814 | pf_busy = 0; | 824 | pf_busy = 0; |
815 | do_pf_request(pf_queue); | 825 | do_pf_request(pf_queue); |
816 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); | 826 | spin_unlock_irqrestore(&pf_spin_lock, saved_flags); |
diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c index 7e22a58926b8..a280e679b1ca 100644 --- a/drivers/block/pktcdvd.c +++ b/drivers/block/pktcdvd.c | |||
@@ -229,7 +229,7 @@ static int pkt_grow_pktlist(struct pktcdvd_device *pd, int nr_packets) | |||
229 | return 1; | 229 | return 1; |
230 | } | 230 | } |
231 | 231 | ||
232 | static void *pkt_rb_alloc(unsigned int __nocast gfp_mask, void *data) | 232 | static void *pkt_rb_alloc(gfp_t gfp_mask, void *data) |
233 | { | 233 | { |
234 | return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); | 234 | return kmalloc(sizeof(struct pkt_rb_node), gfp_mask); |
235 | } | 235 | } |
@@ -2082,7 +2082,7 @@ static int pkt_close(struct inode *inode, struct file *file) | |||
2082 | } | 2082 | } |
2083 | 2083 | ||
2084 | 2084 | ||
2085 | static void *psd_pool_alloc(unsigned int __nocast gfp_mask, void *data) | 2085 | static void *psd_pool_alloc(gfp_t gfp_mask, void *data) |
2086 | { | 2086 | { |
2087 | return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); | 2087 | return kmalloc(sizeof(struct packet_stacked_data), gfp_mask); |
2088 | } | 2088 | } |
diff --git a/drivers/block/scsi_ioctl.c b/drivers/block/scsi_ioctl.c index 856c2278e9d0..382dea7b224c 100644 --- a/drivers/block/scsi_ioctl.c +++ b/drivers/block/scsi_ioctl.c | |||
@@ -168,6 +168,7 @@ static int verify_command(struct file *file, unsigned char *cmd) | |||
168 | safe_for_write(WRITE_VERIFY_12), | 168 | safe_for_write(WRITE_VERIFY_12), |
169 | safe_for_write(WRITE_16), | 169 | safe_for_write(WRITE_16), |
170 | safe_for_write(WRITE_LONG), | 170 | safe_for_write(WRITE_LONG), |
171 | safe_for_write(WRITE_LONG_2), | ||
171 | safe_for_write(ERASE), | 172 | safe_for_write(ERASE), |
172 | safe_for_write(GPCMD_MODE_SELECT_10), | 173 | safe_for_write(GPCMD_MODE_SELECT_10), |
173 | safe_for_write(MODE_SELECT), | 174 | safe_for_write(MODE_SELECT), |
@@ -200,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd) | |||
200 | return 0; | 201 | return 0; |
201 | } | 202 | } |
202 | 203 | ||
204 | /* And root can do any command.. */ | ||
205 | if (capable(CAP_SYS_RAWIO)) | ||
206 | return 0; | ||
207 | |||
203 | if (!type) { | 208 | if (!type) { |
204 | cmd_type[cmd[0]] = CMD_WARNED; | 209 | cmd_type[cmd[0]] = CMD_WARNED; |
205 | printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); | 210 | printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]); |
206 | } | 211 | } |
207 | 212 | ||
208 | /* And root can do any command.. */ | ||
209 | if (capable(CAP_SYS_RAWIO)) | ||
210 | return 0; | ||
211 | |||
212 | /* Otherwise fail it with an "Operation not permitted" */ | 213 | /* Otherwise fail it with an "Operation not permitted" */ |
213 | return -EPERM; | 214 | return -EPERM; |
214 | } | 215 | } |
diff --git a/drivers/block/ub.c b/drivers/block/ub.c index aa0bf7ee008d..ed4d5006fe62 100644 --- a/drivers/block/ub.c +++ b/drivers/block/ub.c | |||
@@ -172,7 +172,7 @@ struct bulk_cs_wrap { | |||
172 | */ | 172 | */ |
173 | struct ub_dev; | 173 | struct ub_dev; |
174 | 174 | ||
175 | #define UB_MAX_REQ_SG 4 | 175 | #define UB_MAX_REQ_SG 9 /* cdrecord requires 32KB and maybe a header */ |
176 | #define UB_MAX_SECTORS 64 | 176 | #define UB_MAX_SECTORS 64 |
177 | 177 | ||
178 | /* | 178 | /* |
@@ -387,7 +387,7 @@ struct ub_dev { | |||
387 | struct bulk_cs_wrap work_bcs; | 387 | struct bulk_cs_wrap work_bcs; |
388 | struct usb_ctrlrequest work_cr; | 388 | struct usb_ctrlrequest work_cr; |
389 | 389 | ||
390 | int sg_stat[UB_MAX_REQ_SG+1]; | 390 | int sg_stat[6]; |
391 | struct ub_scsi_trace tr; | 391 | struct ub_scsi_trace tr; |
392 | }; | 392 | }; |
393 | 393 | ||
@@ -525,12 +525,13 @@ static ssize_t ub_diag_show(struct device *dev, struct device_attribute *attr, | |||
525 | "qlen %d qmax %d\n", | 525 | "qlen %d qmax %d\n", |
526 | sc->cmd_queue.qlen, sc->cmd_queue.qmax); | 526 | sc->cmd_queue.qlen, sc->cmd_queue.qmax); |
527 | cnt += sprintf(page + cnt, | 527 | cnt += sprintf(page + cnt, |
528 | "sg %d %d %d %d %d\n", | 528 | "sg %d %d %d %d %d .. %d\n", |
529 | sc->sg_stat[0], | 529 | sc->sg_stat[0], |
530 | sc->sg_stat[1], | 530 | sc->sg_stat[1], |
531 | sc->sg_stat[2], | 531 | sc->sg_stat[2], |
532 | sc->sg_stat[3], | 532 | sc->sg_stat[3], |
533 | sc->sg_stat[4]); | 533 | sc->sg_stat[4], |
534 | sc->sg_stat[5]); | ||
534 | 535 | ||
535 | list_for_each (p, &sc->luns) { | 536 | list_for_each (p, &sc->luns) { |
536 | lun = list_entry(p, struct ub_lun, link); | 537 | lun = list_entry(p, struct ub_lun, link); |
@@ -835,7 +836,7 @@ static int ub_cmd_build_block(struct ub_dev *sc, struct ub_lun *lun, | |||
835 | return -1; | 836 | return -1; |
836 | } | 837 | } |
837 | cmd->nsg = n_elem; | 838 | cmd->nsg = n_elem; |
838 | sc->sg_stat[n_elem]++; | 839 | sc->sg_stat[n_elem < 5 ? n_elem : 5]++; |
839 | 840 | ||
840 | /* | 841 | /* |
841 | * build the command | 842 | * build the command |
@@ -891,7 +892,7 @@ static int ub_cmd_build_packet(struct ub_dev *sc, struct ub_lun *lun, | |||
891 | return -1; | 892 | return -1; |
892 | } | 893 | } |
893 | cmd->nsg = n_elem; | 894 | cmd->nsg = n_elem; |
894 | sc->sg_stat[n_elem]++; | 895 | sc->sg_stat[n_elem < 5 ? n_elem : 5]++; |
895 | 896 | ||
896 | memcpy(&cmd->cdb, rq->cmd, rq->cmd_len); | 897 | memcpy(&cmd->cdb, rq->cmd, rq->cmd_len); |
897 | cmd->cdb_len = rq->cmd_len; | 898 | cmd->cdb_len = rq->cmd_len; |
@@ -1010,7 +1011,6 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1010 | sc->last_pipe = sc->send_bulk_pipe; | 1011 | sc->last_pipe = sc->send_bulk_pipe; |
1011 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, | 1012 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->send_bulk_pipe, |
1012 | bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); | 1013 | bcb, US_BULK_CB_WRAP_LEN, ub_urb_complete, sc); |
1013 | sc->work_urb.transfer_flags = 0; | ||
1014 | 1014 | ||
1015 | /* Fill what we shouldn't be filling, because usb-storage did so. */ | 1015 | /* Fill what we shouldn't be filling, because usb-storage did so. */ |
1016 | sc->work_urb.actual_length = 0; | 1016 | sc->work_urb.actual_length = 0; |
@@ -1019,7 +1019,6 @@ static int ub_scsi_cmd_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1019 | 1019 | ||
1020 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { | 1020 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { |
1021 | /* XXX Clear stalls */ | 1021 | /* XXX Clear stalls */ |
1022 | printk("ub: cmd #%d start failed (%d)\n", cmd->tag, rc); /* P3 */ | ||
1023 | ub_complete(&sc->work_done); | 1022 | ub_complete(&sc->work_done); |
1024 | return rc; | 1023 | return rc; |
1025 | } | 1024 | } |
@@ -1190,11 +1189,9 @@ static void ub_scsi_urb_compl(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1190 | return; | 1189 | return; |
1191 | } | 1190 | } |
1192 | if (urb->status != 0) { | 1191 | if (urb->status != 0) { |
1193 | printk("ub: cmd #%d cmd status (%d)\n", cmd->tag, urb->status); /* P3 */ | ||
1194 | goto Bad_End; | 1192 | goto Bad_End; |
1195 | } | 1193 | } |
1196 | if (urb->actual_length != US_BULK_CB_WRAP_LEN) { | 1194 | if (urb->actual_length != US_BULK_CB_WRAP_LEN) { |
1197 | printk("ub: cmd #%d xferred %d\n", cmd->tag, urb->actual_length); /* P3 */ | ||
1198 | /* XXX Must do reset here to unconfuse the device */ | 1195 | /* XXX Must do reset here to unconfuse the device */ |
1199 | goto Bad_End; | 1196 | goto Bad_End; |
1200 | } | 1197 | } |
@@ -1395,14 +1392,12 @@ static void ub_data_start(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1395 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, | 1392 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, pipe, |
1396 | page_address(sg->page) + sg->offset, sg->length, | 1393 | page_address(sg->page) + sg->offset, sg->length, |
1397 | ub_urb_complete, sc); | 1394 | ub_urb_complete, sc); |
1398 | sc->work_urb.transfer_flags = 0; | ||
1399 | sc->work_urb.actual_length = 0; | 1395 | sc->work_urb.actual_length = 0; |
1400 | sc->work_urb.error_count = 0; | 1396 | sc->work_urb.error_count = 0; |
1401 | sc->work_urb.status = 0; | 1397 | sc->work_urb.status = 0; |
1402 | 1398 | ||
1403 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { | 1399 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_ATOMIC)) != 0) { |
1404 | /* XXX Clear stalls */ | 1400 | /* XXX Clear stalls */ |
1405 | printk("ub: data #%d submit failed (%d)\n", cmd->tag, rc); /* P3 */ | ||
1406 | ub_complete(&sc->work_done); | 1401 | ub_complete(&sc->work_done); |
1407 | ub_state_done(sc, cmd, rc); | 1402 | ub_state_done(sc, cmd, rc); |
1408 | return; | 1403 | return; |
@@ -1442,7 +1437,6 @@ static int __ub_state_stat(struct ub_dev *sc, struct ub_scsi_cmd *cmd) | |||
1442 | sc->last_pipe = sc->recv_bulk_pipe; | 1437 | sc->last_pipe = sc->recv_bulk_pipe; |
1443 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, | 1438 | usb_fill_bulk_urb(&sc->work_urb, sc->dev, sc->recv_bulk_pipe, |
1444 | &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); | 1439 | &sc->work_bcs, US_BULK_CS_WRAP_LEN, ub_urb_complete, sc); |
1445 | sc->work_urb.transfer_flags = 0; | ||
1446 | sc->work_urb.actual_length = 0; | 1440 | sc->work_urb.actual_length = 0; |
1447 | sc->work_urb.error_count = 0; | 1441 | sc->work_urb.error_count = 0; |
1448 | sc->work_urb.status = 0; | 1442 | sc->work_urb.status = 0; |
@@ -1563,7 +1557,6 @@ static int ub_submit_clear_stall(struct ub_dev *sc, struct ub_scsi_cmd *cmd, | |||
1563 | 1557 | ||
1564 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, | 1558 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, |
1565 | (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); | 1559 | (unsigned char*) cr, NULL, 0, ub_urb_complete, sc); |
1566 | sc->work_urb.transfer_flags = 0; | ||
1567 | sc->work_urb.actual_length = 0; | 1560 | sc->work_urb.actual_length = 0; |
1568 | sc->work_urb.error_count = 0; | 1561 | sc->work_urb.error_count = 0; |
1569 | sc->work_urb.status = 0; | 1562 | sc->work_urb.status = 0; |
@@ -2000,17 +1993,16 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) | |||
2000 | 1993 | ||
2001 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe, | 1994 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->recv_ctrl_pipe, |
2002 | (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl); | 1995 | (unsigned char*) cr, p, 1, ub_probe_urb_complete, &compl); |
2003 | sc->work_urb.transfer_flags = 0; | ||
2004 | sc->work_urb.actual_length = 0; | 1996 | sc->work_urb.actual_length = 0; |
2005 | sc->work_urb.error_count = 0; | 1997 | sc->work_urb.error_count = 0; |
2006 | sc->work_urb.status = 0; | 1998 | sc->work_urb.status = 0; |
2007 | 1999 | ||
2008 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { | 2000 | if ((rc = usb_submit_urb(&sc->work_urb, GFP_KERNEL)) != 0) { |
2009 | if (rc == -EPIPE) { | 2001 | if (rc == -EPIPE) { |
2010 | printk("%s: Stall at GetMaxLUN, using 1 LUN\n", | 2002 | printk("%s: Stall submitting GetMaxLUN, using 1 LUN\n", |
2011 | sc->name); /* P3 */ | 2003 | sc->name); /* P3 */ |
2012 | } else { | 2004 | } else { |
2013 | printk(KERN_WARNING | 2005 | printk(KERN_NOTICE |
2014 | "%s: Unable to submit GetMaxLUN (%d)\n", | 2006 | "%s: Unable to submit GetMaxLUN (%d)\n", |
2015 | sc->name, rc); | 2007 | sc->name, rc); |
2016 | } | 2008 | } |
@@ -2028,6 +2020,18 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) | |||
2028 | del_timer_sync(&timer); | 2020 | del_timer_sync(&timer); |
2029 | usb_kill_urb(&sc->work_urb); | 2021 | usb_kill_urb(&sc->work_urb); |
2030 | 2022 | ||
2023 | if ((rc = sc->work_urb.status) < 0) { | ||
2024 | if (rc == -EPIPE) { | ||
2025 | printk("%s: Stall at GetMaxLUN, using 1 LUN\n", | ||
2026 | sc->name); /* P3 */ | ||
2027 | } else { | ||
2028 | printk(KERN_NOTICE | ||
2029 | "%s: Error at GetMaxLUN (%d)\n", | ||
2030 | sc->name, rc); | ||
2031 | } | ||
2032 | goto err_io; | ||
2033 | } | ||
2034 | |||
2031 | if (sc->work_urb.actual_length != 1) { | 2035 | if (sc->work_urb.actual_length != 1) { |
2032 | printk("%s: GetMaxLUN returned %d bytes\n", sc->name, | 2036 | printk("%s: GetMaxLUN returned %d bytes\n", sc->name, |
2033 | sc->work_urb.actual_length); /* P3 */ | 2037 | sc->work_urb.actual_length); /* P3 */ |
@@ -2048,6 +2052,7 @@ static int ub_sync_getmaxlun(struct ub_dev *sc) | |||
2048 | kfree(p); | 2052 | kfree(p); |
2049 | return nluns; | 2053 | return nluns; |
2050 | 2054 | ||
2055 | err_io: | ||
2051 | err_submit: | 2056 | err_submit: |
2052 | kfree(p); | 2057 | kfree(p); |
2053 | err_alloc: | 2058 | err_alloc: |
@@ -2080,7 +2085,6 @@ static int ub_probe_clear_stall(struct ub_dev *sc, int stalled_pipe) | |||
2080 | 2085 | ||
2081 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, | 2086 | usb_fill_control_urb(&sc->work_urb, sc->dev, sc->send_ctrl_pipe, |
2082 | (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); | 2087 | (unsigned char*) cr, NULL, 0, ub_probe_urb_complete, &compl); |
2083 | sc->work_urb.transfer_flags = 0; | ||
2084 | sc->work_urb.actual_length = 0; | 2088 | sc->work_urb.actual_length = 0; |
2085 | sc->work_urb.error_count = 0; | 2089 | sc->work_urb.error_count = 0; |
2086 | sc->work_urb.status = 0; | 2090 | sc->work_urb.status = 0; |
@@ -2213,8 +2217,10 @@ static int ub_probe(struct usb_interface *intf, | |||
2213 | * This is needed to clear toggles. It is a problem only if we do | 2217 | * This is needed to clear toggles. It is a problem only if we do |
2214 | * `rmmod ub && modprobe ub` without disconnects, but we like that. | 2218 | * `rmmod ub && modprobe ub` without disconnects, but we like that. |
2215 | */ | 2219 | */ |
2220 | #if 0 /* iPod Mini fails if we do this (big white iPod works) */ | ||
2216 | ub_probe_clear_stall(sc, sc->recv_bulk_pipe); | 2221 | ub_probe_clear_stall(sc, sc->recv_bulk_pipe); |
2217 | ub_probe_clear_stall(sc, sc->send_bulk_pipe); | 2222 | ub_probe_clear_stall(sc, sc->send_bulk_pipe); |
2223 | #endif | ||
2218 | 2224 | ||
2219 | /* | 2225 | /* |
2220 | * The way this is used by the startup code is a little specific. | 2226 | * The way this is used by the startup code is a little specific. |
@@ -2241,10 +2247,10 @@ static int ub_probe(struct usb_interface *intf, | |||
2241 | for (i = 0; i < 3; i++) { | 2247 | for (i = 0; i < 3; i++) { |
2242 | if ((rc = ub_sync_getmaxlun(sc)) < 0) { | 2248 | if ((rc = ub_sync_getmaxlun(sc)) < 0) { |
2243 | /* | 2249 | /* |
2244 | * Some devices (i.e. Iomega Zip100) need this -- | 2250 | * This segment is taken from usb-storage. They say |
2245 | * apparently the bulk pipes get STALLed when the | 2251 | * that ZIP-100 needs this, but my own ZIP-100 works |
2246 | * GetMaxLUN request is processed. | 2252 | * fine without this. |
2247 | * XXX I have a ZIP-100, verify it does this. | 2253 | * Still, it does not seem to hurt anything. |
2248 | */ | 2254 | */ |
2249 | if (rc == -EPIPE) { | 2255 | if (rc == -EPIPE) { |
2250 | ub_probe_clear_stall(sc, sc->recv_bulk_pipe); | 2256 | ub_probe_clear_stall(sc, sc->recv_bulk_pipe); |
@@ -2313,7 +2319,7 @@ static int ub_probe_lun(struct ub_dev *sc, int lnum) | |||
2313 | disk->first_minor = lun->id * UB_MINORS_PER_MAJOR; | 2319 | disk->first_minor = lun->id * UB_MINORS_PER_MAJOR; |
2314 | disk->fops = &ub_bd_fops; | 2320 | disk->fops = &ub_bd_fops; |
2315 | disk->private_data = lun; | 2321 | disk->private_data = lun; |
2316 | disk->driverfs_dev = &sc->intf->dev; /* XXX Many to one ok? */ | 2322 | disk->driverfs_dev = &sc->intf->dev; |
2317 | 2323 | ||
2318 | rc = -ENOMEM; | 2324 | rc = -ENOMEM; |
2319 | if ((q = blk_init_queue(ub_request_fn, &sc->lock)) == NULL) | 2325 | if ((q = blk_init_queue(ub_request_fn, &sc->lock)) == NULL) |
@@ -2466,9 +2472,6 @@ static int __init ub_init(void) | |||
2466 | { | 2472 | { |
2467 | int rc; | 2473 | int rc; |
2468 | 2474 | ||
2469 | /* P3 */ printk("ub: sizeof ub_scsi_cmd %zu ub_dev %zu ub_lun %zu\n", | ||
2470 | sizeof(struct ub_scsi_cmd), sizeof(struct ub_dev), sizeof(struct ub_lun)); | ||
2471 | |||
2472 | if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) | 2475 | if ((rc = register_blkdev(UB_MAJOR, DRV_NAME)) != 0) |
2473 | goto err_regblkdev; | 2476 | goto err_regblkdev; |
2474 | devfs_mk_dir(DEVFS_NAME); | 2477 | devfs_mk_dir(DEVFS_NAME); |