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
ab40fdb6
Commit
ab40fdb6
authored
Jan 10, 2004
by
Alexander Viro
Committed by
Stephen Hemminger
Jan 10, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr de600] use alloc_etherdev; request_region fixes
parent
ea6bea79
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
25 deletions
+35
-25
drivers/net/de600.c
drivers/net/de600.c
+35
-24
drivers/net/de600.h
drivers/net/de600.h
+0
-1
No files found.
drivers/net/de600.c
View file @
ab40fdb6
...
@@ -99,7 +99,7 @@ static volatile int tx_fifo_in;
...
@@ -99,7 +99,7 @@ static volatile int tx_fifo_in;
static
volatile
int
tx_fifo_out
;
static
volatile
int
tx_fifo_out
;
static
volatile
int
free_tx_pages
=
TX_PAGES
;
static
volatile
int
free_tx_pages
=
TX_PAGES
;
static
int
was_down
;
static
int
was_down
;
static
spinlock_t
de600_lock
;
static
spinlock_t
de600_lock
=
SPIN_LOCK_UNLOCKED
;
static
inline
u8
de600_read_status
(
struct
net_device
*
dev
)
static
inline
u8
de600_read_status
(
struct
net_device
*
dev
)
{
{
...
@@ -398,20 +398,31 @@ static void de600_rx_intr(struct net_device *dev)
...
@@ -398,20 +398,31 @@ static void de600_rx_intr(struct net_device *dev)
*/
*/
}
}
int
__init
de600_probe
(
struct
net_device
*
dev
)
static
struct
net_device
*
__init
de600_probe
(
void
)
{
{
int
i
;
int
i
;
static
struct
net_device_stats
de600_netstats
;
struct
net_device
*
dev
;
/*dev->priv = kmalloc(sizeof(struct net_device_stats), GFP_KERNEL);*/
int
err
;
dev
=
alloc_etherdev
(
sizeof
(
struct
net_device_stats
));
if
(
!
dev
)
return
ERR_PTR
(
-
ENOMEM
);
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
if
(
!
request_region
(
DE600_IO
,
3
,
"de600"
))
{
printk
(
KERN_WARNING
"DE600: port 0x%x busy
\n
"
,
DE600_IO
);
err
=
-
EBUSY
;
goto
out
;
}
printk
(
KERN_INFO
"%s: D-Link DE-600 pocket adapter"
,
dev
->
name
);
printk
(
KERN_INFO
"%s: D-Link DE-600 pocket adapter"
,
dev
->
name
);
/* Alpha testers must have the version number to report bugs. */
/* Alpha testers must have the version number to report bugs. */
if
(
de600_debug
>
1
)
if
(
de600_debug
>
1
)
printk
(
version
);
printk
(
version
);
/* probe for adapter */
/* probe for adapter */
err
=
-
ENODEV
;
rx_page
=
0
;
rx_page
=
0
;
select_nic
();
select_nic
();
(
void
)
de600_read_status
(
dev
);
(
void
)
de600_read_status
(
dev
);
...
@@ -419,7 +430,7 @@ int __init de600_probe(struct net_device *dev)
...
@@ -419,7 +430,7 @@ int __init de600_probe(struct net_device *dev)
de600_put_command
(
STOP_RESET
);
de600_put_command
(
STOP_RESET
);
if
(
de600_read_status
(
dev
)
&
0xf0
)
{
if
(
de600_read_status
(
dev
)
&
0xf0
)
{
printk
(
": not at I/O %#3x.
\n
"
,
DATA_PORT
);
printk
(
": not at I/O %#3x.
\n
"
,
DATA_PORT
);
return
-
ENODEV
;
goto
out1
;
}
}
/*
/*
...
@@ -444,12 +455,7 @@ int __init de600_probe(struct net_device *dev)
...
@@ -444,12 +455,7 @@ int __init de600_probe(struct net_device *dev)
dev
->
dev_addr
[
3
]
|=
0x70
;
dev
->
dev_addr
[
3
]
|=
0x70
;
}
else
{
}
else
{
printk
(
" not identified in the printer port
\n
"
);
printk
(
" not identified in the printer port
\n
"
);
return
-
ENODEV
;
goto
out1
;
}
if
(
!
request_region
(
DE600_IO
,
3
,
"de600"
))
{
printk
(
KERN_WARNING
"DE600: port 0x%x busy
\n
"
,
DE600_IO
);
return
-
EBUSY
;
}
}
printk
(
", Ethernet Address: %02X"
,
dev
->
dev_addr
[
0
]);
printk
(
", Ethernet Address: %02X"
,
dev
->
dev_addr
[
0
]);
...
@@ -457,22 +463,27 @@ int __init de600_probe(struct net_device *dev)
...
@@ -457,22 +463,27 @@ int __init de600_probe(struct net_device *dev)
printk
(
":%02X"
,
dev
->
dev_addr
[
i
]);
printk
(
":%02X"
,
dev
->
dev_addr
[
i
]);
printk
(
"
\n
"
);
printk
(
"
\n
"
);
/* Initialize the device structure. */
dev
->
priv
=
&
de600_netstats
;
memset
(
dev
->
priv
,
0
,
sizeof
(
struct
net_device_stats
));
dev
->
get_stats
=
get_stats
;
dev
->
get_stats
=
get_stats
;
dev
->
open
=
de600_open
;
dev
->
open
=
de600_open
;
dev
->
stop
=
de600_close
;
dev
->
stop
=
de600_close
;
dev
->
hard_start_xmit
=
&
de600_start_xmit
;
dev
->
hard_start_xmit
=
&
de600_start_xmit
;
ether_setup
(
dev
);
dev
->
flags
&=~
IFF_MULTICAST
;
dev
->
flags
&=~
IFF_MULTICAST
;
select_prn
();
select_prn
();
return
0
;
err
=
register_netdev
(
dev
);
if
(
err
)
goto
out1
;
return
dev
;
out1:
release_region
(
DE600_IO
,
3
);
out:
free_netdev
(
dev
);
return
ERR_PTR
(
err
);
}
}
static
int
adapter_init
(
struct
net_device
*
dev
)
static
int
adapter_init
(
struct
net_device
*
dev
)
...
@@ -527,21 +538,21 @@ static int adapter_init(struct net_device *dev)
...
@@ -527,21 +538,21 @@ static int adapter_init(struct net_device *dev)
return
0
;
/* OK */
return
0
;
/* OK */
}
}
static
struct
net_device
de600_dev
;
static
struct
net_device
*
de600_dev
;
static
int
__init
de600_init
(
void
)
static
int
__init
de600_init
(
void
)
{
{
spin_lock_init
(
&
de600_lock
);
de600_dev
=
de600_probe
();
de600_dev
.
init
=
de600_probe
;
if
(
IS_ERR
(
de600_dev
))
if
(
register_netdev
(
&
de600_dev
)
!=
0
)
return
PTR_ERR
(
de600_dev
);
return
-
EIO
;
return
0
;
return
0
;
}
}
static
void
__exit
de600_exit
(
void
)
static
void
__exit
de600_exit
(
void
)
{
{
unregister_netdev
(
&
de600_dev
);
unregister_netdev
(
de600_dev
);
release_region
(
DE600_IO
,
3
);
release_region
(
DE600_IO
,
3
);
free_netdev
(
de600_dev
);
}
}
module_init
(
de600_init
);
module_init
(
de600_init
);
...
...
drivers/net/de600.h
View file @
ab40fdb6
...
@@ -131,7 +131,6 @@ static void de600_rx_intr(struct net_device *dev);
...
@@ -131,7 +131,6 @@ static void de600_rx_intr(struct net_device *dev);
/* Initialization */
/* Initialization */
static
void
trigger_interrupt
(
struct
net_device
*
dev
);
static
void
trigger_interrupt
(
struct
net_device
*
dev
);
int
de600_probe
(
struct
net_device
*
dev
);
static
int
adapter_init
(
struct
net_device
*
dev
);
static
int
adapter_init
(
struct
net_device
*
dev
);
/*
/*
...
...
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