Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
eb24ab2c
Commit
eb24ab2c
authored
Aug 14, 2003
by
Stephen Hemminger
Committed by
David S. Miller
Aug 14, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[NET]: Convert YAM driver to seq_file.
parent
2b5ca00d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
43 deletions
+61
-43
drivers/net/hamradio/yam.c
drivers/net/hamradio/yam.c
+61
-43
No files found.
drivers/net/hamradio/yam.c
View file @
eb24ab2c
...
@@ -72,6 +72,7 @@
...
@@ -72,6 +72,7 @@
#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/proc_fs.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/version.h>
#include <linux/version.h>
#include <asm/uaccess.h>
#include <asm/uaccess.h>
...
@@ -765,56 +766,73 @@ static irqreturn_t yam_interrupt(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -765,56 +766,73 @@ static irqreturn_t yam_interrupt(int irq, void *dev_id, struct pt_regs *regs)
return
IRQ_RETVAL
(
handled
);
return
IRQ_RETVAL
(
handled
);
}
}
static
int
yam_net_get_info
(
char
*
buffer
,
char
**
start
,
off_t
offset
,
int
length
)
#ifdef CONFIG_PROC_FS
static
void
*
yam_seq_start
(
struct
seq_file
*
seq
,
loff_t
*
pos
)
{
{
int
len
=
0
;
return
(
*
pos
<
NR_PORTS
)
?
yam_devs
[
*
pos
]
:
NULL
;
int
i
;
}
off_t
pos
=
0
;
off_t
begin
=
0
;
static
void
*
yam_seq_next
(
struct
seq_file
*
seq
,
void
*
v
,
loff_t
*
pos
)
{
++*
pos
;
return
(
*
pos
<
NR_PORTS
)
?
yam_devs
[
*
pos
]
:
NULL
;
}
for
(
i
=
0
;
i
<
NR_PORTS
;
i
++
)
{
static
void
yam_seq_stop
(
struct
seq_file
*
seq
,
void
*
v
)
if
(
yam_ports
[
i
].
iobase
==
0
||
yam_ports
[
i
].
irq
==
0
)
{
continue
;
}
len
+=
sprintf
(
buffer
+
len
,
"Device yam%d
\n
"
,
i
);
len
+=
sprintf
(
buffer
+
len
,
" Up %d
\n
"
,
netif_running
(
&
yam_ports
[
i
].
dev
));
len
+=
sprintf
(
buffer
+
len
,
" Speed %u
\n
"
,
yam_ports
[
i
].
bitrate
);
len
+=
sprintf
(
buffer
+
len
,
" IoBase 0x%x
\n
"
,
yam_ports
[
i
].
iobase
);
len
+=
sprintf
(
buffer
+
len
,
" BaudRate %u
\n
"
,
yam_ports
[
i
].
baudrate
);
len
+=
sprintf
(
buffer
+
len
,
" IRQ %u
\n
"
,
yam_ports
[
i
].
irq
);
len
+=
sprintf
(
buffer
+
len
,
" TxState %u
\n
"
,
yam_ports
[
i
].
tx_state
);
len
+=
sprintf
(
buffer
+
len
,
" Duplex %u
\n
"
,
yam_ports
[
i
].
dupmode
);
len
+=
sprintf
(
buffer
+
len
,
" HoldDly %u
\n
"
,
yam_ports
[
i
].
holdd
);
len
+=
sprintf
(
buffer
+
len
,
" TxDelay %u
\n
"
,
yam_ports
[
i
].
txd
);
len
+=
sprintf
(
buffer
+
len
,
" TxTail %u
\n
"
,
yam_ports
[
i
].
txtail
);
len
+=
sprintf
(
buffer
+
len
,
" SlotTime %u
\n
"
,
yam_ports
[
i
].
slot
);
len
+=
sprintf
(
buffer
+
len
,
" Persist %u
\n
"
,
yam_ports
[
i
].
pers
);
len
+=
sprintf
(
buffer
+
len
,
" TxFrames %lu
\n
"
,
yam_ports
[
i
].
stats
.
tx_packets
);
len
+=
sprintf
(
buffer
+
len
,
" RxFrames %lu
\n
"
,
yam_ports
[
i
].
stats
.
rx_packets
);
len
+=
sprintf
(
buffer
+
len
,
" TxInt %u
\n
"
,
yam_ports
[
i
].
nb_mdint
);
len
+=
sprintf
(
buffer
+
len
,
" RxInt %u
\n
"
,
yam_ports
[
i
].
nb_rxint
);
len
+=
sprintf
(
buffer
+
len
,
" RxOver %lu
\n
"
,
yam_ports
[
i
].
stats
.
rx_fifo_errors
);
len
+=
sprintf
(
buffer
+
len
,
"
\n
"
);
pos
=
begin
+
len
;
if
(
pos
<
offset
)
{
len
=
0
;
begin
=
pos
;
}
if
(
pos
>
offset
+
length
)
break
;
}
*
start
=
buffer
+
(
offset
-
begin
);
static
int
yam_seq_show
(
struct
seq_file
*
seq
,
void
*
v
)
len
-=
(
offset
-
begin
);
{
const
struct
net_device
*
dev
=
v
;
const
struct
yam_port
*
yp
=
dev
->
priv
;
seq_printf
(
seq
,
"Device %s
\n
"
,
dev
->
name
);
seq_printf
(
seq
,
" Up %d
\n
"
,
netif_running
(
dev
));
seq_printf
(
seq
,
" Speed %u
\n
"
,
yp
->
bitrate
);
seq_printf
(
seq
,
" IoBase 0x%x
\n
"
,
yp
->
iobase
);
seq_printf
(
seq
,
" BaudRate %u
\n
"
,
yp
->
baudrate
);
seq_printf
(
seq
,
" IRQ %u
\n
"
,
yp
->
irq
);
seq_printf
(
seq
,
" TxState %u
\n
"
,
yp
->
tx_state
);
seq_printf
(
seq
,
" Duplex %u
\n
"
,
yp
->
dupmode
);
seq_printf
(
seq
,
" HoldDly %u
\n
"
,
yp
->
holdd
);
seq_printf
(
seq
,
" TxDelay %u
\n
"
,
yp
->
txd
);
seq_printf
(
seq
,
" TxTail %u
\n
"
,
yp
->
txtail
);
seq_printf
(
seq
,
" SlotTime %u
\n
"
,
yp
->
slot
);
seq_printf
(
seq
,
" Persist %u
\n
"
,
yp
->
pers
);
seq_printf
(
seq
,
" TxFrames %lu
\n
"
,
yp
->
stats
.
tx_packets
);
seq_printf
(
seq
,
" RxFrames %lu
\n
"
,
yp
->
stats
.
rx_packets
);
seq_printf
(
seq
,
" TxInt %u
\n
"
,
yp
->
nb_mdint
);
seq_printf
(
seq
,
" RxInt %u
\n
"
,
yp
->
nb_rxint
);
seq_printf
(
seq
,
" RxOver %lu
\n
"
,
yp
->
stats
.
rx_fifo_errors
);
seq_printf
(
seq
,
"
\n
"
);
if
(
len
>
length
)
}
len
=
length
;
static
struct
seq_operations
yam_seqops
=
{
.
start
=
yam_seq_start
,
.
next
=
yam_seq_next
,
.
stop
=
yam_seq_stop
,
.
show
=
yam_seq_show
,
};
return
len
;
static
int
yam_info_open
(
struct
inode
*
inode
,
struct
file
*
file
)
{
return
seq_open
(
file
,
&
yam_seqops
);
}
}
static
struct
file_operations
yam_info_fops
=
{
.
owner
=
THIS_MODULE
,
.
open
=
yam_info_open
,
.
read
=
seq_read
,
.
llseek
=
seq_lseek
,
.
release
=
seq_release
,
};
#endif
/* --------------------------------------------------------------------- */
/* --------------------------------------------------------------------- */
static
struct
net_device_stats
*
yam_get_stats
(
struct
net_device
*
dev
)
static
struct
net_device_stats
*
yam_get_stats
(
struct
net_device
*
dev
)
...
@@ -1153,7 +1171,7 @@ static int __init yam_init_driver(void)
...
@@ -1153,7 +1171,7 @@ static int __init yam_init_driver(void)
yam_timer
.
expires
=
jiffies
+
HZ
/
100
;
yam_timer
.
expires
=
jiffies
+
HZ
/
100
;
add_timer
(
&
yam_timer
);
add_timer
(
&
yam_timer
);
proc_net_
create
(
"yam"
,
0
,
yam_net_get_info
);
proc_net_
fops_create
(
"yam"
,
S_IRUGO
,
&
yam_info_fops
);
return
0
;
return
0
;
error:
error:
while
(
--
i
>=
0
)
{
while
(
--
i
>=
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment