linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH] Bluetooth: Fix Class of Device indication when powering off
Date: Wed, 16 Jan 2013 21:21:35 -0800	[thread overview]
Message-ID: <1358400095.3059.7.camel@aeonflux> (raw)
In-Reply-To: <1358345734-17892-1-git-send-email-johan.hedberg@gmail.com>

Hi Johan,

> When a HCI device is powered off the Management interface specification
> dictates that the class of device value is indicated as zero. This patch
> fixes sending of the appropriate class of device changed event when a
> HCI device is powered off.
> 
> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
> ---
>  net/bluetooth/mgmt.c |    6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> index fc171f2..54f3ddba 100644
> --- a/net/bluetooth/mgmt.c
> +++ b/net/bluetooth/mgmt.c
> @@ -2987,7 +2987,13 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered)
>  		}
>  	} else {
>  		u8 status = MGMT_STATUS_NOT_POWERED;
> +		u8 zero_cod[] = { 0, 0, 0 };
> +
>  		mgmt_pending_foreach(0, hdev, cmd_status_rsp, &status);
> +
> +		if (memcmp(hdev->dev_class, zero_cod, sizeof(zero_cod)) != 0)

shouldn't we better use if (memcmp( ...)) here.

> +			mgmt_event(MGMT_EV_CLASS_OF_DEV_CHANGED, hdev,
> +				   zero_cod, sizeof(zero_cod), NULL);
>  	}

Otherwise this is fine with me.

Acked-by: Marcel Holtmann <marcel@holtmann.org>

Regards

Marcel



  reply	other threads:[~2013-01-17  5:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-16 14:15 [PATCH] Bluetooth: Fix Class of Device indication when powering off Johan Hedberg
2013-01-17  5:21 ` Marcel Holtmann [this message]
2013-01-23  4:20 ` Gustavo Padovan

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=1358400095.3059.7.camel@aeonflux \
    --to=marcel@holtmann.org \
    --cc=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;
as well as URLs for NNTP newsgroup(s).