From: "Gix, Brian" <brian.gix@intel.com>
To: "linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
"Stotland, Inga" <inga.stotland@intel.com>
Subject: Re: [PATCH BlueZ] mesh: Fix calculation of model publication period
Date: Wed, 29 Jul 2020 19:00:05 +0000 [thread overview]
Message-ID: <c0cacac96a78fbc11162df2fea419c9d48d01524.camel@intel.com> (raw)
In-Reply-To: <20200728181051.22075-1-inga.stotland@intel.com>
Applied
On Tue, 2020-07-28 at 11:10 -0700, Inga Stotland wrote:
> This fixes the extraction of bit fields from model publication
> period octet received as part of Congif Publication Set message.
>
> The step resolution field is extracted as upper 2 bits (shift by 6)
> and the number of steps field is extracted by masking lower 6 bits.
> ---
> mesh/model.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/mesh/model.c b/mesh/model.c
> index 31197b363..ef7668147 100644
> --- a/mesh/model.c
> +++ b/mesh/model.c
> @@ -170,20 +170,21 @@ static struct mesh_model *get_model(struct mesh_node *node, uint8_t ele_idx,
>
> static uint32_t pub_period_to_ms(uint8_t pub_period)
> {
> - int n;
> + int step_res, num_steps;
>
> - n = pub_period >> 2;
> + step_res = pub_period >> 6;
> + num_steps = pub_period & 0x3f;
>
> - switch (pub_period & 0x3) {
> + switch (step_res) {
> default:
> - return n * 100;
> + return num_steps * 100;
> case 2:
> - n *= 10;
> + num_steps *= 10;
> /* Fall Through */
> case 1:
> - return n * 1000;
> + return num_steps * 1000;
> case 3:
> - return n * 10 * 60 * 1000;
> + return num_steps * 10 * 60 * 1000;
> }
> }
>
prev parent reply other threads:[~2020-07-29 19:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-28 18:10 [PATCH BlueZ] mesh: Fix calculation of model publication period Inga Stotland
2020-07-29 19:00 ` Gix, Brian [this message]
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=c0cacac96a78fbc11162df2fea419c9d48d01524.camel@intel.com \
--to=brian.gix@intel.com \
--cc=inga.stotland@intel.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;
as well as URLs for NNTP newsgroup(s).