diff mbox

[04/12] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM

Message ID 1478701441-29107-5-git-send-email-m.szyprowski@samsung.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Marek Szyprowski Nov. 9, 2016, 2:23 p.m. UTC
From: Ulf Hansson <ulf.hansson@linaro.org>

There are no need to set up the runtime PM callbacks unless they are
being used. It also causes compiler warnings about unused functions.

Silence the warnings by making them available for CONFIG_PM.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
[mszyprow: rebased onto v4.9-rc4]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
---
 drivers/media/platform/exynos-gsc/gsc-core.c | 79 ++++++++++++++--------------
 1 file changed, 40 insertions(+), 39 deletions(-)

Comments

kernel test robot Nov. 10, 2016, 3:44 a.m. UTC | #1
Hi Ulf,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.9-rc4 next-20161109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048
base:   git://linuxtv.org/media_tree.git master
config: openrisc-allyesconfig (attached as .config)
compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
reproduce:
        wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        make.cross ARCH=openrisc 

Note: the linux-review/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048 HEAD 92b20676ac75659d1ea1d83b00e8028f45ea84e9 builds fine.
      It only hurts bisectibility.

All errors (new ones prefixed by >>):

   drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_resume':
>> drivers/media/platform/exynos-gsc/gsc-core.c:1183:3: error: implicit declaration of function 'gsc_runtime_resume'
   drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_suspend':
>> drivers/media/platform/exynos-gsc/gsc-core.c:1198:3: error: implicit declaration of function 'gsc_runtime_suspend'

vim +/gsc_runtime_resume +1183 drivers/media/platform/exynos-gsc/gsc-core.c

89069699 Sungchun Kang 2012-07-31  1177  		spin_unlock_irqrestore(&gsc->slock, flags);
89069699 Sungchun Kang 2012-07-31  1178  		return 0;
89069699 Sungchun Kang 2012-07-31  1179  	}
89069699 Sungchun Kang 2012-07-31  1180  	spin_unlock_irqrestore(&gsc->slock, flags);
89069699 Sungchun Kang 2012-07-31  1181  
f9fa906f Prathyush K   2013-08-07  1182  	if (!pm_runtime_suspended(dev))
f9fa906f Prathyush K   2013-08-07 @1183  		return gsc_runtime_resume(dev);
f9fa906f Prathyush K   2013-08-07  1184  
f9fa906f Prathyush K   2013-08-07  1185  	return 0;
89069699 Sungchun Kang 2012-07-31  1186  }
89069699 Sungchun Kang 2012-07-31  1187  
89069699 Sungchun Kang 2012-07-31  1188  static int gsc_suspend(struct device *dev)
89069699 Sungchun Kang 2012-07-31  1189  {
89069699 Sungchun Kang 2012-07-31  1190  	struct gsc_dev *gsc = dev_get_drvdata(dev);
89069699 Sungchun Kang 2012-07-31  1191  
89069699 Sungchun Kang 2012-07-31  1192  	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
89069699 Sungchun Kang 2012-07-31  1193  
89069699 Sungchun Kang 2012-07-31  1194  	if (test_and_set_bit(ST_SUSPEND, &gsc->state))
89069699 Sungchun Kang 2012-07-31  1195  		return 0;
89069699 Sungchun Kang 2012-07-31  1196  
f9fa906f Prathyush K   2013-08-07  1197  	if (!pm_runtime_suspended(dev))
f9fa906f Prathyush K   2013-08-07 @1198  		return gsc_runtime_suspend(dev);
f9fa906f Prathyush K   2013-08-07  1199  
f9fa906f Prathyush K   2013-08-07  1200  	return 0;
89069699 Sungchun Kang 2012-07-31  1201  }

:::::: The code at line 1183 was first introduced by commit
:::::: f9fa906f00388bf326d010f36bc905cbd0b6554f [media] exynos-gsc: fix s2r functionality

