/drivers/net/wireless/sd8797/mlinux/moal_proc.c

https://bitbucket.org/cyanogenmod/android_kernel_asus_tf300t · C · 631 lines · 461 code · 42 blank · 128 comment · 76 complexity · 06840b2cb0ba4c2edd2879c93cdd46ad MD5 · raw file

  1. /** @file moal_proc.c
  2. *
  3. * @brief This file contains functions for proc file.
  4. *
  5. * Copyright (C) 2008-2010, Marvell International Ltd.
  6. *
  7. * This software file (the "File") is distributed by Marvell International
  8. * Ltd. under the terms of the GNU General Public License Version 2, June 1991
  9. * (the "License"). You may use, redistribute and/or modify this File in
  10. * accordance with the terms and conditions of the License, a copy of which
  11. * is available by writing to the Free Software Foundation, Inc.,
  12. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the
  13. * worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
  14. *
  15. * THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE
  16. * IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE
  17. * ARE EXPRESSLY DISCLAIMED. The License provides additional details about
  18. * this warranty disclaimer.
  19. *
  20. */
  21. /********************************************************
  22. Change log:
  23. 10/21/2008: initial version
  24. ********************************************************/
  25. #include "moal_main.h"
  26. #ifdef UAP_SUPPORT
  27. #include "moal_uap.h"
  28. #endif
  29. #include "moal_sdio.h"
  30. /********************************************************
  31. Local Variables
  32. ********************************************************/
  33. #ifdef CONFIG_PROC_FS
  34. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
  35. #define PROC_DIR NULL
  36. #define MWLAN_PROC_DIR "mwlan/"
  37. /** Proc top level directory entry */
  38. struct proc_dir_entry *proc_mwlan = NULL;
  39. #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
  40. #define PROC_DIR &proc_root
  41. #else
  42. #define PROC_DIR proc_net
  43. #endif
  44. #ifdef STA_SUPPORT
  45. static char *szModes[] = {
  46. "Unknown",
  47. "Managed",
  48. "Ad-hoc",
  49. "Auto",
  50. };
  51. #endif
  52. extern int drv_mode;
  53. /********************************************************
  54. Global Variables
  55. ********************************************************/
  56. /********************************************************
  57. Local Functions
  58. ********************************************************/
  59. /**
  60. * @brief Proc read function for info
  61. *
  62. * @param page Pointer to buffer
  63. * @param start Read data starting position
  64. * @param offset Offset
  65. * @param count Counter
  66. * @param eof End of file flag
  67. * @param data Data to output
  68. *
  69. * @return Number of output data
  70. */
  71. static int
  72. woal_info_proc_read(char *page, char **start, off_t offset,
  73. int count, int *eof, void *data)
  74. {
  75. char *p = page;
  76. struct net_device *netdev = data;
  77. char fmt[MLAN_MAX_VER_STR_LEN];
  78. moal_private *priv = (moal_private *) netdev_priv(netdev);
  79. #ifdef STA_SUPPORT
  80. int i = 0;
  81. moal_handle *handle = priv->phandle;
  82. mlan_bss_info info;
  83. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
  84. struct dev_mc_list *mcptr = netdev->mc_list;
  85. int mc_count = netdev->mc_count;
  86. #else
  87. struct netdev_hw_addr *mcptr = NULL;
  88. int mc_count = netdev_mc_count(netdev);
  89. #endif /* < 2.6.35 */
  90. #else
  91. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
  92. int i = 0;
  93. #endif /* >= 2.6.29 */
  94. #endif
  95. #ifdef UAP_SUPPORT
  96. mlan_ds_uap_stats ustats;
  97. #endif
  98. ENTER();
  99. if (offset) {
  100. *eof = 1;
  101. goto exit;
  102. }
  103. memset(fmt, 0, sizeof(fmt));
  104. #ifdef UAP_SUPPORT
  105. if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
  106. p += sprintf(p, "driver_name = " "\"uap\"\n");
  107. woal_uap_get_version(priv, fmt, sizeof(fmt) - 1);
  108. if (MLAN_STATUS_SUCCESS !=
  109. woal_uap_get_stats(priv, MOAL_PROC_WAIT, &ustats)) {
  110. *eof = 1;
  111. goto exit;
  112. }
  113. }
  114. #endif /* UAP_SUPPORT */
  115. #ifdef STA_SUPPORT
  116. if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) {
  117. woal_get_version(handle, fmt, sizeof(fmt) - 1);
  118. memset(&info, 0, sizeof(info));
  119. if (MLAN_STATUS_SUCCESS !=
  120. woal_get_bss_info(priv, MOAL_PROC_WAIT, &info)) {
  121. *eof = 1;
  122. goto exit;
  123. }
  124. p += sprintf(p, "driver_name = " "\"wlan\"\n");
  125. }
  126. #endif
  127. p += sprintf(p, "driver_version = %s", fmt);
  128. p += sprintf(p, "\ninterface_name=\"%s\"\n", netdev->name);
  129. #if defined(WIFI_DIRECT_SUPPORT)
  130. if (priv->bss_type == MLAN_BSS_TYPE_WIFIDIRECT) {
  131. if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA)
  132. p += sprintf(p, "bss_mode = \"WIFIDIRECT-Client\"\n");
  133. else
  134. p += sprintf(p, "bss_mode = \"WIFIDIRECT-GO\"\n");
  135. }
  136. #endif
  137. #ifdef STA_SUPPORT
  138. if (priv->bss_type == MLAN_BSS_TYPE_STA)
  139. p += sprintf(p, "bss_mode =\"%s\"\n", szModes[info.bss_mode]);
  140. #endif
  141. p += sprintf(p, "media_state=\"%s\"\n",
  142. ((priv->media_connected ==
  143. MFALSE) ? "Disconnected" : "Connected"));
  144. p += sprintf(p, "mac_address=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
  145. netdev->dev_addr[0], netdev->dev_addr[1], netdev->dev_addr[2],
  146. netdev->dev_addr[3], netdev->dev_addr[4], netdev->dev_addr[5]);
  147. #ifdef STA_SUPPORT
  148. if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_STA) {
  149. p += sprintf(p, "multicast_count=\"%d\"\n", mc_count);
  150. p += sprintf(p, "essid=\"%s\"\n", info.ssid.ssid);
  151. p += sprintf(p, "bssid=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
  152. info.bssid[0], info.bssid[1],
  153. info.bssid[2], info.bssid[3],
  154. info.bssid[4], info.bssid[5]);
  155. p += sprintf(p, "channel=\"%d\"\n", (int) info.bss_chan);
  156. p += sprintf(p, "region_code = \"%02x\"\n", (t_u8) info.region_code);
  157. /*
  158. * Put out the multicast list
  159. */
  160. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
  161. for (i = 0; i < netdev->mc_count; i++) {
  162. p += sprintf(p,
  163. "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
  164. i,
  165. mcptr->dmi_addr[0], mcptr->dmi_addr[1],
  166. mcptr->dmi_addr[2], mcptr->dmi_addr[3],
  167. mcptr->dmi_addr[4], mcptr->dmi_addr[5]);
  168. mcptr = mcptr->next;
  169. }
  170. #else
  171. netdev_for_each_mc_addr(mcptr, netdev)
  172. p += sprintf(p,
  173. "multicast_address[%d]=\"%02x:%02x:%02x:%02x:%02x:%02x\"\n",
  174. i++,
  175. mcptr->addr[0], mcptr->addr[1],
  176. mcptr->addr[2], mcptr->addr[3],
  177. mcptr->addr[4], mcptr->addr[5]);
  178. #endif /* < 2.6.35 */
  179. }
  180. #endif
  181. p += sprintf(p, "num_tx_bytes = %lu\n", priv->stats.tx_bytes);
  182. p += sprintf(p, "num_rx_bytes = %lu\n", priv->stats.rx_bytes);
  183. p += sprintf(p, "num_tx_pkts = %lu\n", priv->stats.tx_packets);
  184. p += sprintf(p, "num_rx_pkts = %lu\n", priv->stats.rx_packets);
  185. p += sprintf(p, "num_tx_pkts_dropped = %lu\n", priv->stats.tx_dropped);
  186. p += sprintf(p, "num_rx_pkts_dropped = %lu\n", priv->stats.rx_dropped);
  187. p += sprintf(p, "num_tx_pkts_err = %lu\n", priv->stats.tx_errors);
  188. p += sprintf(p, "num_rx_pkts_err = %lu\n", priv->stats.rx_errors);
  189. p += sprintf(p, "carrier %s\n",
  190. ((netif_carrier_ok(priv->netdev)) ? "on" : "off"));
  191. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,29)
  192. for (i = 0; i < netdev->num_tx_queues; i++) {
  193. p += sprintf(p, "tx queue %d: %s\n", i,
  194. ((netif_tx_queue_stopped(netdev_get_tx_queue(netdev, 0))) ?
  195. "stopped" : "started"));
  196. }
  197. #else
  198. p += sprintf(p, "tx queue %s\n",
  199. ((netif_queue_stopped(priv->netdev)) ? "stopped" : "started"));
  200. #endif
  201. #ifdef UAP_SUPPORT
  202. if (GET_BSS_ROLE(priv) == MLAN_BSS_ROLE_UAP) {
  203. p += sprintf(p, "tkip_mic_failures = %u\n", ustats.tkip_mic_failures);
  204. p += sprintf(p, "ccmp_decrypt_errors = %u\n",
  205. ustats.ccmp_decrypt_errors);
  206. p += sprintf(p, "wep_undecryptable_count = %u\n",
  207. ustats.wep_undecryptable_count);
  208. p += sprintf(p, "wep_icv_error_count = %u\n",
  209. ustats.wep_icv_error_count);
  210. p += sprintf(p, "decrypt_failure_count = %u\n",
  211. ustats.decrypt_failure_count);
  212. p += sprintf(p, "mcast_tx_count = %u\n", ustats.mcast_tx_count);
  213. p += sprintf(p, "failed_count = %u\n", ustats.failed_count);
  214. p += sprintf(p, "retry_count = %u\n", ustats.retry_count);
  215. p += sprintf(p, "multiple_retry_count = %u\n",
  216. ustats.multi_retry_count);
  217. p += sprintf(p, "frame_duplicate_count = %u\n", ustats.frame_dup_count);
  218. p += sprintf(p, "rts_success_count = %u\n", ustats.rts_success_count);
  219. p += sprintf(p, "rts_failure_count = %u\n", ustats.rts_failure_count);
  220. p += sprintf(p, "ack_failure_count = %u\n", ustats.ack_failure_count);
  221. p += sprintf(p, "rx_fragment_count = %u\n", ustats.rx_fragment_count);
  222. p += sprintf(p, "mcast_rx_frame_count = %u\n",
  223. ustats.mcast_rx_frame_count);
  224. p += sprintf(p, "fcs_error_count = %u\n", ustats.fcs_error_count);
  225. p += sprintf(p, "tx_frame_count = %u\n", ustats.tx_frame_count);
  226. p += sprintf(p, "rsna_tkip_cm_invoked = %u\n",
  227. ustats.rsna_tkip_cm_invoked);
  228. p += sprintf(p, "rsna_4way_hshk_failures = %u\n",
  229. ustats.rsna_4way_hshk_failures);
  230. }
  231. #endif /* UAP_SUPPORT */
  232. exit:
  233. LEAVE();
  234. return (p - page);
  235. }
  236. #define CMD52_STR_LEN 50
  237. /*
  238. * @brief Parse cmd52 string
  239. *
  240. * @param buffer A pointer user buffer
  241. * @param len Length user buffer
  242. * @param func Parsed func number
  243. * @param reg Parsed reg value
  244. * @param val Parsed value to set
  245. * @return BT_STATUS_SUCCESS
  246. */
  247. static int
  248. parse_cmd52_string(const char __user * buffer, size_t len, int *func, int *reg,
  249. int *val)
  250. {
  251. int ret = MLAN_STATUS_SUCCESS;
  252. char *string = NULL;
  253. char *pos = NULL;
  254. ENTER();
  255. string = (char *) kmalloc(CMD52_STR_LEN, GFP_KERNEL);
  256. memset(string, 0, CMD52_STR_LEN);
  257. memcpy(string, buffer + strlen("sdcmd52rw="), len - strlen("sdcmd52rw="));
  258. string = strstrip(string);
  259. *func = -1;
  260. *reg = -1;
  261. *val = -1;
  262. /* Get func */
  263. pos = strsep(&string, " \t");
  264. if (pos) {
  265. *func = woal_string_to_number(pos);
  266. }
  267. /* Get reg */
  268. pos = strsep(&string, " \t");
  269. if (pos) {
  270. *reg = woal_string_to_number(pos);
  271. }
  272. /* Get val (optional) */
  273. pos = strsep(&string, " \t");
  274. if (pos) {
  275. *val = woal_string_to_number(pos);
  276. }
  277. if (string)
  278. kfree(string);
  279. LEAVE();
  280. return ret;
  281. }
  282. /**
  283. * @brief config proc write function
  284. *
  285. * @param f file pointer
  286. * @param buf pointer to data buffer
  287. * @param cnt data number to write
  288. * @param data data to write
  289. * @return number of data
  290. */
  291. static int
  292. woal_config_write(struct file *f, const char *buf, unsigned long cnt,
  293. void *data)
  294. {
  295. char databuf[101];
  296. char *line;
  297. t_u32 config_data = 0;
  298. moal_handle *handle = (moal_handle *) data;
  299. int func, reg, val;
  300. ENTER();
  301. if (!MODULE_GET) {
  302. LEAVE();
  303. return 0;
  304. }
  305. if (cnt >= sizeof(databuf)) {
  306. MODULE_PUT;
  307. LEAVE();
  308. return (int) cnt;
  309. }
  310. memset(databuf, 0, sizeof(databuf));
  311. if (copy_from_user(databuf, buf, cnt)) {
  312. MODULE_PUT;
  313. LEAVE();
  314. return 0;
  315. }
  316. line = databuf;
  317. if (!strncmp(databuf, "soft_reset", strlen("soft_reset"))) {
  318. line += strlen("soft_reset") + 1;
  319. config_data = (t_u32) woal_string_to_number(line);
  320. PRINTM(MINFO, "soft_reset: %d\n", (int) config_data);
  321. if (woal_request_soft_reset(handle) == MLAN_STATUS_SUCCESS) {
  322. handle->hardware_status = HardwareStatusReset;
  323. } else {
  324. PRINTM(MERROR, "Could not perform soft reset\n");
  325. }
  326. }
  327. if (!strncmp(databuf, "drv_mode", strlen("drv_mode"))) {
  328. line += strlen("drv_mode") + 1;
  329. config_data = (t_u32) woal_string_to_number(line);
  330. PRINTM(MINFO, "drv_mode: %d\n", (int) config_data);
  331. if (config_data != (t_u32) drv_mode)
  332. if (woal_switch_drv_mode(handle, config_data) !=
  333. MLAN_STATUS_SUCCESS) {
  334. PRINTM(MERROR, "Could not switch drv mode\n");
  335. }
  336. }
  337. if (!strncmp(databuf, "sdcmd52rw=", strlen("sdcmd52rw="))) {
  338. parse_cmd52_string(databuf, (size_t) cnt, &func, &reg, &val);
  339. woal_sdio_read_write_cmd52(handle, func, reg, val);
  340. }
  341. MODULE_PUT;
  342. LEAVE();
  343. return (int) cnt;
  344. }
  345. /**
  346. * @brief config proc read function
  347. *
  348. * @param page pointer to buffer
  349. * @param s read data starting position
  350. * @param off offset
  351. * @param cnt counter
  352. * @param eof end of file flag
  353. * @param data data to output
  354. * @return number of output data
  355. */
  356. static int
  357. woal_config_read(char *page, char **s, off_t off, int cnt, int *eof, void *data)
  358. {
  359. char *p = page;
  360. moal_handle *handle = (moal_handle *) data;
  361. ENTER();
  362. if (!MODULE_GET) {
  363. LEAVE();
  364. return 0;
  365. }
  366. p += sprintf(p, "hardware_status=%d\n", (int) handle->hardware_status);
  367. p += sprintf(p, "netlink_num=%d\n", (int) handle->netlink_num);
  368. p += sprintf(p, "drv_mode=%d\n", (int) drv_mode);
  369. p += sprintf(p, "sdcmd52rw=%d 0x%0x 0x%02X\n", handle->cmd52_func,
  370. handle->cmd52_reg, handle->cmd52_val);
  371. MODULE_PUT;
  372. LEAVE();
  373. return p - page;
  374. }
  375. /********************************************************
  376. Global Functions
  377. ********************************************************/
  378. /**
  379. * @brief Convert string to number
  380. *
  381. * @param s Pointer to numbered string
  382. *
  383. * @return Converted number from string s
  384. */
  385. int
  386. woal_string_to_number(char *s)
  387. {
  388. int r = 0;
  389. int base = 0;
  390. int pn = 1;
  391. if (!strncmp(s, "-", 1)) {
  392. pn = -1;
  393. s++;
  394. }
  395. if (!strncmp(s, "0x", 2) || !strncmp(s, "0X", 2)) {
  396. base = 16;
  397. s += 2;
  398. } else
  399. base = 10;
  400. for (s = s; *s; s++) {
  401. if ((*s >= '0') && (*s <= '9'))
  402. r = (r * base) + (*s - '0');
  403. else if ((*s >= 'A') && (*s <= 'F'))
  404. r = (r * base) + (*s - 'A' + 10);
  405. else if ((*s >= 'a') && (*s <= 'f'))
  406. r = (r * base) + (*s - 'a' + 10);
  407. else
  408. break;
  409. }
  410. return (r * pn);
  411. }
  412. /**
  413. * @brief Create the top level proc directory
  414. *
  415. * @param handle Pointer to woal_handle
  416. *
  417. * @return N/A
  418. */
  419. void
  420. woal_proc_init(moal_handle * handle)
  421. {
  422. struct proc_dir_entry *r;
  423. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
  424. struct proc_dir_entry *pde = PROC_DIR;
  425. #endif
  426. char config_proc_dir[20];
  427. ENTER();
  428. PRINTM(MINFO, "Create Proc Interface\n");
  429. if (!handle->proc_mwlan) {
  430. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,26)
  431. /* Check if directory already exists */
  432. for (pde = pde->subdir; pde; pde = pde->next) {
  433. if (pde->namelen && !strcmp("mwlan", pde->name)) {
  434. /* Directory exists */
  435. PRINTM(MWARN, "proc interface already exists!\n");
  436. handle->proc_mwlan = pde;
  437. break;
  438. }
  439. }
  440. if (pde == NULL) {
  441. handle->proc_mwlan = proc_mkdir("mwlan", PROC_DIR);
  442. if (!handle->proc_mwlan)
  443. PRINTM(MERROR, "Cannot create proc interface!\n");
  444. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
  445. else
  446. atomic_set(&handle->proc_mwlan->count, 1);
  447. #endif
  448. }
  449. #else
  450. if (!proc_mwlan) {
  451. handle->proc_mwlan = proc_mkdir("mwlan", PROC_DIR);
  452. if (!handle->proc_mwlan) {
  453. PRINTM(MERROR, "Cannot create proc interface!\n");
  454. }
  455. } else {
  456. handle->proc_mwlan = proc_mwlan;
  457. }
  458. #endif
  459. if (handle->proc_mwlan) {
  460. if (handle->handle_idx)
  461. sprintf(config_proc_dir, "config%d", handle->handle_idx);
  462. else
  463. strcpy(config_proc_dir, "config");
  464. r = create_proc_entry(config_proc_dir, 0644, handle->proc_mwlan);
  465. if (r) {
  466. r->data = handle;
  467. r->read_proc = woal_config_read;
  468. r->write_proc = woal_config_write;
  469. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30)
  470. r->owner = THIS_MODULE;
  471. #endif
  472. } else
  473. PRINTM(MMSG, "Fail to create proc config\n");
  474. }
  475. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
  476. proc_mwlan = handle->proc_mwlan;
  477. #endif
  478. }
  479. LEAVE();
  480. }
  481. /**
  482. * @brief Remove the top level proc directory
  483. *
  484. * @param handle pointer moal_handle
  485. *
  486. * @return N/A
  487. */
  488. void
  489. woal_proc_exit(moal_handle * handle)
  490. {
  491. ENTER();
  492. PRINTM(MINFO, "Remove Proc Interface\n");
  493. if (handle->proc_mwlan) {
  494. char config_proc_dir[20];
  495. if (handle->handle_idx)
  496. sprintf(config_proc_dir, "config%d", handle->handle_idx);
  497. else
  498. strcpy(config_proc_dir, "config");
  499. remove_proc_entry(config_proc_dir, handle->proc_mwlan);
  500. /* Remove only if we are the only instance using this */
  501. if (atomic_read(&(handle->proc_mwlan->count)) > 1) {
  502. PRINTM(MWARN, "More than one interface using proc!\n");
  503. } else {
  504. #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24)
  505. atomic_dec(&(handle->proc_mwlan->count));
  506. #endif
  507. remove_proc_entry("mwlan", PROC_DIR);
  508. handle->proc_mwlan = NULL;
  509. #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,26)
  510. proc_mwlan = NULL;
  511. #endif
  512. }
  513. }
  514. LEAVE();
  515. }
  516. /**
  517. * @brief Create proc file for interface
  518. *
  519. * @param priv pointer moal_private
  520. *
  521. * @return N/A
  522. */
  523. void
  524. woal_create_proc_entry(moal_private * priv)
  525. {
  526. struct net_device *dev = priv->netdev;
  527. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
  528. char proc_dir_name[20];
  529. #endif
  530. ENTER();
  531. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
  532. if (!priv->proc_entry) {
  533. memset(proc_dir_name, 0, sizeof(proc_dir_name));
  534. strcpy(proc_dir_name, MWLAN_PROC_DIR);
  535. strcat(proc_dir_name, dev->name);
  536. /* Try to create mwlan/mlanX first */
  537. priv->proc_entry = proc_mkdir(proc_dir_name, PROC_DIR);
  538. if (priv->proc_entry) {
  539. /* Success. Continue normally */
  540. if (!priv->phandle->proc_mwlan) {
  541. priv->phandle->proc_mwlan = priv->proc_entry->parent;
  542. }
  543. atomic_inc(&(priv->phandle->proc_mwlan->count));
  544. } else {
  545. /* Failure. mwlan may not exist. Try to create that first */
  546. priv->phandle->proc_mwlan = proc_mkdir("mwlan", PROC_DIR);
  547. if (!priv->phandle->proc_mwlan) {
  548. /* Failure. Something broken */
  549. LEAVE();
  550. return;
  551. } else {
  552. /* Success. Now retry creating mlanX */
  553. priv->proc_entry = proc_mkdir(proc_dir_name, PROC_DIR);
  554. atomic_inc(&(priv->phandle->proc_mwlan->count));
  555. }
  556. }
  557. #else
  558. if (priv->phandle->proc_mwlan && !priv->proc_entry) {
  559. priv->proc_entry = proc_mkdir(dev->name, priv->phandle->proc_mwlan);
  560. atomic_inc(&(priv->phandle->proc_mwlan->count));
  561. #endif
  562. strcpy(priv->proc_entry_name, dev->name);
  563. if (priv->proc_entry) {
  564. create_proc_read_entry("info", 0, priv->proc_entry,
  565. woal_info_proc_read, dev);
  566. }
  567. }
  568. LEAVE();
  569. }
  570. /**
  571. * @brief Remove proc file
  572. *
  573. * @param priv Pointer moal_private
  574. *
  575. * @return N/A
  576. */
  577. void
  578. woal_proc_remove(moal_private * priv)
  579. {
  580. ENTER();
  581. if (priv->phandle->proc_mwlan && priv->proc_entry) {
  582. remove_proc_entry("info", priv->proc_entry);
  583. remove_proc_entry(priv->proc_entry_name, priv->phandle->proc_mwlan);
  584. atomic_dec(&(priv->phandle->proc_mwlan->count));
  585. priv->proc_entry = NULL;
  586. }
  587. LEAVE();
  588. }
  589. #endif