From patchwork Fri Mar 28 16:08:02 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 27316 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f72.google.com (mail-qg0-f72.google.com [209.85.192.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0937520545 for ; Fri, 28 Mar 2014 16:08:57 +0000 (UTC) Received: by mail-qg0-f72.google.com with SMTP id q108sf6104208qgd.3 for ; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=bwvDjh1YehHlb8qOuwrFd7WVS0CRTDIkNoETFTb8MMU=; b=j3zfxBMeSbflLojxl8j5NsQk6jGwREYyMyC3Nda9kaiRPv1T951T6rEAaW2XSu8P8c jSWJI/choYXllsTKdzrQbedYbjJJjieNLE+mC0QBYamKrtnsNGenEW60OUb+z6Dkun6R VcFrNCTQX9PdVRBHdqHi3LFWAKzuGp6AK64/TpMn8c1QkruiCFjbOhQeLXzRp8+L2Kzx w4zD5b9zIry+wluvHvhqEOTwuVRkaM4iLsJEkOKG+FVxPexckufGuvupiJ+g4qJ34RXI ooT2DRV4q3AiJUgEYnlNvGJxviKJTvF76lLyUILpagtr5reEpLvmhREG5k8TuU/D9i+u segg== X-Gm-Message-State: ALoCoQmA8mvvSVQPqgxj87Xfm3JFD4uUFDIWMbOdj9OK4yDz+FApf5K0OrgT8AE7QLsJ6zb+mZVp X-Received: by 10.58.168.137 with SMTP id zw9mr2433904veb.15.1396022937823; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.30.67 with SMTP id c61ls839117qgc.33.gmail; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) X-Received: by 10.58.187.78 with SMTP id fq14mr7741571vec.9.1396022937730; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id j5si1329766veb.21.2014.03.28.09.08.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 09:08:57 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so6188579veb.28 for ; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) X-Received: by 10.58.133.15 with SMTP id oy15mr7641699veb.19.1396022937644; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) 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.220.12.8 with SMTP id v8csp20399vcv; Fri, 28 Mar 2014 09:08:57 -0700 (PDT) X-Received: by 10.68.4.232 with SMTP id n8mr9607266pbn.114.1396022936886; Fri, 28 Mar 2014 09:08:56 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id fa7si3925677pab.483.2014.03.28.09.08.56; Fri, 28 Mar 2014 09:08:56 -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; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752497AbaC1QIr (ORCPT + 27 others); Fri, 28 Mar 2014 12:08:47 -0400 Received: from mail-pd0-f176.google.com ([209.85.192.176]:46093 "EHLO mail-pd0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbaC1QIR (ORCPT ); Fri, 28 Mar 2014 12:08:17 -0400 Received: by mail-pd0-f176.google.com with SMTP id r10so5025983pdi.21 for ; Fri, 28 Mar 2014 09:08:17 -0700 (PDT) X-Received: by 10.68.133.163 with SMTP id pd3mr9459760pbb.166.1396022897096; Fri, 28 Mar 2014 09:08:17 -0700 (PDT) Received: from trevor.secretlab.ca ([184.48.92.32]) by mx.google.com with ESMTPSA id hw8sm24820243pbc.62.2014.03.28.09.08.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 09:08:14 -0700 (PDT) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 75730C41FFE; Fri, 28 Mar 2014 16:08:10 +0000 (GMT) From: Grant Likely To: devicetree@vger.kernel.org, christoffer.dall@linaro.org, linux-kernel@vger.kernel.org, olof@lixom.net, benh@kernel.crashing.org, rob.herring@linaro.org Cc: Grant Likely Subject: [RFC 2/5] of: Create of_console_check() for selecting a console specified in /chosen Date: Fri, 28 Mar 2014 09:08:02 -0700 Message-Id: <1396022885-6102-3-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1396022885-6102-1-git-send-email-grant.likely@linaro.org> References: <1396022885-6102-1-git-send-email-grant.likely@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grant.likely@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) 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-Post: , List-Help: , List-Archive: List-Unsubscribe: , The devicetree has a binding for specifying the console device in the /chosen node, but the kernel doesn't use it consistently. This change adds an API for testing if a device node is a console, and adds a preferred console entry if it is. At the same time this patch removes the of_device_is_stdout_path() API since it is unused. Signed-off-by: Grant Likely --- drivers/of/base.c | 23 +++++++++++++---------- include/linux/of.h | 6 +++--- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/of/base.c b/drivers/of/base.c index be2861d69b02..a5643badeb1d 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -17,6 +17,7 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ +#include #include #include #include @@ -2073,20 +2074,22 @@ const char *of_prop_next_string(struct property *prop, const char *cur) EXPORT_SYMBOL_GPL(of_prop_next_string); /** - * of_device_is_stdout_path - check if a device node matches the - * linux,stdout-path property - * - * Check if this device node matches the linux,stdout-path property - * in the chosen node. return true if yes, false otherwise. + * of_console_check() - Test and setup console for DT setup + * @dn - Pointer to device node + * @name - Name to use for preferred console without index. ex. "ttyS" + * @index - Index to use for preferred console. + * + * Check if the given device node matches the stdout-path property in the + * /chosen node. If it does then register it as the preferred console and return + * TRUE. Otherwise return FALSE. */ -int of_device_is_stdout_path(struct device_node *dn) +bool of_console_check(struct device_node *dn, char *name, int index) { - if (!of_stdout) + if (!dn || dn != of_stdout || console_set_on_cmdline) return false; - - return of_stdout == dn; + return add_preferred_console(name, index, NULL); } -EXPORT_SYMBOL_GPL(of_device_is_stdout_path); +EXPORT_SYMBOL_GPL(of_console_check); /** * of_find_next_cache_node - Find a node's subsidiary cache diff --git a/include/linux/of.h b/include/linux/of.h index a8b9dad90c64..417945ebd8e1 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -343,7 +343,7 @@ const __be32 *of_prop_next_u32(struct property *prop, const __be32 *cur, */ const char *of_prop_next_string(struct property *prop, const char *cur); -int of_device_is_stdout_path(struct device_node *dn); +bool of_console_check(struct device_node *dn, char *name, int index); #else /* CONFIG_OF */ @@ -544,9 +544,9 @@ static inline int of_machine_is_compatible(const char *compat) return 0; } -static inline int of_device_is_stdout_path(struct device_node *dn) +static bool of_console_check(const struct device_node *dn, const char *name, int index) { - return 0; + return false; } static inline const __be32 *of_prop_next_u32(struct property *prop,