simple_open: automatically convert to simple_open()
[linux-2.6.git] / drivers / net / wireless / mwifiex / debugfs.c
index 77d7c77..1a84507 100644 (file)
@@ -27,8 +27,8 @@ static struct dentry *mwifiex_dfs_dir;
 
 static char *bss_modes[] = {
        "Unknown",
-       "Managed",
        "Ad-hoc",
+       "Managed",
        "Auto"
 };
 
@@ -140,18 +140,6 @@ static struct mwifiex_debug_data items[] = {
 static int num_of_items = ARRAY_SIZE(items);
 
 /*
- * Generic proc file open handler.
- *
- * This function is called every time a file is accessed for read or write.
- */
-static int
-mwifiex_open_generic(struct inode *inode, struct file *file)
-{
-       file->private_data = inode->i_private;
-       return 0;
-}
-
-/*
  * Proc info file read handler.
  *
  * This function is called when the 'info' file is opened for reading.
@@ -193,7 +181,7 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
        unsigned long page = get_zeroed_page(GFP_KERNEL);
        char *p = (char *) page, fmt[64];
        struct mwifiex_bss_info info;
-       ssize_t ret = 0;
+       ssize_t ret;
        int i = 0;
 
        if (!p)
@@ -216,28 +204,19 @@ mwifiex_info_read(struct file *file, char __user *ubuf,
        p += sprintf(p, "bss_mode=\"%s\"\n", bss_modes[info.bss_mode]);
        p += sprintf(p, "media_state=\"%s\"\n",
                     (!priv->media_connected ? "Disconnected" : "Connected"));
-       p += sprintf(p, "mac_address=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
-                    netdev->dev_addr[0], netdev->dev_addr[1],
-                    netdev->dev_addr[2], netdev->dev_addr[3],
-                    netdev->dev_addr[4], netdev->dev_addr[5]);
+       p += sprintf(p, "mac_address=\"%pM\"\n", netdev->dev_addr);
 
        if (GET_BSS_ROLE(priv) == MWIFIEX_BSS_ROLE_STA) {
                p += sprintf(p, "multicast_count=\"%d\"\n",
                             netdev_mc_count(netdev));
                p += sprintf(p, "essid=\"%s\"\n", info.ssid.ssid);
-               p += sprintf(p, "bssid=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
-                            info.bssid[0], info.bssid[1],
-                            info.bssid[2], info.bssid[3],
-                            info.bssid[4], info.bssid[5]);
+               p += sprintf(p, "bssid=\"%pM\"\n", info.bssid);
                p += sprintf(p, "channel=\"%d\"\n", (int) info.bss_chan);
                p += sprintf(p, "region_code = \"%02x\"\n", info.region_code);
 
                netdev_for_each_mc_addr(ha, netdev)
-                       p += sprintf(p, "multicast_address[%d]="
-                                    "\"%02x:%02x:%02x:%02x:%02x:%02x\"\n", i++,
-                                    ha->addr[0], ha->addr[1],
-                                    ha->addr[2], ha->addr[3],
-                                    ha->addr[4], ha->addr[5]);
+                       p += sprintf(p, "multicast_address[%d]=\"%pM\"\n",
+                                       i++, ha->addr);
        }
 
        p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes);
@@ -288,7 +267,7 @@ mwifiex_getlog_read(struct file *file, char __user *ubuf,
                (struct mwifiex_private *) file->private_data;
        unsigned long page = get_zeroed_page(GFP_KERNEL);
        char *p = (char *) page;
-       ssize_t ret = 0;
+       ssize_t ret;
        struct mwifiex_ds_get_stats stats;
 
        if (!p)
@@ -400,7 +379,7 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
        struct mwifiex_debug_data *d = &items[0];
        unsigned long page = get_zeroed_page(GFP_KERNEL);
        char *p = (char *) page;
-       ssize_t ret = 0;
+       ssize_t ret;
        size_t size, addr;
        long val;
        int i, j;
@@ -451,26 +430,18 @@ mwifiex_debug_read(struct file *file, char __user *ubuf,
        if (info.tx_tbl_num) {
                p += sprintf(p, "Tx BA stream table:\n");
                for (i = 0; i < info.tx_tbl_num; i++)
-                       p += sprintf(p, "tid = %d, "
-                                    "ra = %02x:%02x:%02x:%02x:%02x:%02x\n",
-                                    info.tx_tbl[i].tid, info.tx_tbl[i].ra[0],
-                                    info.tx_tbl[i].ra[1], info.tx_tbl[i].ra[2],
-                                    info.tx_tbl[i].ra[3], info.tx_tbl[i].ra[4],
-                                    info.tx_tbl[i].ra[5]);
+                       p += sprintf(p, "tid = %d, ra = %pM\n",
+                                    info.tx_tbl[i].tid, info.tx_tbl[i].ra);
        }
 
        if (info.rx_tbl_num) {
                p += sprintf(p, "Rx reorder table:\n");
                for (i = 0; i < info.rx_tbl_num; i++) {
-
-                       p += sprintf(p, "tid = %d, "
-                                    "ta = %02x:%02x:%02x:%02x:%02x:%02x, "
+                       p += sprintf(p, "tid = %d, ta = %pM, "
                                     "start_win = %d, "
                                     "win_size = %d, buffer: ",
                                     info.rx_tbl[i].tid,
-                                    info.rx_tbl[i].ta[0], info.rx_tbl[i].ta[1],
-                                    info.rx_tbl[i].ta[2], info.rx_tbl[i].ta[3],
-                                    info.rx_tbl[i].ta[4], info.rx_tbl[i].ta[5],
+                                    info.rx_tbl[i].ta,
                                     info.rx_tbl[i].start_win,
                                     info.rx_tbl[i].win_size);
 
@@ -507,7 +478,7 @@ mwifiex_regrdwr_write(struct file *file,
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *) addr;
        size_t buf_size = min(count, (size_t) (PAGE_SIZE - 1));
-       int ret = 0;
+       int ret;
        u32 reg_type = 0, reg_offset = 0, reg_value = UINT_MAX;
 
        if (!buf)
@@ -650,7 +621,7 @@ mwifiex_rdeeprom_read(struct file *file, char __user *ubuf,
                (struct mwifiex_private *) file->private_data;
        unsigned long addr = get_zeroed_page(GFP_KERNEL);
        char *buf = (char *) addr;
-       int pos = 0, ret = 0, i = 0;
+       int pos = 0, ret = 0, i;
        u8 value[MAX_EEPROM_DATA];
 
        if (!buf)
@@ -693,19 +664,19 @@ done:
 static const struct file_operations mwifiex_dfs_##name##_fops = {       \
        .read = mwifiex_##name##_read,                                  \
        .write = mwifiex_##name##_write,                                \
-       .open = mwifiex_open_generic,                                   \
+       .open = simple_open,                                            \
 };
 
 #define MWIFIEX_DFS_FILE_READ_OPS(name)                                 \
 static const struct file_operations mwifiex_dfs_##name##_fops = {       \
        .read = mwifiex_##name##_read,                                  \
-       .open = mwifiex_open_generic,                                   \
+       .open = simple_open,                                            \
 };
 
 #define MWIFIEX_DFS_FILE_WRITE_OPS(name)                                \
 static const struct file_operations mwifiex_dfs_##name##_fops = {       \
        .write = mwifiex_##name##_write,                                \
-       .open = mwifiex_open_generic,                                   \
+       .open = simple_open,                                            \
 };
 
 
@@ -735,8 +706,6 @@ mwifiex_dev_debugfs_init(struct mwifiex_private *priv)
        MWIFIEX_DFS_ADD_FILE(getlog);
        MWIFIEX_DFS_ADD_FILE(regrdwr);
        MWIFIEX_DFS_ADD_FILE(rdeeprom);
-
-       return;
 }
 
 /*
@@ -749,7 +718,6 @@ mwifiex_dev_debugfs_remove(struct mwifiex_private *priv)
                return;
 
        debugfs_remove_recursive(priv->dfs_dev_dir);
-       return;
 }
 
 /*