mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-23 18:07:03 +00:00
ecb4433550
Do not call ->suspend, ->resume methods after we unregister wiphy. Also delete sta_clanup timer after we finish wiphy unregister to avoid this: WARNING: at lib/debugobjects.c:262 debug_print_object+0x85/0xa0() Hardware name: 6369CTO ODEBUG: free active (active state 0) object type: timer_list hint: sta_info_cleanup+0x0/0x180 [mac80211] Modules linked in: aes_i586 aes_generic fuse bridge stp llc autofs4 sunrpc cpufreq_ondemand acpi_cpufreq mperf ext2 dm_mod uinput thinkpad_acpi hwmon sg arc4 rt2800usb rt2800lib crc_ccitt rt2x00usb rt2x00lib mac80211 cfg80211 i2c_i801 iTCO_wdt iTCO_vendor_support e1000e ext4 mbcache jbd2 sd_mod crc_t10dif sr_mod cdrom yenta_socket ahci libahci pata_acpi ata_generic ata_piix i915 drm_kms_helper drm i2c_algo_bit video [last unloaded: microcode] Pid: 5663, comm: pm-hibernate Not tainted 3.1.0-rc1-wl+ #19 Call Trace: [<c0454cfd>] warn_slowpath_common+0x6d/0xa0 [<c05e05e5>] ? debug_print_object+0x85/0xa0 [<c05e05e5>] ? debug_print_object+0x85/0xa0 [<c0454dae>] warn_slowpath_fmt+0x2e/0x30 [<c05e05e5>] debug_print_object+0x85/0xa0 [<f8a808e0>] ? sta_info_alloc+0x1a0/0x1a0 [mac80211] [<c05e0bd2>] debug_check_no_obj_freed+0xe2/0x180 [<c051175b>] kfree+0x8b/0x150 [<f8a126ae>] cfg80211_dev_free+0x7e/0x90 [cfg80211] [<f8a13afd>] wiphy_dev_release+0xd/0x10 [cfg80211] [<c068d959>] device_release+0x19/0x80 [<c05d06ba>] kobject_release+0x7a/0x1c0 [<c07646a8>] ? rtnl_unlock+0x8/0x10 [<f8a13adb>] ? wiphy_resume+0x6b/0x80 [cfg80211] [<c05d0640>] ? kobject_del+0x30/0x30 [<c05d1a6d>] kref_put+0x2d/0x60 [<c05d056d>] kobject_put+0x1d/0x50 [<c08015f4>] ? mutex_lock+0x14/0x40 [<c068d60f>] put_device+0xf/0x20 [<c069716a>] dpm_resume+0xca/0x160 [<c04912bd>] hibernation_snapshot+0xcd/0x260 [<c04903df>] ? freeze_processes+0x3f/0x90 [<c049151b>] hibernate+0xcb/0x1e0 [<c048fdc0>] ? pm_async_store+0x40/0x40 [<c048fe60>] state_store+0xa0/0xb0 [<c048fdc0>] ? pm_async_store+0x40/0x40 [<c05d0200>] kobj_attr_store+0x20/0x30 [<c0575ea4>] sysfs_write_file+0x94/0xf0 [<c051e26a>] vfs_write+0x9a/0x160 [<c0575e10>] ? sysfs_open_file+0x200/0x200 [<c051e3fd>] sys_write+0x3d/0x70 [<c080959f>] sysenter_do_call+0x12/0x28 Cc: stable@kernel.org Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
154 lines
3.4 KiB
C
154 lines
3.4 KiB
C
/*
|
|
* This file provides /sys/class/ieee80211/<wiphy name>/
|
|
* and some default attributes.
|
|
*
|
|
* Copyright 2005-2006 Jiri Benc <jbenc@suse.cz>
|
|
* Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
|
|
*
|
|
* This file is GPLv2 as found in COPYING.
|
|
*/
|
|
|
|
#include <linux/device.h>
|
|
#include <linux/module.h>
|
|
#include <linux/netdevice.h>
|
|
#include <linux/nl80211.h>
|
|
#include <linux/rtnetlink.h>
|
|
#include <net/cfg80211.h>
|
|
#include "sysfs.h"
|
|
#include "core.h"
|
|
|
|
static inline struct cfg80211_registered_device *dev_to_rdev(
|
|
struct device *dev)
|
|
{
|
|
return container_of(dev, struct cfg80211_registered_device, wiphy.dev);
|
|
}
|
|
|
|
#define SHOW_FMT(name, fmt, member) \
|
|
static ssize_t name ## _show(struct device *dev, \
|
|
struct device_attribute *attr, \
|
|
char *buf) \
|
|
{ \
|
|
return sprintf(buf, fmt "\n", dev_to_rdev(dev)->member); \
|
|
}
|
|
|
|
SHOW_FMT(index, "%d", wiphy_idx);
|
|
SHOW_FMT(macaddress, "%pM", wiphy.perm_addr);
|
|
SHOW_FMT(address_mask, "%pM", wiphy.addr_mask);
|
|
|
|
static ssize_t name_show(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf) {
|
|
struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
|
|
return sprintf(buf, "%s\n", dev_name(&wiphy->dev));
|
|
}
|
|
|
|
|
|
static ssize_t addresses_show(struct device *dev,
|
|
struct device_attribute *attr,
|
|
char *buf)
|
|
{
|
|
struct wiphy *wiphy = &dev_to_rdev(dev)->wiphy;
|
|
char *start = buf;
|
|
int i;
|
|
|
|
if (!wiphy->addresses)
|
|
return sprintf(buf, "%pM\n", wiphy->perm_addr);
|
|
|
|
for (i = 0; i < wiphy->n_addresses; i++)
|
|
buf += sprintf(buf, "%pM\n", &wiphy->addresses[i].addr);
|
|
|
|
return buf - start;
|
|
}
|
|
|
|
static struct device_attribute ieee80211_dev_attrs[] = {
|
|
__ATTR_RO(index),
|
|
__ATTR_RO(macaddress),
|
|
__ATTR_RO(address_mask),
|
|
__ATTR_RO(addresses),
|
|
__ATTR_RO(name),
|
|
{}
|
|
};
|
|
|
|
static void wiphy_dev_release(struct device *dev)
|
|
{
|
|
struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
|
|
|
|
cfg80211_dev_free(rdev);
|
|
}
|
|
|
|
#ifdef CONFIG_HOTPLUG
|
|
static int wiphy_uevent(struct device *dev, struct kobj_uevent_env *env)
|
|
{
|
|
/* TODO, we probably need stuff here */
|
|
return 0;
|
|
}
|
|
#endif
|
|
|
|
static int wiphy_suspend(struct device *dev, pm_message_t state)
|
|
{
|
|
struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
|
|
int ret = 0;
|
|
|
|
rdev->suspend_at = get_seconds();
|
|
|
|
if (rdev->ops->suspend) {
|
|
rtnl_lock();
|
|
if (rdev->wiphy.registered)
|
|
ret = rdev->ops->suspend(&rdev->wiphy, rdev->wowlan);
|
|
rtnl_unlock();
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static int wiphy_resume(struct device *dev)
|
|
{
|
|
struct cfg80211_registered_device *rdev = dev_to_rdev(dev);
|
|
int ret = 0;
|
|
|
|
/* Age scan results with time spent in suspend */
|
|
spin_lock_bh(&rdev->bss_lock);
|
|
cfg80211_bss_age(rdev, get_seconds() - rdev->suspend_at);
|
|
spin_unlock_bh(&rdev->bss_lock);
|
|
|
|
if (rdev->ops->resume) {
|
|
rtnl_lock();
|
|
if (rdev->wiphy.registered)
|
|
ret = rdev->ops->resume(&rdev->wiphy);
|
|
rtnl_unlock();
|
|
}
|
|
|
|
return ret;
|
|
}
|
|
|
|
static const void *wiphy_namespace(struct device *d)
|
|
{
|
|
struct wiphy *wiphy = container_of(d, struct wiphy, dev);
|
|
|
|
return wiphy_net(wiphy);
|
|
}
|
|
|
|
struct class ieee80211_class = {
|
|
.name = "ieee80211",
|
|
.owner = THIS_MODULE,
|
|
.dev_release = wiphy_dev_release,
|
|
.dev_attrs = ieee80211_dev_attrs,
|
|
#ifdef CONFIG_HOTPLUG
|
|
.dev_uevent = wiphy_uevent,
|
|
#endif
|
|
.suspend = wiphy_suspend,
|
|
.resume = wiphy_resume,
|
|
.ns_type = &net_ns_type_operations,
|
|
.namespace = wiphy_namespace,
|
|
};
|
|
|
|
int wiphy_sysfs_init(void)
|
|
{
|
|
return class_register(&ieee80211_class);
|
|
}
|
|
|
|
void wiphy_sysfs_exit(void)
|
|
{
|
|
class_unregister(&ieee80211_class);
|
|
}
|