SUNRPC: Fix the return value in gss_import_sec_context()
[safe/jmp/linux-2.6] / net / ieee802154 / wpan-class.c
index 68ccde6..2686912 100644 (file)
@@ -22,6 +22,8 @@
 
 #include <net/wpan-phy.h>
 
+#include "ieee802154.h"
+
 #define MASTER_SHOW_COMPLEX(name, format_string, args...)              \
 static ssize_t name ## _show(struct device *dev,                       \
                            struct device_attribute *attr, char *buf)   \
@@ -40,12 +42,30 @@ static ssize_t name ## _show(struct device *dev,                    \
 
 MASTER_SHOW(current_channel, "%d");
 MASTER_SHOW(current_page, "%d");
-MASTER_SHOW(channels_supported, "%#x");
 MASTER_SHOW_COMPLEX(transmit_power, "%d +- %d dB",
        ((signed char) (phy->transmit_power << 2)) >> 2,
        (phy->transmit_power >> 6) ? (phy->transmit_power >> 6) * 3 : 1 );
 MASTER_SHOW(cca_mode, "%d");
 
+static ssize_t channels_supported_show(struct device *dev,
+                           struct device_attribute *attr, char *buf)
+{
+       struct wpan_phy *phy = container_of(dev, struct wpan_phy, dev);
+       int ret;
+       int i, len = 0;
+
+       mutex_lock(&phy->pib_lock);
+       for (i = 0; i < 32; i++) {
+               ret = snprintf(buf + len, PAGE_SIZE - len,
+                               "%#09x\n", phy->channels_supported[i]);
+               if (ret < 0)
+                       break;
+               len += ret;
+       }
+       mutex_unlock(&phy->pib_lock);
+       return len;
+}
+
 static struct device_attribute pmib_attrs[] = {
        __ATTR_RO(current_channel),
        __ATTR_RO(current_page),
@@ -150,10 +170,8 @@ struct wpan_phy *wpan_phy_alloc(size_t priv_size)
 }
 EXPORT_SYMBOL(wpan_phy_alloc);
 
-int wpan_phy_register(struct device *parent, struct wpan_phy *phy)
+int wpan_phy_register(struct wpan_phy *phy)
 {
-       phy->dev.parent = parent;
-
        return device_add(&phy->dev);
 }
 EXPORT_SYMBOL(wpan_phy_register);
@@ -172,16 +190,31 @@ EXPORT_SYMBOL(wpan_phy_free);
 
 static int __init wpan_phy_class_init(void)
 {
-       return class_register(&wpan_phy_class);
+       int rc;
+       rc = class_register(&wpan_phy_class);
+       if (rc)
+               goto err;
+
+       rc = ieee802154_nl_init();
+       if (rc)
+               goto err_nl;
+
+       return 0;
+err_nl:
+       class_unregister(&wpan_phy_class);
+err:
+       return rc;
 }
 subsys_initcall(wpan_phy_class_init);
 
 static void __exit wpan_phy_class_exit(void)
 {
+       ieee802154_nl_exit();
        class_unregister(&wpan_phy_class);
 }
 module_exit(wpan_phy_class_exit);
 
-MODULE_DESCRIPTION("IEEE 802.15.4 device class");
 MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("IEEE 802.15.4 configuration interface");
+MODULE_AUTHOR("Dmitry Eremin-Solenikov");