From patchwork Sun Jun 9 08:10:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe Leroy X-Patchwork-Id: 2693981 Return-Path: X-Original-To: patchwork-spi-devel-general@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by patchwork2.kernel.org (Postfix) with ESMTP id A37DCDF2A1 for ; Sun, 9 Jun 2013 09:31:04 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Ulbxm-0001G3-OM; Sun, 09 Jun 2013 09:31:02 +0000 Received: from sog-mx-1.v43.ch3.sourceforge.com ([172.29.43.191] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1Ulbxl-0001Fw-9Q for spi-devel-general@lists.sourceforge.net; Sun, 09 Jun 2013 09:31:01 +0000 X-ACL-Warn: Received: from pegase1.c-s.fr ([93.17.236.30] helo=mailhub1.si.c-s.fr) by sog-mx-1.v43.ch3.sourceforge.com with esmtp (Exim 4.76) id 1Ulbxj-0006TQ-1Z for spi-devel-general@lists.sourceforge.net; Sun, 09 Jun 2013 09:31:01 +0000 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id BB5031C8386; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from mailhub1.si.c-s.fr ([192.168.12.234]) by localhost (mailhub1.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id gBUMZvMh-xlt; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 9DFB71C82E8; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 87561C73C5; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id vHVkyMIq8s_m; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) Received: from localhost.localdomain (unknown [192.168.4.167]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by messagerie.si.c-s.fr (Postfix) with ESMTP id 2ECF1C73C4; Sun, 9 Jun 2013 10:49:11 +0200 (CEST) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by localhost.localdomain (8.13.8/8.13.8) with ESMTP id r598A4aA013109; Sun, 9 Jun 2013 10:12:45 +0200 Received: (from root@localhost) by localhost.localdomain (8.13.8/8.13.8/Submit) id r598A3D1013107; Sun, 9 Jun 2013 10:10:03 +0200 Date: Sun, 9 Jun 2013 10:10:03 +0200 Message-Id: <201306090810.r598A3D1013107@localhost.localdomain> From: Christophe Leroy To: Grant Likely Subject: [PATCH] Fix regression on spi-fsl-spi.c following modification on spi.c X-Antivirus: avast! (VPS 130608-1, 08/06/2013), Outbound message X-Antivirus-Status: Clean X-Spam-Score: -0.1 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain X-Headers-End: 1Ulbxj-0006TQ-1Z Cc: spi-devel-general@lists.sourceforge.net, Laxman Dewangan , linux-kernel@vger.kernel.org X-BeenThere: spi-devel-general@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux SPI core/device drivers discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: spi-devel-general-bounces@lists.sourceforge.net spi-fsl-spi.c made the assumption that t->bits_per_word and t->speed_hz were set only when wanting to change the setting. Since commit e6811d1d7a6a38ee637fe219c3b67dbfe17e8b3f, t->bits_per_word has been set in all transfers, therefore the assumption made by the driver leads to failure. This patch fixes the issue by comparing the t->new bits_per_word and t->speed_hz with the previous one in order to determine if one of them changed. Signed-off-by: Christophe Leroy ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j --- linux-3.8.13/drivers/spi/spi-fsl-spi.c 2013-05-11 22:57:46.000000000 +0200 +++ linux/drivers/spi/spi-fsl-spi.c 2013-06-09 00:13:30.000000000 +0200 @@ -476,11 +476,14 @@ unsigned int cs_change; const int nsecs = 50; int status; + u32 prev_speed_hz = 0; + u8 prev_bits_per_word = 0; cs_change = 1; status = 0; list_for_each_entry(t, &m->transfers, transfer_list) { - if (t->bits_per_word || t->speed_hz) { + if (prev_bits_per_word != t->bits_per_word + || prev_speed_hz != t->speed_hz) { /* Don't allow changes if CS is active */ status = -EINVAL; @@ -488,6 +491,8 @@ status = fsl_spi_setup_transfer(spi, t); if (status < 0) break; + prev_bits_per_word = t->bits_per_word; + prev_speed_hz = t->speed_hz; } if (cs_change) {