From patchwork Tue Apr 13 18:02:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Niklas_S=C3=B6derlund?= X-Patchwork-Id: 421364 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 48EB0C433ED for ; Tue, 13 Apr 2021 18:04:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 280A4613B6 for ; Tue, 13 Apr 2021 18:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347522AbhDMSEj (ORCPT ); Tue, 13 Apr 2021 14:04:39 -0400 Received: from bin-mail-out-05.binero.net ([195.74.38.228]:27736 "EHLO bin-mail-out-05.binero.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347520AbhDMSEa (ORCPT ); Tue, 13 Apr 2021 14:04:30 -0400 X-Halon-ID: a452fb5c-9c82-11eb-aed0-005056917f90 Authorized-sender: niklas.soderlund@fsdn.se Received: from bismarck.berto.se (p54ac5521.dip0.t-ipconnect.de [84.172.85.33]) by bin-vsp-out-02.atm.binero.net (Halon) with ESMTPA id a452fb5c-9c82-11eb-aed0-005056917f90; Tue, 13 Apr 2021 20:04:08 +0200 (CEST) From: =?utf-8?q?Niklas_S=C3=B6derlund?= To: Hans Verkuil , linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?utf-8?q?Niklas_S=C3=B6derlund?= Subject: [PATCH 09/11] rcar-vin: Specify media device ops at group creation time Date: Tue, 13 Apr 2021 20:02:51 +0200 Message-Id: <20210413180253.2575451-10-niklas.soderlund+renesas@ragnatech.se> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210413180253.2575451-1-niklas.soderlund+renesas@ragnatech.se> References: <20210413180253.2575451-1-niklas.soderlund+renesas@ragnatech.se> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org The media device operations structure will be different deepening on what media graph layout is used. Instead of hard-coding the R-Car CSI-2 layout allow the operations to be passed as an argument. Signed-off-by: Niklas Söderlund Reviewed-by: Jacopo Mondi --- drivers/media/platform/rcar-vin/rcar-core.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index d03ecd443b01c2b3..28bf9e8f19a1a27b 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -248,7 +248,8 @@ static void rvin_group_cleanup(struct rvin_group *group) } static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin, - void (*link_setup)(struct rvin_dev *)) + void (*link_setup)(struct rvin_dev *), + const struct media_device_ops *ops) { struct media_device *mdev = &group->mdev; const struct of_device_id *match; @@ -267,7 +268,7 @@ static int rvin_group_init(struct rvin_group *group, struct rvin_dev *vin, group->link_setup = link_setup; mdev->dev = vin->dev; - mdev->ops = &rvin_media_ops; + mdev->ops = ops; match = of_match_node(vin->dev->driver->of_match_table, vin->dev->of_node); @@ -299,7 +300,8 @@ static void rvin_group_release(struct kref *kref) } static int rvin_group_get(struct rvin_dev *vin, - void (*link_setup)(struct rvin_dev *)) + void (*link_setup)(struct rvin_dev *), + const struct media_device_ops *ops) { struct rvin_group *group; u32 id; @@ -331,7 +333,7 @@ static int rvin_group_get(struct rvin_dev *vin, goto err_group; } - ret = rvin_group_init(group, vin, link_setup); + ret = rvin_group_init(group, vin, link_setup, ops); if (ret) { kfree(group); vin_err(vin, "Failed to initialize group\n"); @@ -984,7 +986,7 @@ static int rvin_csi2_init(struct rvin_dev *vin) if (ret < 0) return ret; - ret = rvin_group_get(vin, rvin_csi2_setup_links); + ret = rvin_group_get(vin, rvin_csi2_setup_links, &rvin_media_ops); if (ret) goto err_controls;