Patch "bus: mhi: Fix pm_state conversion to string" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bus: mhi: Fix pm_state conversion to string

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bus-mhi-fix-pm_state-conversion-to-string.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit b459a1a4993d2711f8547107174c59a767db2fc8
Author: Paul Davey <paul.davey@xxxxxxxxxxxxxxxxxxx>
Date:   Tue Mar 1 21:33:00 2022 +0530

    bus: mhi: Fix pm_state conversion to string
    
    [ Upstream commit 64f93a9a27c1970fa8ee5ffc5a6ae2bda477ec5b ]
    
    On big endian architectures the mhi debugfs files which report pm state
    give "Invalid State" for all states.  This is caused by using
    find_last_bit which takes an unsigned long* while the state is passed in
    as an enum mhi_pm_state which will be of int size.
    
    Fix by using __fls to pass the value of state instead of find_last_bit.
    
    Also the current API expects "mhi_pm_state" enumerator as the function
    argument but the function only works with bitmasks. So as Alex suggested,
    let's change the argument to u32 to avoid confusion.
    
    Fixes: a6e2e3522f29 ("bus: mhi: core: Add support for PM state transitions")
    Cc: stable@xxxxxxxxxxxxxxx
    [mani: changed the function argument to u32]
    Reviewed-by: Manivannan Sadhasivam <mani@xxxxxxxxxx>
    Reviewed-by: Hemant Kumar <hemantk@xxxxxxxxxxxxxx>
    Reviewed-by: Alex Elder <elder@xxxxxxxxxx>
    Signed-off-by: Paul Davey <paul.davey@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220301160308.107452-3-manivannan.sadhasivam@xxxxxxxxxx
    Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c
index c0187367ae75..d8787aaa176b 100644
--- a/drivers/bus/mhi/core/init.c
+++ b/drivers/bus/mhi/core/init.c
@@ -77,12 +77,14 @@ static const char * const mhi_pm_state_str[] = {
 	[MHI_PM_STATE_LD_ERR_FATAL_DETECT] = "Linkdown or Error Fatal Detect",
 };
 
-const char *to_mhi_pm_state_str(enum mhi_pm_state state)
+const char *to_mhi_pm_state_str(u32 state)
 {
-	unsigned long pm_state = state;
-	int index = find_last_bit(&pm_state, 32);
+	int index;
 
-	if (index >= ARRAY_SIZE(mhi_pm_state_str))
+	if (state)
+		index = __fls(state);
+
+	if (!state || index >= ARRAY_SIZE(mhi_pm_state_str))
 		return "Invalid State";
 
 	return mhi_pm_state_str[index];
diff --git a/drivers/bus/mhi/core/internal.h b/drivers/bus/mhi/core/internal.h
index c02c4d48b744..71f181402be9 100644
--- a/drivers/bus/mhi/core/internal.h
+++ b/drivers/bus/mhi/core/internal.h
@@ -622,7 +622,7 @@ void mhi_free_bhie_table(struct mhi_controller *mhi_cntrl,
 enum mhi_pm_state __must_check mhi_tryset_pm_state(
 					struct mhi_controller *mhi_cntrl,
 					enum mhi_pm_state state);
-const char *to_mhi_pm_state_str(enum mhi_pm_state state);
+const char *to_mhi_pm_state_str(u32 state);
 int mhi_queue_state_transition(struct mhi_controller *mhi_cntrl,
 			       enum dev_st_transition state);
 void mhi_pm_st_worker(struct work_struct *work);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux