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
405cd39f
Commit
405cd39f
authored
Nov 04, 2009
by
Dmitry Eremin-Solenikov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fakehard: mlme_ops->get_phy implementation
Signed-off-by:
Dmitry Eremin-Solenikov
<
dbaryshkov@gmail.com
>
parent
42723448
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
6 deletions
+32
-6
drivers/ieee802154/fakehard.c
drivers/ieee802154/fakehard.c
+32
-6
No files found.
drivers/ieee802154/fakehard.c
View file @
405cd39f
...
@@ -32,9 +32,29 @@
...
@@ -32,9 +32,29 @@
#include <net/nl802154.h>
#include <net/nl802154.h>
#include <net/wpan-phy.h>
#include <net/wpan-phy.h>
static
struct
wpan_phy
*
net_to_phy
(
struct
net_device
*
dev
)
struct
fakehard_priv
{
struct
wpan_phy
*
phy
;
};
static
struct
wpan_phy
*
fake_to_phy
(
const
struct
net_device
*
dev
)
{
struct
fakehard_priv
*
priv
=
netdev_priv
(
dev
);
return
priv
->
phy
;
}
/**
* fake_get_phy - Return a phy corresponding to this device.
* @dev: The network device for which to return the wan-phy object
*
* This function returns a wpan-phy object corresponding to the passed
* network device. Reference counter for wpan-phy object is incremented,
* so when the wpan-phy isn't necessary, you should drop the reference
* via @wpan_phy_put() call.
*/
static
struct
wpan_phy
*
fake_get_phy
(
const
struct
net_device
*
dev
)
{
{
return
container_of
(
dev
->
dev
.
parent
,
struct
wpan_phy
,
dev
);
struct
wpan_phy
*
phy
=
fake_to_phy
(
dev
);
return
to_phy
(
get_device
(
&
phy
->
dev
));
}
}
/**
/**
...
@@ -121,7 +141,7 @@ static u8 fake_get_bsn(const struct net_device *dev)
...
@@ -121,7 +141,7 @@ static u8 fake_get_bsn(const struct net_device *dev)
static
int
fake_assoc_req
(
struct
net_device
*
dev
,
static
int
fake_assoc_req
(
struct
net_device
*
dev
,
struct
ieee802154_addr
*
addr
,
u8
channel
,
u8
page
,
u8
cap
)
struct
ieee802154_addr
*
addr
,
u8
channel
,
u8
page
,
u8
cap
)
{
{
struct
wpan_phy
*
phy
=
net
_to_phy
(
dev
);
struct
wpan_phy
*
phy
=
fake
_to_phy
(
dev
);
mutex_lock
(
&
phy
->
pib_lock
);
mutex_lock
(
&
phy
->
pib_lock
);
phy
->
current_channel
=
channel
;
phy
->
current_channel
=
channel
;
...
@@ -196,7 +216,7 @@ static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
...
@@ -196,7 +216,7 @@ static int fake_start_req(struct net_device *dev, struct ieee802154_addr *addr,
u8
bcn_ord
,
u8
sf_ord
,
u8
pan_coord
,
u8
blx
,
u8
bcn_ord
,
u8
sf_ord
,
u8
pan_coord
,
u8
blx
,
u8
coord_realign
)
u8
coord_realign
)
{
{
struct
wpan_phy
*
phy
=
net
_to_phy
(
dev
);
struct
wpan_phy
*
phy
=
fake
_to_phy
(
dev
);
mutex_lock
(
&
phy
->
pib_lock
);
mutex_lock
(
&
phy
->
pib_lock
);
phy
->
current_channel
=
channel
;
phy
->
current_channel
=
channel
;
...
@@ -239,6 +259,8 @@ static struct ieee802154_mlme_ops fake_mlme = {
...
@@ -239,6 +259,8 @@ static struct ieee802154_mlme_ops fake_mlme = {
.
start_req
=
fake_start_req
,
.
start_req
=
fake_start_req
,
.
scan_req
=
fake_scan_req
,
.
scan_req
=
fake_scan_req
,
.
get_phy
=
fake_get_phy
,
.
get_pan_id
=
fake_get_pan_id
,
.
get_pan_id
=
fake_get_pan_id
,
.
get_short_addr
=
fake_get_short_addr
,
.
get_short_addr
=
fake_get_short_addr
,
.
get_dsn
=
fake_get_dsn
,
.
get_dsn
=
fake_get_dsn
,
...
@@ -313,7 +335,7 @@ static const struct net_device_ops fake_ops = {
...
@@ -313,7 +335,7 @@ static const struct net_device_ops fake_ops = {
static
void
ieee802154_fake_destruct
(
struct
net_device
*
dev
)
static
void
ieee802154_fake_destruct
(
struct
net_device
*
dev
)
{
{
struct
wpan_phy
*
phy
=
net
_to_phy
(
dev
);
struct
wpan_phy
*
phy
=
fake
_to_phy
(
dev
);
wpan_phy_unregister
(
phy
);
wpan_phy_unregister
(
phy
);
free_netdev
(
dev
);
free_netdev
(
dev
);
...
@@ -338,13 +360,14 @@ static void ieee802154_fake_setup(struct net_device *dev)
...
@@ -338,13 +360,14 @@ static void ieee802154_fake_setup(struct net_device *dev)
static
int
__devinit
ieee802154fake_probe
(
struct
platform_device
*
pdev
)
static
int
__devinit
ieee802154fake_probe
(
struct
platform_device
*
pdev
)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
fakehard_priv
*
priv
;
struct
wpan_phy
*
phy
=
wpan_phy_alloc
(
0
);
struct
wpan_phy
*
phy
=
wpan_phy_alloc
(
0
);
int
err
;
int
err
;
if
(
!
phy
)
if
(
!
phy
)
return
-
ENOMEM
;
return
-
ENOMEM
;
dev
=
alloc_netdev
(
0
,
"hardwpan%d"
,
ieee802154_fake_setup
);
dev
=
alloc_netdev
(
sizeof
(
struct
fakehard_priv
)
,
"hardwpan%d"
,
ieee802154_fake_setup
);
if
(
!
dev
)
{
if
(
!
dev
)
{
wpan_phy_free
(
phy
);
wpan_phy_free
(
phy
);
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -370,6 +393,9 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
...
@@ -370,6 +393,9 @@ static int __devinit ieee802154fake_probe(struct platform_device *pdev)
dev
->
netdev_ops
=
&
fake_ops
;
dev
->
netdev_ops
=
&
fake_ops
;
dev
->
ml_priv
=
&
fake_mlme
;
dev
->
ml_priv
=
&
fake_mlme
;
priv
=
netdev_priv
(
dev
);
priv
->
phy
=
phy
;
/*
/*
* If the name is a format string the caller wants us to do a
* If the name is a format string the caller wants us to do a
* name allocation.
* name allocation.
...
...
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