]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: ufs: Protect some contexts from unexpected clock scaling
authorCan Guo <cang@codeaurora.org>
Wed, 20 Jan 2021 10:04:21 +0000 (02:04 -0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Jan 2021 03:22:02 +0000 (22:22 -0500)
commit88cfe29932e94a8864973b7ec3df38821cc72917
treecde6a76e93b4c93475833fb47e68f9b50e54a5fb
parent5faf75a3d8ed8d895d55b170e12f7ccec5fcc96e
scsi: ufs: Protect some contexts from unexpected clock scaling

In contexts like suspend, shutdown, and error handling we need to
suspend devfreq to make sure these contexts won't be disturbed by
clock scaling.  However, suspending devfreq is not enough since users
can still trigger a clock scaling by manipulating the devfreq sysfs
nodes like min/max_freq and governor even after devfreq is
suspended. Moreover, mere suspending devfreq cannot synchroinze a
clock scaling which has already been invoked through these sysfs
nodes. Add one more flag in struct clk_scaling and wrap the entire
func ufshcd_devfreq_scale() with the clk_scaling_lock, so that we can
use this flag and clk_scaling_lock to control and synchronize clock
scaling invoked through devfreq sysfs nodes.

Link: https://lore.kernel.org/r/1611137065-14266-2-git-send-email-cang@codeaurora.org
Reviewed-by: Stanley Chu <stanley.chu@mediatek.com>
Signed-off-by: Can Guo <cang@codeaurora.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd.c
drivers/scsi/ufs/ufshcd.h