# Re: \[PATCH\] bluetooth: opcode field of sent commands is little endian.

- From: Michel Dänzer \<hidden\>
- Date: 2012-06-25 07:06:24 
- List: linux-bluetooth
- Page: https://ratatoskr.run/linux-bluetooth/2012/06/9469798
- Thread: https://ratatoskr.run/linux-bluetooth/2012/06/9469796/t.md

```text
On Son, 2012-06-24 at 23:51 -0700, Marcel Holtmann wrote:=20
> Hi Michel,
>=20
> > Fixes built-in Bluetooth not working on Apple PowerBooks, regression fr=
om
> > commit 75fb0e324daa48ec458fb5c2960eb07b80cfad9d ('Bluetooth: Fix init s=
equence
> > for some CSR based controllers').
> >=20
> > Cc: <redacted> [v3.4]
> > Signed-off-by: Michel D=E4nzer <redacted>
> > ---
> >  net/bluetooth/hci_core.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >=20
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index d6dc44c..e039e3d 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -92,7 +92,7 @@ void hci_req_complete(struct hci_dev *hdev, __u16 cmd=
, int result)
> >  		 * command.
> >  		 */
> > =20
> > -		if (cmd !=3D HCI_OP_RESET || sent->opcode =3D=3D HCI_OP_RESET)
> > +		if (cmd !=3D HCI_OP_RESET || sent->opcode =3D=3D cpu_to_le16(HCI_OP_=
RESET))
> >  			return;
>=20
> actually you could use __constant_cpu_to_le16() here.

Yes, but I checked and that's not used anywhere in the bluetooth code
yet, so I thought I'd stay consistent for now.


> That said, this got actually fixed differently upstream. So I prefer if
> that patch gets merged into stable and not this one.
>=20
> commit 1036b89042df96e71c0cb941be212f8053ecccc0
> Author: Andrei Emeltchenko [ref]
> Date:   Mon Mar 12 15:59:33 2012 +0200
>=20
>     Bluetooth: Fix opcode access in hci_complete

Fine with me, though FWIW that not only doesn't use
__constant_cpu_to_le16() but actually swaps the non-constant value.

Also, it would have been nice if that fix was promoted to stable, so I
wouldn't have had to spend a good part of the weekend bisecting...


> In general patches need to get into Linus' tree first before you can
> even request them for stable.

I know, that's why I only put the stable tag in commit logs but don't
submit patches there via e-mail.


--=20
Earthling Michel D=E4nzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer
```
