From patchwork Sun Mar 29 13:27:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sakari Ailus X-Patchwork-Id: 6115641 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C395A9F1BE for ; Sun, 29 Mar 2015 13:28:28 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 346A52026D for ; Sun, 29 Mar 2015 13:28:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A554720268 for ; Sun, 29 Mar 2015 13:28:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752577AbbC2N2X (ORCPT ); Sun, 29 Mar 2015 09:28:23 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:54881 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751623AbbC2N2W (ORCPT ); Sun, 29 Mar 2015 09:28:22 -0400 Received: from valkosipuli.retiisi.org.uk (vihersipuli.retiisi.org.uk [IPv6:2001:1bc8:102:7fc9::84:2]) by hillosipuli.retiisi.org.uk (Postfix) with ESMTP id DED4F60093; Sun, 29 Mar 2015 16:28:17 +0300 (EEST) Received: by valkosipuli.retiisi.org.uk (Postfix, from userid 1005) id B89F0210B4; Sun, 29 Mar 2015 16:27:47 +0300 (EEST) From: Sakari Ailus To: linux-media@vger.kernel.org Cc: mchehab@osg.samsung.com, hverkuil@xs4all.nl Subject: [RESEND PATCH 1/1] vb2: Fix dma_dir setting for dma-contig mem type Date: Sun, 29 Mar 2015 16:27:47 +0300 Message-Id: <1427635667-30142-1-git-send-email-sakari.ailus@iki.fi> X-Mailer: git-send-email 1.7.10.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Sakari Ailus The last argument of vb2_dc_get_user_pages() is of type enum dma_data_direction, but the caller, vb2_dc_get_userptr() passes a value which is the result of comparison dma_dir == DMA_FROM_DEVICE. This results in the write parameter to get_user_pages() being zero in all cases, i.e. that the caller has no intent to write there. This was broken by patch "vb2: replace 'write' by 'dma_dir'". Signed-off-by: Sakari Ailus Cc: stable@vger.kernel.org # for v3.19 Acked-by: Hans Verkuil Fixes: cd474037c4a9 ("[media] vb2: replace 'write' by 'dma_dir'") --- Hi, This fixes videobuf2 dma-contig memory type USERPTR support for v3.19. The pull req for the patch was submitted some time ago: Mauro, let us know if you have objections. Thanks. drivers/media/v4l2-core/videobuf2-dma-contig.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/media/v4l2-core/videobuf2-dma-contig.c b/drivers/media/v4l2-core/videobuf2-dma-contig.c index b481d20..69e0483 100644 --- a/drivers/media/v4l2-core/videobuf2-dma-contig.c +++ b/drivers/media/v4l2-core/videobuf2-dma-contig.c @@ -632,8 +632,7 @@ static void *vb2_dc_get_userptr(void *alloc_ctx, unsigned long vaddr, } /* extract page list from userspace mapping */ - ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, - dma_dir == DMA_FROM_DEVICE); + ret = vb2_dc_get_user_pages(start, pages, n_pages, vma, dma_dir); if (ret) { unsigned long pfn; if (vb2_dc_get_user_pfn(start, n_pages, vma, &pfn) == 0) {