From patchwork Fri Nov 20 16:35:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 7669631 Return-Path: X-Original-To: patchwork-linux-block@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 451C2BF90C for ; Fri, 20 Nov 2015 16:41:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70F24201EC for ; Fri, 20 Nov 2015 16:41:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 339B7201C8 for ; Fri, 20 Nov 2015 16:40:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1163102AbbKTQkx (ORCPT ); Fri, 20 Nov 2015 11:40:53 -0500 Received: from bombadil.infradead.org ([198.137.202.9]:51087 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163015AbbKTQkw (ORCPT ); Fri, 20 Nov 2015 11:40:52 -0500 Received: from p3ee3e1bb.dip0.t-ipconnect.de ([62.227.225.187] helo=localhost) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zzojx-0006oE-6t; Fri, 20 Nov 2015 16:40:49 +0000 From: Christoph Hellwig To: keith.busch@intel.com, axboe@fb.com Cc: linux-nvme@lists.infradead.org, linux-block@vger.kernel.org Subject: [PATCH 09/47] nvme: add a vendor field to struct nvme_dev Date: Fri, 20 Nov 2015 17:35:04 +0100 Message-Id: <1448037342-18384-10-git-send-email-hch@lst.de> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448037342-18384-1-git-send-email-hch@lst.de> References: <1448037342-18384-1-git-send-email-hch@lst.de> X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SCSI translation layer currently has to poke into the PCI device structure to find a vendor ID for the device identification fallback. We won't nessecarily have a PCI device behind the device structure in the future, so add a new vendor field that can be filled out by the PCIe driver instead. Signed-off-by: Christoph Hellwig Acked-by: Keith Busch Signed-off-by: Keith Busch --- drivers/nvme/host/nvme.h | 1 + drivers/nvme/host/pci.c | 3 +++ drivers/nvme/host/scsi.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index a53977c..02fca73 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -74,6 +74,7 @@ struct nvme_dev { u16 abort_limit; u8 event_limit; u8 vwc; + u16 vendor; }; /* diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 094c355..79bca52 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -3150,6 +3150,9 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) INIT_WORK(&dev->reset_work, nvme_reset_work); dev->dev = get_device(&pdev->dev); pci_set_drvdata(pdev, dev); + + dev->vendor = pdev->vendor; + result = nvme_set_instance(dev); if (result) goto put_pci; diff --git a/drivers/nvme/host/scsi.c b/drivers/nvme/host/scsi.c index c3d8d38..8f2d2c5 100644 --- a/drivers/nvme/host/scsi.c +++ b/drivers/nvme/host/scsi.c @@ -657,7 +657,7 @@ static int nvme_trans_device_id_page(struct nvme_ns *ns, struct sg_io_hdr *hdr, inq_response[6] = 0x00; /* Rsvd */ inq_response[7] = 0x44; /* Designator Length */ - sprintf(&inq_response[8], "%04x", to_pci_dev(dev->dev)->vendor); + sprintf(&inq_response[8], "%04x", dev->vendor); memcpy(&inq_response[12], dev->model, sizeof(dev->model)); sprintf(&inq_response[52], "%04x", tmp_id); memcpy(&inq_response[56], dev->serial, sizeof(dev->serial));