Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1400733imm; Thu, 5 Jul 2018 22:37:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc2vw1XTLrFAJ13oeCoLxgE+K/q7a16PupKUQdG0tv5AsajXPudL+0UYAc4ymUSjTCBtEke X-Received: by 2002:a63:9402:: with SMTP id m2-v6mr1908212pge.8.1530855429696; Thu, 05 Jul 2018 22:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530855429; cv=none; d=google.com; s=arc-20160816; b=HJuM17EDH2Ib8bzlcT2E0utHnjUCXoMT7+j0YuRA4YuVNuU+bRpoVu54DBg0fv4/oa w/7G7FczxIEy+IOsTZ/8oR5QfMXjeLEOK7MV16Tikuz+iXE6ociSPjz0p8KTaOxp6iZ1 unCywMFRS7UsIVLY6BnV9u1pMtYduFOxJN5FieshZgnmBKHUgf+rLMX3NFsSUNV5o9mG hHh9bLbOfdmx6iNeY2H53JKPxy+KgFl+qGkV/VNlRwraKtNhC30afQyDE2OvLN2cPpzE YCavQA3ooBzLULc5DL12c5z2jR4zbKKIHwKCeyb0YElwun7saaVW03btiwBSI7mashTy fx/w== 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=gsg4d5f5Gn6Q79ccyYwhAoSffij+qDhI7fYYs763OellCFbQ20K1DFMhsuBg7L0y+N YHkE8HaIrB62pn20Q76y3G4h6q+OmVoZsDnh9J8yCyFo3B/wJlUv76clsnm4PpCaGIA1 0yYFoTqrNmBIZi1KFEmaIj3dUrId2NhA8CZvzC+KOHRP5Bi8RfrQjkXtO1KiJ62wD07y 2jTpA5jSZrvLJp1kJKUVHqC8l1vliyf1zr1kOxndRi6sgV780raHZqcWJjGHvPBqXRTX bslYjYpnF1npfteiQztFHHNzZCbsNJWwfsA7Kh2hKlb8DPOKeeJwLFijOTUsSas1AXCz 6nFg== 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 a7-v6si8099500pfg.200.2018.07.05.22.36.54; Thu, 05 Jul 2018 22:37:09 -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 S932573AbeGFFgI (ORCPT + 99 others); Fri, 6 Jul 2018 01:36:08 -0400 Received: from mail.bugwerft.de ([46.23.86.59]:37618 "EHLO mail.bugwerft.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932300AbeGFFgF (ORCPT ); Fri, 6 Jul 2018 01:36:05 -0400 Received: from localhost.localdomain (pD95EF57F.dip0.t-ipconnect.de [217.94.245.127]) by mail.bugwerft.de (Postfix) with ESMTPSA id DCA5628DBFB; Fri, 6 Jul 2018 05:35:59 +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 v4 3/5] w1: core: match sub-nodes of bus masters in devicetree Date: Fri, 6 Jul 2018 07:35:50 +0200 Message-Id: <20180706053552.11438-4-daniel@zonque.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180706053552.11438-1-daniel@zonque.org> References: <20180706053552.11438-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