* [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies
@ 2012-03-01 22:32 Marcel Holtmann
2012-03-01 22:36 ` Johan Hedberg
2012-03-02 0:23 ` Anderson Lizardo
0 siblings, 2 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-03-01 22:32 UTC (permalink / raw)
To: linux-bluetooth
The MGMT and SMP timeout constants are always used in form of jiffies. So
just include the conversion from msecs in the define itself. This has the
advantage of making the code where the timeout is used more readable.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
---
net/bluetooth/mgmt.c | 5 ++---
net/bluetooth/smp.c | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 7bd7d57..40b3da3 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -116,7 +116,7 @@ static const u16 mgmt_events[] = {
#define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
#define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */
-#define SERVICE_CACHE_TIMEOUT (5 * 1000)
+#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
#define hdev_is_powered(hdev) (test_bit(HCI_UP, &hdev->flags) && \
!test_bit(HCI_AUTO_OFF, &hdev->dev_flags))
@@ -1298,8 +1298,7 @@ static bool enable_service_cache(struct hci_dev *hdev)
return false;
if (!test_and_set_bit(HCI_SERVICE_CACHE, &hdev->dev_flags)) {
- schedule_delayed_work(&hdev->service_cache,
- msecs_to_jiffies(SERVICE_CACHE_TIMEOUT));
+ schedule_delayed_work(&hdev->service_cache, CACHE_TIMEOUT);
return true;
}
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index f6a6d8b..75937d7 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -29,7 +29,7 @@
#include <linux/scatterlist.h>
#include <crypto/b128ops.h>
-#define SMP_TIMEOUT 30000 /* 30 seconds */
+#define SMP_TIMEOUT msecs_to_jiffies(30000)
static inline void swap128(u8 src[16], u8 dst[16])
{
@@ -186,8 +186,7 @@ static void smp_send_cmd(struct l2cap_conn *conn, u8 code, u16 len, void *data)
hci_send_acl(conn->hchan, skb, 0);
cancel_delayed_work_sync(&conn->security_timer);
- schedule_delayed_work(&conn->security_timer,
- msecs_to_jiffies(SMP_TIMEOUT));
+ schedule_delayed_work(&conn->security_timer, SMP_TIMEOUT);
}
static __u8 authreq_to_seclevel(__u8 authreq)
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies
2012-03-01 22:32 [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies Marcel Holtmann
@ 2012-03-01 22:36 ` Johan Hedberg
2012-03-02 0:23 ` Anderson Lizardo
1 sibling, 0 replies; 4+ messages in thread
From: Johan Hedberg @ 2012-03-01 22:36 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Thu, Mar 01, 2012, Marcel Holtmann wrote:
> The MGMT and SMP timeout constants are always used in form of jiffies. So
> just include the conversion from msecs in the define itself. This has the
> advantage of making the code where the timeout is used more readable.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> net/bluetooth/mgmt.c | 5 ++---
> net/bluetooth/smp.c | 5 ++---
> 2 files changed, 4 insertions(+), 6 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies
2012-03-01 22:32 [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies Marcel Holtmann
2012-03-01 22:36 ` Johan Hedberg
@ 2012-03-02 0:23 ` Anderson Lizardo
2012-03-02 0:48 ` Marcel Holtmann
1 sibling, 1 reply; 4+ messages in thread
From: Anderson Lizardo @ 2012-03-02 0:23 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth
Hi Marcel,
On Thu, Mar 1, 2012 at 6:32 PM, Marcel Holtmann <marcel@holtmann.org> wrote=
:
> The MGMT and SMP timeout constants are always used in form of jiffies. So
> just include the conversion from msecs in the define itself. This has the
> advantage of making the code where the timeout is used more readable.
>
> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> =A0net/bluetooth/mgmt.c | =A0 =A05 ++---
> =A0net/bluetooth/smp.c =A0| =A0 =A05 ++---
> =A02 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index 7bd7d57..40b3da3 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -116,7 +116,7 @@ static const u16 mgmt_events[] =3D {
> =A0#define INQUIRY_LEN_BREDR =A0 =A0 =A0 =A0 =A0 =A0 =A00x08 =A0 =A0/* TG=
AP(100) */
> =A0#define INQUIRY_LEN_BREDR_LE =A0 =A0 =A0 =A0 =A0 0x04 =A0 =A0/* TGAP(1=
00)/2 */
>
> -#define SERVICE_CACHE_TIMEOUT (5 * 1000)
> +#define CACHE_TIMEOUT =A0msecs_to_jiffies(2 * 1000)
Was it intentional to change timeout from 5 seconds to 2 seconds on this co=
mmit?
Regards,
--=20
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies
2012-03-02 0:23 ` Anderson Lizardo
@ 2012-03-02 0:48 ` Marcel Holtmann
0 siblings, 0 replies; 4+ messages in thread
From: Marcel Holtmann @ 2012-03-02 0:48 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
Hi Anderson,
> > The MGMT and SMP timeout constants are always used in form of jiffies. So
> > just include the conversion from msecs in the define itself. This has the
> > advantage of making the code where the timeout is used more readable.
> >
> > Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
> > ---
> > net/bluetooth/mgmt.c | 5 ++---
> > net/bluetooth/smp.c | 5 ++---
> > 2 files changed, 4 insertions(+), 6 deletions(-)
> >
> > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> > index 7bd7d57..40b3da3 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -116,7 +116,7 @@ static const u16 mgmt_events[] = {
> > #define INQUIRY_LEN_BREDR 0x08 /* TGAP(100) */
> > #define INQUIRY_LEN_BREDR_LE 0x04 /* TGAP(100)/2 */
> >
> > -#define SERVICE_CACHE_TIMEOUT (5 * 1000)
> > +#define CACHE_TIMEOUT msecs_to_jiffies(2 * 1000)
>
> Was it intentional to change timeout from 5 seconds to 2 seconds on this commit?
the change was intentional, but unintentional I forgot to mention it in
the commit message.
Regards
Marcel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-03-02 0:48 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 22:32 [PATCH] Bluetooth: Update MGMT and SMP timeout constants to use msecs_to_jiffies Marcel Holtmann
2012-03-01 22:36 ` Johan Hedberg
2012-03-02 0:23 ` Anderson Lizardo
2012-03-02 0:48 ` Marcel Holtmann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).