Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753114AbbETLcp (ORCPT ); Wed, 20 May 2015 07:32:45 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:14503 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751272AbbETLcn (ORCPT ); Wed, 20 May 2015 07:32:43 -0400 X-PGP-Universal: processed; by hqnvupgp08.nvidia.com on Wed, 20 May 2015 04:29:52 -0700 Date: Wed, 20 May 2015 13:32:33 +0200 From: Thierry Reding To: Alexandre Courbot CC: Ben Skeggs , David Airlie , "Arnd Bergmann" , , , , Subject: Re: [PATCH] drm/nouveau/platform: fix compilation if !CONFIG_IOMMU Message-ID: <20150520113231.GA21937@ulmo.nvidia.com> References: <555BD66A.5020704@nvidia.com> <1432102224-15169-1-git-send-email-acourbot@nvidia.com> MIME-Version: 1.0 In-Reply-To: <1432102224-15169-1-git-send-email-acourbot@nvidia.com> X-NVConfidentiality: public User-Agent: Mutt/1.5.23 (2014-03-12) X-Originating-IP: [10.2.70.242] X-ClientProxiedBy: UKMAIL101.nvidia.com (10.26.138.13) To UKMAIL101.nvidia.com (10.26.138.13) Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="VbJkn9YxBvnuCH5J" Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3281 Lines: 94 --VbJkn9YxBvnuCH5J Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, May 20, 2015 at 03:10:24PM +0900, Alexandre Courbot wrote: > The lack of IOMMU API support can make nouveau_platform_probe_iommu() > fail to compile because struct iommu_ops is then empty. Fix this by > skipping IOMMU probe in that case - lack of IOMMU on platform devices > is sub-optimal, but is not an error. >=20 > Signed-off-by: Alexandre Courbot > --- > This is an alternative to https://lkml.org/lkml/2015/5/19/484. Most users > of Nouveau do not care about IOMMU support, so we should not impose that > option on them. >=20 > drm/nouveau/nouveau_platform.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) >=20 > diff --git a/drivers/gpu/drm/nouveau/nouveau_platform.c b/drivers/gpu/drm= /nouveau/nouveau_platform.c > index 775277f1edb0..dcfbbfaf1739 100644 > --- a/drivers/gpu/drm/nouveau/nouveau_platform.c > +++ b/drivers/gpu/drm/nouveau/nouveau_platform.c > @@ -92,6 +92,8 @@ static int nouveau_platform_power_down(struct nouveau_p= latform_gpu *gpu) > return 0; > } > =20 > +#if IS_ENABLED(CONFIG_IOMMU_API) > + > static void nouveau_platform_probe_iommu(struct device *dev, > struct nouveau_platform_gpu *gpu) > { > @@ -158,6 +160,20 @@ static void nouveau_platform_remove_iommu(struct dev= ice *dev, > } > } > =20 > +#else > + > +static void nouveau_platform_probe_iommu(struct device *dev, > + struct nouveau_platform_gpu *gpu) > +{ > +} > + > +static void nouveau_platform_remove_iommu(struct device *dev, > + struct nouveau_platform_gpu *gpu) > +{ > +} > + > +#endif > + Since these are all static functions, perhaps an "if (IS_ENABLED(...))" would work here? That way you'd get compile coverage of the code in all cases. But perhaps that doesn't work for IOMMU. I have a vague memory of running across something like this before and IOMMU has this quirk of defining struct iommu_ops as empty if IOMMU_API is deselected so you'll probably get compiler errors unless you actually preprocess the code out. Thierry --VbJkn9YxBvnuCH5J Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAABCAAGBQJVXHDMAAoJEN0jrNd/PrOhDLcP/3PO6dFMQvOSrAI9sNCqC6pA pGg16armwKR+3my0bC+g8SnKaJHwdqvp2heMNNDyZLMaCwBHDIgGnlk8YlmVCmxS 5yKu4PF2K+JwD7jOwsIZkXE7cQXi1AAt/ICQVJax8gClo71EukFz59pNgEoAfMc1 r2A2Wi8stbhTa0wAiu8U9M8gL8aTNQhZIDwMQGDYN7h07ZpANzyOl8x8j9zCCv6L VCQxDWb32FWQlMXGlvtLokMwMzIGRoaOgLeuMmuidIdhBtmmqxHFUITO8LA/GLN6 Rm1L6+B69J/CEsZB0opw8Z6v7mvHl84vDEeR+CyxIaOB097zjF8tdYB7p6fG1Bzx 7RaQblXCAdBe4xT2LwomDrxV+hsqRoa/+zdEvsKGTRYMEW9COj/cb+WR+NyKFk6M ea6RLkaXRY38sm2FuTuTKOnnP8JmMcGBnnCiNAYOjVSwGtDVtLaT7QLslmc3f5i1 ZZkZqQsNzcGIvtxmjKgQGmk86UhLBb3RrBVN1eoVRIboI05M7g41hKqjQlYCwbWd iWxiuaYO4kaZak+QAgnk0sW+XKxsMnUcPhJ95qcYlgboCD/8zHkNogXT4elHffEw Wz26TuxM+DH/WuK0ByNIH9Dc4dvd9HkJ0p1g2nQjzQEBCDdy10H7+vcrdaqTHtE5 Z80KXmj/ophJMPXJh6G7 =sit3 -----END PGP SIGNATURE----- --VbJkn9YxBvnuCH5J-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/