From f0b9ad5690ed96f95d91ca19fba2fb2894bae6f0 Mon Sep 17 00:00:00 2001 From: Wolfgang Wiedmeyer Date: Sat, 24 Oct 2015 02:08:33 +0200 Subject: update network code --- net/wireless_ath/sysfs.c | 157 ----------------------------------------------- 1 file changed, 157 deletions(-) delete mode 100755 net/wireless_ath/sysfs.c (limited to 'net/wireless_ath/sysfs.c') diff --git a/net/wireless_ath/sysfs.c b/net/wireless_ath/sysfs.c deleted file mode 100755 index 2f8af6e..0000000 --- a/net/wireless_ath/sysfs.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * This file provides /sys/class/ieee80211// - * and some default attributes. - * - * Copyright 2005-2006 Jiri Benc - * Copyright 2006 Johannes Berg - * - * This file is GPLv2 as found in COPYING. - */ - -#include -#include -#include -#include -#include -#include -#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; -} - -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) -static const void *wiphy_namespace(struct device *d) -{ - struct wiphy *wiphy = container_of(d, struct wiphy, dev); - - return wiphy_net(wiphy); -} -#endif - -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, -#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) - .ns_type = &net_ns_type_operations, - .namespace = wiphy_namespace, -#endif -}; - -int wiphy_sysfs_init(void) -{ - return class_register(&ieee80211_class); -} - -void wiphy_sysfs_exit(void) -{ - class_unregister(&ieee80211_class); -} -- cgit v1.1