From patchwork Wed Jul 6 22:12:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Yan X-Patchwork-Id: 9217129 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 60B71608A6 for ; Wed, 6 Jul 2016 22:12:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F7B1284C6 for ; Wed, 6 Jul 2016 22:12:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4426D284CB; Wed, 6 Jul 2016 22:12:54 +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 D985F284C8 for ; Wed, 6 Jul 2016 22:12:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755777AbcGFWMt (ORCPT ); Wed, 6 Jul 2016 18:12:49 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35410 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755650AbcGFWMr (ORCPT ); Wed, 6 Jul 2016 18:12:47 -0400 Received: by mail-pf0-f195.google.com with SMTP id t190so7873pfb.2; Wed, 06 Jul 2016 15:12:30 -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=LGoMotMHSZAbCrRR8rOua0cFP4ie9fRhGJc2tcCsuB4=; b=uPBCYVqQZ8Rv90ers2cL9sH5kfSEyUhDHvBbvT7kLYML+icXoKDChT+ZetCu8Ur44D ZKywlQzRB/ln43IBxHzMVz1k4gfluEJEGBEa6NsuEB5rvaciZLlZv9vv/c+mgWLVqeUh J1RcA6XZvprt+GlbP3PWFC6kkViswmPzxAPzkPc3LD5RV49j/5Il3NDZUS3YNb4hWjTQ 3aSfo0+/M7huW8Z905S+23g3SD6+IbfhU5djBNZ3rYVZPqUXCsoHkv14smO4HOA166JO n3FXc78HCTN0q+cG2Z41JmPHLlZrEayLReAT3vXFTjN8amS+eetxk14IRllN/OdV8jyc uK2g== 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=LGoMotMHSZAbCrRR8rOua0cFP4ie9fRhGJc2tcCsuB4=; b=YtnwLiQzzBGAQwRLAYYhQJNx7SM9a+IEz5jWR/PI/3krmMmcWvpBPtICPyuvM9x7QQ OTFkhSFu5h4ZsFi4cYWdmBVUq/4RjU9IwV6wnqoLZAiZ9Oo6M4WjONcQvLwmwnNW0B+C VPQYb5zhaMoXtQoygIAmawdJEMsUkzqvusxh4P2IVoUqGq3FXLXmDn0J6Ne8p0V6x0OH WIQtHHb0N3cThIVzXmh+91wXKrTtp64MUE0BlI9gpXyDVU+APchF0mtjf1QfIbwzeJ2b g6gevN66hXChSAV/ykb45GKluoRG2aLzJe7jHYtEXo8g7LxcDVFfWOFkYeEkIH+O3Iig h3MQ== X-Gm-Message-State: ALyK8tLgVntdylX1Wq0NyFcandGfwJFVZRslde3YGRPmupCpE0HbhXIr5OlF/EILy1YJlg== X-Received: by 10.98.70.144 with SMTP id o16mr46568622pfi.126.1467843150018; Wed, 06 Jul 2016 15:12:30 -0700 (PDT) Received: from localhost.localdomain ([2404:c805:e00:4700:ae22:bff:fe29:e60c]) by smtp.gmail.com with ESMTPSA id z1sm3989364pab.19.2016.07.06.15.12.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2016 15:12:29 -0700 (PDT) Message-ID: <577d824d.a10c420a.da50c.ffff9544@mx.google.com> X-Google-Original-Message-ID: <20160706221213.1928-2-me> From: tom.ty89@gmail.com X-Google-Original-From: me To: tj@kernel.org Cc: linux-ide@vger.kernel.org, linux-scsi@vger.kernel.org, Tom Yan Subject: [PATCH 2/2] libata-scsi: do not return t10 designator if drive has WWN Date: Thu, 7 Jul 2016 06:12:13 +0800 X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160706221213.1928-1-me> References: <20160706221213.1928-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 SAT (as of sat4r05f.pdf) only requires the t10 designator if the drive does not support/have WWN. Besides, we already have the ATA information VPD. Signed-off-by: Tom Yan diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 9f478ad..84b3d42 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c @@ -2210,21 +2210,6 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf) rbuf[1] = 0x83; /* this page code */ num = 4; - /* SAT defined lu model and serial numbers descriptor */ - /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ - rbuf[num + 0] = 2; - rbuf[num + 1] = 1; - rbuf[num + 3] = sat_model_serial_desc_len; - num += 4; - memcpy(rbuf + num, "ATA ", 8); - num += 8; - ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD, - ATA_ID_PROD_LEN); - num += ATA_ID_PROD_LEN; - ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO, - ATA_ID_SERNO_LEN); - num += ATA_ID_SERNO_LEN; - if (ata_id_has_wwn(args->id)) { /* SAT defined lu world wide name */ /* piv=0, assoc=lu, code_set=binary, designator=NAA */ @@ -2236,6 +2221,23 @@ static unsigned int ata_scsiop_inq_83(struct ata_scsi_args *args, u8 *rbuf) ATA_ID_WWN, ATA_ID_WWN_LEN); num += ATA_ID_WWN_LEN; } + else { + /* SAT defined lu model and serial numbers descriptor */ + /* piv=0, assoc=lu, code_set=ACSII, designator=t10 vendor id */ + rbuf[num + 0] = 2; + rbuf[num + 1] = 1; + rbuf[num + 3] = sat_model_serial_desc_len; + num += 4; + memcpy(rbuf + num, "ATA ", 8); + num += 8; + ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_PROD, + ATA_ID_PROD_LEN); + num += ATA_ID_PROD_LEN; + ata_id_string(args->id, (unsigned char *) rbuf + num, ATA_ID_SERNO, + ATA_ID_SERNO_LEN); + num += ATA_ID_SERNO_LEN; + } + rbuf[3] = num - 4; /* page len (assume less than 256 bytes) */ return 0; }