diff options
| author | Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org> | 2022-03-01 21:33:08 +0530 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-03-18 14:02:55 +0100 |
| commit | 3a1b8e281a2693c286f7dbaa57f6291e0d032c0c (patch) | |
| tree | 4dd06d63cc20a8498125acf9c25707092ffe6ed6 /drivers/bus/mhi/common.h | |
| parent | 8485149c7a84bbe9d2646b1d6b465d34dbf7ee02 (diff) | |
bus: mhi: Make mhi_state_str[] array static inline and move to common.h
mhi_state_str[] array could be used by MHI endpoint stack also. So let's
make the array as "static inline function" and move it inside the
"common.h" header so that the endpoint stack could also make use of it.
Reviewed-by: Hemant Kumar <hemantk@codeaurora.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Link: https://lore.kernel.org/r/20220301160308.107452-11-manivannan.sadhasivam@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/bus/mhi/common.h')
| -rw-r--r-- | drivers/bus/mhi/common.h | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h index f2690bf11c99..b4ef9acd3ce7 100644 --- a/drivers/bus/mhi/common.h +++ b/drivers/bus/mhi/common.h @@ -275,9 +275,30 @@ struct mhi_ring_element { __le32 dword[2]; }; -extern const char * const mhi_state_str[MHI_STATE_MAX]; -#define TO_MHI_STATE_STR(state) ((state >= MHI_STATE_MAX || \ - !mhi_state_str[state]) ? \ - "INVALID_STATE" : mhi_state_str[state]) +static inline const char *mhi_state_str(enum mhi_state state) +{ + switch (state) { + case MHI_STATE_RESET: + return "RESET"; + case MHI_STATE_READY: + return "READY"; + case MHI_STATE_M0: + return "M0"; + case MHI_STATE_M1: + return "M1"; + case MHI_STATE_M2: + return "M2"; + case MHI_STATE_M3: + return "M3"; + case MHI_STATE_M3_FAST: + return "M3 FAST"; + case MHI_STATE_BHI: + return "BHI"; + case MHI_STATE_SYS_ERR: + return "SYS ERROR"; + default: + return "Unknown state"; + } +}; #endif /* _MHI_COMMON_H */ |
