[COMMON] fimc-is2: simplify getting .drvdata
authorJeongtae Park <jtp.park@samsung.com>
Thu, 26 Apr 2018 02:50:37 +0000 (11:50 +0900)
committerSunyoung Kang <sy0816.kang@samsung.com>
Mon, 23 Jul 2018 08:05:02 +0000 (17:05 +0900)
We should get drvdata from struct device directly.
Going via platform_device is an unneeded step back and forth.

Change-Id: I76cd504d46b1f19a71d14b7a729652166f7f5c6d
Signed-off-by: Jeongtae Park <jtp.park@samsung.com>
drivers/media/platform/exynos/fimc-is2/fimc-is-core.c
drivers/media/platform/exynos/fimc-is2/fimc-is-device-ischain.c
drivers/media/platform/exynos/fimc-is2/fimc-is-device-preprocessor.c
drivers/media/platform/exynos/fimc-is2/ischain/fimc-is-v3_11_0/fimc-is-hw-pwr.c
drivers/media/platform/exynos/fimc-is2/ischain/fimc-is-v4_0_0/fimc-is-hw-pwr.c
drivers/media/platform/exynos/fimc-is2/ischain/fimc-is-v4_3_0/fimc-is-hw-pwr.c
drivers/media/platform/exynos/fimc-is2/ischain/fimc-is-v5_10_0/fimc-is-hw-pwr.c

