From patchwork Wed Feb 23 04:33:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 84088 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id A21F0B82CA for ; Wed, 23 Feb 2011 15:37:08 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753602Ab1BWEd7 (ORCPT ); Tue, 22 Feb 2011 23:33:59 -0500 Received: from mail-yw0-f46.google.com ([209.85.213.46]:52621 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753447Ab1BWEdu (ORCPT ); Tue, 22 Feb 2011 23:33:50 -0500 Received: by ywj3 with SMTP id 3so1561866ywj.19 for ; Tue, 22 Feb 2011 20:33:49 -0800 (PST) Received: by 10.100.48.4 with SMTP id v4mr1591046anv.47.1298435629604; Tue, 22 Feb 2011 20:33:49 -0800 (PST) Received: from angua (S01060002b3d79728.cg.shawcable.net [70.72.87.49]) by mx.google.com with ESMTPS id d15sm9098955ana.15.2011.02.22.20.33.47 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 22 Feb 2011 20:33:48 -0800 (PST) Received: from localhost6.localdomain6 (unknown [IPv6:::1]) by angua (Postfix) with ESMTP id 5DDCE3C00D9; Tue, 22 Feb 2011 21:33:45 -0700 (MST) Subject: [RFC PATCH 02/15] dt: add a match table pointer to struct device To: Benjamin Herrenschmidt , devicetree-discuss@lists.ozlabs.org, sfr@canb.auug.org.au, linux-kernel@vger.kernel.org, davem@davemloft.net From: Grant Likely Cc: sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Tue, 22 Feb 2011 21:33:45 -0700 Message-ID: <20110223043345.20795.2936.stgit@localhost6.localdomain6> In-Reply-To: <20110223043015.20795.37090.stgit@localhost6.localdomain6> References: <20110223043015.20795.37090.stgit@localhost6.localdomain6> User-Agent: StGit/0.15 MIME-Version: 1.0 Sender: sparclinux-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: sparclinux@vger.kernel.org Add a new .of_match field to struct device which points at the matching device driver .of_match_table entry when a device is probed via the device tree Signed-off-by: Grant Likely --- include/linux/device.h | 1 + include/linux/of_device.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe sparclinux" 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/include/linux/device.h b/include/linux/device.h index ca5d252..8d8e267 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -441,6 +441,7 @@ struct device { struct dev_archdata archdata; struct device_node *of_node; /* associated device tree node */ + const struct of_device_id *of_match; /* matching of_device_id from driver */ dev_t devt; /* dev_t, creates the sysfs "dev" */ diff --git a/include/linux/of_device.h b/include/linux/of_device.h index 975d347..8bfe6c1 100644 --- a/include/linux/of_device.h +++ b/include/linux/of_device.h @@ -18,10 +18,11 @@ extern void of_device_make_bus_id(struct device *dev); * @drv: the device_driver structure to test * @dev: the device structure to match against */ -static inline int of_driver_match_device(const struct device *dev, +static inline int of_driver_match_device(struct device *dev, const struct device_driver *drv) { - return of_match_device(drv->of_match_table, dev) != NULL; + dev->of_match = of_match_device(drv->of_match_table, dev); + return dev->of_match != NULL; } extern struct platform_device *of_dev_get(struct platform_device *dev);