From patchwork Mon Jun 4 15:00:03 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: 10447081 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 05D0860375 for ; Mon, 4 Jun 2018 17:48:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E570128D16 for ; Mon, 4 Jun 2018 17:48:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D69A228D18; Mon, 4 Jun 2018 17:48:35 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, 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 9929428D16 for ; Mon, 4 Jun 2018 17:48:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751164AbeFDRsd (ORCPT ); Mon, 4 Jun 2018 13:48:33 -0400 Received: from office2.cesnet.cz ([195.113.144.244]:48638 "EHLO office2.cesnet.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751017AbeFDRsc (ORCPT ); Mon, 4 Jun 2018 13:48:32 -0400 Received: from localhost (unknown [IPv6:2001:718:1:2c:a4a8:fc6b:670f:47e3]) (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 855CC40007F; Mon, 4 Jun 2018 19:41:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cesnet.cz; s=office2; t=1528134079; bh=/Ln+fZsBgrggVXakolJVM+668GdpNClpZ2jkKMImyiM=; h=Resent-Date:Resent-From:Resent-To:Resent-Cc:In-Reply-To: References:From:Date:Subject:To:Cc; b=rx6pGhH8ZEyTvENM4hMorsjTeSoVKq4h8VBM7brH49TS2Hs8J5CrvvTCY4wNaCn/s fQuLGGvb1jhz78BD+U3uUI5abiqLOakHuXX9Sg8DvqQSlgXGbXLLFxYNBXytxMDNGO Ysl1eipKEoZjzic4mP8ImFBsMgW1XfJVa8BEb110= Message-Id: <188e1e02cc13e8370f2cbf62105105fb80fefb87.1528133962.git.jan.kundrat@cesnet.cz> In-Reply-To: <1518714806.25567.63.camel@impinj.com> References: <1518714806.25567.63.camel@impinj.com> From: =?UTF-8?q?Jan=20Kundr=C3=A1t?= Date: Mon, 4 Jun 2018 17:00:03 +0200 Subject: [PATCH v2] spi: orion: Respect per-transfer bits_per_word settings MIME-Version: 1.0 To: linux-spi@vger.kernel.org Cc: Trent Piepho , Mark Brown 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 a12ec0814327..5477e7b70902 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -432,7 +432,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; count = xfer->len; orion_spi = spi_master_get_devdata(spi->master);