net/wireless/sysfs.c

Source file repositories/reference/linux-study-clean/net/wireless/sysfs.c

File Facts

System
Linux kernel
Corpus path
net/wireless/sysfs.c
Extension
.c
Size
4442 bytes
Lines
188
Domain
Networking Core
Bucket
Sockets, Protocols, Packet Path, And Network Policy
Inferred role
Networking Core: implementation source
Status
source implementation candidate

Why This File Exists

Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.

Dependency Surface

Detected Declarations

Annotated Snippet

scoped_guard(wiphy, &rdev->wiphy) {
			cfg80211_process_wiphy_works(rdev, NULL);
			if (rdev->ops->suspend)
				ret = rdev_suspend(rdev,
						   rdev->wiphy.wowlan_config);
			if (ret <= 0)
				goto out_unlock_rtnl;
		}
	}

	/* Driver refused to configure wowlan (ret = 1) or no wowlan */

	cfg80211_leave_all(rdev);
	scoped_guard(wiphy, &rdev->wiphy) {
		cfg80211_process_rdev_events(rdev);
		cfg80211_process_wiphy_works(rdev, NULL);
		if (rdev->ops->suspend)
			ret = rdev_suspend(rdev, NULL);
	}
out_unlock_rtnl:
	if (ret == 0)
		rdev->suspended = true;
	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 */
	cfg80211_bss_age(rdev, ktime_get_boottime_seconds() - rdev->suspend_at);

	rtnl_lock();
	wiphy_lock(&rdev->wiphy);
	if (rdev->wiphy.registered && rdev->ops->resume)
		ret = rdev_resume(rdev);
	rdev->suspended = false;
	queue_work(system_dfl_wq, &rdev->wiphy_work);
	wiphy_unlock(&rdev->wiphy);

	if (ret)
		cfg80211_shutdown_all_interfaces(&rdev->wiphy);

	rtnl_unlock();

	return ret;
}

static SIMPLE_DEV_PM_OPS(wiphy_pm_ops, wiphy_suspend, wiphy_resume);
#define WIPHY_PM_OPS (&wiphy_pm_ops)
#else
#define WIPHY_PM_OPS NULL
#endif

static const struct ns_common *wiphy_namespace(const struct device *d)
{
	struct wiphy *wiphy = container_of(d, struct wiphy, dev);

	return to_ns_common(wiphy_net(wiphy));
}

struct class ieee80211_class = {
	.name = "ieee80211",
	.dev_release = wiphy_dev_release,
	.dev_groups = ieee80211_groups,
	.pm = WIPHY_PM_OPS,
	.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);
}

Annotation

Implementation Notes