Commit 4c4df9b9 authored by David Howells's avatar David Howells Committed by Al Viro

atmel: 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: Simon Kelley <simon@thekelleys.org.uk>
cc: John W. Linville <linville@tuxdriver.com>
cc: linux-wireless@vger.kernel.org
cc: netdev@vger.kernel.org
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 9fb8ca5c
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include <linux/crc32.h> #include <linux/crc32.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/firmware.h> #include <linux/firmware.h>
...@@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel) ...@@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel)
return 0; return 0;
} }
static int atmel_proc_output (char *buf, struct atmel_private *priv) static int atmel_proc_show(struct seq_file *m, void *v)
{ {
struct atmel_private *priv = m->private;
int i; int i;
char *p = buf;
char *s, *r, *c; char *s, *r, *c;
p += sprintf(p, "Driver version:\t\t%d.%d\n", seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR);
DRIVER_MAJOR, DRIVER_MINOR);
if (priv->station_state != STATION_STATE_DOWN) { if (priv->station_state != STATION_STATE_DOWN) {
p += sprintf(p, "Firmware version:\t%d.%d build %d\n" seq_printf(m,
"Firmware location:\t", "Firmware version:\t%d.%d build %d\n"
priv->host_info.major_version, "Firmware location:\t",
priv->host_info.minor_version, priv->host_info.major_version,
priv->host_info.build_version); priv->host_info.minor_version,
priv->host_info.build_version);
if (priv->card_type != CARD_TYPE_EEPROM) if (priv->card_type != CARD_TYPE_EEPROM)
p += sprintf(p, "on card\n"); seq_puts(m, "on card\n");
else if (priv->firmware) else if (priv->firmware)
p += sprintf(p, "%s loaded by host\n", seq_printf(m, "%s loaded by host\n", priv->firmware_id);
priv->firmware_id);
else else
p += sprintf(p, "%s loaded by hotplug\n", seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id);
priv->firmware_id);
switch (priv->card_type) { switch (priv->card_type) {
case CARD_TYPE_PARALLEL_FLASH: case CARD_TYPE_PARALLEL_FLASH:
...@@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) ...@@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
if (priv->reg_domain == channel_table[i].reg_domain) if (priv->reg_domain == channel_table[i].reg_domain)
r = channel_table[i].name; r = channel_table[i].name;
p += sprintf(p, "MAC memory type:\t%s\n", c); seq_printf(m, "MAC memory type:\t%s\n", c);
p += sprintf(p, "Regulatory domain:\t%s\n", r); seq_printf(m, "Regulatory domain:\t%s\n", r);
p += sprintf(p, "Host CRC checking:\t%s\n", seq_printf(m, "Host CRC checking:\t%s\n",
priv->do_rx_crc ? "On" : "Off"); priv->do_rx_crc ? "On" : "Off");
p += sprintf(p, "WPA-capable firmware:\t%s\n", seq_printf(m, "WPA-capable firmware:\t%s\n",
priv->use_wpa ? "Yes" : "No"); priv->use_wpa ? "Yes" : "No");
} }
switch (priv->station_state) { switch (priv->station_state) {
...@@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) ...@@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
s = "<unknown>"; s = "<unknown>";
} }
p += sprintf(p, "Current state:\t\t%s\n", s); seq_printf(m, "Current state:\t\t%s\n", s);
return p - buf; return 0;
} }
static int atmel_read_proc(char *page, char **start, off_t off, static int atmel_proc_open(struct inode *inode, struct file *file)
int count, int *eof, void *data)
{ {
struct atmel_private *priv = data; return single_open(file, atmel_proc_show, PDE_DATA(inode));
int len = atmel_proc_output (page, priv);
if (len <= off+count)
*eof = 1;
*start = page + off;
len -= off;
if (len > count)
len = count;
if (len < 0)
len = 0;
return len;
} }
static const struct file_operations atmel_proc_fops = {
.open = atmel_proc_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static const struct net_device_ops atmel_netdev_ops = { static const struct net_device_ops atmel_netdev_ops = {
.ndo_open = atmel_open, .ndo_open = atmel_open,
.ndo_stop = atmel_close, .ndo_stop = atmel_close,
...@@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, ...@@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
struct device *sys_dev, struct device *sys_dev,
int (*card_present)(void *), void *card) int (*card_present)(void *), void *card)
{ {
struct proc_dir_entry *ent;
struct net_device *dev; struct net_device *dev;
struct atmel_private *priv; struct atmel_private *priv;
int rc; int rc;
...@@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, ...@@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
netif_carrier_off(dev); netif_carrier_off(dev);
ent = create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv));
if (!ent)
printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); printk(KERN_WARNING "atmel: unable to create /proc entry.\n");
printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n",
......
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