Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4130211pxj; Tue, 15 Jun 2021 16:20:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzycc4M0AclPeLen/sWHbTxJs0XoGGwhD0Vm62WGIJeliQ5lQwMB2VDz/Du9L1zpp31xAC1 X-Received: by 2002:a02:8241:: with SMTP id q1mr1371435jag.134.1623799216273; Tue, 15 Jun 2021 16:20:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623799216; cv=none; d=google.com; s=arc-20160816; b=vwe4VbTzvdtOUALksYaRfR8c3wj8EHHoQICJmUunEGRNgamY3lQu9Wkg+fUxKMveW/ 5a3juNXSKpmc5lZK1ppJphzec369r7RqrAfk+iDWPiiIeUZrRU4zHKHKYBnQ9DXFkbZc dQVDP5jQSgb9wMvQygb0/6De/IdsJMtzIbW7j1n6ZL8PnIqlBjGQMsLYYRfAJA2IyWuL f0lRXtZ7SrH3vyJNw6HGXihdsNgdoSpZ+YPy46z34r/4ah501sVAR04kz/xcMIBnQ+6/ s5EbSFMR3uJC4oxVeqhADPgcR3ZvfgiEbwSZ18xqw9gTJCZaXz0S2ITB3ZlyJUbiVD3B wE1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=UTi++YV3tm7/98coVz04zwkuBRjkmBAkFM+b7uNXrRM=; b=JBHBLf0bjXvx5yQADVb5MOR2OV8ZUyyzJjs5c1tZ+ygXZRewGwwBigemhmre0JCdbM 5AzfQRaxHRL2IvgQT26Jg4+ZPl+yyAxIp1Q1Wx3CUdW4rgaEoBJcst6XIz+83RkfAScn WFFpCDwlxQkQnDrUaBuhQ7IOMUKy+VcYzMfCd1g7URzSEYqKL167nif1nuyNJgMd3h3e wljCP/rPJmNExadJH8bqqXVP01xlM3310L9XENNl4cGHWXUzPBnjj/w8eK+meE77x+Hu bfDp07OFGZKM38nncW4Krmc+nIsKZ18dGhC6wGpnTN3oWvDH+Xs2kE/BVIbCkcbT4+eF 20dA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i1si582727jaj.53.2021.06.15.16.20.03; Tue, 15 Jun 2021 16:20:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231444AbhFOXUe (ORCPT + 99 others); Tue, 15 Jun 2021 19:20:34 -0400 Received: from mga12.intel.com ([192.55.52.136]:51237 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbhFOXUd (ORCPT ); Tue, 15 Jun 2021 19:20:33 -0400 IronPort-SDR: JZZ1KWuP0V+KguAymJEvbl4qreeEV+KEvzAKyJkCDDUBQVemsClqPYaCtcHbd+Kdx8EwEkQZIf +A6tRhy51z6A== X-IronPort-AV: E=McAfee;i="6200,9189,10016"; a="185776159" X-IronPort-AV: E=Sophos;i="5.83,276,1616482800"; d="scan'208";a="185776159" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2021 16:18:28 -0700 IronPort-SDR: FPel43yAGe7C6TXE6cpYEMs/5YBQvb4RH0W11fkuSIaQbkdQ52xUpyFAaRP7272S7KnJYu7FOI HiPnqL+ENJ1A== X-IronPort-AV: E=Sophos;i="5.83,276,1616482800"; d="scan'208";a="487940036" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Jun 2021 16:18:28 -0700 Subject: [PATCH v2 4/5] libnvdimm: Drop unused device power management support From: Dan Williams To: linux-cxl@vger.kernel.org Cc: Jonathan Cameron , linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev Date: Tue, 15 Jun 2021 16:18:28 -0700 Message-ID: <162379910795.2993820.10130417680551632288.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <162379908663.2993820.16543025953842049041.stgit@dwillia2-desk3.amr.corp.intel.com> References: <162379908663.2993820.16543025953842049041.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org LIBNVDIMM device objects register sysfs power attributes despite nothing requiring that support. Clean up sysfs remove the power/ attribute group. This requires a device_create() and a device_register() usage to be converted to the device_initialize() + device_add() pattern. Reviewed-by: Jonathan Cameron Link: https://lore.kernel.org/r/162336397948.2462439.5230237265829121099.stgit@dwillia2-desk3.amr.corp.intel.com Signed-off-by: Dan Williams --- drivers/nvdimm/bus.c | 45 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 37 insertions(+), 8 deletions(-) diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index a11821df83b5..e6aa87043a95 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -363,8 +363,13 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, 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); + device_initialize(&nvdimm_bus->dev); + device_set_pm_not_required(&nvdimm_bus->dev); + rc = dev_set_name(&nvdimm_bus->dev, "ndbus%d", nvdimm_bus->id); + if (rc) + goto err; + + rc = device_add(&nvdimm_bus->dev); if (rc) { dev_dbg(&nvdimm_bus->dev, "registration failed: %d\n", rc); goto err; @@ -525,6 +530,7 @@ void __nd_device_register(struct device *dev) set_dev_node(dev, to_nd_region(dev)->numa_node); dev->bus = &nvdimm_bus_type; + device_set_pm_not_required(dev); if (dev->parent) { get_device(dev->parent); if (dev_to_node(dev) == NUMA_NO_NODE) @@ -717,18 +723,41 @@ const struct attribute_group nd_numa_attribute_group = { .is_visible = nd_numa_attr_visible, }; +static void ndctl_release(struct device *dev) +{ + kfree(dev); +} + int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus) { dev_t devt = MKDEV(nvdimm_bus_major, nvdimm_bus->id); struct device *dev; + int rc; - dev = device_create(nd_class, &nvdimm_bus->dev, devt, nvdimm_bus, - "ndctl%d", nvdimm_bus->id); + dev = kzalloc(sizeof(*dev), GFP_KERNEL); + if (!dev) + return -ENOMEM; + device_initialize(dev); + device_set_pm_not_required(dev); + dev->class = nd_class; + dev->parent = &nvdimm_bus->dev; + dev->devt = devt; + dev->release = ndctl_release; + rc = dev_set_name(dev, "ndctl%d", nvdimm_bus->id); + if (rc) + goto err; - if (IS_ERR(dev)) - dev_dbg(&nvdimm_bus->dev, "failed to register ndctl%d: %ld\n", - nvdimm_bus->id, PTR_ERR(dev)); - return PTR_ERR_OR_ZERO(dev); + rc = device_add(dev); + if (rc) { + dev_dbg(&nvdimm_bus->dev, "failed to register ndctl%d: %d\n", + nvdimm_bus->id, rc); + goto err; + } + return 0; + +err: + put_device(dev); + return rc; } void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus)