From patchwork Thu Mar 24 01:26:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 8655751 Return-Path: X-Original-To: patchwork-linux-nvdimm@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 8A95CC0553 for ; Thu, 24 Mar 2016 01:27:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD2792037F for ; Thu, 24 Mar 2016 01:27:09 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A37D5202E5 for ; Thu, 24 Mar 2016 01:27:08 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8063E1A1E04; Wed, 23 Mar 2016 18:27:33 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by ml01.01.org (Postfix) with ESMTP id 856711A1E04 for ; Wed, 23 Mar 2016 18:27:32 -0700 (PDT) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga101.fm.intel.com with ESMTP; 23 Mar 2016 18:27:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,383,1455004800"; d="scan'208";a="917588379" Received: from dwillia2-desk3.jf.intel.com ([10.54.39.14]) by orsmga001.jf.intel.com with ESMTP; 23 Mar 2016 18:27:07 -0700 Subject: [PATCH 13/13] libnvdimm, pmem: kill ->pmem_queue and ->pmem_disk From: Dan Williams To: linux-nvdimm@lists.01.org Date: Wed, 23 Mar 2016 18:26:29 -0700 Message-ID: <20160324012629.21436.58603.stgit@dwillia2-desk3.jf.intel.com> In-Reply-To: <20160324012520.21436.22505.stgit@dwillia2-desk3.jf.intel.com> References: <20160324012520.21436.22505.stgit@dwillia2-desk3.jf.intel.com> User-Agent: StGit/0.17.1-9-g687f MIME-Version: 1.0 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, T_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 devm conversion obviates the need to continue to remember the queue and disk locally in the driver. Signed-off-by: Dan Williams Reviewed-by: Johannes Thumshirn --- drivers/nvdimm/pmem.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c index 616a16cd655b..0cd7c6529497 100644 --- a/drivers/nvdimm/pmem.c +++ b/drivers/nvdimm/pmem.c @@ -33,9 +33,6 @@ #include "nd.h" struct pmem_device { - struct request_queue *pmem_queue; - struct gendisk *pmem_disk; - /* One contiguous memory region per device */ phys_addr_t phys_addr; /* when non-zero this device is hosting a 'pfn' instance */ @@ -52,7 +49,7 @@ struct pmem_device { static void pmem_clear_poison(struct pmem_device *pmem, phys_addr_t offset, unsigned int len) { - struct device *dev = disk_to_dev(pmem->pmem_disk); + struct device *dev = pmem->bb.dev; sector_t sector; long cleared; @@ -227,7 +224,6 @@ static int pmem_attach_disk(struct device *dev, q = blk_alloc_queue_node(GFP_KERNEL, dev_to_node(dev)); if (!q) return -ENOMEM; - pmem->pmem_queue = q; pmem->pfn_flags = PFN_DEV; if (is_nd_pfn(dev)) { @@ -260,12 +256,12 @@ static int pmem_attach_disk(struct device *dev, return PTR_ERR(addr); pmem->virt_addr = (void __pmem *) addr; - blk_queue_make_request(pmem->pmem_queue, pmem_make_request); - blk_queue_physical_block_size(pmem->pmem_queue, PAGE_SIZE); - blk_queue_max_hw_sectors(pmem->pmem_queue, UINT_MAX); - blk_queue_bounce_limit(pmem->pmem_queue, BLK_BOUNCE_ANY); - queue_flag_set_unlocked(QUEUE_FLAG_NONROT, pmem->pmem_queue); - pmem->pmem_queue->queuedata = pmem; + blk_queue_make_request(q, pmem_make_request); + blk_queue_physical_block_size(q, PAGE_SIZE); + blk_queue_max_hw_sectors(q, UINT_MAX); + blk_queue_bounce_limit(q, BLK_BOUNCE_ANY); + queue_flag_set_unlocked(QUEUE_FLAG_NONROT, q); + q->queuedata = pmem; disk = alloc_disk_node(0, nid); if (!disk) @@ -276,13 +272,12 @@ static int pmem_attach_disk(struct device *dev, } disk->fops = &pmem_fops; - disk->queue = pmem->pmem_queue; + disk->queue = q; disk->flags = GENHD_FL_EXT_DEVT; nvdimm_namespace_disk_name(ndns, disk->disk_name); disk->driverfs_dev = dev; set_capacity(disk, (pmem->size - pmem->pfn_pad - pmem->data_offset) / 512); - pmem->pmem_disk = disk; if (devm_init_badblocks(dev, &pmem->bb)) return -ENOMEM; nvdimm_badblocks_populate(to_nd_region(dev->parent), &pmem->bb, res);