From: johan.hedberg@gmail.com
To: linux-bluetooth@vger.kernel.org
Subject: [PATCH 3/3] Bluetooth: Remove useless l2cap_err_to_reason function
Date: Wed, 16 Oct 2013 11:06:41 +0300 [thread overview]
Message-ID: <1381910801-3130-4-git-send-email-johan.hedberg@gmail.com> (raw)
In-Reply-To: <1381910801-3130-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
Now that the only reason code this function can return is
L2CAP_REJ_NOT_UNDERSTOOD we can just do the necessary assignment without
needing a separate function at all.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/l2cap_core.c | 14 ++------------
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 5f2720c..5cbcd4a 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5313,16 +5313,6 @@ static inline int l2cap_le_sig_cmd(struct l2cap_conn *conn,
}
}
-static __le16 l2cap_err_to_reason(int err)
-{
- switch (err) {
- case -EINVAL:
- case -EPROTO:
- default:
- return __constant_cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
- }
-}
-
static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
struct sk_buff *skb)
{
@@ -5355,7 +5345,7 @@ static inline void l2cap_le_sig_channel(struct l2cap_conn *conn,
BT_ERR("Wrong link type (%d)", err);
- rej.reason = l2cap_err_to_reason(err);
+ rej.reason = __constant_cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
l2cap_send_cmd(conn, cmd->ident, L2CAP_COMMAND_REJ,
sizeof(rej), &rej);
}
@@ -5400,7 +5390,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn,
BT_ERR("Wrong link type (%d)", err);
- rej.reason = l2cap_err_to_reason(err);
+ rej.reason = __constant_cpu_to_le16(L2CAP_REJ_NOT_UNDERSTOOD);
l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ,
sizeof(rej), &rej);
}
--
1.8.3.1
next prev parent reply other threads:[~2013-10-16 8:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-16 8:06 [PATCH 0/3] Fix L2CAP command reject PDUs johan.hedberg
2013-10-16 8:06 ` [PATCH 1/3] Bluetooth: Fix L2CAP "Command Reject: Invalid CID" response johan.hedberg
2013-10-16 11:34 ` Anderson Lizardo
2013-10-16 11:43 ` Johan Hedberg
2013-10-16 8:06 ` [PATCH 2/3] Bluetooth: Remove unused command reject mapping for EMSGSIZE johan.hedberg
2013-10-16 8:06 ` johan.hedberg [this message]
2013-10-16 8:16 ` [PATCH 0/3] Fix L2CAP command reject PDUs Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1381910801-3130-4-git-send-email-johan.hedberg@gmail.com \
--to=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox