2024-02-08 20:30:18

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 1/2] dmaengine: pl08x: constify pointer to char in filter function

The opaque argument chan_id passed to filter function is actually
pointer to const memory, so make that obvious in the filter for code
readability and safety.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/dma/amba-pl08x.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c
index eea8bd33b4b7..fbf048f432bf 100644
--- a/drivers/dma/amba-pl08x.c
+++ b/drivers/dma/amba-pl08x.c
@@ -2239,7 +2239,7 @@ static int pl08x_resume(struct dma_chan *chan)
bool pl08x_filter_id(struct dma_chan *chan, void *chan_id)
{
struct pl08x_dma_chan *plchan;
- char *name = chan_id;
+ const char *name = chan_id;

/* Reject channels for devices not bound to this driver */
if (chan->device->dev->driver != &pl08x_amba_driver.drv)
--
2.34.1



2024-02-08 20:30:30

by Krzysztof Kozlowski

[permalink] [raw]
Subject: [PATCH 2/2] dmaengine: of: constify of_phandle_args in of_dma_find_controller()

of_dma_find_controller() does not modify passed of_phandle_args so the
argument can be made pointer to const for code safety.

Signed-off-by: Krzysztof Kozlowski <[email protected]>
---
drivers/dma/of-dma.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/dma/of-dma.c b/drivers/dma/of-dma.c
index 775a7f408b9a..e588fff9f21d 100644
--- a/drivers/dma/of-dma.c
+++ b/drivers/dma/of-dma.c
@@ -29,7 +29,7 @@ static DEFINE_MUTEX(of_dma_lock);
* to the DMA data stored is retuned. A NULL pointer is returned if no match is
* found.
*/
-static struct of_dma *of_dma_find_controller(struct of_phandle_args *dma_spec)
+static struct of_dma *of_dma_find_controller(const struct of_phandle_args *dma_spec)
{
struct of_dma *ofdma;

--
2.34.1


2024-02-23 12:10:09

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH 1/2] dmaengine: pl08x: constify pointer to char in filter function


On Thu, 08 Feb 2024 21:27:41 +0100, Krzysztof Kozlowski wrote:
> The opaque argument chan_id passed to filter function is actually
> pointer to const memory, so make that obvious in the filter for code
> readability and safety.
>
>

Applied, thanks!

[1/2] dmaengine: pl08x: constify pointer to char in filter function
commit: 16374aba824971d73916f005e79207370c9c31dd
[2/2] dmaengine: of: constify of_phandle_args in of_dma_find_controller()
commit: 716141d366f45d62ffe4dd53a045867b26e29d19

Best regards,
--
~Vinod