diff options
author | David Howells <dhowells@redhat.com> | 2013-04-10 11:50:58 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2013-04-29 15:41:56 -0400 |
commit | 4c4df9b91bf6ffd4bb01abe4cfba1f8f145878a0 (patch) | |
tree | 2f348b4614bb2afebfbc911a4b13a217b3691ce0 /drivers/net | |
parent | 9fb8ca5c2029b41edc7dbbe478f376ead14944ec (diff) |
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: David 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: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/atmel.c | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c index 4374079dfc2a..23a3498f14d4 100644 --- a/drivers/net/wireless/atmel.c +++ b/drivers/net/wireless/atmel.c | |||
@@ -63,6 +63,7 @@ | |||
63 | #include <net/iw_handler.h> | 63 | #include <net/iw_handler.h> |
64 | #include <linux/crc32.h> | 64 | #include <linux/crc32.h> |
65 | #include <linux/proc_fs.h> | 65 | #include <linux/proc_fs.h> |
66 | #include <linux/seq_file.h> | ||
66 | #include <linux/device.h> | 67 | #include <linux/device.h> |
67 | #include <linux/moduleparam.h> | 68 | #include <linux/moduleparam.h> |
68 | #include <linux/firmware.h> | 69 | #include <linux/firmware.h> |
@@ -1409,30 +1410,28 @@ static int atmel_validate_channel(struct atmel_private *priv, int channel) | |||
1409 | return 0; | 1410 | return 0; |
1410 | } | 1411 | } |
1411 | 1412 | ||
1412 | static int atmel_proc_output (char *buf, struct atmel_private *priv) | 1413 | static int atmel_proc_show(struct seq_file *m, void *v) |
1413 | { | 1414 | { |
1415 | struct atmel_private *priv = m->private; | ||
1414 | int i; | 1416 | int i; |
1415 | char *p = buf; | ||
1416 | char *s, *r, *c; | 1417 | char *s, *r, *c; |
1417 | 1418 | ||
1418 | p += sprintf(p, "Driver version:\t\t%d.%d\n", | 1419 | seq_printf(m, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR); |
1419 | DRIVER_MAJOR, DRIVER_MINOR); | ||
1420 | 1420 | ||
1421 | if (priv->station_state != STATION_STATE_DOWN) { | 1421 | if (priv->station_state != STATION_STATE_DOWN) { |
1422 | p += sprintf(p, "Firmware version:\t%d.%d build %d\n" | 1422 | seq_printf(m, |
1423 | "Firmware location:\t", | 1423 | "Firmware version:\t%d.%d build %d\n" |
1424 | priv->host_info.major_version, | 1424 | "Firmware location:\t", |
1425 | priv->host_info.minor_version, | 1425 | priv->host_info.major_version, |
1426 | priv->host_info.build_version); | 1426 | priv->host_info.minor_version, |
1427 | priv->host_info.build_version); | ||
1427 | 1428 | ||
1428 | if (priv->card_type != CARD_TYPE_EEPROM) | 1429 | if (priv->card_type != CARD_TYPE_EEPROM) |
1429 | p += sprintf(p, "on card\n"); | 1430 | seq_puts(m, "on card\n"); |
1430 | else if (priv->firmware) | 1431 | else if (priv->firmware) |
1431 | p += sprintf(p, "%s loaded by host\n", | 1432 | seq_printf(m, "%s loaded by host\n", priv->firmware_id); |
1432 | priv->firmware_id); | ||
1433 | else | 1433 | else |
1434 | p += sprintf(p, "%s loaded by hotplug\n", | 1434 | seq_printf(m, "%s loaded by hotplug\n", priv->firmware_id); |
1435 | priv->firmware_id); | ||
1436 | 1435 | ||
1437 | switch (priv->card_type) { | 1436 | switch (priv->card_type) { |
1438 | case CARD_TYPE_PARALLEL_FLASH: | 1437 | case CARD_TYPE_PARALLEL_FLASH: |
@@ -1453,12 +1452,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1453 | if (priv->reg_domain == channel_table[i].reg_domain) | 1452 | if (priv->reg_domain == channel_table[i].reg_domain) |
1454 | r = channel_table[i].name; | 1453 | r = channel_table[i].name; |
1455 | 1454 | ||
1456 | p += sprintf(p, "MAC memory type:\t%s\n", c); | 1455 | seq_printf(m, "MAC memory type:\t%s\n", c); |
1457 | p += sprintf(p, "Regulatory domain:\t%s\n", r); | 1456 | seq_printf(m, "Regulatory domain:\t%s\n", r); |
1458 | p += sprintf(p, "Host CRC checking:\t%s\n", | 1457 | seq_printf(m, "Host CRC checking:\t%s\n", |
1459 | priv->do_rx_crc ? "On" : "Off"); | 1458 | priv->do_rx_crc ? "On" : "Off"); |
1460 | p += sprintf(p, "WPA-capable firmware:\t%s\n", | 1459 | seq_printf(m, "WPA-capable firmware:\t%s\n", |
1461 | priv->use_wpa ? "Yes" : "No"); | 1460 | priv->use_wpa ? "Yes" : "No"); |
1462 | } | 1461 | } |
1463 | 1462 | ||
1464 | switch (priv->station_state) { | 1463 | switch (priv->station_state) { |
@@ -1490,26 +1489,22 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv) | |||
1490 | s = "<unknown>"; | 1489 | s = "<unknown>"; |
1491 | } | 1490 | } |
1492 | 1491 | ||
1493 | p += sprintf(p, "Current state:\t\t%s\n", s); | 1492 | seq_printf(m, "Current state:\t\t%s\n", s); |
1494 | return p - buf; | 1493 | return 0; |
1495 | } | 1494 | } |
1496 | 1495 | ||
1497 | static int atmel_read_proc(char *page, char **start, off_t off, | 1496 | static int atmel_proc_open(struct inode *inode, struct file *file) |
1498 | int count, int *eof, void *data) | ||
1499 | { | 1497 | { |
1500 | struct atmel_private *priv = data; | 1498 | return single_open(file, atmel_proc_show, PDE_DATA(inode)); |
1501 | int len = atmel_proc_output (page, priv); | ||
1502 | if (len <= off+count) | ||
1503 | *eof = 1; | ||
1504 | *start = page + off; | ||
1505 | len -= off; | ||
1506 | if (len > count) | ||
1507 | len = count; | ||
1508 | if (len < 0) | ||
1509 | len = 0; | ||
1510 | return len; | ||
1511 | } | 1499 | } |
1512 | 1500 | ||
1501 | static const struct file_operations atmel_proc_fops = { | ||
1502 | .open = atmel_proc_open, | ||
1503 | .read = seq_read, | ||
1504 | .llseek = seq_lseek, | ||
1505 | .release = seq_release, | ||
1506 | }; | ||
1507 | |||
1513 | static const struct net_device_ops atmel_netdev_ops = { | 1508 | static const struct net_device_ops atmel_netdev_ops = { |
1514 | .ndo_open = atmel_open, | 1509 | .ndo_open = atmel_open, |
1515 | .ndo_stop = atmel_close, | 1510 | .ndo_stop = atmel_close, |
@@ -1525,7 +1520,6 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1525 | struct device *sys_dev, | 1520 | struct device *sys_dev, |
1526 | int (*card_present)(void *), void *card) | 1521 | int (*card_present)(void *), void *card) |
1527 | { | 1522 | { |
1528 | struct proc_dir_entry *ent; | ||
1529 | struct net_device *dev; | 1523 | struct net_device *dev; |
1530 | struct atmel_private *priv; | 1524 | struct atmel_private *priv; |
1531 | int rc; | 1525 | int rc; |
@@ -1630,8 +1624,7 @@ struct net_device *init_atmel_card(unsigned short irq, unsigned long port, | |||
1630 | 1624 | ||
1631 | netif_carrier_off(dev); | 1625 | netif_carrier_off(dev); |
1632 | 1626 | ||
1633 | ent = create_proc_read_entry ("driver/atmel", 0, NULL, atmel_read_proc, priv); | 1627 | if (!proc_create_data("driver/atmel", 0, NULL, &atmel_proc_fops, priv)); |
1634 | if (!ent) | ||
1635 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); | 1628 | printk(KERN_WARNING "atmel: unable to create /proc entry.\n"); |
1636 | 1629 | ||
1637 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", | 1630 | printk(KERN_INFO "%s: Atmel at76c50x. Version %d.%d. MAC %pM\n", |