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
63d902f7
Commit
63d902f7
authored
Oct 13, 2002
by
Maksim Krasnyanskiy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get rid of the MIN() thing in Bluetooth code and use min_t() instead.
parent
ba4d1613
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
19 deletions
+15
-19
drivers/bluetooth/hci_h4.c
drivers/bluetooth/hci_h4.c
+1
-1
drivers/bluetooth/hci_usb.c
drivers/bluetooth/hci_usb.c
+1
-1
drivers/bluetooth/hci_vhci.c
drivers/bluetooth/hci_vhci.c
+1
-1
include/net/bluetooth/bluetooth.h
include/net/bluetooth/bluetooth.h
+0
-4
net/bluetooth/hci_sock.c
net/bluetooth/hci_sock.c
+2
-2
net/bluetooth/l2cap.c
net/bluetooth/l2cap.c
+7
-7
net/bluetooth/sco.c
net/bluetooth/sco.c
+3
-3
No files found.
drivers/bluetooth/hci_h4.c
View file @
63d902f7
...
...
@@ -160,7 +160,7 @@ static int h4_recv(struct hci_uart *hu, void *data, int count)
ptr
=
data
;
while
(
count
)
{
if
(
h4
->
rx_count
)
{
len
=
MIN
(
h4
->
rx_count
,
count
);
len
=
min_t
(
unsigned
int
,
h4
->
rx_count
,
count
);
memcpy
(
skb_put
(
h4
->
rx_skb
,
len
),
ptr
,
len
);
h4
->
rx_count
-=
len
;
count
-=
len
;
ptr
+=
len
;
...
...
drivers/bluetooth/hci_usb.c
View file @
63d902f7
...
...
@@ -639,7 +639,7 @@ int hci_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
/* Find endpoints that we need */
ifn
=
MIN
(
udev
->
actconfig
->
bNumInterfaces
,
HCI_MAX_IFACE_NUM
);
ifn
=
min_t
(
unsigned
int
,
udev
->
actconfig
->
bNumInterfaces
,
HCI_MAX_IFACE_NUM
);
for
(
i
=
0
;
i
<
ifn
;
i
++
)
{
iface
=
&
udev
->
actconfig
->
interface
[
i
];
for
(
a
=
0
;
a
<
iface
->
num_altsetting
;
a
++
)
{
...
...
drivers/bluetooth/hci_vhci.c
View file @
63d902f7
...
...
@@ -172,7 +172,7 @@ static inline ssize_t hci_vhci_put_user(struct hci_vhci_struct *hci_vhci,
int
len
=
count
,
total
=
0
;
char
*
ptr
=
buf
;
len
=
MIN
(
skb
->
len
,
len
);
len
=
min_t
(
unsigned
int
,
skb
->
len
,
len
);
if
(
copy_to_user
(
ptr
,
skb
->
data
,
len
))
return
-
EFAULT
;
total
+=
len
;
...
...
include/net/bluetooth/bluetooth.h
View file @
63d902f7
...
...
@@ -42,10 +42,6 @@
/* Reserv for core and drivers use */
#define BT_SKB_RESERVE 8
#ifndef MIN
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#endif
#define BTPROTO_L2CAP 0
#define BTPROTO_HCI 1
#define BTPROTO_SCO 2
...
...
net/bluetooth/hci_sock.c
View file @
63d902f7
...
...
@@ -454,7 +454,7 @@ int hci_sock_setsockopt(struct socket *sock, int level, int optname, char *optva
break
;
case
HCI_FILTER
:
len
=
MIN
(
len
,
sizeof
(
uf
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
uf
));
if
(
copy_from_user
(
&
uf
,
optval
,
len
))
{
err
=
-
EFAULT
;
break
;
...
...
@@ -525,7 +525,7 @@ int hci_sock_getsockopt(struct socket *sock, int level, int optname, char *optva
uf
.
event_mask
[
1
]
=
*
((
u32
*
)
f
->
event_mask
+
1
);
}
len
=
MIN
(
len
,
sizeof
(
uf
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
uf
));
if
(
copy_to_user
(
optval
,
&
uf
,
len
))
return
-
EFAULT
;
break
;
...
...
net/bluetooth/l2cap.c
View file @
63d902f7
...
...
@@ -682,7 +682,7 @@ static int l2cap_sock_setsockopt(struct socket *sock, int level, int optname, ch
switch
(
optname
)
{
case
L2CAP_OPTIONS
:
len
=
MIN
(
sizeof
(
opts
),
optlen
);
len
=
min_t
(
unsigned
int
,
sizeof
(
opts
),
optlen
);
if
(
copy_from_user
((
char
*
)
&
opts
,
optval
,
len
))
{
err
=
-
EFAULT
;
break
;
...
...
@@ -727,7 +727,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
opts
.
omtu
=
l2cap_pi
(
sk
)
->
omtu
;
opts
.
flush_to
=
l2cap_pi
(
sk
)
->
flush_to
;
len
=
MIN
(
len
,
sizeof
(
opts
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
opts
));
if
(
copy_to_user
(
optval
,
(
char
*
)
&
opts
,
len
))
err
=
-
EFAULT
;
...
...
@@ -746,7 +746,7 @@ static int l2cap_sock_getsockopt(struct socket *sock, int level, int optname, ch
cinfo
.
hci_handle
=
l2cap_pi
(
sk
)
->
conn
->
hcon
->
handle
;
len
=
MIN
(
len
,
sizeof
(
cinfo
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
cinfo
));
if
(
copy_to_user
(
optval
,
(
char
*
)
&
cinfo
,
len
))
err
=
-
EFAULT
;
...
...
@@ -1017,7 +1017,7 @@ static int l2cap_chan_send(struct sock *sk, struct msghdr *msg, int len)
else
hlen
=
L2CAP_HDR_SIZE
;
count
=
MIN
(
conn
->
mtu
-
hlen
,
len
);
count
=
min_t
(
unsigned
int
,
(
conn
->
mtu
-
hlen
)
,
len
);
skb
=
bt_skb_send_alloc
(
sk
,
hlen
+
count
,
msg
->
msg_flags
&
MSG_DONTWAIT
,
&
err
);
...
...
@@ -1043,7 +1043,7 @@ static int l2cap_chan_send(struct sock *sk, struct msghdr *msg, int len)
/* Continuation fragments (no L2CAP header) */
frag
=
&
skb_shinfo
(
skb
)
->
frag_list
;
while
(
len
)
{
count
=
MIN
(
conn
->
mtu
,
len
);
count
=
min_t
(
unsigned
int
,
conn
->
mtu
,
len
);
*
frag
=
bt_skb_send_alloc
(
sk
,
count
,
msg
->
msg_flags
&
MSG_DONTWAIT
,
&
err
);
if
(
!*
frag
)
...
...
@@ -1103,7 +1103,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
BT_DBG
(
"conn %p, code 0x%2.2x, ident 0x%2.2x, len %d"
,
conn
,
code
,
ident
,
dlen
);
len
=
L2CAP_HDR_SIZE
+
L2CAP_CMD_HDR_SIZE
+
dlen
;
count
=
MIN
(
conn
->
mtu
,
len
);
count
=
min_t
(
unsigned
int
,
conn
->
mtu
,
len
);
skb
=
bt_skb_alloc
(
count
,
GFP_ATOMIC
);
if
(
!
skb
)
...
...
@@ -1129,7 +1129,7 @@ static struct sk_buff *l2cap_build_cmd(struct l2cap_conn *conn,
/* Continuation fragments (no L2CAP header) */
frag
=
&
skb_shinfo
(
skb
)
->
frag_list
;
while
(
len
)
{
count
=
MIN
(
conn
->
mtu
,
len
);
count
=
min_t
(
unsigned
int
,
conn
->
mtu
,
len
);
*
frag
=
bt_skb_alloc
(
count
,
GFP_ATOMIC
);
if
(
!*
frag
)
...
...
net/bluetooth/sco.c
View file @
63d902f7
...
...
@@ -258,7 +258,7 @@ static inline int sco_send_frame(struct sock *sk, struct msghdr *msg, int len)
BT_DBG
(
"sk %p len %d"
,
sk
,
len
);
count
=
MIN
(
conn
->
mtu
,
len
);
count
=
min_t
(
unsigned
int
,
conn
->
mtu
,
len
);
if
(
!
(
skb
=
bt_skb_send_alloc
(
sk
,
count
,
msg
->
msg_flags
&
MSG_DONTWAIT
,
&
err
)))
return
err
;
...
...
@@ -699,7 +699,7 @@ int sco_sock_getsockopt(struct socket *sock, int level, int optname, char *optva
BT_INFO
(
"mtu %d"
,
opts
.
mtu
);
len
=
MIN
(
len
,
sizeof
(
opts
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
opts
));
if
(
copy_to_user
(
optval
,
(
char
*
)
&
opts
,
len
))
err
=
-
EFAULT
;
...
...
@@ -713,7 +713,7 @@ int sco_sock_getsockopt(struct socket *sock, int level, int optname, char *optva
cinfo
.
hci_handle
=
sco_pi
(
sk
)
->
conn
->
hcon
->
handle
;
len
=
MIN
(
len
,
sizeof
(
cinfo
));
len
=
min_t
(
unsigned
int
,
len
,
sizeof
(
cinfo
));
if
(
copy_to_user
(
optval
,
(
char
*
)
&
cinfo
,
len
))
err
=
-
EFAULT
;
...
...
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