Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp379060imm; Tue, 3 Jul 2018 21:46:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdui5iNNkfaSO7uffDUTEzqWc2DdbWxntcD4cBPfvRFOTj5/jvkCzsgGx65OwIIbNJpzMlu X-Received: by 2002:a17:902:4c88:: with SMTP id b8-v6mr509717ple.285.1530679617311; Tue, 03 Jul 2018 21:46:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530679617; cv=none; d=google.com; s=arc-20160816; b=nsoj9rbmetjzq6HCnE0CJBOTBMD9sX5vFUZOT12OCh4LUFoFqnV5GafjI/D2yI1Ato fbRtLa0sHnr+GO2kfXzT1w0lu4b1i4gdAlSI91/8KtIN0aemC3bnpai/wrDValcSkH4v B3pRHhUwW5hpYcrabhH/Gc2HjyxRwbqEhZ64WV16Nk1bi+6/6Pd8P/TPOCnb5ffNJgZ9 gYOZwkLzLs5GWn543Qu/4x1BrUA+bQpH2IbsB7TLAd35uqOZJ8d8NfpLOT1Y5ePYVcpA 9dfZsZtdFNnLuD0HS1RpBBrSmW30/8zw7m5xc/iUFvvaEaM7LxszCspf2IRUfw8zLyGB 1nOg== 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=0iZFYDuRJSU+RbZipu1a0snDw0BaoXvMJo9jE4cOuF8=; b=WBuOW7NCachObfPcezZnBntHeKVSy4aMlaiJP2z8cqBjuPyAeS+2usSXS3QGqLUahl Xujv6G+RIPRaTrcKRZMJOlS0PYkIrS9FUkX0KZUOdBY3KgyZtio8EzXXCEPWonbzXiOV eg0BEXEC1CdjixfPD2vKaROzXsgsjdV5EJEXSlCAPqlGZlLjLUisgLFv/YjtVF2f0hB3 wYvG4WpMYsG1Uy3c7gnZhLcFRUDhbFX13Cims7nrsS2BYfWo8FLvXLrvaZRaln0C7t3v 3wWUlPzaOki/IZLLxe6wz+K3z2KiWWVsUB0m9Py/qYCFhwTbU5W5/BjtyttHm0bwdFSu /NCw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p187-v6si2784114pfp.125.2018.07.03.21.46.43; Tue, 03 Jul 2018 21:46:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933329AbeGDEpA (ORCPT + 99 others); Wed, 4 Jul 2018 00:45:00 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:41012 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932684AbeGDEoW (ORCPT ); Wed, 4 Jul 2018 00:44:22 -0400 Received: from localhost.localdomain (pD95EF712.dip0.t-ipconnect.de [217.94.247.18]) by mail.bugwerft.de (Postfix) with ESMTPSA id E753D28D401; Wed, 4 Jul 2018 04:40:58 +0000 (UTC) From: Daniel Mack To: zbr@ioremap.net, robh+dt@kernel.org, mark.rutland@arm.com, szabolcs.gyurko@tlt.hu Cc: sre@kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, robert.jarzmik@free.fr, Daniel Mack Subject: [PATCH v3 2/4] w1: core: match sub-nodes of bus masters in devicetree Date: Wed, 4 Jul 2018 06:44:09 +0200 Message-Id: <20180704044411.2693-3-daniel@zonque.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180704044411.2693-1-daniel@zonque.org> References: <20180704044411.2693-1-daniel@zonque.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once a new slave device is detected, match it against all sub-nodes of the master bus controller. If a match is found, set the slave device's of_node pointer. Signed-off-by: Daniel Mack --- drivers/w1/w1.c | 3 +++ include/linux/w1.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c index caef0e0fd817..890c038c25f8 100644 --- a/drivers/w1/w1.c +++ b/drivers/w1/w1.c @@ -26,6 +26,7 @@ #include #include #include +#include #include @@ -686,6 +687,8 @@ static int __w1_attach_slave_device(struct w1_slave *sl) sl->dev.bus = &w1_bus_type; sl->dev.release = &w1_slave_release; sl->dev.groups = w1_slave_groups; + sl->dev.of_node = of_find_matching_node(sl->master->dev.of_node, + sl->family->of_match_table); dev_set_name(&sl->dev, "%02x-%012llx", (unsigned int) sl->reg_num.family, diff --git a/include/linux/w1.h b/include/linux/w1.h index 694101f744c7..3111585c371f 100644 --- a/include/linux/w1.h +++ b/include/linux/w1.h @@ -274,6 +274,8 @@ struct w1_family { struct w1_family_ops *fops; + const struct of_device_id *of_match_table; + atomic_t refcnt; }; -- 2.17.1