Received: by 10.192.165.156 with SMTP id m28csp862616imm; Thu, 19 Apr 2018 08:45:51 -0700 (PDT) X-Google-Smtp-Source: AIpwx493pvP/z95f1gVoXPJj3ZI5a344M7Kn27JpvidMhA6kK1d1+I4LxHhb0x6Rj2s9umwR8B9s X-Received: by 10.98.182.15 with SMTP id j15mr6298791pff.115.1524152751284; Thu, 19 Apr 2018 08:45:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524152751; cv=none; d=google.com; s=arc-20160816; b=V8yz78C6519tV1yyxDynHAyVToJNRays0RRsWprU3AeHS2TIyNOPwtD642bO9PEmVv jfH8Im5ZP848Q0ZpNH2PvRJHET+XvuG+DkKEjfgdRGZjy88/fOslzV28vFsKNYiTzMSI gEOB6qWeACqZAMdClI77+NjD7HTPXFBiZKQYlQIuwNO8Yce4GLT/Be7bq8F0ursFWUQg lNaOSzGAn2Mj5l331lHVzY2cZfnAUgCgCU3IlsiC7RHQ4hGg6I+JbRm5C4yrogrRDckd QZhhgS/nORuNBNKDDjhF2fLVh1OFSRDWE8NV/FrESBlgmVA+e+9LluATt8AUkDq2sWx3 OpuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=G2ymp0fA2xQenrBWe0HrlXNUZcIYpFQHyldpNotkL4s=; b=JRHg1lvFLCOumDJvtG/EEEVYT/wwJ7ePx4RDdwGgzbz9m9mDrM6WCuSM1dK3ZcvCgj PlI1j0GmrAUpIESl/P5RT4+htrLpUK+0LvnOmzS3vejFTNu2RBwdWOZK/bUy3JOyHSgM aPhDi6xs47mwEfX5letjqLwAMD9uZDuO2VoxuW0DpJ+XQcBif7AhF1m0YaPiG/16u5Pw 3dzOus8efn8KKv/gDh1SEOEYThu1l7A0SZd7l/gh9z9PFnk2BPJVfBmHC1XNesN4FED7 eneFoiZGAswG5sBE+AX62/I5lsWNsW1oOOEgp31iVD4zDdAPHAQRRg1JoJUnqXhd8AUH M3xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si3359966pff.205.2018.04.19.08.45.36; Thu, 19 Apr 2018 08:45:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753401AbeDSPn5 (ORCPT + 99 others); Thu, 19 Apr 2018 11:43:57 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42498 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753002AbeDSPnw (ORCPT ); Thu, 19 Apr 2018 11:43:52 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id 06EDC20867; Thu, 19 Apr 2018 17:43:50 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost.localdomain (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 8DF9E20824; Thu, 19 Apr 2018 17:43:49 +0200 (CEST) From: Paul Kocialkowski To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com Cc: Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Pawel Osciak , Marek Szyprowski , Kyungmin Park , Hans Verkuil , Sakari Ailus , Philipp Zabel , Arnd Bergmann , Alexandre Courbot , Tomasz Figa , Paul Kocialkowski Subject: [PATCH v2 02/10] media-request: Add a request complete operation to allow m2m scheduling Date: Thu, 19 Apr 2018 17:41:16 +0200 Message-Id: <20180419154124.17512-3-paul.kocialkowski@bootlin.com> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> References: <20180419154124.17512-1-paul.kocialkowski@bootlin.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When using the request API in the context of a m2m driver, the operations that come with a m2m run scheduling call in their (m2m-specific) ioctl handler are delayed until the request is queued (for instance, this includes queuing buffers and streamon). Thus, the m2m run scheduling calls are not called in due time since the request AP's internal plumbing will (rightfully) use the relevant core functions directly instead of the ioctl handler. This ends up in a situation where nothing happens if there is no run-scheduling ioctl called after queuing the request. In order to circumvent the issue, a new media operation is introduced, called at the time of handling the media request queue ioctl. It gives m2m drivers a chance to schedule a m2m device run at that time. The existing req_queue operation cannot be used for this purpose, since it is called with the request queue mutex held, that is eventually needed in the device_run call to apply relevant controls. Signed-off-by: Paul Kocialkowski --- drivers/media/media-request.c | 3 +++ include/media/media-device.h | 2 ++ 2 files changed, 5 insertions(+) diff --git a/drivers/media/media-request.c b/drivers/media/media-request.c index 415f7e31019d..28ac5ccfe6a2 100644 --- a/drivers/media/media-request.c +++ b/drivers/media/media-request.c @@ -157,6 +157,9 @@ static long media_request_ioctl_queue(struct media_request *req) media_request_get(req); } + if (mdev->ops->req_complete) + mdev->ops->req_complete(req); + return ret; } diff --git a/include/media/media-device.h b/include/media/media-device.h index 07e323c57202..c7dcf2079cc9 100644 --- a/include/media/media-device.h +++ b/include/media/media-device.h @@ -55,6 +55,7 @@ struct media_entity_notify { * @req_alloc: Allocate a request * @req_free: Free a request * @req_queue: Queue a request + * @req_complete: Complete a request */ struct media_device_ops { int (*link_notify)(struct media_link *link, u32 flags, @@ -62,6 +63,7 @@ struct media_device_ops { struct media_request *(*req_alloc)(struct media_device *mdev); void (*req_free)(struct media_request *req); int (*req_queue)(struct media_request *req); + void (*req_complete)(struct media_request *req); }; /** -- 2.16.3