2021-09-28 15:20:53

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH 1/4] dmaengine: imx-sdma: remove useless braces

Braces {} are not necessary for single statement blocks.

Signed-off-by: Flavio Suligoi <[email protected]>
---
drivers/dma/imx-sdma.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index cacc725ca545..a58798fc3ff8 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -741,9 +741,8 @@ static int sdma_load_script(struct sdma_engine *sdma, void *buf, int size,
unsigned long flags;

buf_virt = dma_alloc_coherent(sdma->dev, size, &buf_phys, GFP_KERNEL);
- if (!buf_virt) {
+ if (!buf_virt)
return -ENOMEM;
- }

spin_lock_irqsave(&sdma->channel_0_lock, flags);

--
2.25.1


2021-09-28 15:21:42

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH 3/4] dmaengine: imx-sdma: align statement to open parenthesis

Alignment should match open parenthesis.

Signed-off-by: Flavio Suligoi <[email protected]>
---
drivers/dma/imx-sdma.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 726076683400..7b3bd3608651 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1241,7 +1241,7 @@ static int sdma_config_channel(struct dma_chan *chan)
}

static int sdma_set_channel_priority(struct sdma_channel *sdmac,
- unsigned int priority)
+ unsigned int priority)
{
struct sdma_engine *sdma = sdmac->sdma;
int channel = sdmac->channel;
@@ -1261,7 +1261,7 @@ static int sdma_request_channel0(struct sdma_engine *sdma)
int ret = -EBUSY;

sdma->bd0 = dma_alloc_coherent(sdma->dev, PAGE_SIZE, &sdma->bd0_phys,
- GFP_NOWAIT);
+ GFP_NOWAIT);
if (!sdma->bd0) {
ret = -ENOMEM;
goto out;
@@ -1284,7 +1284,7 @@ static int sdma_alloc_bd(struct sdma_desc *desc)
int ret = 0;

desc->bd = dma_alloc_coherent(desc->sdmac->sdma->dev, bd_size,
- &desc->bd_phys, GFP_NOWAIT);
+ &desc->bd_phys, GFP_NOWAIT);
if (!desc->bd) {
ret = -ENOMEM;
goto out;
@@ -1757,7 +1757,7 @@ static void sdma_issue_pending(struct dma_chan *chan)
#define SDMA_SCRIPT_ADDRS_ARRAY_SIZE_V4 46

static void sdma_add_scripts(struct sdma_engine *sdma,
- const struct sdma_script_start_addrs *addr)
+ const struct sdma_script_start_addrs *addr)
{
s32 *addr_arr = (u32 *)addr;
s32 *saddr_arr = (u32 *)sdma->script_addrs;
@@ -1840,8 +1840,8 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
clk_enable(sdma->clk_ahb);
/* download the RAM image for SDMA */
sdma_load_script(sdma, ram_code,
- header->ram_code_size,
- addr->ram_code_start_addr);
+ header->ram_code_size,
+ addr->ram_code_start_addr);
clk_disable(sdma->clk_ipg);
clk_disable(sdma->clk_ahb);

@@ -1850,8 +1850,8 @@ static void sdma_load_firmware(const struct firmware *fw, void *context)
sdma->fw_loaded = true;

dev_info(sdma->dev, "loaded firmware %d.%d\n",
- header->version_major,
- header->version_minor);
+ header->version_major,
+ header->version_minor);

err_firmware:
release_firmware(fw);
--
2.25.1

2021-09-28 15:22:16

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH 4/4] dmaengine: imx-sdma: remove space after sizeof

Space prohibited between function name and
open parenthesis '('

Signed-off-by: Flavio Suligoi <[email protected]>
---
drivers/dma/imx-sdma.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index 7b3bd3608651..75ec0754d4ad 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1955,7 +1955,7 @@ static int sdma_init(struct sdma_engine *sdma)
writel_relaxed(0, sdma->regs + SDMA_H_C0PTR);

sdma->channel_control = dma_alloc_coherent(sdma->dev,
- MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control) +
+ MAX_DMA_CHANNELS * sizeof(struct sdma_channel_control) +
sizeof(struct sdma_context_data),
&ccb_phys, GFP_KERNEL);

@@ -1965,9 +1965,9 @@ static int sdma_init(struct sdma_engine *sdma)
}

sdma->context = (void *)sdma->channel_control +
- MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control);
+ MAX_DMA_CHANNELS * sizeof(struct sdma_channel_control);
sdma->context_phys = ccb_phys +
- MAX_DMA_CHANNELS * sizeof (struct sdma_channel_control);
+ MAX_DMA_CHANNELS * sizeof(struct sdma_channel_control);

/* disable all channels */
for (i = 0; i < sdma->drvdata->num_events; i++)
--
2.25.1

2021-09-28 15:22:48

by FLAVIO SULIGOI

[permalink] [raw]
Subject: [PATCH 2/4] dmaengine: imx-sdma: add missed braces

The "if" conditional statement is not a single statement,
so both branches require braces.

Signed-off-by: Flavio Suligoi <[email protected]>
---
drivers/dma/imx-sdma.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a58798fc3ff8..726076683400 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -1226,8 +1226,9 @@ static int sdma_config_channel(struct dma_chan *chan)
if (sdmac->peripheral_type == IMX_DMATYPE_ASRC_SP ||
sdmac->peripheral_type == IMX_DMATYPE_ASRC)
sdma_set_watermarklevel_for_p2p(sdmac);
- } else
+ } else {
__set_bit(sdmac->event_id0, sdmac->event_mask);
+ }

/* Address */
sdmac->shp_addr = sdmac->per_address;
--
2.25.1

2021-10-18 06:51:17

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 1/4] dmaengine: imx-sdma: remove useless braces

On 28-09-21, 17:18, Flavio Suligoi wrote:
> Braces {} are not necessary for single statement blocks.

Nice cleanup, well described and split patches!

Applied all, thanks

--
~Vinod