summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaksim Krasnyanskiy <maxk@qualcomm.com>2002-10-13 18:17:53 -0700
committerMaksim Krasnyanskiy <maxk@qualcomm.com>2002-10-13 18:17:53 -0700
commit63d902f71914cbbbedc5745bc48a1c23b4e5e2ba (patch)
tree8adbafd98a36a01fb496e8bde2c700b1754bc9a3
parentba4d161345176c1cc551ca3fbaaab8ebc790d49c (diff)
Get rid of the MIN() thing in Bluetooth code and use min_t() instead.
-rw-r--r--drivers/bluetooth/hci_h4.c2
-rw-r--r--drivers/bluetooth/hci_usb.c2
-rw-r--r--drivers/bluetooth/hci_vhci.c2
-rw-r--r--include/net/bluetooth/bluetooth.h4
-rw-r--r--net/bluetooth/hci_sock.c4
-rw-r--r--net/bluetooth/l2cap.c14
-rw-r--r--net/bluetooth/sco.c6
7 files changed, 15 insertions, 19 deletions
diff --git a/drivers/bluetooth/hci_h4.c b/drivers/bluetooth/hci_h4.c
index b1ba694cf524..521eb19442be 100644
--- a/drivers/bluetooth/hci_h4.c
+++ b/drivers/bluetooth/hci_h4.c
@@ -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;
diff --git a/drivers/bluetooth/hci_usb.c b/drivers/bluetooth/hci_usb.c
index 65248e1df44f..027b4463f3c9 100644
--- a/drivers/bluetooth/hci_usb.c
+++ b/drivers/bluetooth/hci_usb.c
@@ -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++) {
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index aab1aca475d7..a70eef0fd4d9 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -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;
diff --git a/include/net/bluetooth/bluetooth.h b/include/net/bluetooth/bluetooth.h
index a7202d48b57c..d8e54c8f4daf 100644
--- a/include/net/bluetooth/bluetooth.h
+++ b/include/net/bluetooth/bluetooth.h
@@ -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
diff --git a/net/bluetooth/hci_sock.c b/net/bluetooth/hci_sock.c
index e9379c7f2014..0398bb045b4c 100644
--- a/net/bluetooth/hci_sock.c
+++ b/net/bluetooth/hci_sock.c
@@ -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;
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c
index cb47e43234e9..28f06d39daab 100644
--- a/net/bluetooth/l2cap.c
+++ b/net/bluetooth/l2cap.c
@@ -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)
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index e9b04be730ca..defa54f0afc3 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -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;