Received: by 10.223.176.5 with SMTP id f5csp581243wra; Sat, 27 Jan 2018 05:55:15 -0800 (PST) X-Google-Smtp-Source: AH8x226nPktTN6zdcaxDU73sYukeMT83EXjX/koHkqRpDkymwQ0A2nhPColdzdRUQcdM0dISXimX X-Received: by 10.98.181.14 with SMTP id y14mr22104896pfe.216.1517061315289; Sat, 27 Jan 2018 05:55:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517061315; cv=none; d=google.com; s=arc-20160816; b=AfCguuUlgmETVZyfP+KndSN/YdBqhAg1sjHRL+NCnx3UN1h3YCAATdH4I3ZpuEY70e tunqkJNxub+tRFL+mrdedN8f+Vihp7vDWa0/08UzxVdh0ipq1YMOSoKDrkcZNEpQHTKB 5BZkzzXHcHifwXKI9fO/pg3IRAXC+RkkdFHRa13KRIdtGWHyxNpfD+w7PStj/Jdz9ejF Ip8PlVk6tFtg/Yn7fw1qYKoAK5yAxB5MtIt6Fq8aFWQybTm10gl1QvjTwf6d08Z46PW/ mp982H9KcnneatQIyZFsr193DMeoNSeroq3FaQSnGk/BNnvH3yjbX+PAVtHs2QcPm+H1 lORw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:to:from :arc-authentication-results; bh=bV7f28AoDui3ZNJ8HxBDuxB0hvszIJQe6+YH8B1Q0s4=; b=qEVoU3Bz3PNGlzU5qdxRhVIBVKeaOKhzCkwBlhfm6P/5AzIwtSn/fvVWZVJ++f7lwa 7owNUXT5782iRj3Bk9cBsb7U7DNLYmELp7Mm3PCBwrzAE9qXsDwIs0KHcbpkZGEA70Dx ZnfRkv6ASz0K2eEo2pm4N22vWfeaWTp0KPI591AhmDoZatu+1mxCxi7edTAfHA/+OQDA d9buaYY1O1brTMA7trF9N02Kwku9Rbblv5ODFMQTwq8bvkduObsRWWO6Wq3GMpfSgNkr VfgsptB0eRpT0EuDK4uElEtwHtT0nq+Oav2BpziTXmEEXHf7I5ozon3LxNbFaXhjB78N 4EPA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6-v6si5391409plz.522.2018.01.27.05.54.48; Sat, 27 Jan 2018 05:55:15 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752793AbeA0NyP (ORCPT + 99 others); Sat, 27 Jan 2018 08:54:15 -0500 Received: from mx2.suse.de ([195.135.220.15]:60935 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751904AbeA0NyN (ORCPT ); Sat, 27 Jan 2018 08:54:13 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E6CE9ACE0; Sat, 27 Jan 2018 13:49:42 +0000 (UTC) From: Michal Suchanek To: Jens Axboe , Jonathan Corbet , Borislav Petkov , Tim Waugh , "David S. Miller" , "James E.J. Bottomley" , "Martin K. Petersen" , Michal Suchanek , Kees Cook , Christophe JAILLET , Thomas Gleixner , Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org Subject: [PATCH resend 4/6] cdrom: introduce CDS_DRIVE_ERROR Date: Fri, 26 Jan 2018 17:58:38 +0100 Message-Id: X-Mailer: git-send-email 2.13.6 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CDS_DRIVE_NOT_READY is used for the state in which CDROM is 'becoming ready' (typically analyzing the disc) but also as the fallback when nothing else applies. Introduce CDS_DRIVE_ERROR for the fallback case. Signed-off-by: Michal Suchanek --- drivers/block/paride/pcd.c | 2 +- drivers/cdrom/gdrom.c | 2 +- drivers/ide/ide-cd_ioctl.c | 12 ++++++++---- drivers/scsi/sr_ioctl.c | 2 +- include/uapi/linux/cdrom.h | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/block/paride/pcd.c b/drivers/block/paride/pcd.c index 7b8c6368beb7..6e00093ff34e 100644 --- a/drivers/block/paride/pcd.c +++ b/drivers/block/paride/pcd.c @@ -605,7 +605,7 @@ static int pcd_drive_status(struct cdrom_device_info *cdi, int slot_nr) struct pcd_unit *cd = cdi->handle; if (pcd_ready_wait(cd, PCD_READY_TMO)) - return CDS_DRIVE_NOT_READY; + return CDS_DRIVE_ERROR; if (pcd_atapi(cd, rc_cmd, 8, pcd_scratch, DBMSG("check media"))) return CDS_NO_DISC; return CDS_DISC_OK; diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c index 6495b03f576c..702f255bbe42 100644 --- a/drivers/cdrom/gdrom.c +++ b/drivers/cdrom/gdrom.c @@ -390,7 +390,7 @@ static int gdrom_drivestatus(struct cdrom_device_info *cd_info, int ignore) if (sense == 0) return CDS_DISC_OK; if (sense == 0x20) - return CDS_DRIVE_NOT_READY; + return CDS_DRIVE_ERROR; /* default */ return CDS_NO_INFO; } diff --git a/drivers/ide/ide-cd_ioctl.c b/drivers/ide/ide-cd_ioctl.c index 2acca12b9c94..9a26f50a2092 100644 --- a/drivers/ide/ide-cd_ioctl.c +++ b/drivers/ide/ide-cd_ioctl.c @@ -62,9 +62,13 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) return CDS_NO_DISC; } - if (sense.sense_key == NOT_READY && sense.asc == 0x04 - && sense.ascq == 0x04) - return CDS_DISC_OK; + if (sense.sense_key == NOT_READY && sense.asc == 0x04) + switch (sense.ascq) { + case 0x01: + return CDS_DRIVE_NOT_READY; + case 0x04: + return CDS_DISC_OK; + } /* * If not using Mt Fuji extended media tray reports, @@ -77,7 +81,7 @@ int ide_cdrom_drive_status(struct cdrom_device_info *cdi, int slot_nr) else return CDS_TRAY_OPEN; } - return CDS_DRIVE_NOT_READY; + return CDS_DRIVE_ERROR; } /* diff --git a/drivers/scsi/sr_ioctl.c b/drivers/scsi/sr_ioctl.c index 2a21f2d48592..7c93f12a9cb8 100644 --- a/drivers/scsi/sr_ioctl.c +++ b/drivers/scsi/sr_ioctl.c @@ -333,7 +333,7 @@ int sr_drive_status(struct cdrom_device_info *cdi, int slot) else return CDS_TRAY_OPEN; - return CDS_DRIVE_NOT_READY; + return CDS_DRIVE_ERROR; } int sr_disk_status(struct cdrom_device_info *cdi) diff --git a/include/uapi/linux/cdrom.h b/include/uapi/linux/cdrom.h index 2817230148fd..339b1435f44e 100644 --- a/include/uapi/linux/cdrom.h +++ b/include/uapi/linux/cdrom.h @@ -398,6 +398,7 @@ struct cdrom_generic_command #define CDS_TRAY_OPEN 2 #define CDS_DRIVE_NOT_READY 3 #define CDS_DISC_OK 4 +#define CDS_DRIVE_ERROR 5 /* return values for the CDROM_DISC_STATUS ioctl */ /* can also return CDS_NO_[INFO|DISC], from above */ -- 2.13.6