From patchwork Thu Oct 20 00:03:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brian Norris X-Patchwork-Id: 5944 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp597630wrs; Wed, 19 Oct 2022 17:09:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4klp7a10cKNvFE1b79sEbr/gNCu3wdFksbjwVumXvyz4G5ZHgcmmgilAeppN+OVtUr66Fn X-Received: by 2002:a17:902:a416:b0:178:a030:5f94 with SMTP id p22-20020a170902a41600b00178a0305f94mr11134423plq.162.1666224594550; Wed, 19 Oct 2022 17:09:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666224594; cv=none; d=google.com; s=arc-20160816; b=RpXNFgsCi8mNE3hipxmnzvYscIYKNGkfh0qcC4GHU3IgK5n/Gj4jviLVSrGIUDWTNY Kp2mDrmTPKuGdivXD/9AkVrd2WA5I26Z6AfvixrRYnQzr3L9qpYYrPy4GUb+6sJprpFv lTlPK6IUt55xHgS3fldz39otw30JH7HCifIPdrlzqY8vaTQZDZIgbYlFkOMQaqUNVgY3 Gk5CL+xUrRJkzsHd1FY30VqHxVV50xr+pE4xb7FZwayxsyvgdnaWAf1hxx+AECtsarLA io7l9b1QnuLx/eI/7Wcbx/SuFdUWAEdgykHXVUZaVMmuhc6vN6G53jHe4Pmy6auGfG0J M2RQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=sZ+VMQj++EX3yhoA5VAX5sjDE7Raw/kYiv3NiX50+Qw37/PCr0T3AFdbmv8NV9zAb7 6ar66+Ns4ifHnYevKYdsnXUNceoNJGKgzlrKqar59F4xBvyn6eUHHEckFueXb/84eXFQ aEvDqfvcit8hyD/MBa26OQgMFVEPUV+e5uleSDm3EfO1T3kQdk7l1zZbMH8t+T1Inm3I sQH/eM80KMjSqC3PaLCoXWUJ4tpYzEDLpVGyaPMx3QyiOYBXnPePGSVaGHfmjRiauLT+ K1AkJUBlc+rgj1mjAnxhiGxkR3gsFvxEoXrShdBZS/XhxTScHwI+68ld5XRqyAEpA56Q mmWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NzPUtom5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x207-20020a6331d8000000b00438d81d22a3si18965851pgx.112.2022.10.19.17.09.41; Wed, 19 Oct 2022 17:09:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=NzPUtom5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbiJTAEj (ORCPT + 99 others); Wed, 19 Oct 2022 20:04:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230098AbiJTAEe (ORCPT ); Wed, 19 Oct 2022 20:04:34 -0400 Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F322639 for ; Wed, 19 Oct 2022 17:04:22 -0700 (PDT) Received: by mail-pf1-x42e.google.com with SMTP id h13so18729916pfr.7 for ; Wed, 19 Oct 2022 17:04:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=NzPUtom58NR34m2Vw7sS73ERU30rhe3RyOvvFRL8c790qf5KuZz3KvN69al/nH052u 65SRaYt/WHp0PKjIXDaLYCni7KlNbgouTs8KNf5Fy7byqei7PQ3KRgBHVXjhzqsdhzY0 or9yFqOg4L7gMu66IIQ9eWmxSPJ7xk7vRk2RQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sTMXfwPxByKhRbLMaBxfNCc3mPRoF7RiiHgqUtdhFi8=; b=WKRYG0GahfdSj90TyUJ7A4Ou5SnXJ6ktq99nHmCHj9bF0QHkDXDGua5i0tWoItNbD9 dRvKmE+MU0RlDsNyURPaocwy8DZrCtMQjo7WIUNqoiPYqG8ajQyWsRDMz0WrhqTePi2h CuLSru2oTXWcSUJFwR0Vc535fHASxv0e63k9e4uxruDlX4EkpHpi6AVGZo6hHX55LrV9 0Z6AJ+O0QCts4xOxpPy5uV4mA8mON7FUwk29QE3bQc2/vrHznpQh7qq2Xh/YwnkE/0gz 17pZlUgG9mCwWF4mcFLMwpj0IrlKSlf+fRFP1Kzk45h+dW7uJ6D5F3KBhm7Niy/iZpOC v2dg== X-Gm-Message-State: ACrzQf3BSWZ+rTcIOkRQe9NEWNs5sUURdQAkyxkYyIn8a1knXiQ/gVrV xpB/dKa3rSXK2NTBwPRwjWtD2A== X-Received: by 2002:a63:4283:0:b0:457:dced:8ba3 with SMTP id p125-20020a634283000000b00457dced8ba3mr9328251pga.220.1666224261493; Wed, 19 Oct 2022 17:04:21 -0700 (PDT) Received: from localhost ([2620:15c:9d:2:57b7:1f0e:44d1:f252]) by smtp.gmail.com with UTF8SMTPSA id lb13-20020a17090b4a4d00b0020a825fc912sm459119pjb.45.2022.10.19.17.04.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Oct 2022 17:04:21 -0700 (PDT) From: Brian Norris To: =?utf-8?q?Heiko_St=C3=BCbner?= Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Sandy Huang , linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Heiko Stuebner , Helen Koike , Brian Norris , stable@vger.kernel.org Subject: [PATCH 1/2] drm/rockchip: dsi: Clean up 'usage_mode' when failing to attach Date: Wed, 19 Oct 2022 17:03:48 -0700 Message-Id: <20221019170255.1.Ia68dfb27b835d31d22bfe23812baf366ee1c6eac@changeid> X-Mailer: git-send-email 2.38.0.413.g74048e4d9e-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1747163120620400936?= X-GMAIL-MSGID: =?utf-8?q?1747163120620400936?= If we fail to attach the first time (especially: EPROBE_DEFER), we fail to clean up 'usage_mode', and thus will fail to attach on any subsequent attempts, with "dsi controller already in use". Re-set to DW_DSI_USAGE_IDLE on attach failure. This is especially common to hit when enabling asynchronous probe on a duel-DSI system (such as RK3399 Gru/Scarlet), such that we're more likely to fail dw_mipi_dsi_rockchip_find_second() the first time. Fixes: 71f68fe7f121 ("drm/rockchip: dsi: add ability to work as a phy instead of full dsi") Cc: Signed-off-by: Brian Norris --- drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c index bf6948125b84..d222c6811207 100644 --- a/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw-mipi-dsi-rockchip.c @@ -1051,23 +1051,31 @@ static int dw_mipi_dsi_rockchip_host_attach(void *priv_data, if (ret) { DRM_DEV_ERROR(dsi->dev, "Failed to register component: %d\n", ret); - return ret; + goto out; } second = dw_mipi_dsi_rockchip_find_second(dsi); - if (IS_ERR(second)) - return PTR_ERR(second); + if (IS_ERR(second)) { + ret = PTR_ERR(second); + goto out; + } if (second) { ret = component_add(second, &dw_mipi_dsi_rockchip_ops); if (ret) { DRM_DEV_ERROR(second, "Failed to register component: %d\n", ret); - return ret; + goto out; } } return 0; + +out: + mutex_lock(&dsi->usage_mutex); + dsi->usage_mode = DW_DSI_USAGE_IDLE; + mutex_unlock(&dsi->usage_mutex); + return ret; } static int dw_mipi_dsi_rockchip_host_detach(void *priv_data,