aboutsummaryrefslogtreecommitdiff
path: root/net/irda
diff options
context:
space:
mode:
Diffstat (limited to 'net/irda')
-rw-r--r--net/irda/ircomm/ircomm_tty.c256
-rw-r--r--net/irda/irda_device.c5
-rw-r--r--net/irda/irlan/irlan_eth.c19
-rw-r--r--net/irda/irmod.c4
-rw-r--r--net/irda/irproc.c1
5 files changed, 156 insertions, 129 deletions
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c
index 086d5ef098f..811984d9324 100644
--- a/net/irda/ircomm/ircomm_tty.c
+++ b/net/irda/ircomm/ircomm_tty.c
@@ -34,6 +34,7 @@
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/sched.h>
+#include <linux/seq_file.h>
#include <linux/termios.h>
#include <linux/tty.h>
#include <linux/interrupt.h>
@@ -72,8 +73,7 @@ static int ircomm_tty_control_indication(void *instance, void *sap,
static void ircomm_tty_flow_indication(void *instance, void *sap,
LOCAL_FLOW cmd);
#ifdef CONFIG_PROC_FS
-static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
- int *eof, void *unused);
+static const struct file_operations ircomm_tty_proc_fops;
#endif /* CONFIG_PROC_FS */
static struct tty_driver *driver;
@@ -98,7 +98,7 @@ static const struct tty_operations ops = {
.hangup = ircomm_tty_hangup,
.wait_until_sent = ircomm_tty_wait_until_sent,
#ifdef CONFIG_PROC_FS
- .read_proc = ircomm_tty_read_proc,
+ .proc_fops = &ircomm_tty_proc_fops,
#endif /* CONFIG_PROC_FS */
};
@@ -1245,150 +1245,170 @@ static void ircomm_tty_flow_indication(void *instance, void *sap,
}
#ifdef CONFIG_PROC_FS
-static int ircomm_tty_line_info(struct ircomm_tty_cb *self, char *buf)
+static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m)
{
- int ret=0;
+ char sep;
- ret += sprintf(buf+ret, "State: %s\n", ircomm_tty_state[self->state]);
+ seq_printf(m, "State: %s\n", ircomm_tty_state[self->state]);
- ret += sprintf(buf+ret, "Service type: ");
+ seq_puts(m, "Service type: ");
if (self->service_type & IRCOMM_9_WIRE)
- ret += sprintf(buf+ret, "9_WIRE");
+ seq_puts(m, "9_WIRE");
else if (self->service_type & IRCOMM_3_WIRE)
- ret += sprintf(buf+ret, "3_WIRE");
+ seq_puts(m, "3_WIRE");
else if (self->service_type & IRCOMM_3_WIRE_RAW)
- ret += sprintf(buf+ret, "3_WIRE_RAW");
+ seq_puts(m, "3_WIRE_RAW");
else
- ret += sprintf(buf+ret, "No common service type!\n");
- ret += sprintf(buf+ret, "\n");
-
- ret += sprintf(buf+ret, "Port name: %s\n", self->settings.port_name);
-
- ret += sprintf(buf+ret, "DTE status: ");
- if (self->settings.dte & IRCOMM_RTS)
- ret += sprintf(buf+ret, "RTS|");
- if (self->settings.dte & IRCOMM_DTR)
- ret += sprintf(buf+ret, "DTR|");
- if (self->settings.dte)
- ret--; /* remove the last | */
- ret += sprintf(buf+ret, "\n");
-
- ret += sprintf(buf+ret, "DCE status: ");
- if (self->settings.dce & IRCOMM_CTS)
- ret += sprintf(buf+ret, "CTS|");
- if (self->settings.dce & IRCOMM_DSR)
- ret += sprintf(buf+ret, "DSR|");
- if (self->settings.dce & IRCOMM_CD)
- ret += sprintf(buf+ret, "CD|");
- if (self->settings.dce & IRCOMM_RI)
- ret += sprintf(buf+ret, "RI|");
- if (self->settings.dce)
- ret--; /* remove the last | */
- ret += sprintf(buf+ret, "\n");
-
- ret += sprintf(buf+ret, "Configuration: ");
+ seq_puts(m, "No common service type!\n");
+ seq_putc(m, '\n');
+
+ seq_printf(m, "Port name: %s\n", self->settings.port_name);
+
+ seq_printf(m, "DTE status:");
+ sep = ' ';
+ if (self->settings.dte & IRCOMM_RTS) {
+ seq_printf(m, "%cRTS", sep);
+ sep = '|';
+ }
+ if (self->settings.dte & IRCOMM_DTR) {
+ seq_printf(m, "%cDTR", sep);
+ sep = '|';
+ }
+ seq_putc(m, '\n');
+
+ seq_puts(m, "DCE status:");
+ sep = ' ';
+ if (self->settings.dce & IRCOMM_CTS) {
+ seq_printf(m, "%cCTS", sep);
+ sep = '|';
+ }
+ if (self->settings.dce & IRCOMM_DSR) {
+ seq_printf(m, "%cDSR", sep);
+ sep = '|';
+ }
+ if (self->settings.dce & IRCOMM_CD) {
+ seq_printf(m, "%cCD", sep);
+ sep = '|';
+ }
+ if (self->settings.dce & IRCOMM_RI) {
+ seq_printf(m, "%cRI", sep);
+ sep = '|';
+ }
+ seq_putc(m, '\n');
+
+ seq_puts(m, "Configuration: ");
if (!self->settings.null_modem)
- ret += sprintf(buf+ret, "DTE <-> DCE\n");
+ seq_puts(m, "DTE <-> DCE\n");
else
- ret += sprintf(buf+ret,
- "DTE <-> DTE (null modem emulation)\n");
-
- ret += sprintf(buf+ret, "Data rate: %d\n", self->settings.data_rate);
-
- ret += sprintf(buf+ret, "Flow control: ");
- if (self->settings.flow_control & IRCOMM_XON_XOFF_IN)
- ret += sprintf(buf+ret, "XON_XOFF_IN|");
- if (self->settings.flow_control & IRCOMM_XON_XOFF_OUT)
- ret += sprintf(buf+ret, "XON_XOFF_OUT|");
- if (self->settings.flow_control & IRCOMM_RTS_CTS_IN)
- ret += sprintf(buf+ret, "RTS_CTS_IN|");
- if (self->settings.flow_control & IRCOMM_RTS_CTS_OUT)
- ret += sprintf(buf+ret, "RTS_CTS_OUT|");
- if (self->settings.flow_control & IRCOMM_DSR_DTR_IN)
- ret += sprintf(buf+ret, "DSR_DTR_IN|");
- if (self->settings.flow_control & IRCOMM_DSR_DTR_OUT)
- ret += sprintf(buf+ret, "DSR_DTR_OUT|");
- if (self->settings.flow_control & IRCOMM_ENQ_ACK_IN)
- ret += sprintf(buf+ret, "ENQ_ACK_IN|");
- if (self->settings.flow_control & IRCOMM_ENQ_ACK_OUT)
- ret += sprintf(buf+ret, "ENQ_ACK_OUT|");
- if (self->settings.flow_control)
- ret--; /* remove the last | */
- ret += sprintf(buf+ret, "\n");
-
- ret += sprintf(buf+ret, "Flags: ");
- if (self->flags & ASYNC_CTS_FLOW)
- ret += sprintf(buf+ret, "ASYNC_CTS_FLOW|");
- if (self->flags & ASYNC_CHECK_CD)
- ret += sprintf(buf+ret, "ASYNC_CHECK_CD|");
- if (self->flags & ASYNC_INITIALIZED)
- ret += sprintf(buf+ret, "ASYNC_INITIALIZED|");
- if (self->flags & ASYNC_LOW_LATENCY)
- ret += sprintf(buf+ret, "ASYNC_LOW_LATENCY|");
- if (self->flags & ASYNC_CLOSING)
- ret += sprintf(buf+ret, "ASYNC_CLOSING|");
- if (self->flags & ASYNC_NORMAL_ACTIVE)
- ret += sprintf(buf+ret, "ASYNC_NORMAL_ACTIVE|");
- if (self->flags)
- ret--; /* remove the last | */
- ret += sprintf(buf+ret, "\n");
-
- ret += sprintf(buf+ret, "Role: %s\n", self->client ?
- "client" : "server");
- ret += sprintf(buf+ret, "Open count: %d\n", self->open_count);
- ret += sprintf(buf+ret, "Max data size: %d\n", self->max_data_size);
- ret += sprintf(buf+ret, "Max header size: %d\n", self->max_header_size);
+ seq_puts(m, "DTE <-> DTE (null modem emulation)\n");
+
+ seq_printf(m, "Data rate: %d\n", self->settings.data_rate);
+
+ seq_puts(m, "Flow control:");
+ sep = ' ';
+ if (self->settings.flow_control & IRCOMM_XON_XOFF_IN) {
+ seq_printf(m, "%cXON_XOFF_IN", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_XON_XOFF_OUT) {
+ seq_printf(m, "%cXON_XOFF_OUT", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_RTS_CTS_IN) {
+ seq_printf(m, "%cRTS_CTS_IN", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_RTS_CTS_OUT) {
+ seq_printf(m, "%cRTS_CTS_OUT", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_DSR_DTR_IN) {
+ seq_printf(m, "%cDSR_DTR_IN", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_DSR_DTR_OUT) {
+ seq_printf(m, "%cDSR_DTR_OUT", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_ENQ_ACK_IN) {
+ seq_printf(m, "%cENQ_ACK_IN", sep);
+ sep = '|';
+ }
+ if (self->settings.flow_control & IRCOMM_ENQ_ACK_OUT) {
+ seq_printf(m, "%cENQ_ACK_OUT", sep);
+ sep = '|';
+ }
+ seq_putc(m, '\n');
+
+ seq_puts(m, "Flags:");
+ sep = ' ';
+ if (self->flags & ASYNC_CTS_FLOW) {
+ seq_printf(m, "%cASYNC_CTS_FLOW", sep);
+ sep = '|';
+ }
+ if (self->flags & ASYNC_CHECK_CD) {
+ seq_printf(m, "%cASYNC_CHECK_CD", sep);
+ sep = '|';
+ }
+ if (self->flags & ASYNC_INITIALIZED) {
+ seq_printf(m, "%cASYNC_INITIALIZED", sep);
+ sep = '|';
+ }
+ if (self->flags & ASYNC_LOW_LATENCY) {
+ seq_printf(m, "%cASYNC_LOW_LATENCY", sep);
+ sep = '|';
+ }
+ if (self->flags & ASYNC_CLOSING) {
+ seq_printf(m, "%cASYNC_CLOSING", sep);
+ sep = '|';
+ }
+ if (self->flags & ASYNC_NORMAL_ACTIVE) {
+ seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep);
+ sep = '|';
+ }
+ seq_putc(m, '\n');
+
+ seq_printf(m, "Role: %s\n", self->client ? "client" : "server");
+ seq_printf(m, "Open count: %d\n", self->open_count);
+ seq_printf(m, "Max data size: %d\n", self->max_data_size);
+ seq_printf(m, "Max header size: %d\n", self->max_header_size);
if (self->tty)
- ret += sprintf(buf+ret, "Hardware: %s\n",
+ seq_printf(m, "Hardware: %s\n",
self->tty->hw_stopped ? "Stopped" : "Running");
-
- ret += sprintf(buf+ret, "\n");
- return ret;
}
-
-/*
- * Function ircomm_tty_read_proc (buf, start, offset, len, eof, unused)
- *
- *
- *
- */
-static int ircomm_tty_read_proc(char *buf, char **start, off_t offset, int len,
- int *eof, void *unused)
+static int ircomm_tty_proc_show(struct seq_file *m, void *v)
{
struct ircomm_tty_cb *self;
- int count = 0, l;
- off_t begin = 0;
unsigned long flags;
spin_lock_irqsave(&ircomm_tty->hb_spinlock, flags);
self = (struct ircomm_tty_cb *) hashbin_get_first(ircomm_tty);
- while ((self != NULL) && (count < 4000)) {
+ while (self != NULL) {
if (self->magic != IRCOMM_TTY_MAGIC)
break;
- l = ircomm_tty_line_info(self, buf + count);
- count += l;
- if (count+begin > offset+len)
- goto done;
- if (count+begin < offset) {
- begin += count;
- count = 0;
- }
-
+ ircomm_tty_line_info(self, m);
self = (struct ircomm_tty_cb *) hashbin_get_next(ircomm_tty);
}
- *eof = 1;
-done:
spin_unlock_irqrestore(&ircomm_tty->hb_spinlock, flags);
+ return 0;
+}
- if (offset >= count+begin)
- return 0;
- *start = buf + (offset-begin);
- return ((len < begin+count-offset) ? len : begin+count-offset);
+static int ircomm_tty_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open(file, ircomm_tty_proc_show, NULL);
}
+
+static const struct file_operations ircomm_tty_proc_fops = {
+ .owner = THIS_MODULE,
+ .open = ircomm_tty_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = single_release,
+};
#endif /* CONFIG_PROC_FS */
MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>");
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c
index ea319e3ddc1..bf92e147344 100644
--- a/net/irda/irda_device.c
+++ b/net/irda/irda_device.c
@@ -149,13 +149,14 @@ int irda_device_is_receiving(struct net_device *dev)
IRDA_DEBUG(2, "%s()\n", __func__);
- if (!dev->do_ioctl) {
+ if (!dev->netdev_ops->ndo_do_ioctl) {
IRDA_ERROR("%s: do_ioctl not impl. by device driver\n",
__func__);
return -1;
}
- ret = dev->do_ioctl(dev, (struct ifreq *) &req, SIOCGRECEIVING);
+ ret = (dev->netdev_ops->ndo_do_ioctl)(dev, (struct ifreq *) &req,
+ SIOCGRECEIVING);
if (ret < 0)
return ret;
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c
index 05112be9956..724bcf951b8 100644
--- a/net/irda/irlan/irlan_eth.c
+++ b/net/irda/irlan/irlan_eth.c
@@ -45,6 +45,16 @@ static int irlan_eth_xmit(struct sk_buff *skb, struct net_device *dev);
static void irlan_eth_set_multicast_list( struct net_device *dev);
static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev);
+static const struct net_device_ops irlan_eth_netdev_ops = {
+ .ndo_open = irlan_eth_open,
+ .ndo_stop = irlan_eth_close,
+ .ndo_start_xmit = irlan_eth_xmit,
+ .ndo_get_stats = irlan_eth_get_stats,
+ .ndo_set_multicast_list = irlan_eth_set_multicast_list,
+ .ndo_change_mtu = eth_change_mtu,
+ .ndo_validate_addr = eth_validate_addr,
+};
+
/*
* Function irlan_eth_setup (dev)
*
@@ -53,14 +63,11 @@ static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev);
*/
static void irlan_eth_setup(struct net_device *dev)
{
- dev->open = irlan_eth_open;
- dev->stop = irlan_eth_close;
- dev->hard_start_xmit = irlan_eth_xmit;
- dev->get_stats = irlan_eth_get_stats;
- dev->set_multicast_list = irlan_eth_set_multicast_list;
+ ether_setup(dev);
+
+ dev->netdev_ops = &irlan_eth_netdev_ops;
dev->destructor = free_netdev;
- ether_setup(dev);
/*
* Lets do all queueing in IrTTP instead of this device driver.
diff --git a/net/irda/irmod.c b/net/irda/irmod.c
index 4c487a88372..303a68d9273 100644
--- a/net/irda/irmod.c
+++ b/net/irda/irmod.c
@@ -55,8 +55,8 @@ EXPORT_SYMBOL(irda_debug);
/* Packet type handler.
* Tell the kernel how IrDA packets should be handled.
*/
-static struct packet_type irda_packet_type = {
- .type = __constant_htons(ETH_P_IRDA),
+static struct packet_type irda_packet_type __read_mostly = {
+ .type = cpu_to_be16(ETH_P_IRDA),
.func = irlap_driver_rcv, /* Packet type handler irlap_frame.c */
};
diff --git a/net/irda/irproc.c b/net/irda/irproc.c
index 88e80a31273..8ff1861649e 100644
--- a/net/irda/irproc.c
+++ b/net/irda/irproc.c
@@ -70,7 +70,6 @@ void __init irda_proc_register(void)
proc_irda = proc_mkdir("irda", init_net.proc_net);
if (proc_irda == NULL)
return;
- proc_irda->owner = THIS_MODULE;
for (i = 0; i < ARRAY_SIZE(irda_dirs); i++)
d = proc_create(irda_dirs[i].name, 0, proc_irda,