From patchwork Thu Feb 15 14:19:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Jan_Kundr=C3=A1t?= X-Patchwork-Id: 10221395 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 2542C6056E for ; Thu, 15 Feb 2018 14:31:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16CBD29385 for ; Thu, 15 Feb 2018 14:31:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B78F2939B; Thu, 15 Feb 2018 14:31:33 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 1A21529385 for ; Thu, 15 Feb 2018 14:31:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033028AbeBOObY (ORCPT ); Thu, 15 Feb 2018 09:31:24 -0500 Received: from office2.cesnet.cz ([195.113.144.244]:43620 "EHLO office2.cesnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032957AbeBOObX (ORCPT ); Thu, 15 Feb 2018 09:31:23 -0500 Received: from localhost (unknown [IPv6:2001:718:1:2c:15f8:b813:1f49:2432]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by office2.cesnet.cz (Postfix) with ESMTPSA id A645B400066; Thu, 15 Feb 2018 15:31:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1518705082; bh=uAZ4sOJk7KTfObeUa5zb3HT8FhC0ey1vpGBVwMESaAk=; h=Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To: References:From:Date:Subject:To:Cc; b=I5iyE1A0aSur1fhC3+g6UGgWXhv/BhshL5rsvDrzldIXos+QjRTibGkj6QsfqM5ne wv6GFPvoFVpuETy+SK8E1jwbVK5ucMOsrkNzPQFOmKzH0tDJlmlIcM9DIEY/xM22GF C03FipbZPLDvqwLOAESOJ1j9t68GwHvQnfZPBv9I= Message-Id: In-Reply-To: References: From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Thu, 15 Feb 2018 15:19:11 +0100 Subject: [PATCH 2/4] spi: orion: Respect per-transfer bits_per_word settings MIME-Version: 1.0 To: linux-spi@vger.kernel.org Cc: Mark Brown , Geert Uytterhoeven , Chris Packham , Andy Shevchenko , Gregory CLEMENT , Christophe JAILLET Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP It's a bug to look at the device's bits_per_word because each transfer can override these settings. In fact, e.g., spidev cannot specify "global" bits_per_word and instead relies on passing that through every ioctl. This code already did the right thing in orion_spi_setup_transfer, but then failed to access the HW in an appropriate way here in orion_spi_write_read. Tested by 16-bit trnasfers via spidev on an Armada 388 (Solidrun Clearfog). Signed-off-by: Jan Kundrát --- drivers/spi/spi-orion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index ca52300baeb1..56e419a7ed78 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -427,7 +427,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) struct orion_spi *orion_spi; int cs = spi->chip_select; - word_len = spi->bits_per_word; + word_len = xfer->bits_per_word ? xfer->bits_per_word : spi->bits_per_word; count = xfer->len; orion_spi = spi_master_get_devdata(spi->master);