smsdvb-debugfs.c revision 05ad412a63d66175f8f5a3d08894cf3f1d118cbc
1503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab/*********************************************************************** 2503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * 3503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * Copyright(c) 2013 Mauro Carvalho Chehab <mchehab@redhat.com> 4503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * 5503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * This program is free software: you can redistribute it and/or modify 6503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * it under the terms of the GNU General Public License as published by 7503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * the Free Software Foundation, either version 2 of the License, or 8503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * (at your option) any later version. 9503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 10503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * This program is distributed in the hope that it will be useful, 11503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * but WITHOUT ANY WARRANTY; without even the implied warranty of 12503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * GNU General Public License for more details. 14503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * 15503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * You should have received a copy of the GNU General Public License 16503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * along with this program. If not, see <http://www.gnu.org/licenses/>. 17503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * 18503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab ***********************************************************************/ 19503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 20503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 21503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 22503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/module.h> 23503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/slab.h> 24503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/init.h> 25503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/debugfs.h> 26503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/spinlock.h> 27503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include <linux/usb.h> 28503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 29503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "dmxdev.h" 30503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "dvbdev.h" 31503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "dvb_demux.h" 32503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "dvb_frontend.h" 33503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 34503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "smscoreapi.h" 35503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 36503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab#include "smsdvb.h" 37503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 38503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstatic struct dentry *smsdvb_debugfs_usb_root; 39503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 40503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstruct smsdvb_debugfs { 41503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct kref refcount; 42503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spinlock_t lock; 43503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 44503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab char stats_data[PAGE_SIZE]; 45503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab unsigned stats_count; 46503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab bool stats_was_read; 47503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 48503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab wait_queue_head_t stats_queue; 49503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab}; 50503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 51503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabvoid smsdvb_print_dvb_stats(struct smsdvb_debugfs *debug_data, 52cf0e9cfcc70d8aaeabf19356f42041f8a5495301Mauro Carvalho Chehab struct sms_stats *p) 53503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 54503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab int n = 0; 55503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab char *buf; 56503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 57503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 58503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (debug_data->stats_count) { 59503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 60503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return; 61503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 62503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 63503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab buf = debug_data->stats_data; 64503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 65503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 66dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_rf_locked = %d\n", p->is_rf_locked); 67503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 68dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_demod_locked = %d\n", p->is_demod_locked); 69503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 70dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_external_lna_on = %d\n", p->is_external_lna_on); 71503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 72503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "SNR = %d\n", p->SNR); 73503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 7428a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab "ber = %d\n", p->ber); 75503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 76503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "FIB_CRC = %d\n", p->FIB_CRC); 77503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 7828a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab "ts_per = %d\n", p->ts_per); 79503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 80503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "MFER = %d\n", p->MFER); 81503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 82503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "RSSI = %d\n", p->RSSI); 83503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 84dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "in_band_pwr = %d\n", p->in_band_pwr); 85503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 86dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "carrier_offset = %d\n", p->carrier_offset); 87503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 88dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "modem_state = %d\n", p->modem_state); 89503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 90dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "frequency = %d\n", p->frequency); 91503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 92dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "bandwidth = %d\n", p->bandwidth); 93503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 94dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "transmission_mode = %d\n", p->transmission_mode); 95503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 96dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "modem_state = %d\n", p->modem_state); 97503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 98dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "guard_interval = %d\n", p->guard_interval); 99503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 100dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "code_rate = %d\n", p->code_rate); 101503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 102dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "lp_code_rate = %d\n", p->lp_code_rate); 103503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 104dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "hierarchy = %d\n", p->hierarchy); 105503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 106dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "constellation = %d\n", p->constellation); 107503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 108dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "burst_size = %d\n", p->burst_size); 109503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 110dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "burst_duration = %d\n", p->burst_duration); 111503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 112dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "burst_cycle_time = %d\n", p->burst_cycle_time); 113503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 114dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "calc_burst_cycle_time = %d\n", 11505ad412a63d66175f8f5a3d08894cf3f1d118cbcMauro Carvalho Chehab p->calc_burst_cycle_time); 116503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 117dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_rows = %d\n", p->num_of_rows); 118503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 119dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_padd_cols = %d\n", p->num_of_padd_cols); 120503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 121dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_punct_cols = %d\n", p->num_of_punct_cols); 122503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 123dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "error_ts_packets = %d\n", p->error_ts_packets); 124503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 125dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "total_ts_packets = %d\n", p->total_ts_packets); 126503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 127dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_valid_mpe_tlbs = %d\n", p->num_of_valid_mpe_tlbs); 128503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 129dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_invalid_mpe_tlbs = %d\n", p->num_of_invalid_mpe_tlbs); 130503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 131dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_corrected_mpe_tlbs = %d\n", p->num_of_corrected_mpe_tlbs); 132503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 133dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "ber_error_count = %d\n", p->ber_error_count); 134503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 135dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "ber_bit_count = %d\n", p->ber_bit_count); 136503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 137dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors); 138503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 139dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "pre_ber = %d\n", p->pre_ber); 140503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 141dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "cell_id = %d\n", p->cell_id); 142503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 143dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "dvbh_srv_ind_hp = %d\n", p->dvbh_srv_ind_hp); 144503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 145dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "dvbh_srv_ind_lp = %d\n", p->dvbh_srv_ind_lp); 146503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 147dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_mpe_received = %d\n", p->num_mpe_received); 148503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 149503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data->stats_count = n; 150503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 151503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab wake_up(&debug_data->stats_queue); 152503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 153503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 154503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabvoid smsdvb_print_isdb_stats(struct smsdvb_debugfs *debug_data, 155cf0e9cfcc70d8aaeabf19356f42041f8a5495301Mauro Carvalho Chehab struct sms_isdbt_stats *p) 156503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 157503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab int i, n = 0; 158503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab char *buf; 159503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 160503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 161503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (debug_data->stats_count) { 162503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 163503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return; 164503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 165503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 166503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab buf = debug_data->stats_data; 167503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 168503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 169dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "statistics_type = %d\t", p->statistics_type); 1704cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 171dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "full_size = %d\n", p->full_size); 1724cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab 1734cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 174dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_rf_locked = %d\t\t", p->is_rf_locked); 175503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 176dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_demod_locked = %d\t", p->is_demod_locked); 177503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 178dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_external_lna_on = %d\n", p->is_external_lna_on); 179503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 180503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "SNR = %d dB\t\t", p->SNR); 181503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 182503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "RSSI = %d dBm\t\t", p->RSSI); 183503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 184dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "in_band_pwr = %d dBm\n", p->in_band_pwr); 185503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 186dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "carrier_offset = %d\t", p->carrier_offset); 187503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 188dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "bandwidth = %d\t\t", p->bandwidth); 189503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 190dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "frequency = %d Hz\n", p->frequency); 191503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 192dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "transmission_mode = %d\t", p->transmission_mode); 193503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 194dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "modem_state = %d\t\t", p->modem_state); 195503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 196dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "guard_interval = %d\n", p->guard_interval); 197503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 198dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "system_type = %d\t\t", p->system_type); 199503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 200dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "partial_reception = %d\t", p->partial_reception); 201503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 202dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_layers = %d\n", p->num_of_layers); 203503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 204dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors); 205503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 206503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab for (i = 0; i < 3; i++) { 20728a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab if (p->layer_info[i].number_of_segments < 1 || 20828a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].number_of_segments > 13) 209503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab continue; 210503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 211503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i); 212dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t", 21328a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].code_rate); 214dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n", 21528a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].constellation); 21628a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t", 21728a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber); 218dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t", 21928a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber_error_count); 220dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n", 22128a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber_bit_count); 222dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t", 22328a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].pre_ber); 22428a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n", 22528a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ts_per); 226dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t", 22728a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].error_ts_packets); 228dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t", 22928a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].total_ts_packets); 230dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n", 23128a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ti_ldepth_i); 232503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 233dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "\tnumber_of_segments = %d\t", 23428a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].number_of_segments); 235dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n", 23628a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].tmcc_errors); 237503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 238503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 239503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data->stats_count = n; 240503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 241503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab wake_up(&debug_data->stats_queue); 242503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 243503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 244503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabvoid smsdvb_print_isdb_stats_ex(struct smsdvb_debugfs *debug_data, 245cf0e9cfcc70d8aaeabf19356f42041f8a5495301Mauro Carvalho Chehab struct sms_isdbt_stats_ex *p) 246503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 247503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab int i, n = 0; 248503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab char *buf; 249503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 250503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 251503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (debug_data->stats_count) { 252503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 253503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return; 254503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 255503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 256503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab buf = debug_data->stats_data; 257503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 258503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 259dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "statistics_type = %d\t", p->statistics_type); 2604cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 261dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "full_size = %d\n", p->full_size); 2624cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab 2634cce1f4eb29765def538e7c975dac73346a0d306Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 264dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_rf_locked = %d\t\t", p->is_rf_locked); 265503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 266dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_demod_locked = %d\t", p->is_demod_locked); 267503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 268dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "is_external_lna_on = %d\n", p->is_external_lna_on); 269503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 270503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "SNR = %d dB\t\t", p->SNR); 271503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 272503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab "RSSI = %d dBm\t\t", p->RSSI); 273503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 274dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "in_band_pwr = %d dBm\n", p->in_band_pwr); 275503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 276dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "carrier_offset = %d\t", p->carrier_offset); 277503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 278dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "bandwidth = %d\t\t", p->bandwidth); 279503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 280dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "frequency = %d Hz\n", p->frequency); 281503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 282dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "transmission_mode = %d\t", p->transmission_mode); 283503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 284dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "modem_state = %d\t\t", p->modem_state); 285503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 286dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "guard_interval = %d\n", p->guard_interval); 287503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 288dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "system_type = %d\t\t", p->system_type); 289503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 290dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "partial_reception = %d\t", p->partial_reception); 291503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 292dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "num_of_layers = %d\n", p->num_of_layers); 293dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "segment_number = %d\t", 294dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab p->segment_number); 295dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "tune_bw = %d\n", 296dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab p->tune_bw); 297503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 298503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab for (i = 0; i < 3; i++) { 29928a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab if (p->layer_info[i].number_of_segments < 1 || 30028a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].number_of_segments > 13) 301503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab continue; 302503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 303503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i); 304dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t", 30528a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].code_rate); 306dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n", 30728a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].constellation); 30828a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t", 30928a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber); 310dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t", 31128a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber_error_count); 312dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n", 31328a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ber_bit_count); 314dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t", 31528a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].pre_ber); 31628a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n", 31728a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ts_per); 318dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t", 31928a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].error_ts_packets); 320dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t", 32128a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].total_ts_packets); 322dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n", 32328a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].ti_ldepth_i); 324503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, 325dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab "\tnumber_of_segments = %d\t", 32628a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].number_of_segments); 327dfef84fc135832ad5c270758b6834fcb4bf448fcMauro Carvalho Chehab n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n", 32828a59df4d7cb8f749ba92ad304df4063ccf108fdMauro Carvalho Chehab p->layer_info[i].tmcc_errors); 329503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 330503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 331503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 332503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data->stats_count = n; 333503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 334503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 335503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab wake_up(&debug_data->stats_queue); 336503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 337503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 338503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstatic int smsdvb_stats_open(struct inode *inode, struct file *file) 339503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 340503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smsdvb_client_t *client = inode->i_private; 341503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smsdvb_debugfs *debug_data = client->debug_data; 342503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 343503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab kref_get(&debug_data->refcount); 344503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 345503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 346503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data->stats_count = 0; 347503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data->stats_was_read = false; 348503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 349503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 350503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab file->private_data = debug_data; 351503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 352503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return 0; 353503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 354503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 3556a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehabstatic void smsdvb_debugfs_data_release(struct kref *ref) 3566a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab{ 3576a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab struct smsdvb_debugfs *debug_data; 3586a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 3596a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab debug_data = container_of(ref, struct smsdvb_debugfs, refcount); 3606a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab kfree(debug_data); 3616a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab} 3626a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 363503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstatic int smsdvb_stats_wait_read(struct smsdvb_debugfs *debug_data) 364503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 365503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab int rc = 1; 366503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 367503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 368503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 369503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (debug_data->stats_was_read) 370503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab goto exit; 371503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 372503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab rc = debug_data->stats_count; 373503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 374503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabexit: 375503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 376503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return rc; 377503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 378503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 3796a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehabstatic unsigned int smsdvb_stats_poll(struct file *file, poll_table *wait) 380503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 381503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smsdvb_debugfs *debug_data = file->private_data; 3826a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab int rc; 383503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 3846a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab kref_get(&debug_data->refcount); 385503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 3866a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab poll_wait(file, &debug_data->stats_queue, wait); 3876a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 3886a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = smsdvb_stats_wait_read(debug_data); 3896a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (rc > 0) 3906a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = POLLIN | POLLRDNORM; 3916a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 3926a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); 393503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 394503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return rc; 395503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 396503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 3976a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehabstatic ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf, 3986a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab size_t nbytes, loff_t *ppos) 399503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 4006a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab int rc = 0, len; 4016a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab struct smsdvb_debugfs *debug_data = file->private_data; 402503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 4036a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab kref_get(&debug_data->refcount); 4046a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 4056a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (file->f_flags & O_NONBLOCK) { 4066a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = smsdvb_stats_wait_read(debug_data); 4076a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (!rc) { 4086a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = -EWOULDBLOCK; 4096a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab goto ret; 4106a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab } 4116a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab } else { 4126a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = wait_event_interruptible(debug_data->stats_queue, 4136a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab smsdvb_stats_wait_read(debug_data)); 4146a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (rc < 0) 4156a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab goto ret; 4166a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab } 4176a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 4186a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (debug_data->stats_was_read) { 4196a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = 0; /* EOF */ 4206a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab goto ret; 4216a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab } 4226a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 4236a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab len = debug_data->stats_count - *ppos; 4246a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (len >= 0) 4256a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = simple_read_from_buffer(user_buf, nbytes, ppos, 4266a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab debug_data->stats_data, len); 4276a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab else 4286a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab rc = 0; 4296a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab 4306a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab if (*ppos >= debug_data->stats_count) { 4316a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab spin_lock(&debug_data->lock); 4326a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab debug_data->stats_was_read = true; 4336a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab spin_unlock(&debug_data->lock); 4346a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab } 4356a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehabret: 4366a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); 4376a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab return rc; 438503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 439503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 440503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstatic int smsdvb_stats_release(struct inode *inode, struct file *file) 441503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 442503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smsdvb_debugfs *debug_data = file->private_data; 443503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 444503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock(&debug_data->lock); 4456a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab debug_data->stats_was_read = true; /* return EOF to read() */ 446503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_unlock(&debug_data->lock); 447503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab wake_up_interruptible_sync(&debug_data->stats_queue); 448503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 449503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab kref_put(&debug_data->refcount, smsdvb_debugfs_data_release); 450503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab file->private_data = NULL; 451503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 452503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return 0; 453503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 454503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 455503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabstatic const struct file_operations debugfs_stats_ops = { 456503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab .open = smsdvb_stats_open, 4576a28bd94f4d068b6de65517e52f52b6840603d0aMauro Carvalho Chehab .poll = smsdvb_stats_poll, 458503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab .read = smsdvb_stats_read, 459503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab .release = smsdvb_stats_release, 460503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab .llseek = generic_file_llseek, 461503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab}; 462503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 463503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab/* 464503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * Functions used by smsdvb, in order to create the interfaces 465503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab */ 466503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 467503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabint smsdvb_debugfs_create(struct smsdvb_client_t *client) 468503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 469503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smscore_device_t *coredev = client->coredev; 470503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct dentry *d; 471503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct smsdvb_debugfs *debug_data; 472503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 473503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (!smsdvb_debugfs_usb_root || !coredev->is_usb_device) 474503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return -ENODEV; 475503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 476503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->debugfs = debugfs_create_dir(coredev->devpath, 477503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab smsdvb_debugfs_usb_root); 478503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (IS_ERR_OR_NULL(client->debugfs)) { 479503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab pr_info("Unable to create debugfs %s directory.\n", 480503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab coredev->devpath); 481503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return -ENODEV; 482503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 483503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 484503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab d = debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs, 485503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client, &debugfs_stats_ops); 486503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (!d) { 487503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debugfs_remove(client->debugfs); 488503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return -ENOMEM; 489503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 490503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 491503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL); 492503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (!debug_data) 493503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return -ENOMEM; 494503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 495503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->debug_data = debug_data; 496503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_dvb_stats = smsdvb_print_dvb_stats; 497503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_isdb_stats = smsdvb_print_isdb_stats; 498503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_isdb_stats_ex = smsdvb_print_isdb_stats_ex; 499503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 500503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab init_waitqueue_head(&debug_data->stats_queue); 501503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab spin_lock_init(&debug_data->lock); 502503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab kref_init(&debug_data->refcount); 503503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 504503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return 0; 505503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 506503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 507503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabvoid smsdvb_debugfs_release(struct smsdvb_client_t *client) 508503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 509503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (!client->debugfs) 510503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return; 511503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 512503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_dvb_stats = NULL; 513503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_isdb_stats = NULL; 514503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->prt_isdb_stats_ex = NULL; 515503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 516503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab debugfs_remove_recursive(client->debugfs); 517503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab kref_put(&client->debug_data->refcount, smsdvb_debugfs_data_release); 518503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 519503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->debug_data = NULL; 520503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab client->debugfs = NULL; 521503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 522503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 523503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabint smsdvb_debugfs_register(void) 524503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 525503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab struct dentry *d; 526503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 527503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab /* 528503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * FIXME: This was written to debug Siano USB devices. So, it creates 529503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * the debugfs node under <debugfs>/usb. 530503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * A similar logic would be needed for Siano sdio devices, but, in that 531503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * case, usb_debug_root is not a good choice. 532503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * 533503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * Perhaps the right fix here would be to create another sysfs root 534503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * node for sdio-based boards, but this may need some logic at sdio 535503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab * subsystem. 536503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab */ 537503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab d = debugfs_create_dir("smsdvb", usb_debug_root); 538503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab if (IS_ERR_OR_NULL(d)) { 539503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab sms_err("Couldn't create sysfs node for smsdvb"); 540503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return PTR_ERR(d); 541503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } else { 542503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab smsdvb_debugfs_usb_root = d; 543503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab } 544503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab return 0; 545503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 546503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab 547503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehabvoid smsdvb_debugfs_unregister(void) 548503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab{ 54905ad412a63d66175f8f5a3d08894cf3f1d118cbcMauro Carvalho Chehab debugfs_remove_recursive(smsdvb_debugfs_usb_root); 550503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab smsdvb_debugfs_usb_root = NULL; 551503efe5cfc9fb9f67a6659c4ab39174b442876f3Mauro Carvalho Chehab} 552