public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless <linux-wireless@vger.kernel.org>
Subject: Re: [RFC] cfg80211: add PM hooks
Date: Mon, 4 Aug 2008 18:15:33 +0200	[thread overview]
Message-ID: <99AFB2EC-AECE-419A-B014-8391E45DF6C4@holtmann.org> (raw)
In-Reply-To: <1217853236.4721.32.camel@johannes.berg>

Hi Johannes,

> This should help implement suspend/resume in mac80211, these
> hooks will be run before the device is suspended and after it
> resumes. Therefore, they can touch the hardware as much as
> they want to.
>
> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
> ---
> This should help whoever wants to implement suspend/resume for  
> mac80211.
> I don't intend to, at the moment, but I think these hooks should be
> used.
>
> include/net/cfg80211.h |    6 ++++++
> net/wireless/sysfs.c   |   30 ++++++++++++++++++++++++++++++
> 2 files changed, 36 insertions(+)
>
> --- everything.orig/include/net/cfg80211.h	2008-08-04  
> 14:22:39.000000000 +0200
> +++ everything/include/net/cfg80211.h	2008-08-04 14:26:31.000000000  
> +0200
> @@ -285,6 +285,9 @@ struct wiphy;
>  * wireless extensions but this is subject to reevaluation as soon  
> as this
>  * code is used more widely and we have a first user without wext.
>  *
> + * @suspend: wiphy device needs to be suspended
> + * @resume: wiphy device needs to be resumed
> + *
>  * @add_virtual_intf: create a new virtual interface with the given  
> name
>  *
>  * @del_virtual_intf: remove the virtual interface determined by  
> ifindex.
> @@ -320,6 +323,9 @@ struct wiphy;
>  * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
>  */
> struct cfg80211_ops {
> +	int	(*suspend)(struct wiphy *wiphy);
> +	int	(*resume)(struct wiphy *wiphy);
> +
> 	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
> 				    enum nl80211_iftype type, u32 *flags,
> 				    struct vif_params *params);
> --- everything.orig/net/wireless/sysfs.c	2008-08-04  
> 14:22:39.000000000 +0200
> +++ everything/net/wireless/sysfs.c	2008-08-04 14:31:58.000000000  
> +0200
> @@ -60,6 +60,34 @@ static int wiphy_uevent(struct device *d
> }
> #endif
>
> +static int wiphy_suspend(struct device *dev, pm_message_t state)
> +{
> +	struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
> +	int ret = 0;
> +
> +	if (rdev->ops->suspend) {
> +		rtnl_lock();
> +		ret = rdev->ops->suspend(&rdev->wiphy);
> +		rtnl_unlock();
> +	}
> +
> +	return ret;
> +}
> +
> +static int wiphy_resume(struct device *dev)
> +{
> +	struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
> +	int ret = 0;
> +
> +	if (rdev->ops->resume) {
> +		rtnl_lock();
> +		ret = rdev->ops->suspend(&rdev->wiphy);
> +		rtnl_unlock();
> +	}
> +
> +	return ret;
> +}
> +
> struct class ieee80211_class = {
> 	.name = "ieee80211",
> 	.owner = THIS_MODULE,
> @@ -68,6 +96,8 @@ struct class ieee80211_class = {
> #ifdef CONFIG_HOTPLUG
> 	.dev_uevent = wiphy_uevent,
> #endif
> +	.suspend = wiphy_suspend,
> +	.resume = wiphy_resume,
> };

this needs to be wrapped into CONFIG_PM, because otherwise the build  
will fail when CONFIG_PM is not enabled.

Regards

Marcel


  reply	other threads:[~2008-08-04 16:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 12:33 [RFC] cfg80211: add PM hooks Johannes Berg
2008-08-04 16:15 ` Marcel Holtmann [this message]
2008-08-04 16:19   ` Johannes Berg
2008-08-04 16:27     ` Marcel Holtmann
2008-08-04 16:36       ` Johannes Berg
2008-08-04 16:39         ` Johannes Berg
2008-08-04 17:29 ` Johannes Berg

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=99AFB2EC-AECE-419A-B014-8391E45DF6C4@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.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