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: 9440385 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 AE370600BA for ; Tue, 22 Nov 2016 01:15:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B14B828AD0 for ; Tue, 22 Nov 2016 01:15:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A633628B7A; Tue, 22 Nov 2016 01:15:48 +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 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 5182828AD0 for ; Tue, 22 Nov 2016 01:15:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DD3B96E644; Tue, 22 Nov 2016 01:15:40 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5277D6E228 for ; Mon, 21 Nov 2016 16:33:27 +0000 (UTC) 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-Mailman-Approved-At: Tue, 22 Nov 2016 01:15:40 +0000 Cc: linux-devicetree , LKML , linux-drm , Tomi Valkeinen , Jyri Sarha , 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: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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<---