Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5698232yba; Thu, 11 Apr 2019 03:59:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZQ5JK0tVLwFLxs0w9a0frYJQDkanixrF3sgk3j/E1xEojcj82FSwAdo16qJdL0krOOwD+ X-Received: by 2002:a63:e042:: with SMTP id n2mr34944308pgj.45.1554980383435; Thu, 11 Apr 2019 03:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554980383; cv=none; d=google.com; s=arc-20160816; b=sJ2jlm72XE9jx4+C6ve/rjUQqGKBD7p4JidkSQDLhUcViX2/SOjM5qTYYUq3VdT2ih W7oRSqXeuy/YMdCFPGZBXkDWt1jzVlTorkEM5LADIen3fD7Prw1Emu457l0VtsD+cBie b08OcxjPbBJmrBEoEm8/D9u928bhr/eKt24Lb07L98+cqnEsr9EtxYr5xOerABDoyiDq d2iyauJk4qa5J7epP/qDcHeGrzrbN1Iy9LDdUqzPL7a9/kebIZ9CrkvT07i2JEbTCkAh A5O0OBC3eNL3+tNxlULk5XfAKZ17SSeuPdMRAK3/v8jN3ERYefC8mM9j+EYwDQOJBq9R dXoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=fS6LpPjEpfYrPcydTCdPI5FsuCGhHMg8YJ3B6ys1UrI=; b=D4LvB+8Fip8cfDngCYVH+rH6kZxGoSsSLJikOqVT6CfipUBqdYFCvkt+Gd5EYLI7dh c9gmLqqrI7OY660Bkzxaf8wHwjC5GKAR1GOs7Em2daSMgOE1h1XiWv0cbByaXlymcZGe eX+qeSmB0Nms1cYaR7QBv5mhFL0T0CqOCjRu9awn3sGovihWlFssMgIaE0EAGTsZ0Qk3 hABMilpKlbWjt03rmJS82NXajos0V0lpyXQPHZ6XYyVl+DJPBRJ8k5Vnm3slIL+Z/5hD FvMMxgkz0ByVs5MImTlWgCroVo7GTl3lzJPdNKnlOCZAyYbpaIjVWh4ECEgOW275vrqm Pi+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=t6HVnbos; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a67si27166929pla.350.2019.04.11.03.59.27; Thu, 11 Apr 2019 03:59:43 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@agner.ch header.s=dkim header.b=t6HVnbos; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726775AbfDKK5K (ORCPT + 99 others); Thu, 11 Apr 2019 06:57:10 -0400 Received: from mail.kmu-office.ch ([178.209.48.109]:37958 "EHLO mail.kmu-office.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726215AbfDKK5K (ORCPT ); Thu, 11 Apr 2019 06:57:10 -0400 Received: from webmail.kmu-office.ch (unknown [IPv6:2a02:418:6a02::a3]) by mail.kmu-office.ch (Postfix) with ESMTPSA id E0A695C025A; Thu, 11 Apr 2019 12:57:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1554980227; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=fS6LpPjEpfYrPcydTCdPI5FsuCGhHMg8YJ3B6ys1UrI=; b=t6HVnbosdcljje5KzdmLmrWCjYDdSFhy9fA1ti4hBOzVaAw6d4ID95EdUhQyWKPmblMZWg WxPbcwb/IpdSBZZpSg1bIVar5F7y7k+qCtyCOBygN3GEWMGi7M5T9vSspWeVf4KMjaAU0N dFS9VH01PTq+t08aZuiYIvqJH2/YnYU= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Date: Thu, 11 Apr 2019 12:57:07 +0200 From: Stefan Agner To: Ben Dooks Cc: thierry.reding@gmail.com, digetx@gmail.com, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra-owner@vger.kernel.org Subject: Re: [PATCH] gpu: host1x: fix compile error when IOMMU API is not available In-Reply-To: <7371b1573ddd0b127713724ef5051a6f@codethink.co.uk> References: <4c3d021c73c001f633803e364cfbc6ace3381205.1554936354.git.stefan@agner.ch> <7371b1573ddd0b127713724ef5051a6f@codethink.co.uk> Message-ID: <53b179ccdc64326438a1335db9ecd916@agner.ch> X-Sender: stefan@agner.ch User-Agent: Roundcube Webmail/1.3.7 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.04.2019 10:23, Ben Dooks wrote: > On 2019-04-10 23:47, Stefan Agner wrote: >> In case the IOMMU API is not available compiling host1x fails with >> the following error: >> In file included from drivers/gpu/host1x/hw/host1x06.c:27: >> drivers/gpu/host1x/hw/channel_hw.c: In function ‘host1x_channel_set_streamid’: >> drivers/gpu/host1x/hw/channel_hw.c:118:30: error: implicit >> declaration of function >> ‘dev_iommu_fwspec_get’; did you mean ‘iommu_fwspec_free’? >> [-Werror=implicit-function-declaration] >> struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); >> ^~~~~~~~~~~~~~~~~~~~ >> iommu_fwspec_free >> >> Fixes: de5469c21ff9 ("gpu: host1x: Program the channel stream ID") >> Signed-off-by: Stefan Agner > > would it be better to provide something like this i nthe header that > defines dev_iommu_fwspec_get() to be: > > static inline struct iommu_fwspec *dev_iommu_fwspec_get(struct device > *dev) { return NULL; } > > although returning an PTR_ERR would have been better. > The problem is that the code also accesses fields of struct iommu_fwspec which are not defined in the !CONFIG_IOMMU_API case. -- Stefan >> --- >> drivers/gpu/host1x/hw/channel_hw.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/gpu/host1x/hw/channel_hw.c >> b/drivers/gpu/host1x/hw/channel_hw.c >> index 27101c04a827..4030d64916f0 100644 >> --- a/drivers/gpu/host1x/hw/channel_hw.c >> +++ b/drivers/gpu/host1x/hw/channel_hw.c >> @@ -114,7 +114,7 @@ static inline void synchronize_syncpt_base(struct >> host1x_job *job) >> >> static void host1x_channel_set_streamid(struct host1x_channel *channel) >> { >> -#if HOST1X_HW >= 6 >> +#if IS_ENABLED(CONFIG_IOMMU_API) && HOST1X_HW >= 6 >> struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); >> u32 sid = spec ? spec->ids[0] & 0xffff : 0x7f;