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
591eb992
Commit
591eb992
authored
Sep 30, 2003
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IRDA]: Convert sir to alloc_irdadev().
parent
f414d1e6
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
39 deletions
+16
-39
drivers/net/irda/sir_dev.c
drivers/net/irda/sir_dev.c
+16
-39
No files found.
drivers/net/irda/sir_dev.c
View file @
591eb992
...
...
@@ -538,28 +538,6 @@ static int sirdev_close(struct net_device *ndev)
/* ----------------------------------------------------------------------------- */
static
int
sirdev_init
(
struct
net_device
*
ndev
)
{
struct
sir_dev
*
dev
=
ndev
->
priv
;
SET_MODULE_OWNER
(
ndev
);
/* Set up to be a normal IrDA network device driver */
irda_device_setup
(
ndev
);
dev
->
flags
=
IFF_SIR
|
IFF_PIO
;
/* Override the network functions we need to use */
ndev
->
hard_start_xmit
=
sirdev_hard_xmit
;
ndev
->
open
=
sirdev_open
;
ndev
->
stop
=
sirdev_close
;
ndev
->
get_stats
=
sirdev_get_stats
;
ndev
->
do_ioctl
=
sirdev_ioctl
;
return
0
;
}
struct
sir_dev
*
sirdev_get_instance
(
const
struct
sir_driver
*
drv
,
const
char
*
name
)
{
struct
net_device
*
ndev
;
...
...
@@ -577,12 +555,12 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
/*
* Allocate new instance of the device
*/
dev
=
kmalloc
(
sizeof
(
*
dev
),
GFP_KERNEL
);
if
(
dev
==
NULL
)
{
ndev
=
alloc_irdadev
(
sizeof
(
*
dev
)
);
if
(
n
dev
==
NULL
)
{
ERROR
(
"%s - Can't allocate memory for IrDA control block!
\n
"
,
__FUNCTION__
);
goto
out
;
}
memset
(
dev
,
0
,
sizeof
(
*
dev
))
;
dev
=
ndev
->
priv
;
irda_init_max_qos_capabilies
(
&
dev
->
qos
);
dev
->
qos
.
baud_rate
.
bits
=
IR_9600
|
IR_19200
|
IR_38400
|
IR_57600
|
IR_115200
;
...
...
@@ -591,11 +569,6 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
strncpy
(
dev
->
hwname
,
name
,
sizeof
(
dev
->
hwname
)
-
1
);
ndev
=
kmalloc
(
sizeof
(
*
ndev
),
GFP_KERNEL
);
if
(
ndev
==
NULL
)
goto
out_freedev
;
memset
(
ndev
,
0
,
sizeof
(
*
ndev
));
atomic_set
(
&
dev
->
enable_rx
,
0
);
dev
->
tx_skb
=
NULL
;
...
...
@@ -609,10 +582,17 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
dev
->
drv
=
drv
;
dev
->
netdev
=
ndev
;
ndev
->
priv
=
(
void
*
)
dev
;
ndev
->
init
=
sirdev_init
;
SET_MODULE_OWNER
(
ndev
);
dev
->
flags
=
IFF_SIR
|
IFF_PIO
;
/* Override the network functions we need to use */
ndev
->
hard_start_xmit
=
sirdev_hard_xmit
;
ndev
->
open
=
sirdev_open
;
ndev
->
stop
=
sirdev_close
;
ndev
->
get_stats
=
sirdev_get_stats
;
ndev
->
do_ioctl
=
sirdev_ioctl
;
strcpy
(
ndev
->
name
,
"irda%d"
);
if
(
register_netdev
(
ndev
))
{
ERROR
(
"%s(), register_netdev() failed!
\n
"
,
__FUNCTION__
);
goto
out_freenetdev
;
...
...
@@ -621,9 +601,7 @@ struct sir_dev * sirdev_get_instance(const struct sir_driver *drv, const char *n
return
dev
;
out_freenetdev:
kfree
(
ndev
);
out_freedev:
kfree
(
dev
);
free_netdev
(
ndev
);
out:
return
NULL
;
}
...
...
@@ -653,10 +631,9 @@ int sirdev_put_instance(struct sir_dev *dev)
up
(
&
dev
->
fsm
.
sem
);
/* Remove netdevice */
if
(
dev
->
netdev
)
unregister_netdev
(
dev
->
netdev
);
kfree
(
dev
);
free_netdev
(
dev
->
net
dev
);
return
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