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: 10378425 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 EFE7160327 for ; Thu, 3 May 2018 14:05:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC124284C4 for ; Thu, 3 May 2018 14:05:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D07162874B; Thu, 3 May 2018 14:05:16 +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=-5.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 BC9CF291D9 for ; Thu, 3 May 2018 14:04:40 +0000 (UTC) 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-Google-Smtp-Source: AB8JxZribmpM+gsnnuU4GCPoJet07qWT6H+FVZgbReUajL58kL0q/wReC6LYwiUt5DkFIKMMH+WpBw== 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" X-Virus-Scanned: ClamAV using ClamSMTP 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