Skip to content

Commit 8e63891

Browse files
krzkvinodkoul
authored andcommitted
dmaengine: Use str_enable_disable-like helpers
Replace ternary (condition ? "enable" : "disable") syntax with helpers from string_choices.h because: 1. Simple function call with one argument is easier to read. Ternary operator has three arguments and with wrapping might lead to quite long code. 2. Is slightly shorter thus also easier to read. 3. It brings uniformity in the text - same string. 4. Allows deduping by the linker, which results in a smaller binary file. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> #dw-edma Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com> Link: https://lore.kernel.org/r/20250114191021.854080-1-krzysztof.kozlowski@linaro.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 753f324 commit 8e63891

6 files changed

Lines changed: 14 additions & 8 deletions

File tree

drivers/dma/dw-edma/dw-edma-core.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/irq.h>
1616
#include <linux/dma/edma.h>
1717
#include <linux/dma-mapping.h>
18+
#include <linux/string_choices.h>
1819

1920
#include "dw-edma-core.h"
2021
#include "dw-edma-v0-core.h"
@@ -746,7 +747,7 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc)
746747
chan->ll_max -= 1;
747748

748749
dev_vdbg(dev, "L. List:\tChannel %s[%u] max_cnt=%u\n",
749-
chan->dir == EDMA_DIR_WRITE ? "write" : "read",
750+
str_write_read(chan->dir == EDMA_DIR_WRITE),
750751
chan->id, chan->ll_max);
751752

752753
if (dw->nr_irqs == 1)
@@ -767,7 +768,8 @@ static int dw_edma_channel_setup(struct dw_edma *dw, u32 wr_alloc, u32 rd_alloc)
767768
memcpy(&chan->msi, &irq->msi, sizeof(chan->msi));
768769

769770
dev_vdbg(dev, "MSI:\t\tChannel %s[%u] addr=0x%.8x%.8x, data=0x%.8x\n",
770-
chan->dir == EDMA_DIR_WRITE ? "write" : "read", chan->id,
771+
str_write_read(chan->dir == EDMA_DIR_WRITE),
772+
chan->id,
771773
chan->msi.address_hi, chan->msi.address_lo,
772774
chan->msi.data);
773775

drivers/dma/imx-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/device.h>
1818
#include <linux/dma-mapping.h>
1919
#include <linux/slab.h>
20+
#include <linux/string_choices.h>
2021
#include <linux/platform_device.h>
2122
#include <linux/clk.h>
2223
#include <linux/dmaengine.h>
@@ -942,7 +943,7 @@ static struct dma_async_tx_descriptor *imxdma_prep_dma_interleaved(
942943
" src_sgl=%s dst_sgl=%s numf=%zu frame_size=%zu\n", __func__,
943944
imxdmac->channel, (unsigned long long)xt->src_start,
944945
(unsigned long long) xt->dst_start,
945-
xt->src_sgl ? "true" : "false", xt->dst_sgl ? "true" : "false",
946+
str_true_false(xt->src_sgl), str_true_false(xt->dst_sgl),
946947
xt->numf, xt->frame_size);
947948

948949
if (list_empty(&imxdmac->ld_free) ||

drivers/dma/pxa_dma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/interrupt.h>
1111
#include <linux/dma-mapping.h>
1212
#include <linux/slab.h>
13+
#include <linux/string_choices.h>
1314
#include <linux/dmaengine.h>
1415
#include <linux/platform_device.h>
1516
#include <linux/device.h>
@@ -277,8 +278,7 @@ static int chan_state_show(struct seq_file *s, void *p)
277278
seq_printf(s, "\tPriority : %s\n",
278279
str_prio[(phy->idx & 0xf) / 4]);
279280
seq_printf(s, "\tUnaligned transfer bit: %s\n",
280-
_phy_readl_relaxed(phy, DALGN) & BIT(phy->idx) ?
281-
"yes" : "no");
281+
str_yes_no(_phy_readl_relaxed(phy, DALGN) & BIT(phy->idx)));
282282
seq_printf(s, "\tDCSR = %08x (%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s)\n",
283283
dcsr, PXA_DCSR_STR(RUN), PXA_DCSR_STR(NODESC),
284284
PXA_DCSR_STR(STOPIRQEN), PXA_DCSR_STR(EORIRQEN),

drivers/dma/sun6i-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/platform_device.h>
2020
#include <linux/reset.h>
2121
#include <linux/slab.h>
22+
#include <linux/string_choices.h>
2223
#include <linux/types.h>
2324

2425
#include "virt-dma.h"
@@ -553,7 +554,7 @@ static irqreturn_t sun6i_dma_interrupt(int irq, void *dev_id)
553554
continue;
554555

555556
dev_dbg(sdev->slave.dev, "DMA irq status %s: 0x%x\n",
556-
i ? "high" : "low", status);
557+
str_high_low(i), status);
557558

558559
writel(status, sdev->base + DMA_IRQ_STAT(i));
559560

drivers/dma/ti/edma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/platform_device.h>
1717
#include <linux/slab.h>
1818
#include <linux/spinlock.h>
19+
#include <linux/string_choices.h>
1920
#include <linux/of.h>
2021
#include <linux/of_dma.h>
2122
#include <linux/of_irq.h>
@@ -2047,7 +2048,7 @@ static int edma_setup_from_hw(struct device *dev, struct edma_soc_info *pdata,
20472048
dev_dbg(dev, "num_qchannels: %u\n", ecc->num_qchannels);
20482049
dev_dbg(dev, "num_slots: %u\n", ecc->num_slots);
20492050
dev_dbg(dev, "num_tc: %u\n", ecc->num_tc);
2050-
dev_dbg(dev, "chmap_exist: %s\n", ecc->chmap_exist ? "yes" : "no");
2051+
dev_dbg(dev, "chmap_exist: %s\n", str_yes_no(ecc->chmap_exist));
20512052

20522053
/* Nothing need to be done if queue priority is provided */
20532054
if (pdata->queue_priority_mapping)

drivers/dma/xilinx/xilinx_dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#include <linux/of_irq.h>
4747
#include <linux/platform_device.h>
4848
#include <linux/slab.h>
49+
#include <linux/string_choices.h>
4950
#include <linux/clk.h>
5051
#include <linux/io-64-nonatomic-lo-hi.h>
5152

@@ -2940,7 +2941,7 @@ static int xilinx_dma_chan_probe(struct xilinx_dma_device *xdev,
29402941
XILINX_DMA_DMASR_SG_MASK)
29412942
chan->has_sg = true;
29422943
dev_dbg(chan->dev, "ch %d: SG %s\n", chan->id,
2943-
chan->has_sg ? "enabled" : "disabled");
2944+
str_enabled_disabled(chan->has_sg));
29442945
}
29452946

29462947
/* Initialize the tasklet */

0 commit comments

Comments
 (0)