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
7bd39161
Commit
7bd39161
authored
Oct 08, 2003
by
Michael Hunold
Committed by
Linus Torvalds
Oct 08, 2003
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] Fix DVB network device handling
- simplify and sanitize add/del handling for dvb net devices
parent
49bd4833
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
drivers/media/dvb/dvb-core/dvb_net.c
drivers/media/dvb/dvb-core/dvb_net.c
+21
-15
drivers/media/dvb/dvb-core/dvb_net.h
drivers/media/dvb/dvb-core/dvb_net.h
+1
-1
No files found.
drivers/media/dvb/dvb-core/dvb_net.c
View file @
7bd39161
...
...
@@ -456,7 +456,7 @@ static struct net_device_stats * dvb_net_get_stats(struct net_device *dev)
}
static
void
dvb_net_setup
(
struct
net_device
*
dev
)
static
int
dvb_net_init_dev
(
struct
net_device
*
dev
)
{
ether_setup
(
dev
);
...
...
@@ -472,8 +472,11 @@ static void dvb_net_setup(struct net_device *dev)
dev
->
hard_header_cache
=
NULL
;
dev
->
flags
|=
IFF_NOARP
;
return
0
;
}
static
int
get_if
(
struct
dvb_net
*
dvbnet
)
{
int
i
;
...
...
@@ -493,6 +496,7 @@ static int get_if(struct dvb_net *dvbnet)
static
int
dvb_net_add_if
(
struct
dvb_net
*
dvbnet
,
u16
pid
)
{
struct
net_device
*
net
;
struct
dmx_demux
*
demux
;
struct
dvb_net_priv
*
priv
;
int
result
;
int
if_num
;
...
...
@@ -500,20 +504,25 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
if
((
if_num
=
get_if
(
dvbnet
))
<
0
)
return
-
EINVAL
;
net
=
alloc_netdev
(
sizeof
(
struct
dvb_net_priv
),
"dvb"
,
dvb_net_setup
);
if
(
!
net
)
return
-
ENOMEM
;
net
=
&
dvbnet
->
device
[
if_num
];
demux
=
dvbnet
->
demux
;
sprintf
(
net
->
name
,
"dvb%d_%d"
,
dvbnet
->
dvbdev
->
adapter
->
num
,
if_num
);
memset
(
net
,
0
,
sizeof
(
struct
net_device
)
);
memcpy
(
net
->
name
,
"dvb0_0"
,
7
);
net
->
name
[
3
]
=
dvbnet
->
dvbdev
->
adapter
->
num
+
'0'
;
net
->
name
[
5
]
=
if_num
+
'0'
;
net
->
addr_len
=
6
;
memcpy
(
net
->
dev_addr
,
dvbnet
->
dvbdev
->
adapter
->
proposed_mac
,
6
);
net
->
next
=
NULL
;
net
->
init
=
dvb_net_init_dev
;
dvbnet
->
device
[
if_num
]
=
net
;
if
(
!
(
net
->
priv
=
kmalloc
(
sizeof
(
struct
dvb_net_priv
),
GFP_KERNEL
)))
return
-
ENOMEM
;
priv
=
net
->
priv
;
priv
->
demux
=
dvbnet
->
demux
;
memset
(
priv
,
0
,
sizeof
(
struct
dvb_net_priv
));
priv
->
demux
=
demux
;
priv
->
pid
=
pid
;
priv
->
rx_mode
=
RX_MODE_UNI
;
...
...
@@ -523,7 +532,6 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
net
->
base_addr
=
pid
;
if
((
result
=
register_netdev
(
net
))
<
0
)
{
kfree
(
net
);
return
result
;
}
...
...
@@ -533,20 +541,18 @@ static int dvb_net_add_if(struct dvb_net *dvbnet, u16 pid)
static
int
dvb_net_remove_if
(
struct
dvb_net
*
dvbnet
,
int
num
)
{
struct
net_device
*
net
=
dvbnet
->
device
[
num
];
struct
dvb_net_priv
*
priv
=
net
->
priv
;
struct
dvb_net_priv
*
priv
=
dvbnet
->
device
[
num
].
priv
;
if
(
!
dvbnet
->
state
[
num
])
return
-
EINVAL
;
if
(
priv
->
in_use
)
return
-
EBUSY
;
dvb_net_stop
(
net
);
dvb_net_stop
(
&
dvbnet
->
device
[
num
]
);
flush_scheduled_work
();
unregister_netdev
(
net
);
kfree
(
priv
);
unregister_netdev
(
&
dvbnet
->
device
[
num
]);
dvbnet
->
state
[
num
]
=
0
;
free_netdev
(
net
);
return
0
;
}
...
...
drivers/media/dvb/dvb-core/dvb_net.h
View file @
7bd39161
...
...
@@ -34,7 +34,7 @@
struct
dvb_net
{
struct
dvb_device
*
dvbdev
;
struct
net_device
*
device
[
DVB_NET_DEVICES_MAX
];
struct
net_device
device
[
DVB_NET_DEVICES_MAX
];
int
state
[
DVB_NET_DEVICES_MAX
];
struct
dmx_demux
*
demux
;
};
...
...
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