aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cdrom/gdrom.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-06-03 03:38:04 -0400
committerJens Axboe <axboe@fb.com>2017-06-09 11:27:32 -0400
commit2a842acab109f40f0d7d10b38e9ca88390628996 (patch)
treebdfc7a47fe655c2ea7a5f74127015d7a502042f0 /drivers/cdrom/gdrom.c
parent1be5690984588953e759af0a4c6ddac182a1806c (diff)
block: introduce new block status code type
Currently we use nornal Linux errno values in the block layer, and while we accept any error a few have overloaded magic meanings. This patch instead introduces a new blk_status_t value that holds block layer specific status codes and explicitly explains their meaning. Helpers to convert from and to the previous special meanings are provided for now, but I suspect we want to get rid of them in the long run - those drivers that have a errno input (e.g. networking) usually get errnos that don't know about the special block layer overloads, and similarly returning them to userspace will usually return somethings that strictly speaking isn't correct for file system operations, but that's left as an exercise for later. For now the set of errors is a very limited set that closely corresponds to the previous overloaded errno values, but there is some low hanging fruite to improve it. blk_status_t (ab)uses the sparse __bitwise annotations to allow for sparse typechecking, so that we can easily catch places passing the wrong values. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/cdrom/gdrom.c')
-rw-r--r--drivers/cdrom/gdrom.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 1372763a948f..53f8278e66f7 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -583,7 +583,8 @@ static int gdrom_set_interrupt_handlers(void)
583 */ 583 */
584static void gdrom_readdisk_dma(struct work_struct *work) 584static void gdrom_readdisk_dma(struct work_struct *work)
585{ 585{
586 int err, block, block_cnt; 586 int block, block_cnt;
587 blk_status_t err;
587 struct packet_command *read_command; 588 struct packet_command *read_command;
588 struct list_head *elem, *next; 589 struct list_head *elem, *next;
589 struct request *req; 590 struct request *req;
@@ -641,7 +642,7 @@ static void gdrom_readdisk_dma(struct work_struct *work)
641 __raw_writeb(1, GDROM_DMA_STATUS_REG); 642 __raw_writeb(1, GDROM_DMA_STATUS_REG);
642 wait_event_interruptible_timeout(request_queue, 643 wait_event_interruptible_timeout(request_queue,
643 gd.transfer == 0, GDROM_DEFAULT_TIMEOUT); 644 gd.transfer == 0, GDROM_DEFAULT_TIMEOUT);
644 err = gd.transfer ? -EIO : 0; 645 err = gd.transfer ? BLK_STS_IOERR : BLK_STS_OK;
645 gd.transfer = 0; 646 gd.transfer = 0;
646 gd.pending = 0; 647 gd.pending = 0;
647 /* now seek to take the request spinlock 648 /* now seek to take the request spinlock
@@ -670,11 +671,11 @@ static void gdrom_request(struct request_queue *rq)
670 break; 671 break;
671 case REQ_OP_WRITE: 672 case REQ_OP_WRITE:
672 pr_notice("Read only device - write request ignored\n"); 673 pr_notice("Read only device - write request ignored\n");
673 __blk_end_request_all(req, -EIO); 674 __blk_end_request_all(req, BLK_STS_IOERR);
674 break; 675 break;
675 default: 676 default:
676 printk(KERN_DEBUG "gdrom: Non-fs request ignored\n"); 677 printk(KERN_DEBUG "gdrom: Non-fs request ignored\n");
677 __blk_end_request_all(req, -EIO); 678 __blk_end_request_all(req, BLK_STS_IOERR);
678 break; 679 break;
679 } 680 }
680 } 681 }