:::::: TO: Prathyush K <prathyush.k@samsung.com>
:::::: CC: Mauro Carvalho Chehab <m.chehab@samsung.com>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Ulf Hansson Nov. 11, 2016, 9:47 a.m. UTC | #2
On 10 November 2016 at 04:44, kbuild test robot <lkp@intel.com> wrote:
> Hi Ulf,
>
> [auto build test ERROR on linuxtv-media/master]
> [also build test ERROR on v4.9-rc4 next-20161109]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>
> url:    https://github.com/0day-ci/linux/commits/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048
> base:   git://linuxtv.org/media_tree.git master
> config: openrisc-allyesconfig (attached as .config)
> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
> reproduce:
>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=openrisc
>
> Note: the linux-review/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048 HEAD 92b20676ac75659d1ea1d83b00e8028f45ea84e9 builds fine.
>       It only hurts bisectibility.
>
> All errors (new ones prefixed by >>):
>
>    drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_resume':
>>> drivers/media/platform/exynos-gsc/gsc-core.c:1183:3: error: implicit declaration of function 'gsc_runtime_resume'
>    drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_suspend':
>>> drivers/media/platform/exynos-gsc/gsc-core.c:1198:3: error: implicit declaration of function 'gsc_runtime_suspend'
>

Marek, to avoid the bisectibility issue, we could squash patch 4/12 with 6/12.

Do you want to do it, or you prefer me to re-spin the series?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ulf Hansson Nov. 11, 2016, 9:50 a.m. UTC | #3
On 11 November 2016 at 10:47, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 10 November 2016 at 04:44, kbuild test robot <lkp@intel.com> wrote:
>> Hi Ulf,
>>
>> [auto build test ERROR on linuxtv-media/master]
>> [also build test ERROR on v4.9-rc4 next-20161109]
>> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
>>
>> url:    https://github.com/0day-ci/linux/commits/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048
>> base:   git://linuxtv.org/media_tree.git master
>> config: openrisc-allyesconfig (attached as .config)
>> compiler: or32-linux-gcc (GCC) 4.5.1-or32-1.0rc1
>> reproduce:
>>         wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
>>         chmod +x ~/bin/make.cross
>>         # save the attached .config to linux build tree
>>         make.cross ARCH=openrisc
>>
>> Note: the linux-review/Marek-Szyprowski/media-Exynos-GScaller-driver-fixes/20161110-000048 HEAD 92b20676ac75659d1ea1d83b00e8028f45ea84e9 builds fine.
>>       It only hurts bisectibility.
>>
>> All errors (new ones prefixed by >>):
>>
>>    drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_resume':
>>>> drivers/media/platform/exynos-gsc/gsc-core.c:1183:3: error: implicit declaration of function 'gsc_runtime_resume'
>>    drivers/media/platform/exynos-gsc/gsc-core.c: In function 'gsc_suspend':
>>>> drivers/media/platform/exynos-gsc/gsc-core.c:1198:3: error: implicit declaration of function 'gsc_runtime_suspend'
>>
>
> Marek, to avoid the bisectibility issue, we could squash patch 4/12 with 6/12.

Urgh, ignore this.

What I meant was instead to squash these patches:
[PATCH 04/12] exynos-gsc: Make runtime PM callbacks available for CONFIG_PM
[PATCH 07/12] exynos-gsc: Make system PM callbacks available for CONFIG_PM_SLEEP

So, do you want to deal with it or you prefer me?

Kind regards
Uffe
--
To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/platform/exynos-gsc/gsc-core.c b/drivers/media/platform/exynos-gsc/gsc-core.c
index b5a99af..7e99fda 100644
--- a/drivers/media/platform/exynos-gsc/gsc-core.c
+++ b/drivers/media/platform/exynos-gsc/gsc-core.c
@@ -988,43 +988,6 @@  static void *gsc_get_drv_data(struct platform_device *pdev)
 	return driver_data;
 }
 
