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
ced74922
Commit
ced74922
authored
Sep 30, 2003
by
Stephen Hemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[IRDA]: Convert irport to alloc_irdadev().
parent
b04d4c94
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
31 additions
and
42 deletions
+31
-42
drivers/net/irda/irport.c
drivers/net/irda/irport.c
+31
-42
No files found.
drivers/net/irda/irport.c
View file @
ced74922
...
@@ -78,7 +78,6 @@ static inline void irport_write_wakeup(struct irport_cb *self);
...
@@ -78,7 +78,6 @@ static inline void irport_write_wakeup(struct irport_cb *self);
static
inline
int
irport_write
(
int
iobase
,
int
fifo_size
,
__u8
*
buf
,
int
len
);
static
inline
int
irport_write
(
int
iobase
,
int
fifo_size
,
__u8
*
buf
,
int
len
);
static
inline
void
irport_receive
(
struct
irport_cb
*
self
);
static
inline
void
irport_receive
(
struct
irport_cb
*
self
);
static
int
irport_net_init
(
struct
net_device
*
dev
);
static
int
irport_net_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
static
int
irport_net_ioctl
(
struct
net_device
*
dev
,
struct
ifreq
*
rq
,
int
cmd
);
int
cmd
);
static
inline
int
irport_is_receiving
(
struct
irport_cb
*
self
);
static
inline
int
irport_is_receiving
(
struct
irport_cb
*
self
);
...
@@ -136,30 +135,27 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
...
@@ -136,30 +135,27 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
{
{
struct
net_device
*
dev
;
struct
net_device
*
dev
;
struct
irport_cb
*
self
;
struct
irport_cb
*
self
;
void
*
ret
;
int
err
;
IRDA_DEBUG
(
1
,
"%s()
\n
"
,
__FUNCTION__
);
IRDA_DEBUG
(
1
,
"%s()
\n
"
,
__FUNCTION__
);
/* Lock the port that we need */
/* Lock the port that we need */
ret
=
request_region
(
iobase
,
IO_EXTENT
,
driver_name
);
if
(
!
request_region
(
iobase
,
IO_EXTENT
,
driver_name
))
{
if
(
!
ret
)
{
IRDA_DEBUG
(
0
,
"%s(), can't get iobase of 0x%03x
\n
"
,
IRDA_DEBUG
(
0
,
"%s(), can't get iobase of 0x%03x
\n
"
,
__FUNCTION__
,
iobase
);
__FUNCTION__
,
iobase
);
return
NULL
;
goto
err_out1
;
}
}
/*
/*
* Allocate new instance of the driver
* Allocate new instance of the driver
*/
*/
self
=
kmalloc
(
sizeof
(
struct
irport_cb
),
GFP_KERNEL
);
dev
=
alloc_irdadev
(
sizeof
(
struct
irport_cb
)
);
if
(
!
self
)
{
if
(
!
dev
)
{
ERROR
(
"%s(), can't allocate memory for "
ERROR
(
"%s(), can't allocate memory for "
"control block!
\n
"
,
__FUNCTION__
);
"irda device!
\n
"
,
__FUNCTION__
);
release_region
(
iobase
,
IO_EXTENT
);
goto
err_out2
;
return
NULL
;
}
}
memset
(
self
,
0
,
sizeof
(
struct
irport_cb
));
self
=
dev
->
priv
;
spin_lock_init
(
&
self
->
lock
);
spin_lock_init
(
&
self
->
lock
);
/* Need to store self somewhere */
/* Need to store self somewhere */
...
@@ -189,8 +185,11 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
...
@@ -189,8 +185,11 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
self
->
rx_buff
.
truesize
=
IRDA_SKB_MAX_MTU
;
self
->
rx_buff
.
truesize
=
IRDA_SKB_MAX_MTU
;
self
->
rx_buff
.
skb
=
__dev_alloc_skb
(
self
->
rx_buff
.
truesize
,
self
->
rx_buff
.
skb
=
__dev_alloc_skb
(
self
->
rx_buff
.
truesize
,
GFP_KERNEL
);
GFP_KERNEL
);
if
(
self
->
rx_buff
.
skb
==
NULL
)
if
(
self
->
rx_buff
.
skb
==
NULL
)
{
return
NULL
;
ERROR
(
"%s(), can't allocate memory for "
"receive buffer!
\n
"
,
__FUNCTION__
);
goto
err_out3
;
}
skb_reserve
(
self
->
rx_buff
.
skb
,
1
);
skb_reserve
(
self
->
rx_buff
.
skb
,
1
);
self
->
rx_buff
.
head
=
self
->
rx_buff
.
skb
->
data
;
self
->
rx_buff
.
head
=
self
->
rx_buff
.
skb
->
data
;
/* No need to memset the buffer, unless you are really pedantic */
/* No need to memset the buffer, unless you are really pedantic */
...
@@ -208,30 +207,23 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
...
@@ -208,30 +207,23 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
self
->
tx_buff
.
head
=
(
__u8
*
)
kmalloc
(
self
->
tx_buff
.
truesize
,
self
->
tx_buff
.
head
=
(
__u8
*
)
kmalloc
(
self
->
tx_buff
.
truesize
,
GFP_KERNEL
);
GFP_KERNEL
);
if
(
self
->
tx_buff
.
head
==
NULL
)
{
if
(
self
->
tx_buff
.
head
==
NULL
)
{
kfree_skb
(
self
->
rx_buff
.
skb
);
ERROR
(
"%s(), can't allocate memory for "
self
->
rx_buff
.
skb
=
NULL
;
"transmit buffer!
\n
"
,
__FUNCTION__
);
self
->
rx_buff
.
head
=
NULL
;
goto
err_out4
;
return
NULL
;
}
}
memset
(
self
->
tx_buff
.
head
,
0
,
self
->
tx_buff
.
truesize
);
memset
(
self
->
tx_buff
.
head
,
0
,
self
->
tx_buff
.
truesize
);
}
}
self
->
tx_buff
.
data
=
self
->
tx_buff
.
head
;
self
->
tx_buff
.
data
=
self
->
tx_buff
.
head
;
if
(
!
(
dev
=
dev_alloc
(
"irda%d"
,
&
err
)))
{
ERROR
(
"%s(), dev_alloc() failed!
\n
"
,
__FUNCTION__
);
return
NULL
;
}
self
->
netdev
=
dev
;
self
->
netdev
=
dev
;
/* Keep track of module usage */
/* Keep track of module usage */
SET_MODULE_OWNER
(
dev
);
SET_MODULE_OWNER
(
dev
);
/* May be overridden by piggyback drivers */
/* May be overridden by piggyback drivers */
dev
->
priv
=
(
void
*
)
self
;
self
->
interrupt
=
irport_interrupt
;
self
->
interrupt
=
irport_interrupt
;
self
->
change_speed
=
irport_change_speed
;
self
->
change_speed
=
irport_change_speed
;
/* Override the network functions we need to use */
/* Override the network functions we need to use */
dev
->
init
=
irport_net_init
;
dev
->
hard_start_xmit
=
irport_hard_xmit
;
dev
->
hard_start_xmit
=
irport_hard_xmit
;
dev
->
tx_timeout
=
irport_timeout
;
dev
->
tx_timeout
=
irport_timeout
;
dev
->
watchdog_timeo
=
HZ
;
/* Allow time enough for speed change */
dev
->
watchdog_timeo
=
HZ
;
/* Allow time enough for speed change */
...
@@ -244,17 +236,25 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
...
@@ -244,17 +236,25 @@ irport_open(int i, unsigned int iobase, unsigned int irq)
dev
->
base_addr
=
iobase
;
dev
->
base_addr
=
iobase
;
dev
->
irq
=
irq
;
dev
->
irq
=
irq
;
rtnl_lock
();
if
(
register_netdev
(
dev
))
{
err
=
register_netdevice
(
dev
);
rtnl_unlock
();
if
(
err
)
{
ERROR
(
"%s(), register_netdev() failed!
\n
"
,
__FUNCTION__
);
ERROR
(
"%s(), register_netdev() failed!
\n
"
,
__FUNCTION__
);
return
NULL
;
goto
err_out5
;
}
}
MESSAGE
(
"IrDA: Registered device %s (irport io=0x%X irq=%d)
\n
"
,
MESSAGE
(
"IrDA: Registered device %s (irport io=0x%X irq=%d)
\n
"
,
dev
->
name
,
iobase
,
irq
);
dev
->
name
,
iobase
,
irq
);
return
self
;
return
self
;
err_out5:
kfree
(
self
->
tx_buff
.
head
);
err_out4:
kfree_skb
(
self
->
rx_buff
.
skb
);
err_out3:
free_netdev
(
dev
);
dev_self
[
i
]
=
NULL
;
err_out2:
release_region
(
iobase
,
IO_EXTENT
);
err_out1:
return
NULL
;
}
}
int
irport_close
(
struct
irport_cb
*
self
)
int
irport_close
(
struct
irport_cb
*
self
)
...
@@ -267,8 +267,7 @@ int irport_close(struct irport_cb *self)
...
@@ -267,8 +267,7 @@ int irport_close(struct irport_cb *self)
self
->
dongle
=
NULL
;
self
->
dongle
=
NULL
;
/* Remove netdevice */
/* Remove netdevice */
if
(
self
->
netdev
)
unregister_netdev
(
self
->
netdev
);
unregister_netdev
(
self
->
netdev
);
/* Release the IO-port that this driver is using */
/* Release the IO-port that this driver is using */
IRDA_DEBUG
(
0
,
"%s(), Releasing Region %03x
\n
"
,
IRDA_DEBUG
(
0
,
"%s(), Releasing Region %03x
\n
"
,
...
@@ -284,7 +283,7 @@ int irport_close(struct irport_cb *self)
...
@@ -284,7 +283,7 @@ int irport_close(struct irport_cb *self)
/* Remove ourselves */
/* Remove ourselves */
dev_self
[
self
->
index
]
=
NULL
;
dev_self
[
self
->
index
]
=
NULL
;
kfree
(
self
);
free_netdev
(
self
->
netdev
);
return
0
;
return
0
;
}
}
...
@@ -886,16 +885,6 @@ irqreturn_t irport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
...
@@ -886,16 +885,6 @@ irqreturn_t irport_interrupt(int irq, void *dev_id, struct pt_regs *regs)
return
IRQ_RETVAL
(
handled
);
return
IRQ_RETVAL
(
handled
);
}
}
static
int
irport_net_init
(
struct
net_device
*
dev
)
{
/* Set up to be a normal IrDA network device driver */
irda_device_setup
(
dev
);
/* Insert overrides below this line! */
return
0
;
}
/*
/*
* Function irport_net_open (dev)
* Function irport_net_open (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