smsdvb-debugfs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503
  1. /***********************************************************************
  2. *
  3. * Copyright(c) 2013 Mauro Carvalho Chehab <mchehab@redhat.com>
  4. *
  5. * This program is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation, either version 2 of the License, or
  8. * (at your option) any later version.
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. *
  17. ***********************************************************************/
  18. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  19. #include <linux/module.h>
  20. #include <linux/slab.h>
  21. #include <linux/init.h>
  22. #include <linux/debugfs.h>
  23. #include <linux/spinlock.h>
  24. #include <linux/usb.h>
  25. #include "dmxdev.h"
  26. #include "dvbdev.h"
  27. #include "dvb_demux.h"
  28. #include "dvb_frontend.h"
  29. #include "smscoreapi.h"
  30. #include "smsdvb.h"
  31. static struct dentry *smsdvb_debugfs_usb_root;
  32. struct smsdvb_debugfs {
  33. struct kref refcount;
  34. spinlock_t lock;
  35. char stats_data[PAGE_SIZE];
  36. unsigned stats_count;
  37. bool stats_was_read;
  38. wait_queue_head_t stats_queue;
  39. };
  40. void smsdvb_print_dvb_stats(struct smsdvb_debugfs *debug_data,
  41. struct SMSHOSTLIB_STATISTICS_ST *p)
  42. {
  43. int n = 0;
  44. char *buf;
  45. spin_lock(&debug_data->lock);
  46. if (debug_data->stats_count) {
  47. spin_unlock(&debug_data->lock);
  48. return;
  49. }
  50. buf = debug_data->stats_data;
  51. n += snprintf(&buf[n], PAGE_SIZE - n,
  52. "IsRfLocked = %d\n", p->IsRfLocked);
  53. n += snprintf(&buf[n], PAGE_SIZE - n,
  54. "IsDemodLocked = %d\n", p->IsDemodLocked);
  55. n += snprintf(&buf[n], PAGE_SIZE - n,
  56. "IsExternalLNAOn = %d\n", p->IsExternalLNAOn);
  57. n += snprintf(&buf[n], PAGE_SIZE - n,
  58. "SNR = %d\n", p->SNR);
  59. n += snprintf(&buf[n], PAGE_SIZE - n,
  60. "BER = %d\n", p->BER);
  61. n += snprintf(&buf[n], PAGE_SIZE - n,
  62. "FIB_CRC = %d\n", p->FIB_CRC);
  63. n += snprintf(&buf[n], PAGE_SIZE - n,
  64. "TS_PER = %d\n", p->TS_PER);
  65. n += snprintf(&buf[n], PAGE_SIZE - n,
  66. "MFER = %d\n", p->MFER);
  67. n += snprintf(&buf[n], PAGE_SIZE - n,
  68. "RSSI = %d\n", p->RSSI);
  69. n += snprintf(&buf[n], PAGE_SIZE - n,
  70. "InBandPwr = %d\n", p->InBandPwr);
  71. n += snprintf(&buf[n], PAGE_SIZE - n,
  72. "CarrierOffset = %d\n", p->CarrierOffset);
  73. n += snprintf(&buf[n], PAGE_SIZE - n,
  74. "ModemState = %d\n", p->ModemState);
  75. n += snprintf(&buf[n], PAGE_SIZE - n,
  76. "Frequency = %d\n", p->Frequency);
  77. n += snprintf(&buf[n], PAGE_SIZE - n,
  78. "Bandwidth = %d\n", p->Bandwidth);
  79. n += snprintf(&buf[n], PAGE_SIZE - n,
  80. "TransmissionMode = %d\n", p->TransmissionMode);
  81. n += snprintf(&buf[n], PAGE_SIZE - n,
  82. "ModemState = %d\n", p->ModemState);
  83. n += snprintf(&buf[n], PAGE_SIZE - n,
  84. "GuardInterval = %d\n", p->GuardInterval);
  85. n += snprintf(&buf[n], PAGE_SIZE - n,
  86. "CodeRate = %d\n", p->CodeRate);
  87. n += snprintf(&buf[n], PAGE_SIZE - n,
  88. "LPCodeRate = %d\n", p->LPCodeRate);
  89. n += snprintf(&buf[n], PAGE_SIZE - n,
  90. "Hierarchy = %d\n", p->Hierarchy);
  91. n += snprintf(&buf[n], PAGE_SIZE - n,
  92. "Constellation = %d\n", p->Constellation);
  93. n += snprintf(&buf[n], PAGE_SIZE - n,
  94. "BurstSize = %d\n", p->BurstSize);
  95. n += snprintf(&buf[n], PAGE_SIZE - n,
  96. "BurstDuration = %d\n", p->BurstDuration);
  97. n += snprintf(&buf[n], PAGE_SIZE - n,
  98. "BurstCycleTime = %d\n", p->BurstCycleTime);
  99. n += snprintf(&buf[n], PAGE_SIZE - n,
  100. "CalculatedBurstCycleTime = %d\n",
  101. p->CalculatedBurstCycleTime);
  102. n += snprintf(&buf[n], PAGE_SIZE - n,
  103. "NumOfRows = %d\n", p->NumOfRows);
  104. n += snprintf(&buf[n], PAGE_SIZE - n,
  105. "NumOfPaddCols = %d\n", p->NumOfPaddCols);
  106. n += snprintf(&buf[n], PAGE_SIZE - n,
  107. "NumOfPunctCols = %d\n", p->NumOfPunctCols);
  108. n += snprintf(&buf[n], PAGE_SIZE - n,
  109. "ErrorTSPackets = %d\n", p->ErrorTSPackets);
  110. n += snprintf(&buf[n], PAGE_SIZE - n,
  111. "TotalTSPackets = %d\n", p->TotalTSPackets);
  112. n += snprintf(&buf[n], PAGE_SIZE - n,
  113. "NumOfValidMpeTlbs = %d\n", p->NumOfValidMpeTlbs);
  114. n += snprintf(&buf[n], PAGE_SIZE - n,
  115. "NumOfInvalidMpeTlbs = %d\n", p->NumOfInvalidMpeTlbs);
  116. n += snprintf(&buf[n], PAGE_SIZE - n,
  117. "NumOfCorrectedMpeTlbs = %d\n", p->NumOfCorrectedMpeTlbs);
  118. n += snprintf(&buf[n], PAGE_SIZE - n,
  119. "BERErrorCount = %d\n", p->BERErrorCount);
  120. n += snprintf(&buf[n], PAGE_SIZE - n,
  121. "BERBitCount = %d\n", p->BERBitCount);
  122. n += snprintf(&buf[n], PAGE_SIZE - n,
  123. "SmsToHostTxErrors = %d\n", p->SmsToHostTxErrors);
  124. n += snprintf(&buf[n], PAGE_SIZE - n,
  125. "PreBER = %d\n", p->PreBER);
  126. n += snprintf(&buf[n], PAGE_SIZE - n,
  127. "CellId = %d\n", p->CellId);
  128. n += snprintf(&buf[n], PAGE_SIZE - n,
  129. "DvbhSrvIndHP = %d\n", p->DvbhSrvIndHP);
  130. n += snprintf(&buf[n], PAGE_SIZE - n,
  131. "DvbhSrvIndLP = %d\n", p->DvbhSrvIndLP);
  132. n += snprintf(&buf[n], PAGE_SIZE - n,
  133. "NumMPEReceived = %d\n", p->NumMPEReceived);
  134. debug_data->stats_count = n;
  135. spin_unlock(&debug_data->lock);
  136. wake_up(&debug_data->stats_queue);
  137. }
  138. void smsdvb_print_isdb_stats(struct smsdvb_debugfs *debug_data,
  139. struct SMSHOSTLIB_STATISTICS_ISDBT_ST *p)
  140. {
  141. int i, n = 0;
  142. char *buf;
  143. spin_lock(&debug_data->lock);
  144. if (debug_data->stats_count) {
  145. spin_unlock(&debug_data->lock);
  146. return;
  147. }
  148. buf = debug_data->stats_data;
  149. n += snprintf(&buf[n], PAGE_SIZE - n,
  150. "IsRfLocked = %d\t\t", p->IsRfLocked);
  151. n += snprintf(&buf[n], PAGE_SIZE - n,
  152. "IsDemodLocked = %d\t", p->IsDemodLocked);
  153. n += snprintf(&buf[n], PAGE_SIZE - n,
  154. "IsExternalLNAOn = %d\n", p->IsExternalLNAOn);
  155. n += snprintf(&buf[n], PAGE_SIZE - n,
  156. "SNR = %d dB\t\t", p->SNR);
  157. n += snprintf(&buf[n], PAGE_SIZE - n,
  158. "RSSI = %d dBm\t\t", p->RSSI);
  159. n += snprintf(&buf[n], PAGE_SIZE - n,
  160. "InBandPwr = %d dBm\n", p->InBandPwr);
  161. n += snprintf(&buf[n], PAGE_SIZE - n,
  162. "CarrierOffset = %d\t", p->CarrierOffset);
  163. n += snprintf(&buf[n], PAGE_SIZE - n,
  164. "Bandwidth = %d\t\t", p->Bandwidth);
  165. n += snprintf(&buf[n], PAGE_SIZE - n,
  166. "Frequency = %d Hz\n", p->Frequency);
  167. n += snprintf(&buf[n], PAGE_SIZE - n,
  168. "TransmissionMode = %d\t", p->TransmissionMode);
  169. n += snprintf(&buf[n], PAGE_SIZE - n,
  170. "ModemState = %d\t\t", p->ModemState);
  171. n += snprintf(&buf[n], PAGE_SIZE - n,
  172. "GuardInterval = %d\n", p->GuardInterval);
  173. n += snprintf(&buf[n], PAGE_SIZE - n,
  174. "SystemType = %d\t\t", p->SystemType);
  175. n += snprintf(&buf[n], PAGE_SIZE - n,
  176. "PartialReception = %d\t", p->PartialReception);
  177. n += snprintf(&buf[n], PAGE_SIZE - n,
  178. "NumOfLayers = %d\n", p->NumOfLayers);
  179. n += snprintf(&buf[n], PAGE_SIZE - n,
  180. "SmsToHostTxErrors = %d\n", p->SmsToHostTxErrors);
  181. for (i = 0; i < 3; i++) {
  182. if (p->LayerInfo[i].NumberOfSegments < 1 ||
  183. p->LayerInfo[i].NumberOfSegments > 13)
  184. continue;
  185. n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i);
  186. n += snprintf(&buf[n], PAGE_SIZE - n, "\tCodeRate = %d\t",
  187. p->LayerInfo[i].CodeRate);
  188. n += snprintf(&buf[n], PAGE_SIZE - n, "Constellation = %d\n",
  189. p->LayerInfo[i].Constellation);
  190. n += snprintf(&buf[n], PAGE_SIZE - n, "\tBER = %-5d\t",
  191. p->LayerInfo[i].BER);
  192. n += snprintf(&buf[n], PAGE_SIZE - n, "\tBERErrorCount = %-5d\t",
  193. p->LayerInfo[i].BERErrorCount);
  194. n += snprintf(&buf[n], PAGE_SIZE - n, "BERBitCount = %-5d\n",
  195. p->LayerInfo[i].BERBitCount);
  196. n += snprintf(&buf[n], PAGE_SIZE - n, "\tPreBER = %-5d\t",
  197. p->LayerInfo[i].PreBER);
  198. n += snprintf(&buf[n], PAGE_SIZE - n, "\tTS_PER = %-5d\n",
  199. p->LayerInfo[i].TS_PER);
  200. n += snprintf(&buf[n], PAGE_SIZE - n, "\tErrorTSPackets = %-5d\t",
  201. p->LayerInfo[i].ErrorTSPackets);
  202. n += snprintf(&buf[n], PAGE_SIZE - n, "TotalTSPackets = %-5d\t",
  203. p->LayerInfo[i].TotalTSPackets);
  204. n += snprintf(&buf[n], PAGE_SIZE - n, "TILdepthI = %d\n",
  205. p->LayerInfo[i].TILdepthI);
  206. n += snprintf(&buf[n], PAGE_SIZE - n,
  207. "\tNumberOfSegments = %d\t",
  208. p->LayerInfo[i].NumberOfSegments);
  209. n += snprintf(&buf[n], PAGE_SIZE - n, "TMCCErrors = %d\n",
  210. p->LayerInfo[i].TMCCErrors);
  211. }
  212. debug_data->stats_count = n;
  213. spin_unlock(&debug_data->lock);
  214. wake_up(&debug_data->stats_queue);
  215. }
  216. void smsdvb_print_isdb_stats_ex(struct smsdvb_debugfs *debug_data,
  217. struct SMSHOSTLIB_STATISTICS_ISDBT_EX_ST *p)
  218. {
  219. int i, n = 0;
  220. char *buf;
  221. spin_lock(&debug_data->lock);
  222. if (debug_data->stats_count) {
  223. spin_unlock(&debug_data->lock);
  224. return;
  225. }
  226. buf = debug_data->stats_data;
  227. n += snprintf(&buf[n], PAGE_SIZE - n,
  228. "IsRfLocked = %d\t\t", p->IsRfLocked);
  229. n += snprintf(&buf[n], PAGE_SIZE - n,
  230. "IsDemodLocked = %d\t", p->IsDemodLocked);
  231. n += snprintf(&buf[n], PAGE_SIZE - n,
  232. "IsExternalLNAOn = %d\n", p->IsExternalLNAOn);
  233. n += snprintf(&buf[n], PAGE_SIZE - n,
  234. "SNR = %d dB\t\t", p->SNR);
  235. n += snprintf(&buf[n], PAGE_SIZE - n,
  236. "RSSI = %d dBm\t\t", p->RSSI);
  237. n += snprintf(&buf[n], PAGE_SIZE - n,
  238. "InBandPwr = %d dBm\n", p->InBandPwr);
  239. n += snprintf(&buf[n], PAGE_SIZE - n,
  240. "CarrierOffset = %d\t", p->CarrierOffset);
  241. n += snprintf(&buf[n], PAGE_SIZE - n,
  242. "Bandwidth = %d\t\t", p->Bandwidth);
  243. n += snprintf(&buf[n], PAGE_SIZE - n,
  244. "Frequency = %d Hz\n", p->Frequency);
  245. n += snprintf(&buf[n], PAGE_SIZE - n,
  246. "TransmissionMode = %d\t", p->TransmissionMode);
  247. n += snprintf(&buf[n], PAGE_SIZE - n,
  248. "ModemState = %d\t\t", p->ModemState);
  249. n += snprintf(&buf[n], PAGE_SIZE - n,
  250. "GuardInterval = %d\n", p->GuardInterval);
  251. n += snprintf(&buf[n], PAGE_SIZE - n,
  252. "SystemType = %d\t\t", p->SystemType);
  253. n += snprintf(&buf[n], PAGE_SIZE - n,
  254. "PartialReception = %d\t", p->PartialReception);
  255. n += snprintf(&buf[n], PAGE_SIZE - n,
  256. "NumOfLayers = %d\n", p->NumOfLayers);
  257. n += snprintf(&buf[n], PAGE_SIZE - n, "SegmentNumber = %d\t",
  258. p->SegmentNumber);
  259. n += snprintf(&buf[n], PAGE_SIZE - n, "TuneBW = %d\n",
  260. p->TuneBW);
  261. for (i = 0; i < 3; i++) {
  262. if (p->LayerInfo[i].NumberOfSegments < 1 ||
  263. p->LayerInfo[i].NumberOfSegments > 13)
  264. continue;
  265. n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i);
  266. n += snprintf(&buf[n], PAGE_SIZE - n, "\tCodeRate = %d\t",
  267. p->LayerInfo[i].CodeRate);
  268. n += snprintf(&buf[n], PAGE_SIZE - n, "Constellation = %d\n",
  269. p->LayerInfo[i].Constellation);
  270. n += snprintf(&buf[n], PAGE_SIZE - n, "\tBER = %-5d\t",
  271. p->LayerInfo[i].BER);
  272. n += snprintf(&buf[n], PAGE_SIZE - n, "\tBERErrorCount = %-5d\t",
  273. p->LayerInfo[i].BERErrorCount);
  274. n += snprintf(&buf[n], PAGE_SIZE - n, "BERBitCount = %-5d\n",
  275. p->LayerInfo[i].BERBitCount);
  276. n += snprintf(&buf[n], PAGE_SIZE - n, "\tPreBER = %-5d\t",
  277. p->LayerInfo[i].PreBER);
  278. n += snprintf(&buf[n], PAGE_SIZE - n, "\tTS_PER = %-5d\n",
  279. p->LayerInfo[i].TS_PER);
  280. n += snprintf(&buf[n], PAGE_SIZE - n, "\tErrorTSPackets = %-5d\t",
  281. p->LayerInfo[i].ErrorTSPackets);
  282. n += snprintf(&buf[n], PAGE_SIZE - n, "TotalTSPackets = %-5d\t",
  283. p->LayerInfo[i].TotalTSPackets);
  284. n += snprintf(&buf[n], PAGE_SIZE - n, "TILdepthI = %d\n",
  285. p->LayerInfo[i].TILdepthI);
  286. n += snprintf(&buf[n], PAGE_SIZE - n,
  287. "\tNumberOfSegments = %d\t",
  288. p->LayerInfo[i].NumberOfSegments);
  289. n += snprintf(&buf[n], PAGE_SIZE - n, "TMCCErrors = %d\n",
  290. p->LayerInfo[i].TMCCErrors);
  291. }
  292. debug_data->stats_count = n;
  293. spin_unlock(&debug_data->lock);
  294. wake_up(&debug_data->stats_queue);
  295. }
  296. static int smsdvb_stats_open(struct inode *inode, struct file *file)
  297. {
  298. struct smsdvb_client_t *client = inode->i_private;
  299. struct smsdvb_debugfs *debug_data = client->debug_data;
  300. kref_get(&debug_data->refcount);
  301. spin_lock(&debug_data->lock);
  302. debug_data->stats_count = 0;
  303. debug_data->stats_was_read = false;
  304. spin_unlock(&debug_data->lock);
  305. file->private_data = debug_data;
  306. return 0;
  307. }
  308. static int smsdvb_stats_wait_read(struct smsdvb_debugfs *debug_data)
  309. {
  310. int rc = 1;
  311. spin_lock(&debug_data->lock);
  312. if (debug_data->stats_was_read)
  313. goto exit;
  314. rc = debug_data->stats_count;
  315. exit:
  316. spin_unlock(&debug_data->lock);
  317. return rc;
  318. }
  319. static ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf,
  320. size_t nbytes, loff_t *ppos)
  321. {
  322. int rc = 0;
  323. struct smsdvb_debugfs *debug_data = file->private_data;
  324. rc = wait_event_interruptible(debug_data->stats_queue,
  325. smsdvb_stats_wait_read(debug_data));
  326. if (rc < 0)
  327. return rc;
  328. rc = simple_read_from_buffer(user_buf, nbytes, ppos,
  329. debug_data->stats_data,
  330. debug_data->stats_count);
  331. spin_lock(&debug_data->lock);
  332. debug_data->stats_was_read = true;
  333. spin_unlock(&debug_data->lock);
  334. return rc;
  335. }
  336. static void smsdvb_debugfs_data_release(struct kref *ref)
  337. {
  338. struct smsdvb_debugfs *debug_data;
  339. debug_data = container_of(ref, struct smsdvb_debugfs, refcount);
  340. kfree(debug_data);
  341. }
  342. static int smsdvb_stats_release(struct inode *inode, struct file *file)
  343. {
  344. struct smsdvb_debugfs *debug_data = file->private_data;
  345. spin_lock(&debug_data->lock);
  346. debug_data->stats_was_read = true;
  347. spin_unlock(&debug_data->lock);
  348. wake_up_interruptible_sync(&debug_data->stats_queue);
  349. kref_put(&debug_data->refcount, smsdvb_debugfs_data_release);
  350. file->private_data = NULL;
  351. return 0;
  352. }
  353. static const struct file_operations debugfs_stats_ops = {
  354. .open = smsdvb_stats_open,
  355. .read = smsdvb_stats_read,
  356. .release = smsdvb_stats_release,
  357. .llseek = generic_file_llseek,
  358. };
  359. /*
  360. * Functions used by smsdvb, in order to create the interfaces
  361. */
  362. int smsdvb_debugfs_create(struct smsdvb_client_t *client)
  363. {
  364. struct smscore_device_t *coredev = client->coredev;
  365. struct dentry *d;
  366. struct smsdvb_debugfs *debug_data;
  367. if (!smsdvb_debugfs_usb_root || !coredev->is_usb_device)
  368. return -ENODEV;
  369. client->debugfs = debugfs_create_dir(coredev->devpath,
  370. smsdvb_debugfs_usb_root);
  371. if (IS_ERR_OR_NULL(client->debugfs)) {
  372. pr_info("Unable to create debugfs %s directory.\n",
  373. coredev->devpath);
  374. return -ENODEV;
  375. }
  376. d = debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs,
  377. client, &debugfs_stats_ops);
  378. if (!d) {
  379. debugfs_remove(client->debugfs);
  380. return -ENOMEM;
  381. }
  382. debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL);
  383. if (!debug_data)
  384. return -ENOMEM;
  385. client->debug_data = debug_data;
  386. client->prt_dvb_stats = smsdvb_print_dvb_stats;
  387. client->prt_isdb_stats = smsdvb_print_isdb_stats;
  388. client->prt_isdb_stats_ex = smsdvb_print_isdb_stats_ex;
  389. init_waitqueue_head(&debug_data->stats_queue);
  390. spin_lock_init(&debug_data->lock);
  391. kref_init(&debug_data->refcount);
  392. return 0;
  393. }
  394. void smsdvb_debugfs_release(struct smsdvb_client_t *client)
  395. {
  396. if (!client->debugfs)
  397. return;
  398. printk("%s\n", __func__);
  399. client->prt_dvb_stats = NULL;
  400. client->prt_isdb_stats = NULL;
  401. client->prt_isdb_stats_ex = NULL;
  402. debugfs_remove_recursive(client->debugfs);
  403. kref_put(&client->debug_data->refcount, smsdvb_debugfs_data_release);
  404. client->debug_data = NULL;
  405. client->debugfs = NULL;
  406. }
  407. int smsdvb_debugfs_register(void)
  408. {
  409. struct dentry *d;
  410. /*
  411. * FIXME: This was written to debug Siano USB devices. So, it creates
  412. * the debugfs node under <debugfs>/usb.
  413. * A similar logic would be needed for Siano sdio devices, but, in that
  414. * case, usb_debug_root is not a good choice.
  415. *
  416. * Perhaps the right fix here would be to create another sysfs root
  417. * node for sdio-based boards, but this may need some logic at sdio
  418. * subsystem.
  419. */
  420. d = debugfs_create_dir("smsdvb", usb_debug_root);
  421. if (IS_ERR_OR_NULL(d)) {
  422. sms_err("Couldn't create sysfs node for smsdvb");
  423. return PTR_ERR(d);
  424. } else {
  425. smsdvb_debugfs_usb_root = d;
  426. }
  427. return 0;
  428. }
  429. void smsdvb_debugfs_unregister(void)
  430. {
  431. if (smsdvb_debugfs_usb_root)
  432. debugfs_remove_recursive(smsdvb_debugfs_usb_root);
  433. smsdvb_debugfs_usb_root = NULL;
  434. }