linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: cw00.choi@samsung.com (Chanwoo Choi)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/6] devfreq: add devfreq_suspend/resume() functions
Date: Thu, 22 Nov 2018 12:07:41 +0900	[thread overview]
Message-ID: <5BF61D7D.2090501@samsung.com> (raw)
In-Reply-To: <1542823301-23563-5-git-send-email-l.luba@partner.samsung.com>

Hi,

On 2018? 11? 22? 03:01, Lukasz Luba wrote:
> This patch adds implementation for global suspend/resume for
> devfreq framework. System suspend will next use these functions.
> 
> The patch draws on Tobias Jakobi's work posted ~2 years ago, who tried to
> solve issue with devfreq device's frequency during suspend/resume.
> During the discussion on LKML some corner cases and comments appeared
> related to the design. This patch address them keeping in mind suggestions
> from Chanwoo Choi.

Please remove the duplicate information about patch history.

> 
> Suggested-by: Tobias Jakobi <tjakobi@math.uni-bielefeld.de>
> Suggested-by: Chanwoo Choi <cw00.choi@samsung.com>
> Signed-off-by: Lukasz Luba <l.luba@partner.samsung.com>
> ---
>  drivers/devfreq/devfreq.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
>  include/linux/devfreq.h   |  7 +++++++
>  2 files changed, 56 insertions(+)
> 
> diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
> index 7e09de8..2f4391c 100644
> --- a/drivers/devfreq/devfreq.c
> +++ b/drivers/devfreq/devfreq.c
> @@ -44,6 +44,9 @@ static LIST_HEAD(devfreq_governor_list);
>  static LIST_HEAD(devfreq_list);
>  static DEFINE_MUTEX(devfreq_list_lock);
>  
> +/* Flag showing state of suspend/resume */
> +static bool devfreq_suspended;

Is it necessary? This patch just saves the 'true' or 'false' to this variable.
And there are no any point to check the value of this variable.
Please remove it.

> +
>  /**
>   * find_device_devfreq() - find devfreq struct using device pointer
>   * @dev:	device pointer used to lookup device devfreq.
> @@ -938,6 +941,52 @@ int devfreq_resume_device(struct devfreq *devfreq)
>  EXPORT_SYMBOL(devfreq_resume_device);
>  
>  /**
> + * devfreq_suspend() - Suspend devfreq governors and devices
> + *
> + * Called during system wide Suspend/Hibernate cycles for suspending governors
> + * and devices preserving the state for resume. On some platforms the devfreq
> + * device must have precise state (frequency) after resume in order to provide
> + * fully operating setup.
> + */
> +void devfreq_suspend(void)
> +{
> +	struct devfreq *devfreq;
> +	int ret;
> +
> +	mutex_lock(&devfreq_list_lock);
> +	list_for_each_entry(devfreq, &devfreq_list, node) {
> +		ret = devfreq_suspend_device(devfreq);
> +		if (ret)
> +			dev_warn(&devfreq->dev, "device suspend failed\n");
> +	}
> +	mutex_unlock(&devfreq_list_lock);
> +
> +	devfreq_suspended = true;

Remove it.

> +}
> +
> +/**
> + * devfreq_resume() - Resume devfreq governors and devices
> + *
> + * Called during system wide Suspend/Hibernate cycle for resuming governors and
> + * devices that are suspended with devfreq_suspend().
> + */
> +void devfreq_resume(void)
> +{
> +	struct devfreq *devfreq;
> +	int ret;
> +
> +	devfreq_suspended = false;

Remove it.

> +
> +	mutex_lock(&devfreq_list_lock);
> +	list_for_each_entry(devfreq, &devfreq_list, node) {
> +		ret = devfreq_resume_device(devfreq);
> +		if (ret)
> +			dev_warn(&devfreq->dev, "device resume failed\n");
> +	}
> +	mutex_unlock(&devfreq_list_lock);
> +}
> +
> +/**
>   * devfreq_add_governor() - Add devfreq governor
>   * @governor:	the devfreq governor to be added
>   */
> diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
> index 7fe96f9..4f0fea8 100644
> --- a/include/linux/devfreq.h
> +++ b/include/linux/devfreq.h
> @@ -202,6 +202,10 @@ extern void devm_devfreq_remove_device(struct device *dev,
>  extern int devfreq_suspend_device(struct devfreq *devfreq);
>  extern int devfreq_resume_device(struct devfreq *devfreq);
>  
> +

Remove the blank line.

> +extern void devfreq_suspend(void);
> +extern void devfreq_resume(void);
> +
>  /**
>   * update_devfreq() - Reevaluate the device and configure frequency
>   * @devfreq:	the devfreq device
> @@ -396,6 +400,9 @@ static inline int devfreq_update_stats(struct devfreq *df)
>  {
>  	return -EINVAL;
>  }
> +
> +static inline void devfreq_suspend(void) {}
> +static inline void devfreq_resume(void) {}

You better to move the inline definitions
under 'devfreq_resume_device' inline function.

>  #endif /* CONFIG_PM_DEVFREQ */
>  
>  #endif /* __LINUX_DEVFREQ_H__ */
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

  reply	other threads:[~2018-11-22  3:07 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20181121180156eucas1p225af7f4341a039264ff26f2a9ad9bb12@eucas1p2.samsung.com>
2018-11-21 18:01 ` [PATCH 0/6] devfreq: handle suspend/resume Lukasz Luba
2018-11-21 18:01   ` [PATCH 1/6] devfreq: add basic fileds supporting suspend functionality Lukasz Luba
2018-11-22  2:37     ` Chanwoo Choi
2018-11-26  8:14     ` MyungJoo Ham
2018-12-03 14:03       ` Lukasz Luba
2018-11-21 18:01   ` [PATCH 2/6] devfreq: refactor set_target frequency function Lukasz Luba
2018-11-22  2:52     ` Chanwoo Choi
2018-11-22  2:54       ` Chanwoo Choi
2018-11-22 10:40       ` Lukasz Luba
2018-11-22 23:45         ` Chanwoo Choi
2018-11-23  9:58           ` Lukasz Luba
2018-11-21 18:01   ` [PATCH 3/6] devfreq: add support for suspend/resume of a devfreq device Lukasz Luba
2018-11-22  2:58     ` Chanwoo Choi
2018-11-22 11:00       ` Lukasz Luba
2018-11-22 23:54         ` Chanwoo Choi
2018-11-23 10:01           ` Lukasz Luba
2018-11-26  0:19             ` Chanwoo Choi
2018-12-03 14:05               ` Lukasz Luba
2018-11-21 18:01   ` [PATCH 4/6] devfreq: add devfreq_suspend/resume() functions Lukasz Luba
2018-11-22  3:07     ` Chanwoo Choi [this message]
2018-11-22 11:02       ` Lukasz Luba
2018-11-21 18:01   ` [PATCH 5/6] drivers: power: suspend: call devfreq suspend/resume Lukasz Luba
2018-11-22  3:08     ` Chanwoo Choi
2018-11-21 18:01   ` [PATCH 6/6] arm: dts: exynos4: set opp-suspend for DMC and leftbus Lukasz Luba
2018-11-22  3:09     ` Chanwoo Choi
2018-11-22 11:04       ` Lukasz Luba
2018-11-22 17:24   ` [PATCH 0/6] devfreq: handle suspend/resume Tobias Jakobi
2018-11-22 17:44     ` Lukasz Luba

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5BF61D7D.2090501@samsung.com \
    --to=cw00.choi@samsung.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).