提交 294a08e4 编写于 作者: D David Howells 提交者: Al Viro

csr: Don't use create_proc_read_entry()

Don't use create_proc_read_entry() as that is deprecated, but rather use
proc_create_data() and seq_file instead.
Signed-off-by: NDavid Howells <dhowells@redhat.com>
cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
cc: Randy Dunlap <rdunlap@xenotime.net>
cc: Priit Laes <plaes@plaes.org>
cc: devel@driverdev.osuosl.org
cc: Mikko Virkkilä <mikko.virkkila@bluegiga.com>
cc: Lauri Hintsala <Lauri.Hintsala@bluegiga.com>
cc: Riku Mettälä <riku.mettala@bluegiga.com>
cc: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 1f817b86
...@@ -24,10 +24,50 @@ ...@@ -24,10 +24,50 @@
* *
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/seq_file.h>
#include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_card.h" #include "csr_wifi_hip_card.h"
static void unifi_print_unsafe_sdio_status(card_t *card, struct seq_file *m)
{
#ifdef CSR_UNSAFE_SDIO_ACCESS
s32 iostate;
CsrResult r;
static const char *const states[] = {
"AWAKE", "DROWSY", "TORPID"
};
#define SHARED_READ_RETRY_LIMIT 10
u8 b;
seq_printf(m, "Host State: %s\n", states[card->host_state]);
r = unifi_check_io_status(card, &iostate);
if (iostate == 1) {
seq_puts(m, remaining, "I/O Check: F1 disabled\n");
} else {
if (iostate == 1) {
seq_puts(m, "I/O Check: pending interrupt\n");
seq_printf(m, "BH reason interrupt = %d\n", card->bh_reason_unifi);
seq_printf(m, "BH reason host = %d\n", card->bh_reason_host);
for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) {
r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
if (r == CSR_RESULT_SUCCESS && !(b & 0x80)) {
seq_printf(m, "fhsr: %u (driver thinks is %u)\n",
b, card->from_host_signals_r);
break;
}
}
iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
seq_printf(m, "thsw: %u (driver thinks is %u)\n",
iostate, card->to_host_signals_w);
}
#endif
}
/* /*
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* unifi_print_status * unifi_print_status
...@@ -41,228 +81,93 @@ ...@@ -41,228 +81,93 @@
* None. * None.
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
s32 unifi_print_status(card_t *card, char *str, s32 *remain) s32 unifi_print_status(card_t *card, struct seq_file *m)
{ {
char *p = str; sdio_config_data_t *cfg;
sdio_config_data_t *cfg; u16 i, n;
u16 i, n;
s32 remaining = *remain; i = n = 0;
s32 written; seq_printf(m, "Chip ID %u\n", card->chip_id);
#ifdef CSR_UNSAFE_SDIO_ACCESS seq_printf(m, "Chip Version %04X\n", card->chip_version);
s32 iostate; seq_printf(m, "HIP v%u.%u\n",
CsrResult r; (card->config_data.version >> 8) & 0xFF,
static const char *const states[] = { card->config_data.version & 0xFF);
"AWAKE", "DROWSY", "TORPID" seq_printf(m, "Build %u: %s\n", card->build_id, card->build_id_string);
};
#define SHARED_READ_RETRY_LIMIT 10 cfg = &card->config_data;
u8 b;
#endif seq_printf(m, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset);
seq_printf(m, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle);
if (remaining <= 0) seq_printf(m, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle);
{ seq_printf(m, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags);
return 0; seq_printf(m, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags);
} seq_printf(m, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots);
seq_printf(m, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots);
i = n = 0; seq_printf(m, "data_slot_size %u\n", cfg->data_slot_size);
written = scnprintf(p, remaining, "Chip ID %u\n",
(u16)card->chip_id); /* Added by protocol version 0x0001 */
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "overlay_size %u\n", cfg->overlay_size);
written = scnprintf(p, remaining, "Chip Version %04X\n",
card->chip_version); /* Added by protocol version 0x0300 */
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "data_slot_round %u\n", cfg->data_slot_round);
written = scnprintf(p, remaining, "HIP v%u.%u\n", seq_printf(m, "sig_frag_size %u\n", cfg->sig_frag_size);
(card->config_data.version >> 8) & 0xFF,
card->config_data.version & 0xFF); /* Added by protocol version 0x0300 */
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "tohost_sig_pad %u\n", cfg->tohost_signal_padding);
written = scnprintf(p, remaining, "Build %u: %s\n",
card->build_id, card->build_id_string); seq_puts(m, "\nInternal state:\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
seq_printf(m, "Last PHY PANIC: %04x:%04x\n",
cfg = &card->config_data; card->last_phy_panic_code, card->last_phy_panic_arg);
seq_printf(m, "Last MAC PANIC: %04x:%04x\n",
written = scnprintf(p, remaining, "sdio ctrl offset %u\n", card->last_mac_panic_code, card->last_mac_panic_arg);
cfg->sdio_ctrl_offset);
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "fhsr: %hu\n", (u16)card->from_host_signals_r);
written = scnprintf(p, remaining, "fromhost sigbuf handle %u\n", seq_printf(m, "fhsw: %hu\n", (u16)card->from_host_signals_w);
cfg->fromhost_sigbuf_handle); seq_printf(m, "thsr: %hu\n", (u16)card->to_host_signals_r);
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "thsw: %hu\n", (u16)card->to_host_signals_w);
written = scnprintf(p, remaining, "tohost_sigbuf_handle %u\n", seq_printf(m, "fh buffer contains: %d signals, %td bytes\n",
cfg->tohost_sigbuf_handle); card->fh_buffer.count,
UNIFI_SNPRINTF_RET(p, remaining, written); card->fh_buffer.ptr - card->fh_buffer.buf);
written = scnprintf(p, remaining, "num_fromhost_sig_frags %u\n",
cfg->num_fromhost_sig_frags); seq_puts(m, "paused: ");
UNIFI_SNPRINTF_RET(p, remaining, written); for (i = 0; i < ARRAY_SIZE(card->tx_q_paused_flag); i++)
written = scnprintf(p, remaining, "num_tohost_sig_frags %u\n", seq_printf(m, card->tx_q_paused_flag[i] ? "1" : "0");
cfg->num_tohost_sig_frags); seq_putc(m, '\n');
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "num_fromhost_data_slots %u\n", seq_printf(m, "fh command q: %u waiting, %u free of %u:\n",
cfg->num_fromhost_data_slots); CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
UNIFI_SNPRINTF_RET(p, remaining, written); CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
written = scnprintf(p, remaining, "num_tohost_data_slots %u\n", UNIFI_SOFT_COMMAND_Q_LENGTH);
cfg->num_tohost_data_slots);
UNIFI_SNPRINTF_RET(p, remaining, written); for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
written = scnprintf(p, remaining, "data_slot_size %u\n", seq_printf(m, "fh traffic q[%u]: %u waiting, %u free of %u:\n",
cfg->data_slot_size); i,
UNIFI_SNPRINTF_RET(p, remaining, written); CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
/* Added by protocol version 0x0001 */ UNIFI_SOFT_TRAFFIC_Q_LENGTH);
written = scnprintf(p, remaining, "overlay_size %u\n",
(u16)cfg->overlay_size); seq_printf(m, "fh data slots free: %u\n",
UNIFI_SNPRINTF_RET(p, remaining, written); card->from_host_data ? CardGetFreeFromHostDataSlots(card) : 0);
/* Added by protocol version 0x0300 */ seq_puts(m, "From host data slots:");
written = scnprintf(p, remaining, "data_slot_round %u\n", n = card->config_data.num_fromhost_data_slots;
cfg->data_slot_round); for (i = 0; i < n && card->from_host_data; i++)
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, " %hu", (u16)card->from_host_data[i].bd.data_length);
written = scnprintf(p, remaining, "sig_frag_size %u\n", seq_putc(m, '\n');
cfg->sig_frag_size);
UNIFI_SNPRINTF_RET(p, remaining, written); seq_puts(m, "To host data slots:");
n = card->config_data.num_tohost_data_slots;
/* Added by protocol version 0x0300 */ for (i = 0; i < n && card->to_host_data; i++)
written = scnprintf(p, remaining, "tohost_sig_pad %u\n", seq_printf(m, " %hu", (u16)card->to_host_data[i].data_length);
cfg->tohost_signal_padding); seq_putc(m, '\n');
UNIFI_SNPRINTF_RET(p, remaining, written);
unifi_print_unsafe_sdio_status(card, m);
written = scnprintf(p, remaining, "\nInternal state:\n");
UNIFI_SNPRINTF_RET(p, remaining, written); seq_puts(m, "\nStats:\n");
seq_printf(m, "Total SDIO bytes: R=%u W=%u\n",
written = scnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n", card->sdio_bytes_read, card->sdio_bytes_written);
card->last_phy_panic_code, card->last_phy_panic_arg);
UNIFI_SNPRINTF_RET(p, remaining, written); seq_printf(m, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq);
written = scnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n", return 0;
card->last_mac_panic_code, card->last_mac_panic_arg); }
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "fhsr: %u\n",
(u16)card->from_host_signals_r);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "fhsw: %u\n",
(u16)card->from_host_signals_w);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "thsr: %u\n",
(u16)card->to_host_signals_r);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "thsw: %u\n",
(u16)card->to_host_signals_w);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining,
"fh buffer contains: %d signals, %td bytes\n",
card->fh_buffer.count,
card->fh_buffer.ptr - card->fh_buffer.buf);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "paused: ");
UNIFI_SNPRINTF_RET(p, remaining, written);
for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++)
{
written = scnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0");
UNIFI_SNPRINTF_RET(p, remaining, written);
}
written = scnprintf(p, remaining, "\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining,
"fh command q: %u waiting, %u free of %u:\n",
CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
UNIFI_SOFT_COMMAND_Q_LENGTH);
UNIFI_SNPRINTF_RET(p, remaining, written);
for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
{
written = scnprintf(p, remaining,
"fh traffic q[%u]: %u waiting, %u free of %u:\n",
i,
CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
UNIFI_SOFT_TRAFFIC_Q_LENGTH);
UNIFI_SNPRINTF_RET(p, remaining, written);
}
written = scnprintf(p, remaining, "fh data slots free: %u\n",
card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "From host data slots:");
UNIFI_SNPRINTF_RET(p, remaining, written);
n = card->config_data.num_fromhost_data_slots;
for (i = 0; i < n && card->from_host_data; i++)
{
written = scnprintf(p, remaining, " %u",
(u16)card->from_host_data[i].bd.data_length);
UNIFI_SNPRINTF_RET(p, remaining, written);
}
written = scnprintf(p, remaining, "\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "To host data slots:");
UNIFI_SNPRINTF_RET(p, remaining, written);
n = card->config_data.num_tohost_data_slots;
for (i = 0; i < n && card->to_host_data; i++)
{
written = scnprintf(p, remaining, " %u",
(u16)card->to_host_data[i].data_length);
UNIFI_SNPRINTF_RET(p, remaining, written);
}
written = scnprintf(p, remaining, "\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
#ifdef CSR_UNSAFE_SDIO_ACCESS
written = scnprintf(p, remaining, "Host State: %s\n", states[card->host_state]);
UNIFI_SNPRINTF_RET(p, remaining, written);
r = unifi_check_io_status(card, &iostate);
if (iostate == 1)
{
written = scnprintf(p, remaining, "I/O Check: F1 disabled\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
}
else
{
if (iostate == 1)
{
written = scnprintf(p, remaining, "I/O Check: pending interrupt\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
}
written = scnprintf(p, remaining, "BH reason interrupt = %d\n",
card->bh_reason_unifi);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "BH reason host = %d\n",
card->bh_reason_host);
UNIFI_SNPRINTF_RET(p, remaining, written);
for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++)
{
r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80)))
{
written = scnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n",
b, card->from_host_signals_r);
UNIFI_SNPRINTF_RET(p, remaining, written);
break;
}
}
iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
written = scnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n",
iostate, card->to_host_signals_w);
UNIFI_SNPRINTF_RET(p, remaining, written);
}
#endif
written = scnprintf(p, remaining, "\nStats:\n");
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "Total SDIO bytes: R=%u W=%u\n",
card->sdio_bytes_read, card->sdio_bytes_written);
UNIFI_SNPRINTF_RET(p, remaining, written);
written = scnprintf(p, remaining, "Interrupts generated on card: %u\n",
card->unifi_interrupt_seq);
UNIFI_SNPRINTF_RET(p, remaining, written);
*remain = remaining;
return (p - str);
} /* unifi_print_status() */
...@@ -47,21 +47,6 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn); ...@@ -47,21 +47,6 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
* This is used in the linux /proc interface and might be useful * This is used in the linux /proc interface and might be useful
* in other systems. * in other systems.
*/ */
s32 unifi_print_status(card_t *card, char *str, s32 *remain); s32 unifi_print_status(card_t *card, struct seq_file *m);
#define UNIFI_SNPRINTF_RET(buf_p, remain, written) \
do { \
if (written >= remain) { \
if (remain >= 2) { \
buf_p[remain - 2] = '\n'; \
buf_p[remain - 1] = 0; \
} \
buf_p += remain; \
remain = 0; \
} else if (written > 0) { \
buf_p += written; \
remain -= written; \
} \
} while (0)
#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */ #endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "csr_wifi_hip_unifi.h" #include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_unifiversion.h" #include "csr_wifi_hip_unifiversion.h"
...@@ -76,9 +77,28 @@ DEFINE_SEMAPHORE(Unifi_instance_mutex); ...@@ -76,9 +77,28 @@ DEFINE_SEMAPHORE(Unifi_instance_mutex);
*/ */
DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq); DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq);
#ifdef CONFIG_PROC_FS
/*
* seq_file wrappers for procfile show routines.
*/
static int uf_proc_show(struct seq_file *m, void *v);
#define UNIFI_DEBUG_TXT_BUFFER (8 * 1024)
static int uf_proc_open(struct inode *inode, struct file *file)
{
return single_open_size(file, uf_proc_show, PDE_DATA(inode),
UNIFI_DEBUG_TXT_BUFFER);
}
static const struct file_operations uf_proc_fops = {
.open = uf_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int uf_read_proc(char *page, char **start, off_t offset, int count, #endif /* CONFIG_PROC_FS */
int *eof, void *data);
#ifdef CSR_WIFI_RX_PATH_SPLIT #ifdef CSR_WIFI_RX_PATH_SPLIT
...@@ -327,8 +347,8 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev) ...@@ -327,8 +347,8 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev)
* The following complex casting is in place in order to eliminate 64-bit compilation warning * The following complex casting is in place in order to eliminate 64-bit compilation warning
* "cast to/from pointer from/to integer of different size" * "cast to/from pointer from/to integer of different size"
*/ */
if (!create_proc_read_entry(priv->proc_entry_name, 0, 0, if (!proc_create_data(priv->proc_entry_name, 0, NULL,
uf_read_proc, (void *)(long)priv->instance)) &uf_proc_fops, (void *)(long)priv->instance))
{ {
unifi_error(priv, "unifi: can't create /proc/driver/unifi\n"); unifi_error(priv, "unifi: can't create /proc/driver/unifi\n");
} }
...@@ -827,7 +847,7 @@ uf_put_instance(int inst) ...@@ -827,7 +847,7 @@ uf_put_instance(int inst)
/* /*
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
* uf_read_proc * uf_proc_show
* *
* Read method for driver node in /proc/driver/unifi0 * Read method for driver node in /proc/driver/unifi0
* *
...@@ -844,107 +864,54 @@ uf_put_instance(int inst) ...@@ -844,107 +864,54 @@ uf_put_instance(int inst)
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
*/ */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
static int static int uf_proc_show(struct seq_file *m, void *v)
uf_read_proc(char *page, char **start, off_t offset, int count,
int *eof, void *data)
{ {
#define UNIFI_DEBUG_TXT_BUFFER 8*1024 unifi_priv_t *priv;
unifi_priv_t *priv; int i;
int actual_amount_to_copy;
char *p, *orig_p; /*
s32 remain = UNIFI_DEBUG_TXT_BUFFER; * The following complex casting is in place in order to eliminate
s32 written; * 64-bit compilation warning "cast to/from pointer from/to integer of
int i; * different size"
*/
/* priv = uf_find_instance((long)m->private);
* The following complex casting is in place in order to eliminate 64-bit compilation warning if (!priv)
* "cast to/from pointer from/to integer of different size" return 0;
*/
priv = uf_find_instance((int)(long)data); seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
if (!priv) { CSR_WIFI_VERSION, __DATE__, __TIME__);
return 0;
}
p = kmalloc( UNIFI_DEBUG_TXT_BUFFER, GFP_KERNEL );
orig_p = p;
written = scnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n",
CSR_WIFI_VERSION, __DATE__, __TIME__);
UNIFI_SNPRINTF_RET(p, remain, written);
#ifdef CSR_SME_USERSPACE #ifdef CSR_SME_USERSPACE
written = scnprintf(p, remain, "SME: CSR userspace "); seq_puts(m, "SME: CSR userspace ");
UNIFI_SNPRINTF_RET(p, remain, written);
#ifdef CSR_SUPPORT_WEXT #ifdef CSR_SUPPORT_WEXT
written = scnprintf(p, remain, "with WEXT support\n"); seq_puts(m, "with WEXT support\n");
#else #else
written = scnprintf(p, remain, "\n"); seq_putc(m, '\n');
#endif /* CSR_SUPPORT_WEXT */ #endif /* CSR_SUPPORT_WEXT */
UNIFI_SNPRINTF_RET(p, remain, written);
#endif /* CSR_SME_USERSPACE */ #endif /* CSR_SME_USERSPACE */
#ifdef CSR_NATIVE_LINUX #ifdef CSR_NATIVE_LINUX
written = scnprintf(p, remain, "SME: native\n"); seq_puts(m, "SME: native\n");
UNIFI_SNPRINTF_RET(p, remain, written);
#endif #endif
#ifdef CSR_SUPPORT_SME #ifdef CSR_SUPPORT_SME
written = scnprintf(p, remain, seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
"Firmware (ROM) build:%u, Patch:%u\n", priv->card_info.fw_build,
priv->card_info.fw_build, priv->sme_versions.firmwarePatch);
priv->sme_versions.firmwarePatch);
UNIFI_SNPRINTF_RET(p, remain, written);
#endif #endif
p += unifi_print_status(priv->card, p, &remain);
written = scnprintf(p, remain, "Last dbg str: %s\n",
priv->last_debug_string);
UNIFI_SNPRINTF_RET(p, remain, written);
written = scnprintf(p, remain, "Last dbg16:");
UNIFI_SNPRINTF_RET(p, remain, written);
for (i = 0; i < 8; i++) {
written = scnprintf(p, remain, " %04X",
priv->last_debug_word16[i]);
UNIFI_SNPRINTF_RET(p, remain, written);
}
written = scnprintf(p, remain, "\n");
UNIFI_SNPRINTF_RET(p, remain, written);
written = scnprintf(p, remain, " ");
UNIFI_SNPRINTF_RET(p, remain, written);
for (; i < 16; i++) {
written = scnprintf(p, remain, " %04X",
priv->last_debug_word16[i]);
UNIFI_SNPRINTF_RET(p, remain, written);
}
written = scnprintf(p, remain, "\n");
UNIFI_SNPRINTF_RET(p, remain, written);
*start = page;
written = UNIFI_DEBUG_TXT_BUFFER - remain;
if( offset >= written )
{
*eof = 1;
kfree( orig_p );
return(0);
}
if( offset + count > written )
{
actual_amount_to_copy = written - offset;
*eof = 1;
}
else
{
actual_amount_to_copy = count;
}
memcpy( page, &(orig_p[offset]), actual_amount_to_copy ); unifi_print_status(priv->card, m);
kfree( orig_p ); seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string);
return( actual_amount_to_copy ); seq_puts(m, "Last dbg16:");
} /* uf_read_proc() */ for (i = 0; i < 8; i++)
seq_printf(m, " %04X", priv->last_debug_word16[i]);
seq_putc(m, '\n');
seq_puts(m, " ");
for (; i < 16; i++)
seq_printf(m, " %04X", priv->last_debug_word16[i]);
seq_putc(m, '\n');
return 0;
}
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册