From patchwork Thu Apr 11 16:42:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Noralf_Tr=C3=B8nnes?= X-Patchwork-Id: 10896429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9C2E61390 for ; Thu, 11 Apr 2019 16:43:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 875D628D98 for ; Thu, 11 Apr 2019 16:43:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7B36628D9E; Thu, 11 Apr 2019 16:43:05 +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=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3CE3228DA4 for ; Thu, 11 Apr 2019 16:43:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA25389148; Thu, 11 Apr 2019 16:43:03 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.domeneshop.no (smtp.domeneshop.no [IPv6:2a01:5b40:0:3005::1]) by gabe.freedesktop.org (Postfix) with ESMTPS id 915CA89911 for ; Thu, 11 Apr 2019 16:42:59 +0000 (UTC) Received: from 211.81-166-168.customer.lyse.net ([81.166.168.211]:49732 helo=localhost.localdomain) by smtp.domeneshop.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.84_2) (envelope-from ) id 1hEcmv-0007LK-Na; Thu, 11 Apr 2019 18:42:57 +0200 From: =?utf-8?q?Noralf_Tr=C3=B8nnes?= To: linux-spi@vger.kernel.org, dri-devel@lists.freedesktop.org Subject: [PATCH v4 2/4] spi: Split spi message into max_dma_len size chunks Date: Thu, 11 Apr 2019 18:42:33 +0200 Message-Id: <20190411164235.49771-3-noralf@tronnes.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190411164235.49771-1-noralf@tronnes.org> References: <20190411164235.49771-1-noralf@tronnes.org> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tronnes.org; s=ds201810; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=z/HcVwwA5IlpWJbcKiQwGFrR+4HNdJ3XZao+2cFtF20=; b=JsfcDBiGzaaXIeMLOkh4OCElWrs2cyr5MWFwfCUoVrUPHHkhadPiDftrFg5musNlwDwCLuQjFRQ4egTnH7O6a6hjVa90ngees7zgd0aUM8Crl8acAiObocKAFUA5GNuq6r/7qe+CcVcD8bo3oLQu7b0a6S9RELrbdB0os0GZ7D5Uk9+n/FFBnJxo+yvQWnIGNLkKsULatuy2AaEFpx8w46pqDtlub61NEPgFHTODy7pv7WLt5VVyvxQfu+ZdK7tyHgNUe0qOa64jdWFAwkw1Vb6/XAxpOpiiYL1bCvCzNJwgosSpe2jEwppYP3nQ5rfJubm3al7x8As7hT7Wzd/h+A==; X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stefan.wahren@i2se.com, broonie@kernel.org, linux-rpi-kernel@lists.infradead.org, meghana.madhyastha@gmail.com, kernel@martin.sperl.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Meghana Madhyastha Some drivers like spi_bcm2835 have a max size on DMA transfers. Work around this by splitting up the transfer if necessary. ->max_transfer_size is MAX_INT if the driver doesn't set it, so this change will only affect drivers that set the value. Signed-off-by: Meghana Madhyastha Signed-off-by: Noralf Trønnes --- drivers/spi/spi.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 05875e63be43..22bc658032b3 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1299,6 +1299,11 @@ static void __spi_pump_messages(struct spi_controller *ctlr, bool in_kthread) trace_spi_message_start(ctlr->cur_msg); + ret = spi_split_transfers_maxsize(ctlr, ctlr->cur_msg, ctlr->max_dma_len, + GFP_KERNEL | GFP_DMA); + if (ret) + goto out; + if (ctlr->prepare_message) { ret = ctlr->prepare_message(ctlr, ctlr->cur_msg); if (ret) {