From patchwork Thu May 3 14:04:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 134906 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1969347lji; Thu, 3 May 2018 07:04:40 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp1CkSnEgWijbczp8A58X9b+XhLRaJULX/Og5enpY96tAl/jghKH9S9Z5/9P5tubhWyYFls X-Received: by 2002:a17:902:5ac1:: with SMTP id g1-v6mr24114894plm.43.1525356280583; Thu, 03 May 2018 07:04:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525356280; cv=none; d=google.com; s=arc-20160816; b=l8xZjsp42clLzLVhwzA5xAJmpSkGKGLdywhbD3h3tcmvF7GgVNeLPtRkdVkeKSX/ll kosDrvZ6RYO061RQX1Tg/c7CAAUabP52N+6bEvT7UqQT/0qPRSDvCYYVvhQlemWEXvTD tJ/2t9R4pxphhawbSJgOJX/88yfFV/Z1mS0bkodvEk4tgxScUcKtMSxVod2ZIw8VhBOx pK2vmYWs3maxuPBM6Wga/R9p88goPbot3G2reLcGIHZ7M9mXgaEWC9blYF2ICh2XPWCd dhddEbAcEKQmgKaru2JeD7RlwLI/C2qv2urbbulK0pJz9NheYXhbTRTTYcb5PU8mwMBa 1bXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:message-id:date:subject:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=EnB6qTVIqFxUkVX90hhp8iNFWuJU+BoR85M8l+Xsryw=; b=Gp0gUvtX3oX1plYTsUdMu4CU11GKdZT3j9m25wyTCxdLzXy0UiZKsTzI246QSH34vh kRJlc5SU2d586Ks/O4iAXTk43tqSJfXzImg9M34d2H4cpPI4wQnIqO3I/ERx5ei5Or6z JVa6mYcF4aMkcy7B2tMhZp4Gk8FbxAdmUVb3QFx9Qe7v8+hXZPfoBKGaiuTRB+TwcxZv cF2M8n98IHBsLAsaN/1N56lCmIDN3nJl/a6onSaAJt72awagT2Y1ese5Ft9v6M3KufjA +eTLbx7PDS0KhYmaJCbLlZb2JTiECjsXI6rVLAc1uWC17tQYP0s59aG97lQ4wZUpT3gY oesw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Xzh2ZGDO; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v17-v6si11294283pgb.380.2018.05.03.07.04.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 07:04:40 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Xzh2ZGDO; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 191AE6E6D1; Thu, 3 May 2018 14:04:39 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9AB236E6D1 for ; Thu, 3 May 2018 14:04:37 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id w8-v6so26191938lfe.3 for ; Thu, 03 May 2018 07:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=9HL73V40gL8AubiAbfRT29q8lksu2XWSsMNQREeiykE=; b=Xzh2ZGDOhitNREW3TwNd3h3+VWsJdfQBrNgKxEZ3o9qoU8Qa0OL496UPNrcnxMErrw r2LtmucPxlzMx03cdeCahTlzxJ4Re758cBLIk5r5Uj/gjI5Ufz4rcMT8IJc1uZ+B1KZE zSDQiONMBpsJdxNbOVi5MKwTkHN5PkWb/i3Iw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9HL73V40gL8AubiAbfRT29q8lksu2XWSsMNQREeiykE=; b=DDylP6GVXRCo2A6pJMmbZ9rz4sfS1m/O1q9fe4oqGOkxW8maFZdeLlwlRs2OeEBm+5 CSfE9IgYU7xShEXjUZ8EVX3oGutKXGzDTZdy7ceDOtgEonul6gUz5cxfvQjCYyFYKp8C toSIPaz2BihwSxvO2PX/MY7qmTOXCIPpnUjetjpLSvRPdlx5ZCmyLAnImWA8tNrLiVcP L7tYqFlcIpw5ok9CVIHVbMdDgN1q1oSooz8Ck5ysIBzZ+MxS2QzGg/VGFjJKEY+IQmEV Dv6qPDpSJy5wO+0xBHt8jjxL+2l1tFSsyQZySDZi9sRXnkL0pHxV85Nlw+u1JTWduvjb IxoA== X-Gm-Message-State: ALQs6tAZ7NTZo+0liD0tn6w0RM3MqOz9mlCaqxpcx+0S6hmie6aDHmRw zvcSnh/3EugS5fuq29abGfJGGg== X-Received: by 2002:a2e:9797:: with SMTP id y23-v6mr17104942lji.52.1525356275900; Thu, 03 May 2018 07:04:35 -0700 (PDT) Received: from genomnajs.wlan.se.axis.com ([85.235.16.11]) by smtp.gmail.com with ESMTPSA id y132-v6sm2834791lfc.56.2018.05.03.07.04.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 03 May 2018 07:04:34 -0700 (PDT) From: Linus Walleij To: Gustavo Padovan , Maarten Lankhorst , Sean Paul , Eric Anholt , Liviu Dudau Subject: [PATCH v2] drm/pl111: Fix module probe bug Date: Thu, 3 May 2018 16:04:31 +0200 Message-Id: <20180503140431.5798-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robin Murphy , Pawel Moll , linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Commit a30933c27602 ("drm/pl111: Support the Versatile Express") Added a second module using the builtin_platform_driver() call, which works fine as long as you do not try to build the PL111 driver as a module, because a module can only have one initcall and cause the following build bug: (...) multiple definition of `init_module' (...) Reported-by: Daniel Vetter Cc: Liviu Dudau Cc: Pawel Moll Cc: Eric Anholt Cc: Robin Murphy Fixes: a30933c27602 ("drm/pl111: Support the Versatile Express") Signed-off-by: Linus Walleij Reviewed-by: Sean Paul --- ChangeLog v1->v2: - In my stress I missed that if there are several CLCD instances on the board the platform_driver_register() call will return -EBUSY so we need to ignore that explicitly, all we want is to register the driver at least once. --- drivers/gpu/drm/pl111/pl111_versatile.c | 7 +++++++ drivers/gpu/drm/pl111/pl111_vexpress.c | 12 ++++++++++-- drivers/gpu/drm/pl111/pl111_vexpress.h | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 78ddf8534fd2..ad769e3e9fd3 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -326,6 +326,13 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) if (versatile_clcd_type == VEXPRESS_CLCD_V2M) { struct platform_device *pdev; + /* Registers a driver for the muxfpga */ + ret = vexpress_muxfpga_init(); + if (ret) { + dev_err(dev, "unable to intialize muxfpga driver\n"); + return ret; + } + /* Call into deep Vexpress configuration API */ pdev = of_find_device_by_node(np); if (!pdev) { diff --git a/drivers/gpu/drm/pl111/pl111_vexpress.c b/drivers/gpu/drm/pl111/pl111_vexpress.c index c9fee625faf1..c30f63cd66a8 100644 --- a/drivers/gpu/drm/pl111/pl111_vexpress.c +++ b/drivers/gpu/drm/pl111/pl111_vexpress.c @@ -106,7 +106,6 @@ static int vexpress_muxfpga_probe(struct platform_device *pdev) if (IS_ERR(map)) return PTR_ERR(map); dev_set_drvdata(dev, map); - return 0; } @@ -122,4 +121,13 @@ static struct platform_driver vexpress_muxfpga_driver = { .probe = vexpress_muxfpga_probe, }; -builtin_platform_driver(vexpress_muxfpga_driver); +int vexpress_muxfpga_init(void) +{ + int ret; + + ret = platform_driver_register(&vexpress_muxfpga_driver); + /* -EBUSY just means this driver is already registered */ + if (ret && ret != -EBUSY) + return ret; + return 0; +} diff --git a/drivers/gpu/drm/pl111/pl111_vexpress.h b/drivers/gpu/drm/pl111/pl111_vexpress.h index 49876417f7b6..40fbe42369dc 100644 --- a/drivers/gpu/drm/pl111/pl111_vexpress.h +++ b/drivers/gpu/drm/pl111/pl111_vexpress.h @@ -10,6 +10,8 @@ int pl111_vexpress_clcd_init(struct device *dev, struct pl111_drm_dev_private *priv, struct regmap *map); +int vexpress_muxfpga_init(void); + #else static int inline pl111_vexpress_clcd_init(struct device *dev, @@ -19,4 +21,9 @@ static int inline pl111_vexpress_clcd_init(struct device *dev, return -ENODEV; } +static inline int vexpress_muxfpga_init(void) +{ + return 0; +} + #endif