From patchwork Tue Dec 16 20:08:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 42349 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 96ADB25E25 for ; Tue, 16 Dec 2014 20:11:05 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id f15sf9233075lbj.11 for ; Tue, 16 Dec 2014 12:11:04 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=zBonGrJQR6rEhrH8SkxlvAmnEhHCpbhOJquwuGpSgrw=; b=HUastnF1wmK3LznpR9rI4OhcgryyNLwpBrbYEy6NoeOn7GQkqdo1Pvhfjz8U6fdInZ 8iMVWprZctqnRUPV3C/Ey/7t321uhdsA7zYDZkUlhqKMI1EMmQT6EojeOcPYj5Qp6PEv kP7r/u8F5R740BHJVCcSJCZwtJC2gaub6HLQjvy7p8wPuSHO7o2uPSYaFlVHfzP3BlXc 79bQU9DFKtvWmZ8BE98zHANZaaj4kmUycYdU+nZHxoBpTbq9+1Dij0QG7TLjmyzfZIdM +E+lAAh7MfdxGesgxIGsUKh5w9YzS0FlSPJIaaBjf9SYm5KwOHFg8XRVH7Qec740TDsz 1qww== X-Gm-Message-State: ALoCoQkVBCEmsWDG/ELQh9B7iAO//k+zMMX2UQQZyK5ydHoHuvxB+ZecvSZclOAfIVIiD5o7w27Z X-Received: by 10.112.40.71 with SMTP id v7mr4300lbk.20.1418760664524; Tue, 16 Dec 2014 12:11:04 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.170.166 with SMTP id an6ls505642lac.47.gmail; Tue, 16 Dec 2014 12:11:04 -0800 (PST) X-Received: by 10.112.132.2 with SMTP id oq2mr37513140lbb.11.1418760664273; Tue, 16 Dec 2014 12:11:04 -0800 (PST) Received: from mail-lb0-f174.google.com (mail-lb0-f174.google.com. [209.85.217.174]) by mx.google.com with ESMTPS id gn10si1760996lbc.102.2014.12.16.12.11.04 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 16 Dec 2014 12:11:04 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) client-ip=209.85.217.174; Received: by mail-lb0-f174.google.com with SMTP id 10so11791300lbg.33 for ; Tue, 16 Dec 2014 12:11:04 -0800 (PST) X-Received: by 10.112.141.42 with SMTP id rl10mr37279250lbb.98.1418760664102; Tue, 16 Dec 2014 12:11:04 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.142.69 with SMTP id ru5csp1148821lbb; Tue, 16 Dec 2014 12:11:03 -0800 (PST) X-Received: by 10.221.19.68 with SMTP id qj4mr23774883vcb.2.1418760662283; Tue, 16 Dec 2014 12:11:02 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id wh10si647581vcb.8.2014.12.16.12.11.01 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Dec 2014 12:11:02 -0800 (PST) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y0yQx-0004m8-11; Tue, 16 Dec 2014 20:09:27 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Y0yQv-0004ln-Dk for xen-devel@lists.xenproject.org; Tue, 16 Dec 2014 20:09:25 +0000 Received: from [85.158.137.68] by server-5.bemta-3.messagelabs.com id D6/35-26858-47190945; Tue, 16 Dec 2014 20:09:24 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-2.tower-31.messagelabs.com!1418760563!13822115!1 X-Originating-IP: [209.85.212.171] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.5; banners=-,-,- X-VirusChecked: Checked Received: (qmail 20969 invoked from network); 16 Dec 2014 20:09:24 -0000 Received: from mail-wi0-f171.google.com (HELO mail-wi0-f171.google.com) (209.85.212.171) by server-2.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 16 Dec 2014 20:09:24 -0000 Received: by mail-wi0-f171.google.com with SMTP id bs8so13487902wib.4 for ; Tue, 16 Dec 2014 12:09:23 -0800 (PST) X-Received: by 10.194.80.68 with SMTP id p4mr28995818wjx.108.1418760563774; Tue, 16 Dec 2014 12:09:23 -0800 (PST) Received: from chilopoda.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id b10sm3382705wiw.9.2014.12.16.12.09.21 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 12:09:22 -0800 (PST) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 16 Dec 2014 20:08:45 +0000 Message-Id: <1418760534-18163-5-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 2.1.3 In-Reply-To: <1418760534-18163-1-git-send-email-julien.grall@linaro.org> References: <1418760534-18163-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, manish.jaggi@caviumnetworks.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH for 4.6 04/13] xen/dt: Extend dt_device_match to possibly store data X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: Some drivers may want to configure differently the device depending on the compatible string. Also modify the return type of dt_match_node to return the matching structure. Signed-off-by: Julien Grall --- xen/arch/arm/platform.c | 2 +- xen/common/device_tree.c | 12 ++++++------ xen/include/xen/device_tree.h | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c index cb4cda8..a79a098 100644 --- a/xen/arch/arm/platform.c +++ b/xen/arch/arm/platform.c @@ -157,7 +157,7 @@ bool_t platform_device_is_blacklisted(const struct dt_device_node *node) if ( platform && platform->blacklist_dev ) blacklist = platform->blacklist_dev; - return dt_match_node(blacklist, node); + return (dt_match_node(blacklist, node) != NULL); } unsigned int platform_dom0_evtchn_ppi(void) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index f72b2e9..34a1b9e 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -290,11 +290,12 @@ struct dt_device_node *dt_find_node_by_alias(const char *alias) return NULL; } -bool_t dt_match_node(const struct dt_device_match *matches, - const struct dt_device_node *node) +const struct dt_device_match * +dt_match_node(const struct dt_device_match *matches, + const struct dt_device_node *node) { if ( !matches ) - return 0; + return NULL; while ( matches->path || matches->type || matches->compatible || matches->not_available ) @@ -314,12 +315,11 @@ bool_t dt_match_node(const struct dt_device_match *matches, match &= !dt_device_is_available(node); if ( match ) - return match; - + return matches; matches++; } - return 0; + return NULL; } const struct dt_device_node *dt_get_parent(const struct dt_device_node *node) diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 08db8bc..6502369 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -28,6 +28,7 @@ struct dt_device_match { const char *type; const char *compatible; const bool_t not_available; + const void *data; }; #define DT_MATCH_PATH(p) { .path = p } @@ -547,8 +548,9 @@ bool_t dt_device_is_available(const struct dt_device_node *device); * * Returns true if the device node match one of dt_device_match. */ -bool_t dt_match_node(const struct dt_device_match *matches, - const struct dt_device_node *node); +const struct dt_device_match * +dt_match_node(const struct dt_device_match *matches, + const struct dt_device_node *node); /** * dt_find_matching_node - Find a node based on an dt_device_match match table