Re: [PATCH v5 08/10] bus: mhi: core: Use counters to track MHI device state transitions

2020-07-23 Thread Manivannan Sadhasivam
On Thu, Jul 23, 2020 at 03:36:40PM -0700, Bhaumik Bhatt wrote:
> Use counters to track MHI device state transitions such as those
> to M0, M2, or M3 states. This helps in better debug by allowing
> the user to see the number of transitions to a certain state when
> queried using the states debugfs entry.
> 
> Signed-off-by: Bhaumik Bhatt 

This patch should come before the debugfs patch. Also the header addition
should be here.

Thanks,
Mani

> ---
>  drivers/bus/mhi/core/pm.c | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
> index 27bb471..ce4d969 100644
> --- a/drivers/bus/mhi/core/pm.c
> +++ b/drivers/bus/mhi/core/pm.c
> @@ -256,6 +256,7 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)
>   dev_err(dev, "Unable to transition to M0 state\n");
>   return -EIO;
>   }
> + mhi_cntrl->M0++;
>  
>   /* Wake up the device */
>   read_lock_bh(_cntrl->pm_lock);
> @@ -326,6 +327,8 @@ void mhi_pm_m1_transition(struct mhi_controller 
> *mhi_cntrl)
>   mhi_cntrl->dev_state = MHI_STATE_M2;
>  
>   write_unlock_irq(_cntrl->pm_lock);
> +
> + mhi_cntrl->M2++;
>   wake_up_all(_cntrl->state_event);
>  
>   /* If there are any pending resources, exit M2 immediately */
> @@ -362,6 +365,7 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl)
>   return -EIO;
>   }
>  
> + mhi_cntrl->M3++;
>   wake_up_all(_cntrl->state_event);
>  
>   return 0;
> -- 
> The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
> a Linux Foundation Collaborative Project
> 


[PATCH v5 08/10] bus: mhi: core: Use counters to track MHI device state transitions

2020-07-23 Thread Bhaumik Bhatt
Use counters to track MHI device state transitions such as those
to M0, M2, or M3 states. This helps in better debug by allowing
the user to see the number of transitions to a certain state when
queried using the states debugfs entry.

Signed-off-by: Bhaumik Bhatt 
---
 drivers/bus/mhi/core/pm.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c
index 27bb471..ce4d969 100644
--- a/drivers/bus/mhi/core/pm.c
+++ b/drivers/bus/mhi/core/pm.c
@@ -256,6 +256,7 @@ int mhi_pm_m0_transition(struct mhi_controller *mhi_cntrl)
dev_err(dev, "Unable to transition to M0 state\n");
return -EIO;
}
+   mhi_cntrl->M0++;
 
/* Wake up the device */
read_lock_bh(_cntrl->pm_lock);
@@ -326,6 +327,8 @@ void mhi_pm_m1_transition(struct mhi_controller *mhi_cntrl)
mhi_cntrl->dev_state = MHI_STATE_M2;
 
write_unlock_irq(_cntrl->pm_lock);
+
+   mhi_cntrl->M2++;
wake_up_all(_cntrl->state_event);
 
/* If there are any pending resources, exit M2 immediately */
@@ -362,6 +365,7 @@ int mhi_pm_m3_transition(struct mhi_controller *mhi_cntrl)
return -EIO;
}
 
+   mhi_cntrl->M3++;
wake_up_all(_cntrl->state_event);
 
return 0;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project