Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp105493rdd; Mon, 8 Jan 2024 20:15:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IFg8nLoR5cPyLely4o51yCwtPqmb+kR8EqiWeneUwNAQmmuZjHNMNvln9rcmHe5ZqJ71SJI X-Received: by 2002:a05:6358:7f12:b0:175:5d72:5f7c with SMTP id p18-20020a0563587f1200b001755d725f7cmr6860189rwn.50.1704773739603; Mon, 08 Jan 2024 20:15:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704773739; cv=none; d=google.com; s=arc-20160816; b=hX46u7AiPTZM9rrAMIsIMYI0c50WlX8FoU5dPseh1OfhKFzqmlAWPgNHh7kDyI3sF6 mrO/lXVY2RiPFAQOlbH9UkBSgnMufvMFRJtrohcZeFQB0W1Oo7PUYfEPIT6PeVh/gQOi BQ5UCktgaV3KqrHv7j/ffNRK8Bkm+Oifq71hJOYrFtsRgKwQ4+gvNbNHVjv4Fgk6I/hX oPhz4zl0sUyzyrL8CWYyX5yP0z1rajdEsvb1iIzpnSpXEpvvq1lY0TkI+gQUk1//bLqr TgoBZO4z3w5lNX8HgkjgPJ7rCA2UX6ol++Ni0v3FjqsB633ZVCqIC7z7FMD9VBj4KlLD A9Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=JnmP9HCW0xFGvAZ+PSrTWWszc0HwZwOSM+5mszcUNAM=; fh=hoFS1pvwyUmd9oSJlkSgnFdVB4jSs7Yj/LIFl0+O8Og=; b=jcQEAZQTI5Jk1ZG94nt2EoWEO+W/VmAZZP/GxaXzAq4qlk9wGVm5ca4bFECTa5m9qW jBKHm1/TXfxDuNed8A029wZShvfemo+c3qSeWPEnFnT2VtxbriqEa1bpPtSfNMaUAf1N NwA/Psbj2NhueAmHwKkvUFIGKRP/ONEa8sJYY4Rjltbn6Y9bhaTHrd04BTT2KZw1Ot3D H5dPbeCyBuI9qxlPKJrcy+uTapbLokXBXyysQb9iPx6xirM1pPC5nYrZ9ub0zu2swNtA uU66mdlbiIHgcSW1bDm4oOXgryRb3SoajPXMXuxHHPH2nJK42zUQnsRewhncjeqlUAUs +J1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ksbCsVGY; spf=pass (google.com: domain of linux-kernel+bounces-20371-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id c32-20020a631c20000000b005cdf7f7bb12si841105pgc.426.2024.01.08.20.15.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 20:15:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20371-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ksbCsVGY; spf=pass (google.com: domain of linux-kernel+bounces-20371-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 428A1285241 for ; Tue, 9 Jan 2024 04:15:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4177D79C4; Tue, 9 Jan 2024 04:15:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="ksbCsVGY" Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7EE5613AE3 for ; Tue, 9 Jan 2024 04:15:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1d3ed1ca402so22340875ad.2 for ; Mon, 08 Jan 2024 20:15:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704773726; x=1705378526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JnmP9HCW0xFGvAZ+PSrTWWszc0HwZwOSM+5mszcUNAM=; b=ksbCsVGYZ5Djhduu9K5DQ5WbC00hIJo1XMogbR+xXh1mcPIxS6tcrz00O3nNDdvbcq eUeV6SlLxE8pYFv/4iZPc9ddJnSVluZUqplKqowGHwtfdyBpcP81GdtSj4V2xMDpMsIJ S7+hni+qABt8d0hSx5G9M5FKDq40rqM8b4FRg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704773726; x=1705378526; 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=JnmP9HCW0xFGvAZ+PSrTWWszc0HwZwOSM+5mszcUNAM=; b=AOuS6X/kFYjtOgMzYetYhy3zFRMr8LjDVhRZ6KQmLZfFTwfgNE8QBHIhsEHVz/2MbQ ES7EMcA85qkIZHA5gOWYD8bxh1LMqOZTDV7TM29gAFiSUcsC4/H2Q6tBQ1fPKvJnpZC8 vQSaiMr5hMDatDOWuDp81NFyOQbs7YiTpKz7djXIVdIU4pRKZ3YjSNjfe9Dm59Xmnmgf mL0pkYB/LH45tqXcGcL88SxIvB+rkGqudXmTOjq9LwJJ+dXkdmPs7dXHJA7wvXoH/9g9 EjWqqCTukDSEENhtv+/UMR+0XIX4Hsjp9sGEAuQo4SdkeiyCVwyGG3GF8LTxZSWIid4u iHEw== X-Gm-Message-State: AOJu0YxKEAVcGGwPRrHa0jS37umwwDeKa+eOF++uL/q0PzeIg4677dWo 2hDvi/5zgjnPKFGm2rBg0AFwW+Vo/8Yk X-Received: by 2002:a17:902:7d88:b0:1d0:737d:2ae5 with SMTP id a8-20020a1709027d8800b001d0737d2ae5mr4724686plm.87.1704773725815; Mon, 08 Jan 2024 20:15:25 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:7b29:709a:867f:fec5]) by smtp.gmail.com with ESMTPSA id w8-20020a170902a70800b001d3dff2575fsm676499plq.52.2024.01.08.20.15.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 20:15:25 -0800 (PST) From: Hidenori Kobayashi To: Sakari Ailus , Bingbu Cao , Tianshu Qiu , Mauro Carvalho Chehab , Greg Kroah-Hartman , Yong Zhi Cc: Dan Carpenter , Hidenori Kobayashi , stable@vger.kernel.org, Mauro Carvalho Chehab , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH v2] media: staging: ipu3-imgu: Set fields before media_entity_pads_init() Date: Tue, 9 Jan 2024 13:14:59 +0900 Message-ID: <20240109041500.2790754-1-hidenorik@chromium.org> X-Mailer: git-send-email 2.43.0.472.g3155946c3a-goog Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The imgu driver fails to probe because it does not set the pad's flags before calling media_entity_pads_init(). Fix the initialization order so that the driver probe succeeds. The ops initialization is also moved together for readability. Fixes: a0ca1627b450 ("media: staging/intel-ipu3: Add v4l2 driver based on media framework") Cc: # 6.7 Signed-off-by: Hidenori Kobayashi --- Changes in v2: - Add Fixes tag and revise commit message (Thanks Dan!) - Link to v1: https://lore.kernel.org/lkml/20231228093926.748001-1-hidenorik@chromium.org --- drivers/staging/media/ipu3/ipu3-v4l2.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c index a66f034380c0..3df58eb3e882 100644 --- a/drivers/staging/media/ipu3/ipu3-v4l2.c +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c @@ -1069,6 +1069,11 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu, struct imgu_media_pipe *imgu_pipe = &imgu->imgu_pipe[pipe]; /* Initialize subdev media entity */ + imgu_sd->subdev.entity.ops = &imgu_media_ops; + for (i = 0; i < IMGU_NODE_NUM; i++) { + imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ? + MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE; + } r = media_entity_pads_init(&imgu_sd->subdev.entity, IMGU_NODE_NUM, imgu_sd->subdev_pads); if (r) { @@ -1076,11 +1081,6 @@ static int imgu_v4l2_subdev_register(struct imgu_device *imgu, "failed initialize subdev media entity (%d)\n", r); return r; } - imgu_sd->subdev.entity.ops = &imgu_media_ops; - for (i = 0; i < IMGU_NODE_NUM; i++) { - imgu_sd->subdev_pads[i].flags = imgu_pipe->nodes[i].output ? - MEDIA_PAD_FL_SINK : MEDIA_PAD_FL_SOURCE; - } /* Initialize subdev */ v4l2_subdev_init(&imgu_sd->subdev, &imgu_subdev_ops); @@ -1177,15 +1177,15 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe, } /* Initialize media entities */ + node->vdev_pad.flags = node->output ? + MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK; + vdev->entity.ops = NULL; r = media_entity_pads_init(&vdev->entity, 1, &node->vdev_pad); if (r) { dev_err(dev, "failed initialize media entity (%d)\n", r); mutex_destroy(&node->lock); return r; } - node->vdev_pad.flags = node->output ? - MEDIA_PAD_FL_SOURCE : MEDIA_PAD_FL_SINK; - vdev->entity.ops = NULL; /* Initialize vbq */ vbq->type = node->vdev_fmt.type; -- 2.43.0.472.g3155946c3a-goog