linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4] spi: orion: cosmetics - alias long direct_access variables
@ 2018-08-15 19:04 Kosta Zertsekel
  2018-08-24 20:57 ` Kosta Zertsekel
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Kosta Zertsekel @ 2018-08-15 19:04 UTC (permalink / raw)
  To: Mark Brown, Andrew Lunn, linux-spi, linux-kernel
  Cc: Kosta Zertsekel, Jan Kundrát, Stefan Roese, Ken Wilson

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 <zertsekel@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Stefan Roese <sr@denx.de>
---
 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);
 	}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v4] spi: orion: cosmetics - alias long direct_access variables
  2018-08-15 19:04 [PATCH v4] spi: orion: cosmetics - alias long direct_access variables Kosta Zertsekel
@ 2018-08-24 20:57 ` Kosta Zertsekel
  2018-08-24 22:50 ` Jan Kundrát
       [not found] ` <CADxo8W+JMKJvf8LUdH7_2EXqfi8KvrSPAYa=CZV1eMq2VrQ5rg@mail.gmail.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Kosta Zertsekel @ 2018-08-24 20:57 UTC (permalink / raw)
  To: Mark Brown, Andrew Lunn, linux-spi, linux-kernel
  Cc: Jan Kundrát, Stefan Roese, Ken Wilson

Guys,

Any additional comments?
Or the patch is ready to be merged?

Thanks,
--- Kosta Z.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4] spi: orion: cosmetics - alias long direct_access variables
       [not found] ` <CADxo8W+JMKJvf8LUdH7_2EXqfi8KvrSPAYa=CZV1eMq2VrQ5rg@mail.gmail.com>
@ 2018-08-24 21:01   ` Andrew Lunn
  2018-08-28 20:12   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2018-08-24 21:01 UTC (permalink / raw)
  To: Kosta Zertsekel
  Cc: Mark Brown, linux-spi, linux-kernel, Jan Kundrát,
	Stefan Roese, Ken Wilson

On Fri, Aug 24, 2018 at 11:55:18PM +0300, Kosta Zertsekel wrote:
> Guys,
> 
> Any additional comments?
> Or the patch is ready to be merged?

Hi Kosta

Since the merge window is open at the moment, many maintainers don't
look at patches. They expect you to resubmit, based on -rc1, when the
merge windows closes.

      Andrew

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4] spi: orion: cosmetics - alias long direct_access variables
  2018-08-15 19:04 [PATCH v4] spi: orion: cosmetics - alias long direct_access variables Kosta Zertsekel
  2018-08-24 20:57 ` Kosta Zertsekel
@ 2018-08-24 22:50 ` Jan Kundrát
       [not found] ` <CADxo8W+JMKJvf8LUdH7_2EXqfi8KvrSPAYa=CZV1eMq2VrQ5rg@mail.gmail.com>
  2 siblings, 0 replies; 5+ messages in thread
From: Jan Kundrát @ 2018-08-24 22:50 UTC (permalink / raw)
  To: Kosta Zertsekel
  Cc: Mark Brown, Andrew Lunn, linux-spi, linux-kernel, Stefan Roese,
	Ken Wilson

On středa 15. srpna 2018 21:04:49 CEST, Kosta Zertsekel wrote:
> 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 <zertsekel@gmail.com>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> Reviewed-by: Stefan Roese <sr@denx.de>
> ---
>  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);
>  	}

Reviewed-by: Jan Kundrát <jan.kundrat@cesnet.cz>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v4] spi: orion: cosmetics - alias long direct_access variables
       [not found] ` <CADxo8W+JMKJvf8LUdH7_2EXqfi8KvrSPAYa=CZV1eMq2VrQ5rg@mail.gmail.com>
  2018-08-24 21:01   ` Andrew Lunn
@ 2018-08-28 20:12   ` Mark Brown
  1 sibling, 0 replies; 5+ messages in thread
From: Mark Brown @ 2018-08-28 20:12 UTC (permalink / raw)
  To: Kosta Zertsekel
  Cc: Andrew Lunn, linux-spi, linux-kernel, Jan Kundrát,
	Stefan Roese, Ken Wilson

[-- Attachment #1: Type: text/plain, Size: 701 bytes --]

On Fri, Aug 24, 2018 at 11:55:18PM +0300, Kosta Zertsekel wrote:
> Guys,
> 
> Any additional comments?
> Or the patch is ready to be merged?
> 
> Thanks,
> --- Kosta Z.

Please don't send content free pings and please allow a reasonable time
for review.  People get busy, go on holiday, attend conferences and so 
on so unless there is some reason for urgency (like critical bug fixes)
please allow at least a couple of weeks for review.  If there have been
review comments then people may be waiting for those to be addressed.
Sending content free pings just adds to the mail volume (if they are
seen at all) and if something has gone wrong you'll have to resend the
patches anyway.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-08-28 20:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-15 19:04 [PATCH v4] spi: orion: cosmetics - alias long direct_access variables Kosta Zertsekel
2018-08-24 20:57 ` Kosta Zertsekel
2018-08-24 22:50 ` Jan Kundrát
     [not found] ` <CADxo8W+JMKJvf8LUdH7_2EXqfi8KvrSPAYa=CZV1eMq2VrQ5rg@mail.gmail.com>
2018-08-24 21:01   ` Andrew Lunn
2018-08-28 20:12   ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).