From patchwork Wed Aug 15 19:04:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kosta Zertsekel X-Patchwork-Id: 10566767 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 0FCDE139A for ; Wed, 15 Aug 2018 19:05:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C7F142ADCF for ; Wed, 15 Aug 2018 19:05:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BAD0E2AF3D; Wed, 15 Aug 2018 19:05:10 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 161062ADCF for ; Wed, 15 Aug 2018 19:05:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbeHOV6b (ORCPT ); Wed, 15 Aug 2018 17:58:31 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39436 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727247AbeHOV6a (ORCPT ); Wed, 15 Aug 2018 17:58:30 -0400 Received: by mail-wr1-f68.google.com with SMTP id h10-v6so1982129wre.6; Wed, 15 Aug 2018 12:05:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=oEX5gOHx1pvpWmHV8PDVMKcDGJJZXRTMhlxb0kQd9KY=; b=lJZslMiXAGLU/gYCC6waevoG4BqD8Px0MJaPg+Zu2eoVNSjoUruAzckH36NJqvp5Rk RXqILH37jPUGk0zy8HcAtCNA8CLG7rVz5FqB84ZK91xlw7/V7V6AuGmHYdAQ2GO97bGY Kvvyx9WZX2hBTf5l7iwA9ObbT4tOfx+5OdgYGOaQPHCEKbQbN9dyisYXEFMpbioQ03+M jCFSn+qyaAAWzaGgRgy+Ak1FLXeCMcuUFS4fSjux6LL4k0xyx3jrMmt4D9lsaSvy9JMA +/MeSeErsO0YgjeRSW7c8gC9QOlgxl/FjPc7FpaioQ7TxaMQYjAqCeM/aYXmUq1smI8i o8cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=oEX5gOHx1pvpWmHV8PDVMKcDGJJZXRTMhlxb0kQd9KY=; b=MW2vkgzT4z7dIO1+G45qc2N3K385F4gKojFDihiM3+Fm+T87xaWzWkocFLMFfcqS0Y +cRVS8uIfhuYeSZ9apgt3gOVUcrn6y6965JpWOqVqjJXZqNRB2Pnsl6XI9pVk+4HJDfy 7RQYl0OrPL6FIV0bnEskZnRWzv4BUdqAS4eCz88E8QyqC1LhHJKGO+B6YYiNMy4pfKHb /tduTsS8gtazJt1n8UbVOero0VXJ9gAVL6TbLm7rXNAfTiuATMAa5DAiGZjGHN2zoqvs /9zE98s8cAfjgrHOtlC4dhJRUMb410TA8x7WHRMrwHCC7yJ+mBkFmB3tik4TU5penXrL vNFQ== X-Gm-Message-State: AOUpUlHx0k2fdQp1B3S+Sllx/l3YSugBhViwlRPUZsvxYR+LNSSQ/F6B N/1ZO0t87c83De4KQGUVGsSJsh0m X-Google-Smtp-Source: AA+uWPz1avyre1AVmE/An5Vy0raEHZSFhWyJn9NhEPKVq4gFvjLrcsu7q4jP9DIn8eDjn8LCW1hSRQ== X-Received: by 2002:adf:8276:: with SMTP id 109-v6mr17622835wrb.127.1534359902085; Wed, 15 Aug 2018 12:05:02 -0700 (PDT) Received: from kostamach.yok.int.mrv.com (194-90-138-234.bb.netvision.net.il. [194.90.138.234]) by smtp.gmail.com with ESMTPSA id v5-v6sm31079610wrp.87.2018.08.15.12.04.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Aug 2018 12:05:00 -0700 (PDT) From: Kosta Zertsekel To: Mark Brown , Andrew Lunn , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Kosta Zertsekel , =?utf-8?q?Jan_Kundr=C3=A1t?= , Stefan Roese , Ken Wilson Subject: [PATCH v4] spi: orion: cosmetics - alias long direct_access variables Date: Wed, 15 Aug 2018 22:04:49 +0300 Message-Id: <20180815190449.23738-1-zertsekel@gmail.com> X-Mailer: git-send-email 2.17.1 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 This change increases the source code readability. Instead of using `spi->child[cs].direct_access.XXX` use `dir_acc->XXX`. Instead of using `orion_spi->child[cs].direct_access.vaddr` use `vaddr`. Signed-off-by: Kosta Zertsekel Reviewed-by: Andrew Lunn Reviewed-by: Stefan Roese Reviewed-by: Jan Kundrát --- drivers/spi/spi-orion.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/spi/spi-orion.c b/drivers/spi/spi-orion.c index d01a6adc726e..184ba91abeee 100644 --- a/drivers/spi/spi-orion.c +++ b/drivers/spi/spi-orion.c @@ -430,6 +430,7 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) int word_len; struct orion_spi *orion_spi; int cs = spi->chip_select; + void __iomem *vaddr; word_len = spi->bits_per_word; count = xfer->len; @@ -440,8 +441,9 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Use SPI direct write mode if base address is available. Otherwise * fall back to PIO mode for this transfer. */ - if ((orion_spi->child[cs].direct_access.vaddr) && (xfer->tx_buf) && - (word_len == 8)) { + vaddr = orion_spi->child[cs].direct_access.vaddr; + + if (vaddr && xfer->tx_buf && word_len == 8) { unsigned int cnt = count / 4; unsigned int rem = count % 4; @@ -449,13 +451,11 @@ orion_spi_write_read(struct spi_device *spi, struct spi_transfer *xfer) * Send the TX-data to the SPI device via the direct * mapped address window */ - iowrite32_rep(orion_spi->child[cs].direct_access.vaddr, - xfer->tx_buf, cnt); + iowrite32_rep(vaddr, xfer->tx_buf, cnt); if (rem) { u32 *buf = (u32 *)xfer->tx_buf; - iowrite8_rep(orion_spi->child[cs].direct_access.vaddr, - &buf[cnt], rem); + iowrite8_rep(vaddr, &buf[cnt], rem); } return count; @@ -683,6 +683,7 @@ static int orion_spi_probe(struct platform_device *pdev) /* Scan all SPI devices of this controller for direct mapped devices */ for_each_available_child_of_node(pdev->dev.of_node, np) { + struct orion_direct_acc *dir_acc; u32 cs; /* Get chip-select number from the "reg" property */ @@ -711,14 +712,13 @@ static int orion_spi_probe(struct platform_device *pdev) * This needs to get extended for the direct SPI-NOR / SPI-NAND * support, once this gets implemented. */ - spi->child[cs].direct_access.vaddr = devm_ioremap(&pdev->dev, - r->start, - PAGE_SIZE); - if (!spi->child[cs].direct_access.vaddr) { + dir_acc = &spi->child[cs].direct_access; + dir_acc->vaddr = devm_ioremap(&pdev->dev, r->start, PAGE_SIZE); + if (!dir_acc->vaddr) { status = -ENOMEM; goto out_rel_axi_clk; } - spi->child[cs].direct_access.size = PAGE_SIZE; + dir_acc->size = PAGE_SIZE; dev_info(&pdev->dev, "CS%d configured for direct access\n", cs); }