mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
81e4fc6741
Add an inversed variant of str_read_write(), i.e. str_write_read(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230703185222.50554-2-andriy.shevchenko@linux.intel.com Signed-off-by: Benjamin Tissoires <bentiss@kernel.org>
45 lines
847 B
C
45 lines
847 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_STRING_CHOICES_H_
|
|
#define _LINUX_STRING_CHOICES_H_
|
|
|
|
#include <linux/types.h>
|
|
|
|
static inline const char *str_enable_disable(bool v)
|
|
{
|
|
return v ? "enable" : "disable";
|
|
}
|
|
|
|
static inline const char *str_enabled_disabled(bool v)
|
|
{
|
|
return v ? "enabled" : "disabled";
|
|
}
|
|
|
|
static inline const char *str_hi_lo(bool v)
|
|
{
|
|
return v ? "hi" : "lo";
|
|
}
|
|
#define str_lo_hi(v) str_hi_lo(!(v))
|
|
|
|
static inline const char *str_high_low(bool v)
|
|
{
|
|
return v ? "high" : "low";
|
|
}
|
|
#define str_low_high(v) str_high_low(!(v))
|
|
|
|
static inline const char *str_read_write(bool v)
|
|
{
|
|
return v ? "read" : "write";
|
|
}
|
|
#define str_write_read(v) str_read_write(!(v))
|
|
|
|
static inline const char *str_on_off(bool v)
|
|
{
|
|
return v ? "on" : "off";
|
|
}
|
|
|
|
static inline const char *str_yes_no(bool v)
|
|
{
|
|
return v ? "yes" : "no";
|
|
}
|
|
|
|
#endif
|