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: 9439789 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 A25B6606DB for ; Mon, 21 Nov 2016 16:35:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7E76428771 for ; Mon, 21 Nov 2016 16:35:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 725F628774; Mon, 21 Nov 2016 16:35:43 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 018C628771 for ; Mon, 21 Nov 2016 16:35:43 +0000 (UTC) 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-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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 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<---