From patchwork Mon Jul 10 06:51:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chen-Yu Tsai X-Patchwork-Id: 117667 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp4842340vqx; Mon, 10 Jul 2023 00:22:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFAfxWNbk+F0JKBtShDMOUs25o9F0gNF0kF2O0sIVxORY2AmVs8DdqyzYTGDBMaEdMG47T X-Received: by 2002:a17:902:e80d:b0:1b8:b436:bef3 with SMTP id u13-20020a170902e80d00b001b8b436bef3mr10844986plg.24.1688973770728; Mon, 10 Jul 2023 00:22:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688973770; cv=none; d=google.com; s=arc-20160816; b=hOOPINov89HXQ9rvD4Wz6KBHEAMr9cUwFSjb0O4c0QWrUjn/aR5pfqho/mtrmRoKRC vs5cIolF1IsJq8hGPwZywDn8CChtngFRez9e735DPLVfh1X1y7AH+07eRz7+HbMhJfeT qW80wYQ10TRKgOiJSLtKYP7MHbvC++3NunUyUKX7O7mfvRODPPNPIpcQyG+BwzEaErBI P0RGKSz1LedJNBGjoHH9DfN8D/FregvISz119eIS+3iIvPerTwgeoFLFMAp9WuItvFja SWOoQvoRGXKdSMZgv9hlb/XyqpH4srVmH9dUdf7bgbyrmbkL9nJJ2uvE5P789ZlwrwgR 1k2A== 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=OHTjYXmEzIxUquNxc12N2ed97hoxj5Q5yMhXNmLYxUg=; fh=LHEKcDoeJiFksrXrN7VskAQc21GdFWD/Gp2alG2NGIc=; b=dP+DdlWBSNo8KDxFTOZThIW7t/LA7ldwWzCLKe4Rwbym3j2VSF314UttHhBuemvU41 V31Sfdr9IagFpdFSPeKdViFf4wC8sg9hnPLmu36vbcd/U7b1056V3QV5xicf3V1f1zGv PZ1TGOJopUMj8fDG0j+NN+sWvGCfn5Jw/qIj86qpgSFX5Ptj0Iwnf+s07bgnGtZry0c7 EC7dKn+Y+totqxg2mn5wVy0ES6wpmWKsX/VF7hZNmIrLipmB/FPbkMYX8PkRC0qth24T i6iiHkiFdl0bdopu4iA5YT58Ub3De4AynjbQjTZvTGQQ0vhQyAQGI3Mz7LL0Rkr6OtuV 00/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=dWRiLXZr; 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 k4-20020a170902c40400b001b9d09004dasi4293147plk.451.2023.07.10.00.22.38; Mon, 10 Jul 2023 00:22:50 -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=dWRiLXZr; 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 S229830AbjGJGv6 (ORCPT + 99 others); Mon, 10 Jul 2023 02:51:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229617AbjGJGv5 (ORCPT ); Mon, 10 Jul 2023 02:51:57 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 946C0A8 for ; Sun, 9 Jul 2023 23:51:56 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-55bc29a909dso2016607a12.3 for ; Sun, 09 Jul 2023 23:51:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1688971916; x=1691563916; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=OHTjYXmEzIxUquNxc12N2ed97hoxj5Q5yMhXNmLYxUg=; b=dWRiLXZrSKSFSMWsHBCQVAB/OlaHEOIh/Oml1FQLpvcm3sfSG6ev2fCiruI7p3ku7T 5K625KuWeejYo4UbkfJukPnHuiZaAm5ajcflQvjH11+2dW7FXXGIR/6kcsAN/6BQat8b 7klmo5pQBs08mERbff+G4nguqLH+zekW7LJ7o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688971916; x=1691563916; 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=OHTjYXmEzIxUquNxc12N2ed97hoxj5Q5yMhXNmLYxUg=; b=T4+aiK1jJ6UY5SIuaK8HeqghSUAq75VAkMwQzPxG4Sl+LfC9HdpFB6cT6hrmfGcj76 UflxK0v6p6HasZuf60qTlHe9vBGkp12Ecf+m4JixDZLUSQL4xwRZnzDRPN1T/+Fuacdv E2n5f45KikWxGtrEtYryE2telE9bxsoCjttTrkFYHqiIF+Q9VMU/KevL4KoX5Mcczdxz 4tzq9BLO6XI7N4R5RQH1sXTsfBiwO6lc2bzMOdvt8AZZxoWxlxvEXcjmujB7a9Qz1knb HYlN90rHWMHL5Iu755yev5qy4Yceb6KBC0G5J8spLzhGcJfRihWdHJHDfINc/ErTPImt OeZw== X-Gm-Message-State: ABy/qLbSmiCJqEumV/K7rn+2Xt3mhUJ0S4bJUC0SYZ9i7bhL+WdzCnc5 3hm8bBFsPMqydx8Agd311OGBj/hG0ocWKc7k+XU= X-Received: by 2002:a17:90a:5317:b0:262:d2ca:e209 with SMTP id x23-20020a17090a531700b00262d2cae209mr8935382pjh.18.1688971916071; Sun, 09 Jul 2023 23:51:56 -0700 (PDT) Received: from wenstp920.tpe.corp.google.com ([2401:fa00:1:10:be97:1d05:f9b6:36a6]) by smtp.gmail.com with ESMTPSA id s24-20020a17090aba1800b0026302348ee4sm5537135pjr.30.2023.07.09.23.51.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 23:51:55 -0700 (PDT) From: Chen-Yu Tsai To: Bin Liu , Mauro Carvalho Chehab , Hans Verkuil , Matthias Brugger , AngeloGioacchino Del Regno Cc: Chen-Yu Tsai , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, kyrie.wu@mediatek.com, irui.wang@mediatek.com Subject: [PATCH] media: mtk-jpeg: Set platform driver data earlier Date: Mon, 10 Jul 2023 14:51:36 +0800 Message-ID: <20230710065139.1763695-1-wenst@chromium.org> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: INBOX X-GMAIL-THRID: 1771017360414632926 X-GMAIL-MSGID: 1771017360414632926 In the multi-core JPEG encoder/decoder setup, the driver for the individual cores references the parent device's platform driver data. However, in the parent driver, this is only set at the end of the probe function, way later than devm_of_platform_populate(), which triggers the probe of the cores. This causes a kernel splat in the sub-device probe function. Move platform_set_drvdata() to before devm_of_platform_populate() to fix this. Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware") Signed-off-by: Chen-Yu Tsai Reviewed-by: AngeloGioacchino Del Regno --- Not sure what caused this to surface just now, given that the driver changes were merged in v6.2-rc1, and the corresponding dts entries in v6.3-rc1. This fixes boot failures on MT8195. Please apply and send to Linus ASAP. drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index 4768156181c9..6a8eea9dde67 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1312,6 +1312,8 @@ static int mtk_jpeg_probe(struct platform_device *pdev) jpeg->dev = &pdev->dev; jpeg->variant = of_device_get_match_data(jpeg->dev); + platform_set_drvdata(pdev, jpeg); + ret = devm_of_platform_populate(&pdev->dev); if (ret) { v4l2_err(&jpeg->v4l2_dev, "Master of platform populate failed."); @@ -1383,8 +1385,6 @@ static int mtk_jpeg_probe(struct platform_device *pdev) jpeg->variant->dev_name, jpeg->vdev->num, VIDEO_MAJOR, jpeg->vdev->minor); - platform_set_drvdata(pdev, jpeg); - pm_runtime_enable(&pdev->dev); return 0;