-static int gsc_m2m_suspend(struct gsc_dev *gsc)
-{
-	unsigned long flags;
-	int timeout;
-
-	spin_lock_irqsave(&gsc->slock, flags);
-	if (!gsc_m2m_pending(gsc)) {
-		spin_unlock_irqrestore(&gsc->slock, flags);
-		return 0;
-	}
-	clear_bit(ST_M2M_SUSPENDED, &gsc->state);
-	set_bit(ST_M2M_SUSPENDING, &gsc->state);
-	spin_unlock_irqrestore(&gsc->slock, flags);
-
-	timeout = wait_event_timeout(gsc->irq_queue,
-			     test_bit(ST_M2M_SUSPENDED, &gsc->state),
-			     GSC_SHUTDOWN_TIMEOUT);
-
-	clear_bit(ST_M2M_SUSPENDING, &gsc->state);
-	return timeout == 0 ? -EAGAIN : 0;
-}
-
-static void gsc_m2m_resume(struct gsc_dev *gsc)
-{
-	struct gsc_ctx *ctx;
-	unsigned long flags;
-
-	spin_lock_irqsave(&gsc->slock, flags);
-	/* Clear for full H/W setup in first run after resume */
-	ctx = gsc->m2m.ctx;
-	gsc->m2m.ctx = NULL;
-	spin_unlock_irqrestore(&gsc->slock, flags);
-
-	if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state))
-		gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
-}
-
 static int gsc_probe(struct platform_device *pdev)
 {
 	struct gsc_dev *gsc;
@@ -1130,6 +1093,44 @@  static int gsc_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
+static int gsc_m2m_suspend(struct gsc_dev *gsc)
+{
+	unsigned long flags;
+	int timeout;
+
+	spin_lock_irqsave(&gsc->slock, flags);
+	if (!gsc_m2m_pending(gsc)) {
+		spin_unlock_irqrestore(&gsc->slock, flags);
+		return 0;
+	}
+	clear_bit(ST_M2M_SUSPENDED, &gsc->state);
+	set_bit(ST_M2M_SUSPENDING, &gsc->state);
+	spin_unlock_irqrestore(&gsc->slock, flags);
+
+	timeout = wait_event_timeout(gsc->irq_queue,
+			     test_bit(ST_M2M_SUSPENDED, &gsc->state),
+			     GSC_SHUTDOWN_TIMEOUT);
+
+	clear_bit(ST_M2M_SUSPENDING, &gsc->state);
+	return timeout == 0 ? -EAGAIN : 0;
+}
+
+static void gsc_m2m_resume(struct gsc_dev *gsc)
+{
+	struct gsc_ctx *ctx;
+	unsigned long flags;
+
+	spin_lock_irqsave(&gsc->slock, flags);
+	/* Clear for full H/W setup in first run after resume */
+	ctx = gsc->m2m.ctx;
+	gsc->m2m.ctx = NULL;
+	spin_unlock_irqrestore(&gsc->slock, flags);
+
+	if (test_and_clear_bit(ST_M2M_SUSPENDED, &gsc->state))
+		gsc_m2m_job_finish(ctx, VB2_BUF_STATE_ERROR);
+}
+
 static int gsc_runtime_resume(struct device *dev)
 {
 	struct gsc_dev *gsc = dev_get_drvdata(dev);
@@ -1160,6 +1161,7 @@  static int gsc_runtime_suspend(struct device *dev)
 	pr_debug("gsc%d: state: 0x%lx", gsc->id, gsc->state);
 	return ret;
 }
+#endif
 
 static int gsc_resume(struct device *dev)
 {
@@ -1201,8 +1203,7 @@  static int gsc_suspend(struct device *dev)
 static const struct dev_pm_ops gsc_pm_ops = {
 	.suspend		= gsc_suspend,
 	.resume			= gsc_resume,
-	.runtime_suspend	= gsc_runtime_suspend,
-	.runtime_resume		= gsc_runtime_resume,
+	SET_RUNTIME_PM_OPS(gsc_runtime_suspend, gsc_runtime_resume, NULL)
 };
 
 static struct platform_driver gsc_driver = {