Re: [PATCH 6/9] Bluetooth: mgmt: Fix New Settings event for connectable/discoverable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Marcel,

On Tue, Feb 21, 2012, Marcel Holtmann wrote:
> >  	if (!hdev_is_powered(hdev)) {
> > +		bool changed = false;
> > +
> >  		if (cp->val) {
> > +			if (!test_and_set_bit(HCI_DISCOVERABLE,
> > +							&hdev->dev_flags))
> > +				changed = true;
> >  			set_bit(HCI_CONNECTABLE, &hdev->dev_flags);
> > -			set_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> > -		} else
> > -			clear_bit(HCI_DISCOVERABLE, &hdev->dev_flags);
> > +		} else {
> > +			if (test_and_clear_bit(HCI_DISCOVERABLE,
> > +							&hdev->dev_flags))
> > +				changed = true;
> > +		}
> > +
> 
> does it really need to be this complicated? If we remove the set_bit for
> CONNECTABLE, then we can just send this one out. Since we know that
> something changed.

Since we don't treat trying to change a setting to a value it already
has as an error it's not guaranteed that there will always be a change
in settings. Therefore, we do always need to send the cmd_complete but
not always the new_settings event. In the new set of patches I sent I've
simplified this logic a bit but the check is still there.

Johan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux