summaryrefslogtreecommitdiff
path: root/drivers/media/common/siano/smsdvb-debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/common/siano/smsdvb-debugfs.c')
-rw-r--r--drivers/media/common/siano/smsdvb-debugfs.c401
1 files changed, 136 insertions, 265 deletions
diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c
index 1a8677ade391..d14ba271db50 100644
--- a/drivers/media/common/siano/smsdvb-debugfs.c
+++ b/drivers/media/common/siano/smsdvb-debugfs.c
@@ -1,21 +1,6 @@
-/***********************************************************************
- *
- * Copyright(c) 2013 Mauro Carvalho Chehab
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 2 of the License, or
- * (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- ***********************************************************************/
+// SPDX-License-Identifier: GPL-2.0+
+//
+// Copyright(c) 2013 Mauro Carvalho Chehab
#include "smscoreapi.h"
@@ -26,10 +11,10 @@
#include <linux/spinlock.h>
#include <linux/usb.h>
-#include "dmxdev.h"
-#include "dvbdev.h"
-#include "dvb_demux.h"
-#include "dvb_frontend.h"
+#include <media/dmxdev.h>
+#include <media/dvbdev.h>
+#include <media/dvb_demux.h>
+#include <media/dvb_frontend.h>
#include "smsdvb.h"
@@ -60,89 +45,48 @@ static void smsdvb_print_dvb_stats(struct smsdvb_debugfs *debug_data,
buf = debug_data->stats_data;
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_rf_locked = %d\n", p->is_rf_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_demod_locked = %d\n", p->is_demod_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_external_lna_on = %d\n", p->is_external_lna_on);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "SNR = %d\n", p->SNR);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "ber = %d\n", p->ber);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "FIB_CRC = %d\n", p->FIB_CRC);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "ts_per = %d\n", p->ts_per);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "MFER = %d\n", p->MFER);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "RSSI = %d\n", p->RSSI);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "in_band_pwr = %d\n", p->in_band_pwr);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "carrier_offset = %d\n", p->carrier_offset);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "modem_state = %d\n", p->modem_state);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "frequency = %d\n", p->frequency);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "bandwidth = %d\n", p->bandwidth);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "transmission_mode = %d\n", p->transmission_mode);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "modem_state = %d\n", p->modem_state);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "guard_interval = %d\n", p->guard_interval);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "code_rate = %d\n", p->code_rate);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "lp_code_rate = %d\n", p->lp_code_rate);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "hierarchy = %d\n", p->hierarchy);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "constellation = %d\n", p->constellation);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "burst_size = %d\n", p->burst_size);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "burst_duration = %d\n", p->burst_duration);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "burst_cycle_time = %d\n", p->burst_cycle_time);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "calc_burst_cycle_time = %d\n",
- p->calc_burst_cycle_time);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_rows = %d\n", p->num_of_rows);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_padd_cols = %d\n", p->num_of_padd_cols);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_punct_cols = %d\n", p->num_of_punct_cols);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "error_ts_packets = %d\n", p->error_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "total_ts_packets = %d\n", p->total_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_valid_mpe_tlbs = %d\n", p->num_of_valid_mpe_tlbs);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_invalid_mpe_tlbs = %d\n", p->num_of_invalid_mpe_tlbs);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_corrected_mpe_tlbs = %d\n", p->num_of_corrected_mpe_tlbs);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "ber_error_count = %d\n", p->ber_error_count);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "ber_bit_count = %d\n", p->ber_bit_count);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "pre_ber = %d\n", p->pre_ber);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "cell_id = %d\n", p->cell_id);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "dvbh_srv_ind_hp = %d\n", p->dvbh_srv_ind_hp);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "dvbh_srv_ind_lp = %d\n", p->dvbh_srv_ind_lp);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_mpe_received = %d\n", p->num_mpe_received);
+ n += sysfs_emit_at(buf, n, "is_rf_locked = %d\n", p->is_rf_locked);
+ n += sysfs_emit_at(buf, n, "is_demod_locked = %d\n", p->is_demod_locked);
+ n += sysfs_emit_at(buf, n, "is_external_lna_on = %d\n", p->is_external_lna_on);
+ n += sysfs_emit_at(buf, n, "SNR = %d\n", p->SNR);
+ n += sysfs_emit_at(buf, n, "ber = %d\n", p->ber);
+ n += sysfs_emit_at(buf, n, "FIB_CRC = %d\n", p->FIB_CRC);
+ n += sysfs_emit_at(buf, n, "ts_per = %d\n", p->ts_per);
+ n += sysfs_emit_at(buf, n, "MFER = %d\n", p->MFER);
+ n += sysfs_emit_at(buf, n, "RSSI = %d\n", p->RSSI);
+ n += sysfs_emit_at(buf, n, "in_band_pwr = %d\n", p->in_band_pwr);
+ n += sysfs_emit_at(buf, n, "carrier_offset = %d\n", p->carrier_offset);
+ n += sysfs_emit_at(buf, n, "modem_state = %d\n", p->modem_state);
+ n += sysfs_emit_at(buf, n, "frequency = %d\n", p->frequency);
+ n += sysfs_emit_at(buf, n, "bandwidth = %d\n", p->bandwidth);
+ n += sysfs_emit_at(buf, n, "transmission_mode = %d\n", p->transmission_mode);
+ n += sysfs_emit_at(buf, n, "modem_state = %d\n", p->modem_state);
+ n += sysfs_emit_at(buf, n, "guard_interval = %d\n", p->guard_interval);
+ n += sysfs_emit_at(buf, n, "code_rate = %d\n", p->code_rate);
+ n += sysfs_emit_at(buf, n, "lp_code_rate = %d\n", p->lp_code_rate);
+ n += sysfs_emit_at(buf, n, "hierarchy = %d\n", p->hierarchy);
+ n += sysfs_emit_at(buf, n, "constellation = %d\n", p->constellation);
+ n += sysfs_emit_at(buf, n, "burst_size = %d\n", p->burst_size);
+ n += sysfs_emit_at(buf, n, "burst_duration = %d\n", p->burst_duration);
+ n += sysfs_emit_at(buf, n, "burst_cycle_time = %d\n", p->burst_cycle_time);
+ n += sysfs_emit_at(buf, n, "calc_burst_cycle_time = %d\n", p->calc_burst_cycle_time);
+ n += sysfs_emit_at(buf, n, "num_of_rows = %d\n", p->num_of_rows);
+ n += sysfs_emit_at(buf, n, "num_of_padd_cols = %d\n", p->num_of_padd_cols);
+ n += sysfs_emit_at(buf, n, "num_of_punct_cols = %d\n", p->num_of_punct_cols);
+ n += sysfs_emit_at(buf, n, "error_ts_packets = %d\n", p->error_ts_packets);
+ n += sysfs_emit_at(buf, n, "total_ts_packets = %d\n", p->total_ts_packets);
+ n += sysfs_emit_at(buf, n, "num_of_valid_mpe_tlbs = %d\n", p->num_of_valid_mpe_tlbs);
+ n += sysfs_emit_at(buf, n, "num_of_invalid_mpe_tlbs = %d\n", p->num_of_invalid_mpe_tlbs);
+ n += sysfs_emit_at(buf, n, "num_of_corrected_mpe_tlbs = %d\n",
+ p->num_of_corrected_mpe_tlbs);
+ n += sysfs_emit_at(buf, n, "ber_error_count = %d\n", p->ber_error_count);
+ n += sysfs_emit_at(buf, n, "ber_bit_count = %d\n", p->ber_bit_count);
+ n += sysfs_emit_at(buf, n, "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors);
+ n += sysfs_emit_at(buf, n, "pre_ber = %d\n", p->pre_ber);
+ n += sysfs_emit_at(buf, n, "cell_id = %d\n", p->cell_id);
+ n += sysfs_emit_at(buf, n, "dvbh_srv_ind_hp = %d\n", p->dvbh_srv_ind_hp);
+ n += sysfs_emit_at(buf, n, "dvbh_srv_ind_lp = %d\n", p->dvbh_srv_ind_lp);
+ n += sysfs_emit_at(buf, n, "num_mpe_received = %d\n", p->num_mpe_received);
debug_data->stats_count = n;
spin_unlock(&debug_data->lock);
@@ -163,75 +107,49 @@ static void smsdvb_print_isdb_stats(struct smsdvb_debugfs *debug_data,
buf = debug_data->stats_data;
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "statistics_type = %d\t", p->statistics_type);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "full_size = %d\n", p->full_size);
-
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_rf_locked = %d\t\t", p->is_rf_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_demod_locked = %d\t", p->is_demod_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_external_lna_on = %d\n", p->is_external_lna_on);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "SNR = %d dB\t\t", p->SNR);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "RSSI = %d dBm\t\t", p->RSSI);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "in_band_pwr = %d dBm\n", p->in_band_pwr);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "carrier_offset = %d\t", p->carrier_offset);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "bandwidth = %d\t\t", p->bandwidth);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "frequency = %d Hz\n", p->frequency);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "transmission_mode = %d\t", p->transmission_mode);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "modem_state = %d\t\t", p->modem_state);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "guard_interval = %d\n", p->guard_interval);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "system_type = %d\t\t", p->system_type);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "partial_reception = %d\t", p->partial_reception);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_layers = %d\n", p->num_of_layers);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors);
+ n += sysfs_emit_at(buf, n, "statistics_type = %d\t", p->statistics_type);
+ n += sysfs_emit_at(buf, n, "full_size = %d\n", p->full_size);
+
+ n += sysfs_emit_at(buf, n, "is_rf_locked = %d\t\t", p->is_rf_locked);
+ n += sysfs_emit_at(buf, n, "is_demod_locked = %d\t", p->is_demod_locked);
+ n += sysfs_emit_at(buf, n, "is_external_lna_on = %d\n", p->is_external_lna_on);
+ n += sysfs_emit_at(buf, n, "SNR = %d dB\t\t", p->SNR);
+ n += sysfs_emit_at(buf, n, "RSSI = %d dBm\t\t", p->RSSI);
+ n += sysfs_emit_at(buf, n, "in_band_pwr = %d dBm\n", p->in_band_pwr);
+ n += sysfs_emit_at(buf, n, "carrier_offset = %d\t", p->carrier_offset);
+ n += sysfs_emit_at(buf, n, "bandwidth = %d\t\t", p->bandwidth);
+ n += sysfs_emit_at(buf, n, "frequency = %d Hz\n", p->frequency);
+ n += sysfs_emit_at(buf, n, "transmission_mode = %d\t", p->transmission_mode);
+ n += sysfs_emit_at(buf, n, "modem_state = %d\t\t", p->modem_state);
+ n += sysfs_emit_at(buf, n, "guard_interval = %d\n", p->guard_interval);
+ n += sysfs_emit_at(buf, n, "system_type = %d\t\t", p->system_type);
+ n += sysfs_emit_at(buf, n, "partial_reception = %d\t", p->partial_reception);
+ n += sysfs_emit_at(buf, n, "num_of_layers = %d\n", p->num_of_layers);
+ n += sysfs_emit_at(buf, n, "sms_to_host_tx_errors = %d\n", p->sms_to_host_tx_errors);
for (i = 0; i < 3; i++) {
if (p->layer_info[i].number_of_segments < 1 ||
p->layer_info[i].number_of_segments > 13)
continue;
- n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t",
- p->layer_info[i].code_rate);
- n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n",
- p->layer_info[i].constellation);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t",
- p->layer_info[i].ber);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t",
- p->layer_info[i].ber_error_count);
- n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n",
- p->layer_info[i].ber_bit_count);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t",
- p->layer_info[i].pre_ber);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n",
- p->layer_info[i].ts_per);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t",
- p->layer_info[i].error_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t",
- p->layer_info[i].total_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n",
- p->layer_info[i].ti_ldepth_i);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "\tnumber_of_segments = %d\t",
- p->layer_info[i].number_of_segments);
- n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n",
- p->layer_info[i].tmcc_errors);
+ n += sysfs_emit_at(buf, n, "\nLayer %d\n", i);
+ n += sysfs_emit_at(buf, n, "\tcode_rate = %d\t", p->layer_info[i].code_rate);
+ n += sysfs_emit_at(buf, n, "constellation = %d\n", p->layer_info[i].constellation);
+ n += sysfs_emit_at(buf, n, "\tber = %-5d\t", p->layer_info[i].ber);
+ n += sysfs_emit_at(buf, n, "\tber_error_count = %-5d\t",
+ p->layer_info[i].ber_error_count);
+ n += sysfs_emit_at(buf, n, "ber_bit_count = %-5d\n",
+ p->layer_info[i].ber_bit_count);
+ n += sysfs_emit_at(buf, n, "\tpre_ber = %-5d\t", p->layer_info[i].pre_ber);
+ n += sysfs_emit_at(buf, n, "\tts_per = %-5d\n", p->layer_info[i].ts_per);
+ n += sysfs_emit_at(buf, n, "\terror_ts_packets = %-5d\t",
+ p->layer_info[i].error_ts_packets);
+ n += sysfs_emit_at(buf, n, "total_ts_packets = %-5d\t",
+ p->layer_info[i].total_ts_packets);
+ n += sysfs_emit_at(buf, n, "ti_ldepth_i = %d\n", p->layer_info[i].ti_ldepth_i);
+ n += sysfs_emit_at(buf, n, "\tnumber_of_segments = %d\t",
+ p->layer_info[i].number_of_segments);
+ n += sysfs_emit_at(buf, n, "tmcc_errors = %d\n", p->layer_info[i].tmcc_errors);
}
debug_data->stats_count = n;
@@ -253,77 +171,50 @@ static void smsdvb_print_isdb_stats_ex(struct smsdvb_debugfs *debug_data,
buf = debug_data->stats_data;
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "statistics_type = %d\t", p->statistics_type);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "full_size = %d\n", p->full_size);
-
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_rf_locked = %d\t\t", p->is_rf_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_demod_locked = %d\t", p->is_demod_locked);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "is_external_lna_on = %d\n", p->is_external_lna_on);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "SNR = %d dB\t\t", p->SNR);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "RSSI = %d dBm\t\t", p->RSSI);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "in_band_pwr = %d dBm\n", p->in_band_pwr);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "carrier_offset = %d\t", p->carrier_offset);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "bandwidth = %d\t\t", p->bandwidth);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "frequency = %d Hz\n", p->frequency);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "transmission_mode = %d\t", p->transmission_mode);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "modem_state = %d\t\t", p->modem_state);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "guard_interval = %d\n", p->guard_interval);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "system_type = %d\t\t", p->system_type);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "partial_reception = %d\t", p->partial_reception);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "num_of_layers = %d\n", p->num_of_layers);
- n += snprintf(&buf[n], PAGE_SIZE - n, "segment_number = %d\t",
- p->segment_number);
- n += snprintf(&buf[n], PAGE_SIZE - n, "tune_bw = %d\n",
- p->tune_bw);
+ n += sysfs_emit_at(buf, n, "statistics_type = %d\t", p->statistics_type);
+ n += sysfs_emit_at(buf, n, "full_size = %d\n", p->full_size);
+
+ n += sysfs_emit_at(buf, n, "is_rf_locked = %d\t\t", p->is_rf_locked);
+ n += sysfs_emit_at(buf, n, "is_demod_locked = %d\t", p->is_demod_locked);
+ n += sysfs_emit_at(buf, n, "is_external_lna_on = %d\n", p->is_external_lna_on);
+ n += sysfs_emit_at(buf, n, "SNR = %d dB\t\t", p->SNR);
+ n += sysfs_emit_at(buf, n, "RSSI = %d dBm\t\t", p->RSSI);
+ n += sysfs_emit_at(buf, n, "in_band_pwr = %d dBm\n", p->in_band_pwr);
+ n += sysfs_emit_at(buf, n, "carrier_offset = %d\t", p->carrier_offset);
+ n += sysfs_emit_at(buf, n, "bandwidth = %d\t\t", p->bandwidth);
+ n += sysfs_emit_at(buf, n, "frequency = %d Hz\n", p->frequency);
+ n += sysfs_emit_at(buf, n, "transmission_mode = %d\t", p->transmission_mode);
+ n += sysfs_emit_at(buf, n, "modem_state = %d\t\t", p->modem_state);
+ n += sysfs_emit_at(buf, n, "guard_interval = %d\n", p->guard_interval);
+ n += sysfs_emit_at(buf, n, "system_type = %d\t\t", p->system_type);
+ n += sysfs_emit_at(buf, n, "partial_reception = %d\t", p->partial_reception);
+ n += sysfs_emit_at(buf, n, "num_of_layers = %d\n", p->num_of_layers);
+ n += sysfs_emit_at(buf, n, "segment_number = %d\t", p->segment_number);
+ n += sysfs_emit_at(buf, n, "tune_bw = %d\n", p->tune_bw);
for (i = 0; i < 3; i++) {
if (p->layer_info[i].number_of_segments < 1 ||
p->layer_info[i].number_of_segments > 13)
continue;
- n += snprintf(&buf[n], PAGE_SIZE - n, "\nLayer %d\n", i);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tcode_rate = %d\t",
- p->layer_info[i].code_rate);
- n += snprintf(&buf[n], PAGE_SIZE - n, "constellation = %d\n",
- p->layer_info[i].constellation);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tber = %-5d\t",
- p->layer_info[i].ber);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tber_error_count = %-5d\t",
- p->layer_info[i].ber_error_count);
- n += snprintf(&buf[n], PAGE_SIZE - n, "ber_bit_count = %-5d\n",
- p->layer_info[i].ber_bit_count);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tpre_ber = %-5d\t",
- p->layer_info[i].pre_ber);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\tts_per = %-5d\n",
- p->layer_info[i].ts_per);
- n += snprintf(&buf[n], PAGE_SIZE - n, "\terror_ts_packets = %-5d\t",
- p->layer_info[i].error_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n, "total_ts_packets = %-5d\t",
- p->layer_info[i].total_ts_packets);
- n += snprintf(&buf[n], PAGE_SIZE - n, "ti_ldepth_i = %d\n",
- p->layer_info[i].ti_ldepth_i);
- n += snprintf(&buf[n], PAGE_SIZE - n,
- "\tnumber_of_segments = %d\t",
- p->layer_info[i].number_of_segments);
- n += snprintf(&buf[n], PAGE_SIZE - n, "tmcc_errors = %d\n",
- p->layer_info[i].tmcc_errors);
+ n += sysfs_emit_at(buf, n, "\nLayer %d\n", i);
+ n += sysfs_emit_at(buf, n, "\tcode_rate = %d\t", p->layer_info[i].code_rate);
+ n += sysfs_emit_at(buf, n, "constellation = %d\n", p->layer_info[i].constellation);
+ n += sysfs_emit_at(buf, n, "\tber = %-5d\t", p->layer_info[i].ber);
+ n += sysfs_emit_at(buf, n, "\tber_error_count = %-5d\t",
+ p->layer_info[i].ber_error_count);
+ n += sysfs_emit_at(buf, n, "ber_bit_count = %-5d\n",
+ p->layer_info[i].ber_bit_count);
+ n += sysfs_emit_at(buf, n, "\tpre_ber = %-5d\t", p->layer_info[i].pre_ber);
+ n += sysfs_emit_at(buf, n, "\tts_per = %-5d\n", p->layer_info[i].ts_per);
+ n += sysfs_emit_at(buf, n, "\terror_ts_packets = %-5d\t",
+ p->layer_info[i].error_ts_packets);
+ n += sysfs_emit_at(buf, n, "total_ts_packets = %-5d\t",
+ p->layer_info[i].total_ts_packets);
+ n += sysfs_emit_at(buf, n, "ti_ldepth_i = %d\n", p->layer_info[i].ti_ldepth_i);
+ n += sysfs_emit_at(buf, n, "\tnumber_of_segments = %d\t",
+ p->layer_info[i].number_of_segments);
+ n += sysfs_emit_at(buf, n, "tmcc_errors = %d\n", p->layer_info[i].tmcc_errors);
}
@@ -374,7 +265,7 @@ exit:
return rc;
}
-static unsigned int smsdvb_stats_poll(struct file *file, poll_table *wait)
+static __poll_t smsdvb_stats_poll(struct file *file, poll_table *wait)
{
struct smsdvb_debugfs *debug_data = file->private_data;
int rc;
@@ -384,12 +275,9 @@ static unsigned int smsdvb_stats_poll(struct file *file, poll_table *wait)
poll_wait(file, &debug_data->stats_queue, wait);
rc = smsdvb_stats_wait_read(debug_data);
- if (rc > 0)
- rc = POLLIN | POLLRDNORM;
-
kref_put(&debug_data->refcount, smsdvb_debugfs_data_release);
- return rc;
+ return rc > 0 ? EPOLLIN | EPOLLRDNORM : 0;
}
static ssize_t smsdvb_stats_read(struct file *file, char __user *user_buf,
@@ -465,31 +353,21 @@ static const struct file_operations debugfs_stats_ops = {
int smsdvb_debugfs_create(struct smsdvb_client_t *client)
{
struct smscore_device_t *coredev = client->coredev;
- struct dentry *d;
struct smsdvb_debugfs *debug_data;
if (!smsdvb_debugfs_usb_root || !coredev->is_usb_device)
return -ENODEV;
- client->debugfs = debugfs_create_dir(coredev->devpath,
- smsdvb_debugfs_usb_root);
- if (IS_ERR_OR_NULL(client->debugfs)) {
- pr_info("Unable to create debugfs %s directory.\n",
- coredev->devpath);
- return -ENODEV;
- }
-
- d = debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs,
- client, &debugfs_stats_ops);
- if (!d) {
- debugfs_remove(client->debugfs);
- return -ENOMEM;
- }
-
debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL);
if (!debug_data)
return -ENOMEM;
+ client->debugfs = debugfs_create_dir(coredev->devpath,
+ smsdvb_debugfs_usb_root);
+
+ debugfs_create_file("stats", S_IRUGO | S_IWUSR, client->debugfs,
+ client, &debugfs_stats_ops);
+
client->debug_data = debug_data;
client->prt_dvb_stats = smsdvb_print_dvb_stats;
client->prt_isdb_stats = smsdvb_print_isdb_stats;
@@ -518,10 +396,8 @@ void smsdvb_debugfs_release(struct smsdvb_client_t *client)
client->debugfs = NULL;
}
-int smsdvb_debugfs_register(void)
+void smsdvb_debugfs_register(void)
{
- struct dentry *d;
-
/*
* FIXME: This was written to debug Siano USB devices. So, it creates
* the debugfs node under <debugfs>/usb.
@@ -532,18 +408,13 @@ int smsdvb_debugfs_register(void)
* node for sdio-based boards, but this may need some logic at sdio
* subsystem.
*/
- d = debugfs_create_dir("smsdvb", usb_debug_root);
- if (IS_ERR_OR_NULL(d)) {
- pr_err("Couldn't create sysfs node for smsdvb\n");
- return PTR_ERR(d);
- } else {
- smsdvb_debugfs_usb_root = d;
- }
- return 0;
+ smsdvb_debugfs_usb_root = debugfs_create_dir("smsdvb", usb_debug_root);
}
void smsdvb_debugfs_unregister(void)
{
+ if (!smsdvb_debugfs_usb_root)
+ return;
debugfs_remove_recursive(smsdvb_debugfs_usb_root);
smsdvb_debugfs_usb_root = NULL;
}