From patchwork Thu Nov 16 00:33:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 10060519 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B2B4460230 for ; Thu, 16 Nov 2017 00:33:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A1AA02A3C7 for ; Thu, 16 Nov 2017 00:33:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 96C522A3CA; Thu, 16 Nov 2017 00:33:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 470772A3C7 for ; Thu, 16 Nov 2017 00:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933863AbdKPAd5 (ORCPT ); Wed, 15 Nov 2017 19:33:57 -0500 Received: from galahad.ideasonboard.com ([185.26.127.97]:42604 "EHLO galahad.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932594AbdKPAd4 (ORCPT ); Wed, 15 Nov 2017 19:33:56 -0500 Received: from avalon.ideasonboard.com (unknown [182.232.80.106]) by galahad.ideasonboard.com (Postfix) with ESMTPSA id F30D82034D; Thu, 16 Nov 2017 01:32:34 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1510792357; bh=3wSMVFxDSqfDaCoiY9wpEZm6GFJzphUwZU5SwhKskC8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nvsxC1uzLWGvIb1TzBbQDSLgKyriGLA4pM+EpE+OStwFX9rDC0QgICTaWMQcoZEPO j+BAbigmz9hbIt5YKSJWJmAxuBdi37jpmZx06YX0Z2OA7Sdl0y7+K5VebyU8x5HkZZ RN5SsLlpMuGcGWPb353w10rxv1NWHg/sLwymGsC8= From: Laurent Pinchart To: linux-media@vger.kernel.org Cc: linux-renesas-soc@vger.kernel.org, =?UTF-8?q?Niklas=20S=C3=B6derlund?= , Sakari Ailus , Hans Verkuil Subject: [PATCH/RFC 2/2] v4l: rcar-vin: Wait for device access to complete before unplugging Date: Thu, 16 Nov 2017 02:33:49 +0200 Message-Id: <20171116003349.19235-3-laurent.pinchart+renesas@ideasonboard.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171116003349.19235-1-laurent.pinchart+renesas@ideasonboard.com> References: <20171116003349.19235-1-laurent.pinchart+renesas@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP To avoid races between device access and unplug, call the video_device_unplug() function in the platform driver remove handler. This will unsure that all device access completes before the remove handler proceeds to free resources. Signed-off-by: Laurent Pinchart --- drivers/media/platform/rcar-vin/rcar-core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/media/platform/rcar-vin/rcar-core.c b/drivers/media/platform/rcar-vin/rcar-core.c index bd7976efa1fb..c5210f1d09ed 100644 --- a/drivers/media/platform/rcar-vin/rcar-core.c +++ b/drivers/media/platform/rcar-vin/rcar-core.c @@ -1273,6 +1273,7 @@ static int rcar_vin_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); + video_device_unplug(&vin->vdev); if (!vin->info->use_mc) { v4l2_async_notifier_unregister(&vin->notifier);