From patchwork Sun Feb 2 15:24:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Stefan_S=C3=B8rensen?= X-Patchwork-Id: 3566901 Return-Path: X-Original-To: patchwork-linux-spi@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7DE7FC02DD for ; Sun, 2 Feb 2014 15:43:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AF752201E7 for ; Sun, 2 Feb 2014 15:43:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BDDBA201EC for ; Sun, 2 Feb 2014 15:43:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751731AbaBBPnc (ORCPT ); Sun, 2 Feb 2014 10:43:32 -0500 Received: from 213083164162.static.sonofon.dk ([213.83.164.162]:43381 "EHLO HORWDSPRD01.spectralink.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751759AbaBBPnb (ORCPT ); Sun, 2 Feb 2014 10:43:31 -0500 X-Greylist: delayed 1151 seconds by postgrey-1.27 at vger.kernel.org; Sun, 02 Feb 2014 10:43:30 EST Received: from e37108.spectralink.com ([172.29.161.133]) by HORWDSPRD01.spectralink.com with Microsoft SMTPSVC(7.5.7600.16601); Sun, 2 Feb 2014 16:24:14 +0100 Received: by e37108.spectralink.com (sSMTP sendmail emulation); Sun, 02 Feb 2014 16:24:14 +0100 From: =?UTF-8?q?Stefan=20S=C3=B8rensen?= To: broonie@kernel.org, linux-spi@vger.kernel.org Cc: =?UTF-8?q?Stefan=20S=C3=B8rensen?= Subject: [PATCH] spi: omap2-mcspi: Do not configure the controller on each transfer unless needed Date: Sun, 2 Feb 2014 16:24:12 +0100 Message-Id: <1391354652-32092-1-git-send-email-stefan.sorensen@spectralink.com> X-Mailer: git-send-email 1.8.5.3 MIME-Version: 1.0 X-OriginalArrivalTime: 02 Feb 2014 15:24:14.0796 (UTC) FILETIME=[D4CD18C0:01CF202A] Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 spi_transfer->speed_hz and spi_transfer->bits_per_word used to only be set when not using the default settings but are not set on every transfer, causing omap2_mcspi_setup_transfer to be called on each transfer. This patch changes the check to only call omap2_mcspi_setup_transfer if the settings needs to be changed. Signed-off-by: Stefan Sørensen --- drivers/spi/spi-omap2-mcspi.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index a72127f..965539b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1057,12 +1057,15 @@ static void omap2_mcspi_work(struct omap2_mcspi *mcspi, struct spi_message *m) status = -EINVAL; break; } - if (par_override || t->speed_hz || t->bits_per_word) { + if (par_override || + (t->speed_hz != spi->max_speed_hz) || + (t->bits_per_word != spi->bits_per_word)) { par_override = 1; status = omap2_mcspi_setup_transfer(spi, t); if (status < 0) break; - if (!t->speed_hz && !t->bits_per_word) + if (t->speed_hz == spi->max_speed_hz && + t->bits_per_word == spi->bits_per_word) par_override = 0; } if (cd && cd->cs_per_word) {