From patchwork Mon Nov 21 16:33:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sekhar Nori X-Patchwork-Id: 83269 Delivered-To: patch@linaro.org Received: by 10.140.97.165 with SMTP id m34csp1629789qge; Mon, 21 Nov 2016 08:35:18 -0800 (PST) X-Received: by 10.98.33.133 with SMTP id o5mr19205540pfj.32.1479746118398; Mon, 21 Nov 2016 08:35:18 -0800 (PST) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id 2si23472663pgd.31.2016.11.21.08.35.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Nov 2016 08:35:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=ti.com Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c8rXZ-0004LZ-KY; Mon, 21 Nov 2016 16:33:57 +0000 Received: from lelnx194.ext.ti.com ([198.47.27.80]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c8rXU-00049o-V8 for linux-arm-kernel@lists.infradead.org; Mon, 21 Nov 2016 16:33:54 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id uALGX7Vm027394; Mon, 21 Nov 2016 10:33:07 -0600 Received: from DLEE70.ent.ti.com (dlemailx.itg.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id uALGX7n2005676; Mon, 21 Nov 2016 10:33:07 -0600 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.294.0; Mon, 21 Nov 2016 10:33:06 -0600 Received: from [172.24.190.171] (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id uALGX1Z7014680; Mon, 21 Nov 2016 10:33:02 -0600 Subject: Re: [PATCH v2 1/5] ARM: memory: da8xx-ddrctl: new driver To: Bartosz Golaszewski , Kevin Hilman , Michael Turquette , Rob Herring , Frank Rowand , Mark Rutland , Peter Ujfalusi , Russell King References: <1477925138-23457-1-git-send-email-bgolaszewski@baylibre.com> <1477925138-23457-2-git-send-email-bgolaszewski@baylibre.com> From: Sekhar Nori Message-ID: Date: Mon, 21 Nov 2016 22:03:00 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <1477925138-23457-2-git-send-email-bgolaszewski@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161121_083353_196972_9BBB53CD X-CRM114-Status: GOOD ( 13.91 ) X-Spam-Score: -3.3 (---) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-3.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -1.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-devicetree , David Airlie , LKML , linux-drm , Tomi Valkeinen , Jyri Sarha , arm-soc , Laurent Pinchart Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org On Monday 31 October 2016 08:15 PM, Bartosz Golaszewski wrote: > +static int da8xx_ddrctl_probe(struct platform_device *pdev) > +{ > + const struct da8xx_ddrctl_config_knob *knob; > + const struct da8xx_ddrctl_setting *setting; > + struct device_node *node; > + struct resource *res; > + void __iomem *ddrctl; > + struct device *dev; > + u32 reg; > + > + dev = &pdev->dev; > + node = dev->of_node; > + > + setting = da8xx_ddrctl_get_board_settings(); > + if (!setting) { > + dev_err(dev, "no settings for board '%s'\n", > + of_flat_dt_get_machine_name()); > + return -EINVAL; > + } This causes a section mismatch because of_flat_dt_get_machine_name() has an __init annotation. I did not notice that before, sorry. It can be fixed with a patch like below: ---8<--- A similar fix is required for the other driver in this series (patch 2/5). I need some advise on whether I should introduce a common function to get the machine name post kernel boot-up (I cannot see an existing one). If yes, any advise on which file it should go into? Thanks, Sekhar _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/memory/da8xx-ddrctl.c b/drivers/memory/da8xx-ddrctl.c index a20e7bbbcbe0..9ca5aab3ac54 100644 --- a/drivers/memory/da8xx-ddrctl.c +++ b/drivers/memory/da8xx-ddrctl.c @@ -102,6 +102,18 @@ static const struct da8xx_ddrctl_setting *da8xx_ddrctl_get_board_settings(void) return NULL; } +static const char* da8xx_ddrctl_get_machine_name(void) +{ + const char *str; + int ret; + + ret = of_property_read_string(of_root, "model", &str); + if (ret) + ret = of_property_read_string(of_root, "compatible", &str); + + return str; +} + static int da8xx_ddrctl_probe(struct platform_device *pdev) { const struct da8xx_ddrctl_config_knob *knob; @@ -118,7 +130,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_get_machine_name()); return -EINVAL; } ---8<---