From patchwork Tue Jul 5 06:45:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9213705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 040A26048B for ; Tue, 5 Jul 2016 06:46:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9F88288F2 for ; Tue, 5 Jul 2016 06:46:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE224288F4; Tue, 5 Jul 2016 06:46:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96CA6288F2 for ; Tue, 5 Jul 2016 06:46:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932685AbcGEGqO (ORCPT ); Tue, 5 Jul 2016 02:46:14 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:34303 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932681AbcGEGqM (ORCPT ); Tue, 5 Jul 2016 02:46:12 -0400 Received: by mail-pf0-f193.google.com with SMTP id 66so18216691pfy.1; Mon, 04 Jul 2016 23:46:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:cc:subject:date:in-reply-to:references; bh=wazJAnjq8ZOOhjPVR2JL58T5gYqJhP+Il7VFwJuXsco=; b=EQUwjy4mKAvxHk8AETh7L72TgpqlS/O0TyPWcUOcnoFYQ7+1vijKEobuG1jR/owcH2 KwBC2kZb5OfQE2lHX2q4m11LC+k89nPs5hJnz2mUOtGWg20f7sWyFOD7mP/q3cVOvXdc KK+1pLp5JSreAKAfvYRnq1ouCbemLdFvKhcI3VBT11FydRRsvgCUqnWUcq4JJrk9u2Sy kNteMwx5wM7WNLmqLqj0AcC527PfhUkPqoYwXFpuUeVHH/rmKX8zzuzaibIltmw4Advw naUyktgmuWH/KM088lNmyijYBEPLWBakcHwOMeAUvN+wrGOOtJVVV4fDsPbBzw0Iufed eTsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:from:to:cc:subject:date:in-reply-to :references; bh=wazJAnjq8ZOOhjPVR2JL58T5gYqJhP+Il7VFwJuXsco=; b=Sm4DybbBPtrabUjTSCFmRp+JDC6vlRY9UUvvlcQ4BG4eubZDqRkpQ/Sgf9qAFvB0XO b1soeadrMJLUQeV2AlpeYYQKuBzMiKmJ5L/XeCaqyKw9BWJk6AuewPMmLr1RzBAnwCd1 H0Mkef+CE0mwlxTdLIkFGUv4mFwwGmaiv8LCfnzYBNoKGHFc1QoonhWuDPE0BBX44qmZ 4i8RoKhTxm5bEfl+F2Yf7IzGS2yNj+hYs3cE/J9IcyeAurCdwQVdJ5/zZoA3BChMh2Ik vzVKTmBBrIqrQqyjsoHdASq/r+NXD6HGMnGRHl3t65+PzvEoXQv/xuwa5bdJ0I4F2M1g omhQ== X-Gm-Message-State: ALyK8tKfUivTamYnORoLj13JyMcmh5DEUW1Kst3FD0KMSGRmX9VRYpI7QGvYoqU/OBPvTQ== X-Received: by 10.98.79.17 with SMTP id d17mr29198354pfb.127.1467701171652; Mon, 04 Jul 2016 23:46:11 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id z88sm2191171pfa.59.2016.07.04.23.46.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jul 2016 23:46:11 -0700 (PDT) Message-ID: <577b57b3.5b4c620a.37648.6c91@mx.google.com> X-Google-Original-Message-ID: <20160705064556.909-2-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org, martin.petersen@oracle.com, sergei.shtylyov@cogentembedded.com Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH v2 2/2] libata-scsi: do not respond with "invalid field" for FORMAT UNIT Date: Tue, 5 Jul 2016 14:45:56 +0800 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160705064556.909-1-me> References: <20160705064556.909-1-me> Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Yan It does not make sense and is confusing to respond with "Invalid field in CDB" while we have no support at all implemented for FORMAT UNIT. It is decent to let it go to the default, which will respond with "Invalid command operation code" instead. Signed-off-by: Tom Yan diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 029e738..ac5676e 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -307,7 +307,7 @@ static void ata_scsi_set_invalid_field(struct ata_device *dev, struct scsi_cmnd *cmd, u16 field, u8 bit) { ata_scsi_set_sense(dev, cmd, ILLEGAL_REQUEST, 0x24, 0x0); - /* "Invalid field in cbd" */ + /* "Invalid field in CDB" */ scsi_set_sense_field_pointer(cmd->sense_buffer, SCSI_SENSE_BUFFERSIZE, field, bit, 1); } @@ -4045,11 +4045,6 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd) args.done = cmd->scsi_done; switch(scsicmd[0]) { - /* TODO: worth improving? */ - case FORMAT_UNIT: - ata_scsi_invalid_field(dev, cmd, 0); - break; - case INQUIRY: if (scsicmd[1] & 2) /* is CmdDt set? */ ata_scsi_invalid_field(dev, cmd, 1);