From patchwork Thu Oct 5 19:44:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 114993 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp959342qgn; Thu, 5 Oct 2017 12:46:17 -0700 (PDT) X-Received: by 10.159.252.65 with SMTP id t1mr12554782plz.31.1507232777121; Thu, 05 Oct 2017 12:46:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507232777; cv=none; d=google.com; s=arc-20160816; b=y38blyfgGs3+Jdcotp41pOO+NKM1ige2iMmtOeQZDTDnLsKozrCRUHcZ9Ma8EBhlME 0K8sds/ktZr8xFNy+gxnyGbHaL1VhC2PnzzACOcabl/qiFlY5g+yStciV+KsAGogVYkZ 8Bl9Dpv4f4PTwSMiyo4Rp4xfiBxHD2frP2TT/M2UBpX1k9ucbFGFq0jT+JbN6Lk4xX7C 8zJkvkjRg/tEMN8PcjuNXo42ggOZ9JSHqjP+q74PiXQSeFmxO3CUrF9lOS5KBfRgUeal kA5QzW+hK+MT8w4o/WTKDTRlPRvPzWvWvfcvLhtdNVSLPC7mGU2BuxFFa5o4mfh0cUAI DzDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=NH09NN7rqcGtN93WR7UvCQNdMZgoUYk5ixl653QJu+Q=; b=pGhg5hvDGdG3x80KUKUS81215iQBDElQpA/wzEdsDXNmujI7SllU0EvcQ9Fop3rwkQ GK9PC4hiQXd9tVLvOqLsxUsaNxLQHf6UjnfTlQcDGZ2ol+kpzyDh0HLUnsQ8YkH4fD5H J9V3OTklYykg2AwjW0NGZnYgTbGOkL/kA4AeZoiLbMgVc5gIsLbdJIJlm50Js8QIWYm4 T1uHrbBIY5jJtm/eqmI1G7ZVzBNbZm7K3PeCa+UZDTFxofN9wycrZsg/c5IdcKxccFN8 3IkHoovSpsdSxsvWMN2I6lzK+HtyGoMGWrKMkNDqwMhymIW9IljUC4YOxJkGOl0ouggN EkTA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z1si14228160plb.359.2017.10.05.12.46.16; Thu, 05 Oct 2017 12:46:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752189AbdJETqQ (ORCPT + 6 others); Thu, 5 Oct 2017 15:46:16 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:36145 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751423AbdJETo1 (ORCPT ); Thu, 5 Oct 2017 15:44:27 -0400 Received: by mail-oi0-f65.google.com with SMTP id p187so6563984oif.3; Thu, 05 Oct 2017 12:44:27 -0700 (PDT) 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:in-reply-to :references; bh=Gbet60dKFend4d4DqdVMKAZ7WGjXc3TNcWH61kloWQY=; b=qLMOioQC5A7d+YRaa1rIRdYYlOb2FqGftPkZD1yMS8NBdcfatkIE/6V1TLw14ifJbD 9TajshOyn1Sg9jdfaMStZtb+GOMiOz0fc2JIFAcGpcGFR0C9fAwYmYb29f8qgVDuCbse KWF3y0H/8XeKIiKyRJjrSepQb8DrPExjuUjUUjHUN0TVCQ0trIdyjDXYvvvl4DGJcoHP 08W45dkp9Q/tRv96hZXQJe/dKcGVL7FgX8keXkSdwb0J1pzTpLfXduz6499Zk2Shmxxw bRdgCcHLPb4MfM39YelNbAPut5pL2hQQbMQV8l7XWfaZX0wWTBXGcrr9XWTuSaDxm8yQ yw0w== X-Gm-Message-State: AMCzsaX89EUV0wGbPBDpU8W5mVCVr5pSLkwKsHnpGZpUDArtI4ZdHRlf ZMNqOi84qg7vlmkQHeEMO6vw790= X-Google-Smtp-Source: AOwi7QBpOyJxzmtwBWQ9RySjvC/hAaYJwPXKtxSUuIRkyt7wyRKONrmDJA3M90EIhWkkPqHmcC5FFA== X-Received: by 10.157.68.114 with SMTP id f47mr11140728otj.282.1507232667159; Thu, 05 Oct 2017 12:44:27 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id b73sm9011795oii.1.2017.10.05.12.44.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 12:44:26 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Nicolas Pitre , Frank Rowand , Grant Likely Subject: [PATCH 1/6] of: fix missing kobject init for !SYSFS && OF_DYNAMIC config Date: Thu, 5 Oct 2017 14:44:17 -0500 Message-Id: <20171005194422.26224-2-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171005194422.26224-1-robh@kernel.org> References: <20171005194422.26224-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The ref counting is broken for OF_DYNAMIC when sysfs is disabled because the kobject initialization is skipped. Only the properties add/remove/update should be skipped for !SYSFS config. Cc: Nicolas Pitre Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/of/base.c | 3 --- 1 file changed, 3 deletions(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/of/base.c b/drivers/of/base.c index 260d33c0f26c..9e9bd17121fb 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -169,9 +169,6 @@ int __of_attach_node_sysfs(struct device_node *np) struct property *pp; int rc; - if (!IS_ENABLED(CONFIG_SYSFS)) - return 0; - if (!of_kset) return 0; From patchwork Thu Oct 5 19:44:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 114988 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp958047qgn; Thu, 5 Oct 2017 12:44:37 -0700 (PDT) X-Received: by 10.84.235.72 with SMTP id g8mr22677436plt.86.1507232677050; Thu, 05 Oct 2017 12:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507232677; cv=none; d=google.com; s=arc-20160816; b=C9HVe9JbueNUpyIMcgDKV9Uwwddypb7KJpNIrLifjRpw8EhhGqnfgg/bn7O0wkfNlJ tRkPs595OjbOxzyrCuQdR8ZQrNbGJIJQ3xvNHAkJJ+TLbsNT8FETrWbewbHIu9It2Ivz spjO1NbmCqM9LTf8Nz6vD7RcvRRU1gkzOBSKotCnSvbEotE3sGsxaRo/wWG3UkGuy4EV xYpfTMxrTBtec3Ray1AmM89/rcANyPrZU8AB4/Rz8lX7wNX9HApmfVPUJc54VsGLOP3r s5BdMb/lHROTFyfrM7qP0PJ72JNq7KxwfktmvWN1wPBQILdlcyKOQF5sIBZ5Ae6nn0f+ X3Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=xauYNois0znU/ROzwpaLj5m8DaCkTJvMvH8LycYiq6s=; b=v6a12hppCyn5XPQIDQpTC9PsXfbe4TO1XuJTd01gB7FSiWAIrqnZw3D1Ru93nTO9JU m+QOaEWwtTmW2+NfsCgr+BbJLkNfpks8YrbajvUFcew/igot+02XRLZ4O7UKjl0/s8eF vuDlrTynxR7lptmTqL+1XTQtot/yiKj03qtrpwyZuqt4qdnVDUErUPCnm3qWmJYskRyc rPK0LQ6B3En5hrie4o/+dWENTtLY1prD9+Cd+iqPjliEFKP8GtpuaWRZipK+ENTejNDc rTE5oZGgPn0YkhoFx563iUPz95FYWhvLJLuL0kKW6y0Gjy1p4g7RikDsLh0sF0JRpq/8 MdCw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 67si13593098pfz.229.2017.10.05.12.44.36; Thu, 05 Oct 2017 12:44:37 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752135AbdJEToe (ORCPT + 6 others); Thu, 5 Oct 2017 15:44:34 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:37442 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751405AbdJEToc (ORCPT ); Thu, 5 Oct 2017 15:44:32 -0400 Received: by mail-oi0-f65.google.com with SMTP id h9so9087108oia.4; Thu, 05 Oct 2017 12:44:32 -0700 (PDT) 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:in-reply-to :references; bh=eEkQ9YZk+aag8pEIGZPRr96iYUFTfra6cZEbkF5Lr48=; b=WjpUGWlWUQRKNPcwKrxmzvpAl3N0Rj2WpcY32KS7YO3deojsF9SdanQkAgs1C7RmRY /vxR1lIFlZ3zufL/s6JX3/CQSmFv+RX0DCmUiMvT2hzMz8uKThukbTAbA1VzwUzGZ7uE j3usNSBpDH7utsKuYzuxBWq/PoM9EkA3PUwkmURO1iG6Xipr/iHHDtRZeM1pZj5dlUa9 xaycc98RO56L7tyuTCLyw4iyfNJh/eGQtXmmzrMh7btr5JpHQxP0yoXhJn2TtoS3sp+n Fu3PfpDwN4lS0f1LAsMQr9ctbcLEJuukaUPDHoZ7GEoXLM5qAje1ipoL7/DWZ8wLZPjT jH/A== X-Gm-Message-State: AMCzsaXHZKhRvkbuUDmycvlCtbXQN7pJ9wYAZzjliAlfpqIYWWtQxThD 9Dz46gwTt3dSXtTuccNw3ca2XEo= X-Google-Smtp-Source: AOwi7QBFt8UxezYbd1YTaLvKJsQmbnJbze3MRjXNiRdVIvkv/NadCkSD01+OI91Y1SnIJAnlEBipOA== X-Received: by 10.157.39.35 with SMTP id r32mr9549269ota.400.1507232671874; Thu, 05 Oct 2017 12:44:31 -0700 (PDT) Received: from localhost.localdomain (216-188-254-6.dyn.grandenetworks.net. [216.188.254.6]) by smtp.googlemail.com with ESMTPSA id b73sm9011795oii.1.2017.10.05.12.44.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Oct 2017 12:44:31 -0700 (PDT) From: Rob Herring To: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Cc: Nicolas Pitre , Frank Rowand , Grant Likely , Greg Kroah-Hartman Subject: [PATCH 5/6] of: wrap accesses to device_node kobject Date: Thu, 5 Oct 2017 14:44:21 -0500 Message-Id: <20171005194422.26224-6-robh@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171005194422.26224-1-robh@kernel.org> References: <20171005194422.26224-1-robh@kernel.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In preparation to make kobject element in struct device_node optional, provide and use a macro to return the kobject pointer. The only user outside the DT core is the driver core. Cc: Greg Kroah-Hartman Cc: Nicolas Pitre Cc: Frank Rowand Signed-off-by: Rob Herring --- drivers/base/core.c | 2 +- include/linux/of.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Acked-by: Greg Kroah-Hartman diff --git a/drivers/base/core.c b/drivers/base/core.c index 12ebd055724c..c07b47059538 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -1571,7 +1571,7 @@ static int device_add_class_symlinks(struct device *dev) int error; if (of_node) { - error = sysfs_create_link(&dev->kobj, &of_node->kobj,"of_node"); + error = sysfs_create_link(&dev->kobj, of_node_kobj(of_node), "of_node"); if (error) dev_warn(dev, "Error %d creating of_node link\n",error); /* An error here doesn't warrant bringing down the device */ diff --git a/include/linux/of.h b/include/linux/of.h index 7eb94b7fbcf3..2d685e769409 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -111,6 +111,8 @@ static inline void of_node_init(struct device_node *node) node->fwnode.ops = &of_fwnode_ops; } +#define of_node_kobj(n) (&(n)->kobj) + /* true when node is initialized */ static inline int of_node_is_initialized(struct device_node *node) {