Thread (34 messages) 34 messages, 3 authors, 2022-01-04

RE: [PATCH 5.10.y-cip 20/22] dmaengine: sh: make array ds_lut static

From: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Date: 2021-12-22 10:26:58

Hi Pavel,

Thank you for the review.
-----Original Message-----
From: Pavel Machek <redacted>
Sent: 22 December 2021 10:05
To: Prabhakar Mahadev Lad <prabhakar.mahadev-lad.rj@bp.renesas.com>
Cc: cip-dev@lists.cip-project.org; Nobuhiro Iwamatsu <redacted>; Pavel Machek
[off-list ref]; Biju Das [off-list ref]
Subject: Re: [PATCH 5.10.y-cip 20/22] dmaengine: sh: make array ds_lut static

Hi!
quoted
commit 4c0eee50658746b0333d35a75d3db6e0aac08ef9 upstream.

Don't populate the read-only array ds_lut on the stack but instead it
static. Also makes the object code smaller by 163 bytes:

Before:
   text    data     bss     dec     hex filename
  23508    4796       0   28304    6e90 ./drivers/dma/sh/rz-dmac.o

After:
   text    data     bss     dec     hex filename
  23281    4860       0   28141    6ded ./drivers/dma/sh/rz-dmac.o
Heh.
quoted
@@ -574,7 +574,7 @@ static void rz_dmac_issue_pending(struct dma_chan
*chan)  static u8 rz_dmac_ds_to_val_mapping(enum dma_slave_buswidth
ds)  {
 	u8 i;
-	const enum dma_slave_buswidth ds_lut[] = {
+	static const enum dma_slave_buswidth ds_lut[] = {
 		DMA_SLAVE_BUSWIDTH_1_BYTE,
 		DMA_SLAVE_BUSWIDTH_2_BYTES,
 		DMA_SLAVE_BUSWIDTH_4_BYTES,
Array could be avoided altogether; you could check for power of two and then count bits. That would
give even shorter code, but I'm not sure about readability.
We might loose readability, Ill let Biju decide on this.
I'd also not mind using usual convention here: return int, >= 0 success, < 0 errno.
Agreed.

Cheers,
Prabhakar
Best regards,
								Pavel
--
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help