Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3466887ybi; Mon, 29 Jul 2019 07:05:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYmjTUvVoxOST5Q0LnhznZNbQi/GOABsJXi5+43Xt0xtdbz7z4oXIGYbgFl1DiwaHlop99 X-Received: by 2002:aa7:82da:: with SMTP id f26mr37063008pfn.82.1564409138696; Mon, 29 Jul 2019 07:05:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564409138; cv=none; d=google.com; s=arc-20160816; b=YJ+5Mc4/1dVMk3crPl5d0EZGfHh/Ks+5+ULcamE5i9p7c4eTV/qkGos7rgjvTKBZdm yMkWf2YzJaSoFV0mstTP29AoVx3dC5qE6Cj4RDnJ7HDFFkO7S+q+1TaOXkNxPt4tVoaL Qd8s7DEV+5dq7BJR5Ov50CriKJJhD9D6F5pGolt5ZQtU5FaHyUqOHjpXe7Q9vxnklWs1 HxTEdOQfR+Pv16WqiFV664ajUKar6U+ZB3s0TtlpRL5Rm81Dl+pHKB15YaYEZ4RGe+Yf MTK/f6/9R3GqvwXRTad1ILDdMVJWz3d8/ZsSVDXJlwz55wjRTsrtrQYdiLgmmLL/veD/ xYeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hesoZG+TcuR2ee3ESupVuTZ9BAyVWJDa4N1y2VQSFbA=; b=eSf62ZapdDbKGcI3Y6MW8PWIHr4QICAC4gZc+wlBTHABh9Yd8lkvYsVssWWEq12qzQ a3ysiDDRbsu3rn8KLH+ISqi3MsI7HS+RFl+M7itd9vNmtRrPusm9QMZPv982J/J/c312 TnKbqpTkZwjIoVpOvvAr+d84XRqyp3146484R3cJTf7Qk7gCaaEp+woBO7lzTG5mJldk Rr1r/BZgG1QRJFpdW38JSQpLtcBa35fNpl/MSQrvn0QdYuUEjKXsN5QJUWJ3GpK5Bnqf 4YhE6dkWgXXC4vovqvsoXsd5PPYye6/5qDaLPO6+Lw9RqiKi2E/UGlYULEgs7WGvMrXW 8BPw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="dxlI/uKS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b6si9075625pfd.29.2019.07.29.07.05.22; Mon, 29 Jul 2019 07:05:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="dxlI/uKS"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387981AbfG2NPw (ORCPT + 99 others); Mon, 29 Jul 2019 09:15:52 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:35852 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726973AbfG2NPv (ORCPT ); Mon, 29 Jul 2019 09:15:51 -0400 Received: by mail-io1-f65.google.com with SMTP id o9so16255077iom.3; Mon, 29 Jul 2019 06:15:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hesoZG+TcuR2ee3ESupVuTZ9BAyVWJDa4N1y2VQSFbA=; b=dxlI/uKS1x/I62djieCFmuyPj9xjbstOXhRIT8tlirULC+Cfrf57qeguUW32ksAFai 0cCDFsrNt6NNxY7+AW3VzzbTEZNcBvxoMRSPIrPQMdenQIG4v5CDboDBA4A3XsfXTVLU HFmb9d54USSK1Jw7k3B8Nk+OXD7+PF3vBjayG1RUASPYxvowPUKmw65c6Q0TyRWurLb/ ZOXNTgFWYirtvTvDlKr8AK+7nRHxZeUs5ARsC8Afvqza6XSWdMt+7VqM6SCYfvidaxsL ivcnl5ug5bRl4IE6nxW7vpF3qTqnze7ewJaaTGMvMs7zYv1UYY4MDdG2WH0qJZZSgMwS KTvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hesoZG+TcuR2ee3ESupVuTZ9BAyVWJDa4N1y2VQSFbA=; b=LNcHsfSYZJv6KkgwbeVuhZu3IL1zzD8ZybAmiLgOthE2m0QnKkg6/whD+daHaARy73 Sei70dTDST+DVzgj//RLdSvgI4UGn7pNbGzMlvEYdPDbrWY6GUcoPbm4BYfwpTGTL5sE 8q+lBzA+OWtgW+BAtGS5uN61ZY9DPbknFxVyb4h9U3WVvAM2fK/f8p08R6x+fApPSy10 jFIPOBB6vi0sRD1ZJF69apeawq9cYxyQBV+pAnvs8uZ70Az5ErLRBb+E6GHePW35n9Wg 5Joi8trPfVFoWbjmdKmSMlFCzkPKOqgpwUEL7z7gNQCCvAky//LIpVmEA79+GvPGa+Oj KHqw== X-Gm-Message-State: APjAAAWlHdKq8QdDyKJ79k+FHgpeddsWyxTz0e9pe1IalS5NLmqnAU9F 7B/o0T/ZgJoH+XsywbsNxnU= X-Received: by 2002:a5d:8347:: with SMTP id q7mr95370134ior.277.1564406150592; Mon, 29 Jul 2019 06:15:50 -0700 (PDT) Received: from localhost ([8.46.76.96]) by smtp.gmail.com with ESMTPSA id n22sm100665148iob.37.2019.07.29.06.15.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Jul 2019 06:15:49 -0700 (PDT) Date: Mon, 29 Jul 2019 15:15:32 +0200 From: Dmitry Torokhov To: Heikki Krogerus Cc: Linus Walleij , "Rafael J . Wysocki" , "Enrico Weigelt, metux IT consult" , linux-input@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH 1/2] drivers: base: swnode: link devices to software nodes Message-ID: <20190729131532.GA1201@penguin> References: <20190713075259.243565-1-dmitry.torokhov@gmail.com> <20190713075259.243565-2-dmitry.torokhov@gmail.com> <20190729120715.GA28600@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190729120715.GA28600@kuha.fi.intel.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 29, 2019 at 03:07:15PM +0300, Heikki Krogerus wrote: > On Sat, Jul 13, 2019 at 12:52:58AM -0700, Dmitry Torokhov wrote: > > It is helpful to know what device, if any, a software node is tied to, so > > let's store a pointer to the device in software node structure. Note that > > children software nodes will inherit their parent's device pointer, so we > > do not have to traverse hierarchy to see what device the [sub]tree belongs > > to. > > > > We will be using the device pointer to locate GPIO lookup tables for > > devices with static properties. > > > > Signed-off-by: Dmitry Torokhov > > --- > > drivers/base/property.c | 1 + > > drivers/base/swnode.c | 35 ++++++++++++++++++++++++++++++++++- > > include/linux/property.h | 5 +++++ > > 3 files changed, 40 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/base/property.c b/drivers/base/property.c > > index 348b37e64944..3bc93d4b35c4 100644 > > --- a/drivers/base/property.c > > +++ b/drivers/base/property.c > > @@ -527,6 +527,7 @@ int device_add_properties(struct device *dev, > > if (IS_ERR(fwnode)) > > return PTR_ERR(fwnode); > > > > + software_node_link_device(fwnode, dev); > > set_secondary_fwnode(dev, fwnode); > > return 0; > > } > > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c > > index 7fc5a18e02ad..fd12eea539b6 100644 > > --- a/drivers/base/swnode.c > > +++ b/drivers/base/swnode.c > > @@ -24,6 +24,9 @@ struct software_node { > > > > /* properties */ > > const struct property_entry *properties; > > + > > + /* device this node is associated with */ > > + struct device *dev; > > }; > > Let's not do that! The nodes can be, and in many cases are, associated > with multiple devices. They do? Where? I see that set of properties can be shared between several devices, but when we instantiate SW node we create a new instance for device. This is also how ACPI and OF properties work; they not shared between devices (or, rather, the kernel creates distinct _and single_ devices for instance of ACPI or OF node). I do not think we want swnodes work differently from the other firmware nodes. > > Every device is already linked with the software node kobject, so > isn't it possible to simply walk trough those links in order to check > the devices associated with the node? No, we need to know the exact instance of a device, not a set of devices, because even though some properties can be shared, others can not. For example, even if 2 exactly same touch controllers in the system have "reset-gpios" property, they won't be the same GPIO for the both of them. Thanks. -- Dmitry