From patchwork Wed Nov 15 17:51:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver O'Halloran X-Patchwork-Id: 10059993 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 08FEC60231 for ; Wed, 15 Nov 2017 17:51:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EA8732A168 for ; Wed, 15 Nov 2017 17:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DF6F12A176; Wed, 15 Nov 2017 17:51:58 +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=-1.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, T_DKIM_INVALID autolearn=no version=3.3.1 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.wl.linuxfoundation.org (Postfix) with ESMTPS id 763D02A168 for ; Wed, 15 Nov 2017 17:51:58 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3E19E20356889; Wed, 15 Nov 2017 09:47:49 -0800 (PST) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2607:f8b0:400e:c00::242; helo=mail-pf0-x242.google.com; envelope-from=oohall@gmail.com; receiver=linux-nvdimm@lists.01.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 25C1F20356863 for ; Wed, 15 Nov 2017 09:47:47 -0800 (PST) Received: by mail-pf0-x242.google.com with SMTP id b6so17288998pff.10 for ; Wed, 15 Nov 2017 09:51:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=CFzFNtOhQqVOmVce/xVfEwEWjaBSE/o6FQIdVk6CrU4=; b=PFtxGQaRM2tG2yVWrFLs7XOmDcaKmXiNQFzV+JrSPdJMVxKStwVgzTkiA4Re07TWfE J46RUDrktLTqf1fY4+FKCxuUFw6rYOMJ4p+Nil391kAW3mSQLRNImG9CbwQSJkF2BWB8 8b31zp8a5RsQLq25mXx1D3O+P4J0Stj50FcjXAroywQZeeH9YLH94pDGRSzvq0a9Bmaj 7MGUW9Qqd8ONmWbrazvGlISq3qDKyI2SopRMByKnsabjdbvQtOFBWBbGvLdz/39yOc4M DNJzhZVDIh+TqxNz+lFKK2HhJKea3+ZTbQmjH6K3sPdxXk819rs/KZ/bVdDdKASmIyEz LTSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=CFzFNtOhQqVOmVce/xVfEwEWjaBSE/o6FQIdVk6CrU4=; b=sDBRDdWIYOesQku4tjBtu+PtJEnCR9e/VQoQxWo4UZJ5HtdE3D6avzJk2TdwwhtxLx +RAF25Qat8kY67akSCSN0cTmybZYJzd0R6PQZs9xs/Zu4BCFQok9tpp3VB6ixZGGBLvS LIbjB1fTvrOZKsAr1FPryDFp3fdyr+OAuSm6l6KqiKRVbxSfawWGUtIE4vTeRW282Zpi D4rYjofmRTi8EfBZKkTZ65eutHkqu2jg/yNWlWBlc+Q9GazUbBQCEIxwNocjaRN6kHJk Kek+/Av5sSLg5rC9GfYmbPaQwpdfUz2odTxWXqp0hlcxP1LyaJzwcMHdAHE5pA4alGeE VNIQ== X-Gm-Message-State: AJaThX4RKH5MScb+2cDY6n7GKUjmnVwUvEs/mHAMiqicJUgH6TxnQqkM Kj1vaqUW1XPFXlwWHe7Rc24= X-Google-Smtp-Source: AGs4zMa4XsgszjQqYzsrF2imI2IbF+c+3IFlifupvmlI7a2u4bPt2SdNFTUYlN3+l1S0o8MurStc9w== X-Received: by 10.99.113.30 with SMTP id m30mr12423207pgc.338.1510768316444; Wed, 15 Nov 2017 09:51:56 -0800 (PST) Received: from localhost.localdomain ([103.57.0.128]) by smtp.gmail.com with ESMTPSA id h185sm6995999pfe.171.2017.11.15.09.51.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Nov 2017 09:51:55 -0800 (PST) From: Oliver O'Halloran To: linuxppc-dev@lists.ozlabs.org Subject: [PATCH 1/3] libnvdimm: Add of_node to region and bus descriptors Date: Thu, 16 Nov 2017 04:51:29 +1100 Message-Id: <20171115175131.23631-1-oohall@gmail.com> X-Mailer: git-send-email 2.9.5 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-nvdimm@lists.01.org MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP We want to be able to cross reference the region and bus devices with the device tree node that they were spawned from. libNVDIMM handles creating the actual devices for these internally, so we need to pass in a pointer to the relevant node in the descriptor. Signed-off-by: Oliver O'Halloran Acked-by: Dan Williams --- drivers/nvdimm/bus.c | 1 + drivers/nvdimm/region_devs.c | 1 + include/linux/libnvdimm.h | 3 +++ 3 files changed, 5 insertions(+) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 0a5e6cd758fe..d6f94303ae44 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -358,6 +358,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, nvdimm_bus->dev.release = nvdimm_bus_release; nvdimm_bus->dev.groups = nd_desc->attr_groups; nvdimm_bus->dev.bus = &nvdimm_bus_type; + nvdimm_bus->dev.of_node = nd_desc->of_node; dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id); rc = device_register(&nvdimm_bus->dev); if (rc) { diff --git a/drivers/nvdimm/region_devs.c b/drivers/nvdimm/region_devs.c index abaf38c61220..4d756d8c8386 100644 --- a/drivers/nvdimm/region_devs.c +++ b/drivers/nvdimm/region_devs.c @@ -992,6 +992,7 @@ static struct nd_region *nd_region_create(struct nvdimm_bus *nvdimm_bus, dev->parent = &nvdimm_bus->dev; dev->type = dev_type; dev->groups = ndr_desc->attr_groups; + dev->of_node = ndr_desc->of_node; nd_region->ndr_size = resource_size(ndr_desc->res); nd_region->ndr_start = ndr_desc->res->start; nd_device_register(dev); diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index f8109ddb5ef1..fcd9f521e481 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h @@ -65,12 +65,14 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, struct nvdimm *nvdimm, unsigned int cmd, void *buf, unsigned int buf_len, int *cmd_rc); +struct device_node; struct nvdimm_bus_descriptor { const struct attribute_group **attr_groups; unsigned long bus_dsm_mask; unsigned long cmd_mask; struct module *module; char *provider_name; + struct device_node *of_node; ndctl_fn ndctl; int (*flush_probe)(struct nvdimm_bus_descriptor *nd_desc); int (*clear_to_send)(struct nvdimm_bus_descriptor *nd_desc, @@ -112,6 +114,7 @@ struct nd_region_desc { int num_lanes; int numa_node; unsigned long flags; + struct device_node *of_node; }; struct device;