Commit 294a08e4 authored by David Howells's avatar David Howells Committed by 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: default avatarDavid 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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 1f817b86
This diff is collapsed.
......@@ -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
* in other systems.
*/
s32 unifi_print_status(card_t *card, char *str, s32 *remain);
#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)
s32 unifi_print_status(card_t *card, struct seq_file *m);
#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
......@@ -31,6 +31,7 @@
* ---------------------------------------------------------------------------
*/
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_unifiversion.h"
......@@ -76,9 +77,28 @@ DEFINE_SEMAPHORE(Unifi_instance_mutex);
*/
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,
int *eof, void *data);
#endif /* CONFIG_PROC_FS */
#ifdef CSR_WIFI_RX_PATH_SPLIT
......@@ -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
* "cast to/from pointer from/to integer of different size"
*/
if (!create_proc_read_entry(priv->proc_entry_name, 0, 0,
uf_read_proc, (void *)(long)priv->instance))
if (!proc_create_data(priv->proc_entry_name, 0, NULL,
&uf_proc_fops, (void *)(long)priv->instance))
{
unifi_error(priv, "unifi: can't create /proc/driver/unifi\n");
}
......@@ -827,7 +847,7 @@ uf_put_instance(int inst)
/*
* ---------------------------------------------------------------------------
* uf_read_proc
* uf_proc_show
*
* Read method for driver node in /proc/driver/unifi0
*
......@@ -844,107 +864,54 @@ uf_put_instance(int inst)
* ---------------------------------------------------------------------------
*/
#ifdef CONFIG_PROC_FS
static int
uf_read_proc(char *page, char **start, off_t offset, int count,
int *eof, void *data)
static int uf_proc_show(struct seq_file *m, void *v)
{
#define UNIFI_DEBUG_TXT_BUFFER 8*1024
unifi_priv_t *priv;
int actual_amount_to_copy;
char *p, *orig_p;
s32 remain = UNIFI_DEBUG_TXT_BUFFER;
s32 written;
int i;
/*
* 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"
*/
priv = uf_find_instance((int)(long)data);
if (!priv) {
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);
unifi_priv_t *priv;
int i;
/*
* 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"
*/
priv = uf_find_instance((long)m->private);
if (!priv)
return 0;
seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
CSR_WIFI_VERSION, __DATE__, __TIME__);
#ifdef CSR_SME_USERSPACE
written = scnprintf(p, remain, "SME: CSR userspace ");
UNIFI_SNPRINTF_RET(p, remain, written);
seq_puts(m, "SME: CSR userspace ");
#ifdef CSR_SUPPORT_WEXT
written = scnprintf(p, remain, "with WEXT support\n");
seq_puts(m, "with WEXT support\n");
#else
written = scnprintf(p, remain, "\n");
seq_putc(m, '\n');
#endif /* CSR_SUPPORT_WEXT */
UNIFI_SNPRINTF_RET(p, remain, written);
#endif /* CSR_SME_USERSPACE */
#ifdef CSR_NATIVE_LINUX
written = scnprintf(p, remain, "SME: native\n");
UNIFI_SNPRINTF_RET(p, remain, written);
seq_puts(m, "SME: native\n");
#endif
#ifdef CSR_SUPPORT_SME
written = scnprintf(p, remain,
"Firmware (ROM) build:%u, Patch:%u\n",
priv->card_info.fw_build,
priv->sme_versions.firmwarePatch);
UNIFI_SNPRINTF_RET(p, remain, written);
seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
priv->card_info.fw_build,
priv->sme_versions.firmwarePatch);
#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 );
} /* uf_read_proc() */
seq_puts(m, "Last dbg16:");
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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment