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
nexedi
linux
Commits
0f65172c
Commit
0f65172c
authored
Aug 29, 2004
by
Alexander Viro
Committed by
Linus Torvalds
Aug 29, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[netdrvr usb] use netdev_priv
Update catc, pegasus, rtl8150, and gadget/ether to use netdev_priv()
parent
7ecab9af
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
106 deletions
+57
-106
drivers/usb/gadget/ether.c
drivers/usb/gadget/ether.c
+8
-8
drivers/usb/net/catc.c
drivers/usb/net/catc.c
+10
-20
drivers/usb/net/pegasus.c
drivers/usb/net/pegasus.c
+20
-31
drivers/usb/net/rtl8150.c
drivers/usb/net/rtl8150.c
+19
-47
No files found.
drivers/usb/gadget/ether.c
View file @
0f65172c
...
...
@@ -1670,7 +1670,7 @@ eth_disconnect (struct usb_gadget *gadget)
static
int
eth_change_mtu
(
struct
net_device
*
net
,
int
new_mtu
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
// FIXME if rndis, don't change while link's live
...
...
@@ -1685,12 +1685,12 @@ static int eth_change_mtu (struct net_device *net, int new_mtu)
static
struct
net_device_stats
*
eth_get_stats
(
struct
net_device
*
net
)
{
return
&
((
struct
eth_dev
*
)
net
->
priv
)
->
stats
;
return
&
((
struct
eth_dev
*
)
netdev_priv
(
net
)
)
->
stats
;
}
static
int
eth_ethtool_ioctl
(
struct
net_device
*
net
,
void
__user
*
useraddr
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
u32
cmd
;
if
(
get_user
(
cmd
,
(
u32
__user
*
)
useraddr
))
...
...
@@ -1997,7 +1997,7 @@ static void tx_complete (struct usb_ep *ep, struct usb_request *req)
static
int
eth_start_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
net
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
int
length
=
skb
->
len
;
int
retval
;
struct
usb_request
*
req
=
NULL
;
...
...
@@ -2110,7 +2110,7 @@ static void rndis_control_ack_complete (struct usb_ep *ep, struct usb_request *r
static
int
rndis_control_ack
(
struct
net_device
*
net
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
u32
length
;
struct
usb_request
*
resp
;
...
...
@@ -2177,7 +2177,7 @@ static void eth_start (struct eth_dev *dev, int gfp_flags)
static
int
eth_open
(
struct
net_device
*
net
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
DEBUG
(
dev
,
"%s
\n
"
,
__FUNCTION__
);
if
(
netif_carrier_ok
(
dev
->
net
))
...
...
@@ -2187,7 +2187,7 @@ static int eth_open (struct net_device *net)
static
int
eth_stop
(
struct
net_device
*
net
)
{
struct
eth_dev
*
dev
=
(
struct
eth_dev
*
)
net
->
priv
;
struct
eth_dev
*
dev
=
netdev_priv
(
net
)
;
VDEBUG
(
dev
,
"%s
\n
"
,
__FUNCTION__
);
netif_stop_queue
(
net
);
...
...
@@ -2474,7 +2474,7 @@ eth_bind (struct usb_gadget *gadget)
net
=
alloc_etherdev
(
sizeof
*
dev
);
if
(
!
net
)
return
status
;
dev
=
net
->
priv
;
dev
=
net
dev_priv
(
net
)
;
spin_lock_init
(
&
dev
->
lock
);
INIT_WORK
(
&
dev
->
work
,
eth_work
,
dev
);
INIT_LIST_HEAD
(
&
dev
->
tx_reqs
);
...
...
drivers/usb/net/catc.c
View file @
0f65172c
...
...
@@ -411,7 +411,7 @@ static void catc_tx_done(struct urb *urb, struct pt_regs *regs)
static
int
catc_hard_start_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
unsigned
long
flags
;
char
*
tx_buf
;
...
...
@@ -442,7 +442,7 @@ static int catc_hard_start_xmit(struct sk_buff *skb, struct net_device *netdev)
static
void
catc_tx_timeout
(
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
warn
(
"Transmit timed out."
);
catc
->
tx_urb
->
transfer_flags
|=
URB_ASYNC_UNLINK
;
...
...
@@ -604,7 +604,7 @@ static void catc_stats_timer(unsigned long data)
static
struct
net_device_stats
*
catc_get_stats
(
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
return
&
catc
->
stats
;
}
...
...
@@ -622,7 +622,7 @@ static void catc_multicast(unsigned char *addr, u8 *multicast)
static
void
catc_set_multicast_list
(
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
struct
dev_mc_list
*
mc
;
u8
broadcast
[
6
];
u8
rx
=
RxEnable
|
RxPolarity
|
RxMultiCast
;
...
...
@@ -669,7 +669,7 @@ static void catc_set_multicast_list(struct net_device *netdev)
*/
static
int
netdev_ethtool_ioctl
(
struct
net_device
*
dev
,
void
__user
*
useraddr
)
{
struct
catc
*
catc
=
dev
->
priv
;
struct
catc
*
catc
=
netdev_priv
(
dev
)
;
u32
cmd
;
if
(
get_user
(
cmd
,
(
u32
__user
*
)
useraddr
))
...
...
@@ -739,7 +739,7 @@ static int catc_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
static
int
catc_open
(
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
int
status
;
catc
->
irq_urb
->
dev
=
catc
->
usbdev
;
...
...
@@ -758,7 +758,7 @@ static int catc_open(struct net_device *netdev)
static
int
catc_stop
(
struct
net_device
*
netdev
)
{
struct
catc
*
catc
=
netdev
->
priv
;
struct
catc
*
catc
=
netdev
_priv
(
netdev
)
;
netif_stop_queue
(
netdev
);
...
...
@@ -791,17 +791,11 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
return
-
EIO
;
}
catc
=
kmalloc
(
sizeof
(
struct
catc
),
GFP_KERNEL
);
if
(
!
catc
)
netdev
=
alloc_etherdev
(
sizeof
(
struct
catc
)
);
if
(
!
netdev
)
return
-
ENOMEM
;
memset
(
catc
,
0
,
sizeof
(
struct
catc
));
netdev
=
alloc_etherdev
(
0
);
if
(
!
netdev
)
{
kfree
(
catc
);
return
-
EIO
;
}
catc
=
netdev_priv
(
netdev
);
netdev
->
open
=
catc_open
;
netdev
->
hard_start_xmit
=
catc_hard_start_xmit
;
...
...
@@ -811,7 +805,6 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
netdev
->
watchdog_timeo
=
TX_TIMEOUT
;
netdev
->
set_multicast_list
=
catc_set_multicast_list
;
netdev
->
do_ioctl
=
catc_ioctl
;
netdev
->
priv
=
catc
;
catc
->
usbdev
=
usbdev
;
catc
->
netdev
=
netdev
;
...
...
@@ -839,7 +832,6 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
if
(
catc
->
irq_urb
)
usb_free_urb
(
catc
->
irq_urb
);
free_netdev
(
netdev
);
kfree
(
catc
);
return
-
ENOMEM
;
}
...
...
@@ -944,7 +936,6 @@ static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id
usb_free_urb
(
catc
->
rx_urb
);
usb_free_urb
(
catc
->
irq_urb
);
free_netdev
(
netdev
);
kfree
(
catc
);
return
-
EIO
;
}
return
0
;
...
...
@@ -962,7 +953,6 @@ static void catc_disconnect(struct usb_interface *intf)
usb_free_urb
(
catc
->
rx_urb
);
usb_free_urb
(
catc
->
irq_urb
);
free_netdev
(
catc
->
netdev
);
kfree
(
catc
);
}
}
...
...
drivers/usb/net/pegasus.c
View file @
0f65172c
...
...
@@ -308,7 +308,7 @@ static int read_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 * regd)
static
int
mdio_read
(
struct
net_device
*
dev
,
int
phy_id
,
int
loc
)
{
pegasus_t
*
pegasus
=
(
pegasus_t
*
)
dev
->
priv
;
pegasus_t
*
pegasus
=
(
pegasus_t
*
)
netdev_priv
(
dev
)
;
int
res
;
read_mii_word
(
pegasus
,
phy_id
,
loc
,
(
u16
*
)
&
res
);
...
...
@@ -338,7 +338,7 @@ static int write_mii_word(pegasus_t * pegasus, __u8 phy, __u8 indx, __u16 regd)
static
void
mdio_write
(
struct
net_device
*
dev
,
int
phy_id
,
int
loc
,
int
val
)
{
pegasus_t
*
pegasus
=
(
pegasus_t
*
)
dev
->
priv
;
pegasus_t
*
pegasus
=
(
pegasus_t
*
)
netdev_priv
(
dev
)
;
write_mii_word
(
pegasus
,
phy_id
,
loc
,
val
);
}
...
...
@@ -471,7 +471,7 @@ static int enable_net_traffic(struct net_device *dev, struct usb_device *usb)
{
__u16
linkpart
;
__u8
data
[
4
];
pegasus_t
*
pegasus
=
dev
->
priv
;
pegasus_t
*
pegasus
=
netdev_priv
(
dev
)
;
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_LPA
,
&
linkpart
);
data
[
0
]
=
0xc9
;
...
...
@@ -754,11 +754,7 @@ static void intr_callback(struct urb *urb, struct pt_regs *regs)
static
void
pegasus_tx_timeout
(
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
=
net
->
priv
;
if
(
!
pegasus
)
return
;
pegasus_t
*
pegasus
=
netdev_priv
(
net
);
warn
(
"%s: Tx timed out."
,
net
->
name
);
pegasus
->
tx_urb
->
transfer_flags
|=
URB_ASYNC_UNLINK
;
usb_unlink_urb
(
pegasus
->
tx_urb
);
...
...
@@ -767,7 +763,7 @@ static void pegasus_tx_timeout(struct net_device *net)
static
int
pegasus_start_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
=
net
->
priv
;
pegasus_t
*
pegasus
=
net
dev_priv
(
net
)
;
int
count
=
((
skb
->
len
+
2
)
&
0x3f
)
?
skb
->
len
+
2
:
skb
->
len
+
3
;
int
res
;
__u16
l16
=
skb
->
len
;
...
...
@@ -804,7 +800,7 @@ static int pegasus_start_xmit(struct sk_buff *skb, struct net_device *net)
static
struct
net_device_stats
*
pegasus_netdev_stats
(
struct
net_device
*
dev
)
{
return
&
((
pegasus_t
*
)
dev
->
priv
)
->
stats
;
return
&
((
pegasus_t
*
)
netdev_priv
(
dev
)
)
->
stats
;
}
static
inline
void
disable_net_traffic
(
pegasus_t
*
pegasus
)
...
...
@@ -832,10 +828,9 @@ static inline void get_interrupt_interval(pegasus_t * pegasus)
static
void
set_carrier
(
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
;
pegasus_t
*
pegasus
=
netdev_priv
(
net
)
;
short
tmp
;
pegasus
=
net
->
priv
;
read_mii_word
(
pegasus
,
pegasus
->
phy
,
MII_BMSR
,
&
tmp
);
if
(
tmp
&
BMSR_LSTATUS
)
netif_carrier_on
(
net
);
...
...
@@ -890,7 +885,7 @@ static int alloc_urbs(pegasus_t * pegasus)
static
int
pegasus_open
(
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
=
(
pegasus_t
*
)
net
->
priv
;
pegasus_t
*
pegasus
=
netdev_priv
(
net
)
;
int
res
;
if
(
pegasus
->
rx_skb
==
NULL
)
...
...
@@ -933,7 +928,7 @@ static int pegasus_open(struct net_device *net)
static
int
pegasus_close
(
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
=
net
->
priv
;
pegasus_t
*
pegasus
=
net
dev_priv
(
net
)
;
pegasus
->
flags
&=
~
PEGASUS_RUNNING
;
netif_stop_queue
(
net
);
...
...
@@ -949,7 +944,7 @@ static int pegasus_ethtool_ioctl(struct net_device *dev, void __user *useraddr)
{
u32
ethcmd
;
pegasus_t
*
pegasus
=
dev
->
priv
;
pegasus_t
*
pegasus
=
netdev_priv
(
dev
)
;
if
(
copy_from_user
(
&
ethcmd
,
useraddr
,
sizeof
(
ethcmd
)))
return
-
EFAULT
;
...
...
@@ -1029,7 +1024,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr)
pegasus_t
*
pegasus
;
int
cmd
;
pegasus
=
net
->
priv
;
pegasus
=
net
dev_priv
(
net
)
;
if
(
get_user
(
cmd
,
(
int
__user
*
)
uaddr
))
return
-
EFAULT
;
switch
(
cmd
)
{
...
...
@@ -1108,7 +1103,7 @@ static int pegasus_ethtool_ioctl(struct net_device *net, void __user *uaddr)
static
int
pegasus_ioctl
(
struct
net_device
*
net
,
struct
ifreq
*
rq
,
int
cmd
)
{
__u16
*
data
=
(
__u16
*
)
&
rq
->
ifr_ifru
;
pegasus_t
*
pegasus
=
net
->
priv
;
pegasus_t
*
pegasus
=
net
dev_priv
(
net
)
;
int
res
;
switch
(
cmd
)
{
...
...
@@ -1135,7 +1130,7 @@ static int pegasus_ioctl(struct net_device *net, struct ifreq *rq, int cmd)
static
void
pegasus_set_multicast
(
struct
net_device
*
net
)
{
pegasus_t
*
pegasus
=
net
->
priv
;
pegasus_t
*
pegasus
=
net
dev_priv
(
net
)
;
if
(
net
->
flags
&
IFF_PROMISC
)
{
pegasus
->
eth_regs
[
EthCtrl2
]
|=
RX_PROMISCUOUS
;
...
...
@@ -1211,11 +1206,13 @@ static int pegasus_probe(struct usb_interface *intf,
int
res
=
-
ENOMEM
;
usb_get_dev
(
dev
);
if
(
!
(
pegasus
=
kmalloc
(
sizeof
(
struct
pegasus
),
GFP_KERNEL
)))
{
net
=
alloc_etherdev
(
sizeof
(
struct
pegasus
));
if
(
!
net
)
{
err
(
"out of memory allocating device structure"
);
goto
out
;
}
pegasus
=
netdev_priv
(
net
);
memset
(
pegasus
,
0
,
sizeof
(
struct
pegasus
));
pegasus
->
dev_index
=
dev_index
;
init_waitqueue_head
(
&
pegasus
->
ctrl_wait
);
...
...
@@ -1223,16 +1220,11 @@ static int pegasus_probe(struct usb_interface *intf,
if
(
!
alloc_urbs
(
pegasus
))
goto
out1
;
net
=
alloc_etherdev
(
0
);
if
(
!
net
)
goto
out2
;
tasklet_init
(
&
pegasus
->
rx_tl
,
rx_fixup
,
(
unsigned
long
)
pegasus
);
pegasus
->
usb
=
dev
;
pegasus
->
net
=
net
;
SET_MODULE_OWNER
(
net
);
net
->
priv
=
pegasus
;
net
->
open
=
pegasus_open
;
net
->
stop
=
pegasus_close
;
net
->
watchdog_timeo
=
PEGASUS_TX_TIMEOUT
;
...
...
@@ -1254,7 +1246,7 @@ static int pegasus_probe(struct usb_interface *intf,
if
(
reset_mac
(
pegasus
))
{
err
(
"can't reset MAC"
);
res
=
-
EIO
;
goto
out
3
;
goto
out
2
;
}
set_ethernet_addr
(
pegasus
);
fill_skb_pool
(
pegasus
);
...
...
@@ -1271,19 +1263,17 @@ static int pegasus_probe(struct usb_interface *intf,
SET_NETDEV_DEV
(
net
,
&
intf
->
dev
);
res
=
register_netdev
(
net
);
if
(
res
)
goto
out
4
;
goto
out
3
;
printk
(
"%s: %s
\n
"
,
net
->
name
,
usb_dev_id
[
dev_index
].
name
);
return
0
;
out
4
:
out
3
:
usb_set_intfdata
(
intf
,
NULL
);
free_skb_pool
(
pegasus
);
out3:
free_netdev
(
net
);
out2:
free_all_urbs
(
pegasus
);
out1:
kfree
(
pegasus
);
free_netdev
(
net
);
out:
usb_put_dev
(
dev
);
return
res
;
...
...
@@ -1307,7 +1297,6 @@ static void pegasus_disconnect(struct usb_interface *intf)
if
(
pegasus
->
rx_skb
)
dev_kfree_skb
(
pegasus
->
rx_skb
);
free_netdev
(
pegasus
->
net
);
kfree
(
pegasus
);
}
static
struct
usb_driver
pegasus_driver
=
{
...
...
drivers/usb/net/rtl8150.c
View file @
0f65172c
...
...
@@ -304,15 +304,12 @@ static inline void set_ethernet_addr(rtl8150_t * dev)
static
int
rtl8150_set_mac_address
(
struct
net_device
*
netdev
,
void
*
p
)
{
struct
sockaddr
*
addr
=
p
;
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
int
i
;
if
(
netif_running
(
netdev
))
return
-
EBUSY
;
dev
=
netdev
->
priv
;
if
(
dev
==
NULL
)
{
return
-
ENODEV
;
}
memcpy
(
netdev
->
dev_addr
,
addr
->
sa_data
,
netdev
->
addr_len
);
dbg
(
"%s: Setting MAC address to "
,
netdev
->
name
);
for
(
i
=
0
;
i
<
5
;
i
++
)
...
...
@@ -651,16 +648,12 @@ static void disable_net_traffic(rtl8150_t * dev)
static
struct
net_device_stats
*
rtl8150_netdev_stats
(
struct
net_device
*
dev
)
{
return
&
((
rtl8150_t
*
)
dev
->
priv
)
->
stats
;
return
&
((
rtl8150_t
*
)
netdev_priv
(
dev
)
)
->
stats
;
}
static
void
rtl8150_tx_timeout
(
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
;
dev
=
netdev
->
priv
;
if
(
!
dev
)
return
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
);
warn
(
"%s: Tx timeout."
,
netdev
->
name
);
dev
->
tx_urb
->
transfer_flags
|=
URB_ASYNC_UNLINK
;
usb_unlink_urb
(
dev
->
tx_urb
);
...
...
@@ -669,9 +662,7 @@ static void rtl8150_tx_timeout(struct net_device *netdev)
static
void
rtl8150_set_multicast
(
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
;
dev
=
netdev
->
priv
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
);
netif_stop_queue
(
netdev
);
if
(
netdev
->
flags
&
IFF_PROMISC
)
{
dev
->
rx_creg
|=
cpu_to_le16
(
0x0001
);
...
...
@@ -691,11 +682,10 @@ static void rtl8150_set_multicast(struct net_device *netdev)
static
int
rtl8150_start_xmit
(
struct
sk_buff
*
skb
,
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
int
count
,
res
;
netif_stop_queue
(
netdev
);
dev
=
netdev
->
priv
;
count
=
(
skb
->
len
<
60
)
?
60
:
skb
->
len
;
count
=
(
count
&
0x3f
)
?
count
:
count
+
1
;
dev
->
tx_skb
=
skb
;
...
...
@@ -717,7 +707,7 @@ static int rtl8150_start_xmit(struct sk_buff *skb, struct net_device *netdev)
static
void
set_carrier
(
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
=
netdev
->
priv
;
rtl8150_t
*
dev
=
netdev
_priv
(
netdev
)
;
short
tmp
;
get_registers
(
dev
,
CSCR
,
2
,
&
tmp
);
...
...
@@ -729,13 +719,9 @@ static void set_carrier(struct net_device *netdev)
static
int
rtl8150_open
(
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
int
res
;
dev
=
netdev
->
priv
;
if
(
dev
==
NULL
)
{
return
-
ENODEV
;
}
if
(
dev
->
rx_skb
==
NULL
)
dev
->
rx_skb
=
pull_skb
(
dev
);
if
(
!
dev
->
rx_skb
)
...
...
@@ -761,13 +747,9 @@ static int rtl8150_open(struct net_device *netdev)
static
int
rtl8150_close
(
struct
net_device
*
netdev
)
{
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
int
res
=
0
;
dev
=
netdev
->
priv
;
if
(
!
dev
)
return
-
ENODEV
;
netif_stop_queue
(
netdev
);
if
(
!
test_bit
(
RTL8150_UNPLUG
,
&
dev
->
flags
))
disable_net_traffic
(
dev
);
...
...
@@ -778,10 +760,9 @@ static int rtl8150_close(struct net_device *netdev)
static
int
rtl8150_ethtool_ioctl
(
struct
net_device
*
netdev
,
void
__user
*
uaddr
)
{
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
int
cmd
;
dev
=
netdev
->
priv
;
if
(
get_user
(
cmd
,
(
int
__user
*
)
uaddr
))
return
-
EFAULT
;
...
...
@@ -851,11 +832,10 @@ static int rtl8150_ethtool_ioctl(struct net_device *netdev, void __user *uaddr)
static
int
rtl8150_ioctl
(
struct
net_device
*
netdev
,
struct
ifreq
*
rq
,
int
cmd
)
{
rtl8150_t
*
dev
;
rtl8150_t
*
dev
=
netdev_priv
(
netdev
)
;
u16
*
data
;
int
res
;
dev
=
netdev
->
priv
;
data
=
(
u16
*
)
&
rq
->
ifr_ifru
;
res
=
0
;
...
...
@@ -887,23 +867,18 @@ static int rtl8150_probe(struct usb_interface *intf,
rtl8150_t
*
dev
;
struct
net_device
*
netdev
;
dev
=
kmalloc
(
sizeof
(
rtl8150_t
),
GFP_KERNEL
);
if
(
!
dev
)
{
netdev
=
alloc_etherdev
(
sizeof
(
rtl8150_t
)
);
if
(
!
net
dev
)
{
err
(
"Out of memory"
);
return
-
ENOMEM
;
}
else
}
dev
=
netdev_priv
(
netdev
);
memset
(
dev
,
0
,
sizeof
(
rtl8150_t
));
dev
->
intr_buff
=
kmalloc
(
INTBUFSIZE
,
GFP_KERNEL
);
if
(
!
dev
->
intr_buff
)
{
kfree
(
dev
);
return
-
ENOMEM
;
}
netdev
=
alloc_etherdev
(
0
);
if
(
!
netdev
)
{
kfree
(
dev
->
intr_buff
);
kfree
(
dev
);
err
(
"Oh boy, out of memory again?!?"
);
free_netdev
(
netdev
);
return
-
ENOMEM
;
}
...
...
@@ -913,7 +888,6 @@ static int rtl8150_probe(struct usb_interface *intf,
dev
->
udev
=
udev
;
dev
->
netdev
=
netdev
;
SET_MODULE_OWNER
(
netdev
);
netdev
->
priv
=
dev
;
netdev
->
open
=
rtl8150_open
;
netdev
->
stop
=
rtl8150_close
;
netdev
->
do_ioctl
=
rtl8150_ioctl
;
...
...
@@ -954,7 +928,6 @@ static int rtl8150_probe(struct usb_interface *intf,
out:
kfree
(
dev
->
intr_buff
);
free_netdev
(
netdev
);
kfree
(
dev
);
return
-
EIO
;
}
...
...
@@ -971,9 +944,8 @@ static void rtl8150_disconnect(struct usb_interface *intf)
free_skb_pool
(
dev
);
if
(
dev
->
rx_skb
)
dev_kfree_skb
(
dev
->
rx_skb
);
free_netdev
(
dev
->
netdev
);
kfree
(
dev
->
intr_buff
);
kfree
(
dev
);
free_netdev
(
dev
->
net
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