From patchwork Wed Nov 23 11:06:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 9442975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7148C6075F for ; Wed, 23 Nov 2016 11:06:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79579208C2 for ; Wed, 23 Nov 2016 11:06:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D86524560; Wed, 23 Nov 2016 11:06:52 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EC54C208C2 for ; Wed, 23 Nov 2016 11:06:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 240126E80D; Wed, 23 Nov 2016 11:06:43 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) by gabe.freedesktop.org (Postfix) with ESMTPS id A38166E6F0 for ; Wed, 23 Nov 2016 11:06:37 +0000 (UTC) Received: by mail-wm0-x22e.google.com with SMTP id t79so18494801wmt.0 for ; Wed, 23 Nov 2016 03:06:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=H2bnQVtu9dWoRhSOGr4oKq9Z9NstY1bdpelO72n/ZV4=; b=VjmWzYCOSeSIfxt9EFUiAoxzr9pO7Njy/Oj6C1p4L6XRlW5kYpGSkKgvwAc17ZzNWs g2YJ37uU8CiFnqysqdrMTHChEZy1lFOA01g7DTlaqftXSgSHzlsrD16zNuyoCFV1Vr01 MMdb1pyqGd2RjEqUUuOf+5YTgkLXXRu9RJsCrWPutLXqCFhKtrmRGf5b2Cu4O5an8xqe G4Q34ZqCU/S4j3M4RQG6qi6iCgdqpOKnAKClRE7bV/tlVZIZ7nx4sh+3GudZ163v7QV4 Rfde78BcS09xJH/VJ/To8VloZScLtG1plv0f/5LoyVmfqnoyeokLLTDjU6aAHoiI0ycu b/fA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=H2bnQVtu9dWoRhSOGr4oKq9Z9NstY1bdpelO72n/ZV4=; b=Eqqa4dScLhNemkcWtTDSocryK2cIFC/lGAPBbvfFW17p6rRRZti5v0qlBWSqabGBzR df6TIydjUdMiM/V7eSOmk80UIaYmB3j4lYoH37pxZsufcQ2fv1k88m3h0MhuuNBO5jLc dAGRFInIlXU30B9Ro2As5HAWoJxm0TgKQcwjPKUlwXu7wANRP813lCLcoszS0ZYjU8f8 doKHr+EgUh0ftdTCpH6mfGZVB/YBRl+2jCqJq2KKNqz64SxXGz36PDZ1xVObntxPoGu7 EsZCQ8GLSDavFKOEru5ZH4pH2b+b+GRa8/Pgfr1ebiL1jX7N6DXgRhhFpCp0XYcBD2Ua mIBA== X-Gm-Message-State: AKaTC02qmLOTxlwuncWMWbAKMkgOZUMV3/C3sF2My2nWLR+CKTO6tV1RbdYXULOiBu73XPVe X-Received: by 10.194.100.225 with SMTP id fb1mr2753057wjb.128.1479899196076; Wed, 23 Nov 2016 03:06:36 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id f10sm35746800wjl.28.2016.11.23.03.06.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Nov 2016 03:06:35 -0800 (PST) From: Bartosz Golaszewski To: Kevin Hilman , Michael Turquette , Sekhar Nori , Rob Herring , Frank Rowand , Mark Rutland , Peter Ujfalusi , Russell King Subject: [PATCH v3 2/3] memory: da8xx-ddrctl: drop the call to of_flat_dt_get_machine_name() Date: Wed, 23 Nov 2016 12:06:26 +0100 Message-Id: <1479899187-10199-3-git-send-email-bgolaszewski@baylibre.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1479899187-10199-1-git-send-email-bgolaszewski@baylibre.com> References: <1479899187-10199-1-git-send-email-bgolaszewski@baylibre.com> Cc: linux-devicetree , LKML , linux-drm , Bartosz Golaszewski , Tomi Valkeinen , Jyri Sarha , Sudeep Holla , Robin Murphy , arm-soc , Laurent Pinchart X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP In order to avoid a section mismatch use a locally implemented routine instead of of_flat_dt_get_machine_name() when printing the error message. Signed-off-by: Bartosz Golaszewski --- drivers/memory/da8xx-ddrctl.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/memory/da8xx-ddrctl.c b/drivers/memory/da8xx-ddrctl.c index a20e7bb..1b962ee 100644 --- a/drivers/memory/da8xx-ddrctl.c +++ b/drivers/memory/da8xx-ddrctl.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include @@ -71,6 +70,26 @@ static const struct da8xx_ddrctl_board_settings da8xx_ddrctl_board_confs[] = { }, }; +/* + * FIXME Remove this function once of/base gets a general routine for getting + * the machine model/compatible string. + */ +static const char *da8xx_ddrctl_machine_get_compatible(void) +{ + struct device_node *root; + const char *compatible; + int ret = -1; + + root = of_find_node_by_path("/"); + if (root) { + ret = of_property_read_string_index(root, "compatible", + 0, &compatible); + of_node_put(root); + } + + return ret ? NULL : compatible; +} + static const struct da8xx_ddrctl_config_knob * da8xx_ddrctl_match_knob(const struct da8xx_ddrctl_setting *setting) { @@ -118,7 +137,7 @@ static int da8xx_ddrctl_probe(struct platform_device *pdev) setting = da8xx_ddrctl_get_board_settings(); if (!setting) { dev_err(dev, "no settings for board '%s'\n", - of_flat_dt_get_machine_name()); + da8xx_ddrctl_machine_get_compatible()); return -EINVAL; }