]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dw-xdata: Use str_write_read() in dw_xdata_start() and dw_xdata_perf()
authorThorsten Blum <thorsten.blum@linux.dev>
Wed, 20 Aug 2025 10:21:09 +0000 (12:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 6 Sep 2025 13:59:39 +0000 (15:59 +0200)
Remove hard-coded strings by using the str_write_read() helper function
and silence the following two Coccinelle/coccicheck warnings reported by
string_choices.cocci:

  opportunity for str_write_read(write)
  opportunity for str_write_read(write)

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Link: https://lore.kernel.org/r/20250820102108.760382-2-thorsten.blum@linux.dev
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/dw-xdata-pcie.c

index efd0ca8cc925d177332ccc5623e48bb437f40d06..a604c0e9c038bc5b4887aad4125f6f43c689d8d1 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/mutex.h>
 #include <linux/delay.h>
 #include <linux/pci.h>
+#include <linux/string_choices.h>
 
 #define DW_XDATA_DRIVER_NAME           "dw-xdata-pcie"
 
@@ -132,7 +133,7 @@ static void dw_xdata_start(struct dw_xdata *dw, bool write)
 
        if (!(status & STATUS_DONE))
                dev_dbg(dev, "xData: started %s direction\n",
-                       write ? "write" : "read");
+                       str_write_read(write));
 }
 
 static void dw_xdata_perf_meas(struct dw_xdata *dw, u64 *data, bool write)
@@ -195,7 +196,7 @@ static void dw_xdata_perf(struct dw_xdata *dw, u64 *rate, bool write)
        mutex_unlock(&dw->mutex);
 
        dev_dbg(dev, "xData: time=%llu us, %s=%llu MB/s\n",
-               diff, write ? "write" : "read", *rate);
+               diff, str_write_read(write), *rate);
 }
 
 static struct dw_xdata *misc_dev_to_dw(struct miscdevice *misc_dev)