[COMMON] devfreq: exynos: Modify to get devfreq struct
authorHyeonseong Gil <hs.gil@samsung.com>
Mon, 10 Sep 2018 00:16:03 +0000 (09:16 +0900)
committerCosmin Tanislav <demonsingur@gmail.com>
Mon, 22 Apr 2024 17:23:04 +0000 (20:23 +0300)
Previously, find_exynos_devfreq_device() returns (struct dev *)
and it is used to get devfreq struct by using devfreq_list.
This method hold the mutex(devfreq_list_lock).
It may cause a circular lock problem.
Therefore, it is modified to get devfreq struct directly.

Change-Id: Iee0970dd77d67d9a344419cff47e112e7a2bbee7
Signed-off-by: Hyeonseong Gil <hs.gil@samsung.com>
drivers/devfreq/devfreq.c
drivers/devfreq/exynos/exynos-devfreq.c
include/soc/samsung/exynos-devfreq.h

index 0b4fefcb1156003813a7ec6055d15983cb6c99b3..c8f2137037e9c35f8a1885d1f7655caae1766d53 100644 (file)
@@ -213,24 +213,14 @@ static struct devfreq_governor *find_devfreq_governor(const char *name)
 static int devfreq_frequency_scaler(int dm_type, void *devdata,
                                u32 target_freq, unsigned int relation)
 {
-       struct device *dev;
        struct devfreq *devfreq;
        unsigned long freq = target_freq;
        u32 flags = 0;
        int err = 0;
 
-       dev = find_exynos_devfreq_device(devdata);
-       if (IS_ERR(dev)) {
-               pr_err("%s: No such devfreq device for dm_type(%d)\n", __func__, dm_type);
-               err = -ENODEV;
-               goto err_out;
-       }
-
-       mutex_lock(&devfreq_list_lock);
-       devfreq = find_device_devfreq(dev);
-       mutex_unlock(&devfreq_list_lock);
-       if (IS_ERR(devfreq)) {
-               dev_err(dev, "%s: No such devfreq for the device\n", __func__);
+       devfreq = find_exynos_devfreq_device(devdata);
+       if (IS_ERR_OR_NULL(devfreq)) {
+               pr_err("%s: No such devfreq for dm_type(%d)\n", __func__, dm_type);
                err = -ENODEV;
                goto err_out;
        }
index ea4f05fcddcfbfcd6909878dc7dcb8c9e8583a21..af86162eb823442ecba345485bf3d85a98885ef0 100644 (file)
@@ -803,7 +803,7 @@ int find_exynos_devfreq_dm_type(struct device *dev, int *dm_type)
        return 0;
 }
 
-struct device *find_exynos_devfreq_device(void *devdata)
+struct devfreq *find_exynos_devfreq_device(void *devdata)
 {
        struct exynos_devfreq_data *data = devdata;
 
@@ -812,7 +812,7 @@ struct device *find_exynos_devfreq_device(void *devdata)
                return ERR_PTR(-EINVAL);
        }
 
-       return data->dev;
+       return data->devfreq;
 }
 #endif
 
index 77cdf95baeacc2b5ed1785ec95c29c8c2d2041f1..74098e115af883fe4f3d6ca91300e8f2e5dc90af 100644 (file)
@@ -106,7 +106,7 @@ s32 exynos_devfreq_get_opp_idx(struct exynos_devfreq_opp_table *table,
 #if defined(CONFIG_ARM_EXYNOS_DEVFREQ) && defined(CONFIG_EXYNOS_DVFS_MANAGER)
 u32 exynos_devfreq_get_dm_type(u32 devfreq_type);
 u32 exynos_devfreq_get_devfreq_type(int dm_type);
-struct device *find_exynos_devfreq_device(void *devdata);
+struct devfreq *find_exynos_devfreq_device(void *devdata);
 int find_exynos_devfreq_dm_type(struct device *dev, int *dm_type);
 #endif
 #endif /* __EXYNOS_DEVFREQ_H_ */