From patchwork Thu Aug 9 23:12:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 10563459 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17D0C13B4 for ; Sat, 11 Aug 2018 12:08:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E67D02A157 for ; Sat, 11 Aug 2018 12:08:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D41F72A2B8; Sat, 11 Aug 2018 12:08:19 +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.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,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 91D532A157 for ; Sat, 11 Aug 2018 12:08:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E8436E197; Sat, 11 Aug 2018 12:06:12 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf1-x143.google.com (mail-lf1-x143.google.com [IPv6:2a00:1450:4864:20::143]) by gabe.freedesktop.org (Postfix) with ESMTPS id 982AA6E6E0 for ; Thu, 9 Aug 2018 23:12:34 +0000 (UTC) Received: by mail-lf1-x143.google.com with SMTP id y200-v6so5284885lfd.7 for ; Thu, 09 Aug 2018 16:12:34 -0700 (PDT) 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=PRu/WH3UfsbVfxNrOd5qm0di6r14wGa6ruxSLvmGvrA=; b=H1+xK+rk0KiejM70QF+SMK86usS89LpoBVd8zkvgqySwcwipiDcYkBrTWglFRPHCIl 59iZjc6d0oum33rDkgh9FW5p8MuDv6Xq0U3bBrR0ZcimwzsvbBJXceEw1275d8jqDWdx 3WIUCOY3eUgOEKaRBLhXe3cRDcRgQchR/wkVJe7sLa3g0j8RCMQQ8i1mAztobs6untyO 7gOoKmvXPiMv6qHA2Ck349db/UwSEquByqNQdRW8O7lgFZTFNAwtCYprOinAUch4pdPf VV8R3gaVUkeT02Ks+7N0HKdOcEerbjtgmNy4LQck8N+9HesKmFNRcZTA61TeDs/rwjeG jgWQ== X-Gm-Message-State: AOUpUlEAqSsoDlmYDaCtXDYUyqssjELU4JtB+miWZqLILqiJgVroDLOW SXgSQijyi3Cmf1F2AA1D9XQ= X-Google-Smtp-Source: AA+uWPww8D9HzZlQqeLui4IpnjGTu2HxJdRXdUvEzUv6LN7qkNXTWKz5BTNUJUsXSklN8YcmFxHDIw== X-Received: by 2002:a19:93d2:: with SMTP id w79-v6mr2968971lfk.20.1533856352982; Thu, 09 Aug 2018 16:12:32 -0700 (PDT) Received: from localhost.localdomain ([109.252.90.13]) by smtp.gmail.com with ESMTPSA id v9-v6sm1352177lje.20.2018.08.09.16.12.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Aug 2018 16:12:32 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Subject: [PATCH v2] gpu: host1x: Ignore clients initialization failure Date: Fri, 10 Aug 2018 02:12:11 +0300 Message-Id: <20180809231211.26182-1-digetx@gmail.com> X-Mailer: git-send-email 2.18.0 X-Mailman-Approved-At: Sat, 11 Aug 2018 12:05:13 +0000 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: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.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 From time to time new bugs are popping up, causing some host1x client to fail its initialization. Currently a single clients initialization failure causes whole host1x device registration to fail, as a result a single DRM sub-device initialization failure makes whole DRM initialization to fail. Let's ignore clients initialization failure, as a result display panel lights up even if some DRM clients (say GR2D or VIC) fail to initialize. Actually VIC fails if initramfs misses the firmware file, so with this change a serial console isn't needed anymore to figure out why display isn't working. Signed-off-by: Dmitry Osipenko --- Changelog: v2: Added WARN_ON() that should get more attention than just a error message. Made clients_lock to lock around the lists modification, that is in line with the rest of the code. drivers/gpu/host1x/bus.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c index 815bdb42e3f0..07bb6b6c1260 100644 --- a/drivers/gpu/host1x/bus.c +++ b/drivers/gpu/host1x/bus.c @@ -199,19 +199,23 @@ static void host1x_subdev_unregister(struct host1x_device *device, */ int host1x_device_init(struct host1x_device *device) { - struct host1x_client *client; + struct host1x_client *client, *cl; int err; mutex_lock(&device->clients_lock); - list_for_each_entry(client, &device->clients, list) { + list_for_each_entry_safe(client, cl, &device->clients, list) { if (client->ops && client->ops->init) { err = client->ops->init(client); - if (err < 0) { + if (WARN_ON(err < 0)) { dev_err(&device->dev, "failed to initialize %s: %d\n", dev_name(client->dev), err); - goto teardown; + + /* add the client to the list of idle clients */ + mutex_lock(&clients_lock); + list_add_tail(&client->list, &clients); + mutex_unlock(&clients_lock); } } } @@ -219,14 +223,6 @@ int host1x_device_init(struct host1x_device *device) mutex_unlock(&device->clients_lock); return 0; - -teardown: - list_for_each_entry_continue_reverse(client, &device->clients, list) - if (client->ops->exit) - client->ops->exit(client); - - mutex_unlock(&device->clients_lock); - return err; } EXPORT_SYMBOL(host1x_device_init);