Skip to content

Commit 3bf8c48

Browse files
elfringgregkh
authored andcommitted
coresight: etm4x: Two function calls less
Avoid an extra function call in two function implementations by using a ternary operator instead of a conditional statement. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <[email protected]> Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 526af04 commit 3bf8c48

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

drivers/hwtracing/coresight/coresight-etm4x-sysfs.c

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,11 +296,8 @@ static ssize_t mode_store(struct device *dev,
296296

297297
spin_lock(&drvdata->spinlock);
298298
config->mode = val & ETMv4_MODE_ALL;
299-
300-
if (config->mode & ETM_MODE_EXCLUDE)
301-
etm4_set_mode_exclude(drvdata, true);
302-
else
303-
etm4_set_mode_exclude(drvdata, false);
299+
etm4_set_mode_exclude(drvdata,
300+
config->mode & ETM_MODE_EXCLUDE ? true : false);
304301

305302
if (drvdata->instrp0 == true) {
306303
/* start by clearing instruction P0 field */
@@ -999,10 +996,8 @@ static ssize_t addr_range_store(struct device *dev,
999996
* Program include or exclude control bits for vinst or vdata
1000997
* whenever we change addr comparators to ETM_ADDR_TYPE_RANGE
1001998
*/
1002-
if (config->mode & ETM_MODE_EXCLUDE)
1003-
etm4_set_mode_exclude(drvdata, true);
1004-
else
1005-
etm4_set_mode_exclude(drvdata, false);
999+
etm4_set_mode_exclude(drvdata,
1000+
config->mode & ETM_MODE_EXCLUDE ? true : false);
10061001

10071002
spin_unlock(&drvdata->spinlock);
10081003
return size;

0 commit comments

Comments
 (0)