index 8d6d58976edf147c33791009faa913fc559a32dc..d49590bdebea140179550fbac1b764deee407837 100644 (file)
@@ -558,7 +558,7 @@ static ssize_t store_en_dvfs(struct device *dev,
 {
 #ifdef ENABLE_DVFS
        struct fimc_is_core *core =
-               (struct fimc_is_core *)platform_get_drvdata(to_platform_device(dev));
+               (struct fimc_is_core *)dev_get_drvdata(dev);
        struct fimc_is_resourcemgr *resourcemgr;
        int i;
 
@@ -698,7 +698,7 @@ static ssize_t show_debug_state(struct device *dev, struct device_attribute *att
                                  char *buf)
 {
        struct fimc_is_core *core =
-               (struct fimc_is_core *)platform_get_drvdata(to_platform_device(dev));
+               (struct fimc_is_core *)dev_get_drvdata(dev);
        struct fimc_is_resourcemgr *resourcemgr;
 
        FIMC_BUG(!core);
@@ -713,7 +713,7 @@ static ssize_t store_debug_state(struct device *dev,
                                 const char *buf, size_t count)
 {
        struct fimc_is_core *core =
-               (struct fimc_is_core *)platform_get_drvdata(to_platform_device(dev));
+               (struct fimc_is_core *)dev_get_drvdata(dev);
        struct fimc_is_resourcemgr *resourcemgr;
 
        FIMC_BUG(!core);
index 2dbfa0aeb35a4d045d9a0abd56b487565a151fb5..7d0207e870882d7750704cc84c69ccda5eeccd82 100644 (file)
@@ -2192,7 +2192,7 @@ int fimc_is_ischain_runtime_suspend(struct device *dev)
 {
        int ret = 0;
        struct platform_device *pdev = to_platform_device(dev);
-       struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(pdev);
+       struct fimc_is_core *core = (struct fimc_is_core *)dev_get_drvdata(dev);
        struct fimc_is_mem *mem = &core->resourcemgr.mem;
        struct exynos_platform_fimc_is *pdata;
 
@@ -2275,7 +2275,7 @@ int fimc_is_ischain_runtime_resume(struct device *dev)
 {
        int ret = 0;
        struct platform_device *pdev = to_platform_device(dev);
-       struct fimc_is_core *core = (struct fimc_is_core *)platform_get_drvdata(pdev);
+       struct fimc_is_core *core = (struct fimc_is_core *)dev_get_drvdata(dev);
        struct fimc_is_mem *mem = &core->resourcemgr.mem;
        struct exynos_platform_fimc_is *pdata;
 
@@ -2393,7 +2393,7 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on)
        FIMC_BUG(!device->interface);
 
        dev = &device->pdev->dev;
-       core = (struct fimc_is_core *)platform_get_drvdata(device->pdev);
+       core = (struct fimc_is_core *)dev_get_drvdata(dev);
        vender = &core->vender;
        itf = device->interface;
 
@@ -2541,7 +2541,7 @@ int fimc_is_ischain_power(struct fimc_is_device_ischain *device, int on)
        FIMC_BUG(!device->interface);
 
        dev = &device->pdev->dev;
-       core = (struct fimc_is_core *)platform_get_drvdata(device->pdev);
+       core = (struct fimc_is_core *)dev_get_drvdata(dev);
        vender = &core->vender;
 
        if (on) {
index b4ff2e5c4f9bde9c90e788364bce8a67ca9ed91c..903d32965158743150cdc45271d483b7034607ac 100644 (file)
@@ -689,10 +689,9 @@ static int fimc_is_preproc_resume(struct device *dev)
 int fimc_is_preproc_runtime_suspend(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_preproc *device;
 
-       device = (struct fimc_is_device_preproc *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_preproc *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                ret = -EINVAL;
@@ -734,10 +733,9 @@ p_err:
 int fimc_is_preproc_runtime_resume(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_preproc *device;
 
-       device = (struct fimc_is_device_preproc *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_preproc *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                ret = -EINVAL;
index 114f52e9f637420454464617a6ee155a862cec64..09b23887c3c87cb9ee7067a85439a6ea4d93660e 100644 (file)
 int fimc_is_sensor_runtime_suspend_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -45,10 +44,9 @@ p_err:
 int fimc_is_sensor_runtime_resume_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -63,7 +61,6 @@ int fimc_is_ischain_runtime_suspend_post(struct device *dev)
        int ret = 0;
 #ifndef CONFIG_PM
        {
-               struct platform_device *pdev = to_platform_device(dev);
                struct fimc_is_device_ischain *device;
                void __iomem *reg_mux_clkphy;
                void __iomem *reg_isp_idleness_ch0;
@@ -72,7 +69,7 @@ int fimc_is_ischain_runtime_suspend_post(struct device *dev)
                u32 try_count;
                unsigned int state;
 
-               device = (struct fimc_is_device_ischain *)platform_get_drvdata(pdev);
+               device = (struct fimc_is_device_ishcain *)dev_get_drvdata(dev);
                if (!device) {
                        err("device is NULL");
                        goto p_err;
index 6c68705e4710f75cbf57399d4ccafbb5834b585b..5988c856fe4665be54fc3da901d586b57596fdb8 100644 (file)
 int fimc_is_sensor_runtime_suspend_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -59,10 +58,9 @@ p_err:
 int fimc_is_sensor_runtime_resume_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -647,4 +645,4 @@ int fimc_is_runtime_suspend_post(struct device *dev)
 
 p_err:
        return ret;
-}
\ No newline at end of file
+}
index 812c2b681c4368aa80af6d2820d11e4df676762c..65f57f0a3f2511c62c5bb4d8fc967062c634dca3 100644 (file)
 int fimc_is_sensor_runtime_suspend_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
        unsigned int state;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -70,10 +69,9 @@ p_err:
 int fimc_is_sensor_runtime_resume_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
index c2479263911b881f3a63ebcd2863c31834156e5c..99da446f2b879e61f9edcc510dcdf691ce40fb09 100644 (file)
 int fimc_is_sensor_runtime_suspend_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;
@@ -43,10 +42,9 @@ p_err:
 int fimc_is_sensor_runtime_resume_pre(struct device *dev)
 {
        int ret = 0;
-       struct platform_device *pdev = to_platform_device(dev);
        struct fimc_is_device_sensor *device;
 
-       device = (struct fimc_is_device_sensor *)platform_get_drvdata(pdev);
+       device = (struct fimc_is_device_sensor *)dev_get_drvdata(dev);
        if (!device) {
                err("device is NULL");
                goto p_err;