Skip to content

Commit 1ebb925

Browse files
holtmanndavem330
authored andcommitted
[Bluetooth]: Add endian annotations to the core
This patch adds the endian annotations to the Bluetooth core. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 7ef934b commit 1ebb925

6 files changed

Lines changed: 66 additions & 66 deletions

File tree

‎drivers/bluetooth/bpa10x.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ struct bpa10x_data {
8484

8585
struct hci_vendor_hdr {
8686
__u8 type;
87-
__u16 snum;
88-
__u16 dlen;
87+
__le16 snum;
88+
__le16 dlen;
8989
} __attribute__ ((packed));
9090

9191
static void bpa10x_recv_bulk(struct bpa10x_data *data, unsigned char *buf, int count)

‎include/net/bluetooth/hci.h‎

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,10 @@ enum {
184184
struct hci_rp_read_loc_version {
185185
__u8 status;
186186
__u8 hci_ver;
187-
__u16 hci_rev;
187+
__le16 hci_rev;
188188
__u8 lmp_ver;
189-
__u16 manufacturer;
190-
__u16 lmp_subver;
189+
__le16 manufacturer;
190+
__le16 lmp_subver;
191191
} __attribute__ ((packed));
192192

193193
#define OCF_READ_LOCAL_FEATURES 0x0003
@@ -199,10 +199,10 @@ struct hci_rp_read_loc_features {
199199
#define OCF_READ_BUFFER_SIZE 0x0005
200200
struct hci_rp_read_buffer_size {
201201
__u8 status;
202-
__u16 acl_mtu;
202+
__le16 acl_mtu;
203203
__u8 sco_mtu;
204-
__u16 acl_max_pkt;
205-
__u16 sco_max_pkt;
204+
__le16 acl_max_pkt;
205+
__le16 sco_max_pkt;
206206
} __attribute__ ((packed));
207207

208208
#define OCF_READ_BD_ADDR 0x0009
@@ -267,32 +267,32 @@ struct hci_cp_write_dev_class {
267267

268268
#define OCF_READ_VOICE_SETTING 0x0025
269269
struct hci_rp_read_voice_setting {
270-
__u8 status;
271-
__u16 voice_setting;
270+
__u8 status;
271+
__le16 voice_setting;
272272
} __attribute__ ((packed));
273273

274274
#define OCF_WRITE_VOICE_SETTING 0x0026
275275
struct hci_cp_write_voice_setting {
276-
__u16 voice_setting;
276+
__le16 voice_setting;
277277
} __attribute__ ((packed));
278278

279279
#define OCF_HOST_BUFFER_SIZE 0x0033
280280
struct hci_cp_host_buffer_size {
281-
__u16 acl_mtu;
281+
__le16 acl_mtu;
282282
__u8 sco_mtu;
283-
__u16 acl_max_pkt;
284-
__u16 sco_max_pkt;
283+
__le16 acl_max_pkt;
284+
__le16 sco_max_pkt;
285285
} __attribute__ ((packed));
286286

287287
/* Link Control */
288288
#define OGF_LINK_CTL 0x01
289289
#define OCF_CREATE_CONN 0x0005
290290
struct hci_cp_create_conn {
291291
bdaddr_t bdaddr;
292-
__u16 pkt_type;
292+
__le16 pkt_type;
293293
__u8 pscan_rep_mode;
294294
__u8 pscan_mode;
295-
__u16 clock_offset;
295+
__le16 clock_offset;
296296
__u8 role_switch;
297297
} __attribute__ ((packed));
298298

@@ -310,14 +310,14 @@ struct hci_cp_reject_conn_req {
310310

311311
#define OCF_DISCONNECT 0x0006
312312
struct hci_cp_disconnect {
313-
__u16 handle;
313+
__le16 handle;
314314
__u8 reason;
315315
} __attribute__ ((packed));
316316

317317
#define OCF_ADD_SCO 0x0007
318318
struct hci_cp_add_sco {
319-
__u16 handle;
320-
__u16 pkt_type;
319+
__le16 handle;
320+
__le16 pkt_type;
321321
} __attribute__ ((packed));
322322

323323
#define OCF_INQUIRY 0x0001
@@ -354,56 +354,56 @@ struct hci_cp_pin_code_neg_reply {
354354

355355
#define OCF_CHANGE_CONN_PTYPE 0x000F
356356
struct hci_cp_change_conn_ptype {
357-
__u16 handle;
358-
__u16 pkt_type;
357+
__le16 handle;
358+
__le16 pkt_type;
359359
} __attribute__ ((packed));
360360

361361
#define OCF_AUTH_REQUESTED 0x0011
362362
struct hci_cp_auth_requested {
363-
__u16 handle;
363+
__le16 handle;
364364
} __attribute__ ((packed));
365365

366366
#define OCF_SET_CONN_ENCRYPT 0x0013
367367
struct hci_cp_set_conn_encrypt {
368-
__u16 handle;
368+
__le16 handle;
369369
__u8 encrypt;
370370
} __attribute__ ((packed));
371371

372372
#define OCF_CHANGE_CONN_LINK_KEY 0x0015
373373
struct hci_cp_change_conn_link_key {
374-
__u16 handle;
374+
__le16 handle;
375375
} __attribute__ ((packed));
376376

377377
#define OCF_READ_REMOTE_FEATURES 0x001B
378378
struct hci_cp_read_rmt_features {
379-
__u16 handle;
379+
__le16 handle;
380380
} __attribute__ ((packed));
381381

382382
#define OCF_READ_REMOTE_VERSION 0x001D
383383
struct hci_cp_read_rmt_version {
384-
__u16 handle;
384+
__le16 handle;
385385
} __attribute__ ((packed));
386386

387387
/* Link Policy */
388388
#define OGF_LINK_POLICY 0x02
389389
#define OCF_ROLE_DISCOVERY 0x0009
390390
struct hci_cp_role_discovery {
391-
__u16 handle;
391+
__le16 handle;
392392
} __attribute__ ((packed));
393393
struct hci_rp_role_discovery {
394394
__u8 status;
395-
__u16 handle;
395+
__le16 handle;
396396
__u8 role;
397397
} __attribute__ ((packed));
398398

399399
#define OCF_READ_LINK_POLICY 0x000C
400400
struct hci_cp_read_link_policy {
401-
__u16 handle;
401+
__le16 handle;
402402
} __attribute__ ((packed));
403403
struct hci_rp_read_link_policy {
404404
__u8 status;
405-
__u16 handle;
406-
__u16 policy;
405+
__le16 handle;
406+
__le16 policy;
407407
} __attribute__ ((packed));
408408

409409
#define OCF_SWITCH_ROLE 0x000B
@@ -414,12 +414,12 @@ struct hci_cp_switch_role {
414414

415415
#define OCF_WRITE_LINK_POLICY 0x000D
416416
struct hci_cp_write_link_policy {
417-
__u16 handle;
418-
__u16 policy;
417+
__le16 handle;
418+
__le16 policy;
419419
} __attribute__ ((packed));
420420
struct hci_rp_write_link_policy {
421421
__u8 status;
422-
__u16 handle;
422+
__le16 handle;
423423
} __attribute__ ((packed));
424424

425425
/* Status params */
@@ -441,7 +441,7 @@ struct inquiry_info {
441441
__u8 pscan_period_mode;
442442
__u8 pscan_mode;
443443
__u8 dev_class[3];
444-
__u16 clock_offset;
444+
__le16 clock_offset;
445445
} __attribute__ ((packed));
446446

447447
#define HCI_EV_INQUIRY_RESULT_WITH_RSSI 0x22
@@ -450,7 +450,7 @@ struct inquiry_info_with_rssi {
450450
__u8 pscan_rep_mode;
451451
__u8 pscan_period_mode;
452452
__u8 dev_class[3];
453-
__u16 clock_offset;
453+
__le16 clock_offset;
454454
__s8 rssi;
455455
} __attribute__ ((packed));
456456
struct inquiry_info_with_rssi_and_pscan_mode {
@@ -459,7 +459,7 @@ struct inquiry_info_with_rssi_and_pscan_mode {
459459
__u8 pscan_period_mode;
460460
__u8 pscan_mode;
461461
__u8 dev_class[3];
462-
__u16 clock_offset;
462+
__le16 clock_offset;
463463
__s8 rssi;
464464
} __attribute__ ((packed));
465465

@@ -469,15 +469,15 @@ struct extended_inquiry_info {
469469
__u8 pscan_rep_mode;
470470
__u8 pscan_period_mode;
471471
__u8 dev_class[3];
472-
__u16 clock_offset;
472+
__le16 clock_offset;
473473
__s8 rssi;
474474
__u8 data[240];
475475
} __attribute__ ((packed));
476476

477477
#define HCI_EV_CONN_COMPLETE 0x03
478478
struct hci_ev_conn_complete {
479479
__u8 status;
480-
__u16 handle;
480+
__le16 handle;
481481
bdaddr_t bdaddr;
482482
__u8 link_type;
483483
__u8 encr_mode;
@@ -493,27 +493,27 @@ struct hci_ev_conn_request {
493493
#define HCI_EV_DISCONN_COMPLETE 0x05
494494
struct hci_ev_disconn_complete {
495495
__u8 status;
496-
__u16 handle;
496+
__le16 handle;
497497
__u8 reason;
498498
} __attribute__ ((packed));
499499

500500
#define HCI_EV_AUTH_COMPLETE 0x06
501501
struct hci_ev_auth_complete {
502502
__u8 status;
503-
__u16 handle;
503+
__le16 handle;
504504
} __attribute__ ((packed));
505505

506506
#define HCI_EV_ENCRYPT_CHANGE 0x08
507507
struct hci_ev_encrypt_change {
508508
__u8 status;
509-
__u16 handle;
509+
__le16 handle;
510510
__u8 encrypt;
511511
} __attribute__ ((packed));
512512

513513
#define HCI_EV_CHANGE_CONN_LINK_KEY_COMPLETE 0x09
514514
struct hci_ev_change_conn_link_key_complete {
515515
__u8 status;
516-
__u16 handle;
516+
__le16 handle;
517517
} __attribute__ ((packed));
518518

519519
#define HCI_EV_QOS_SETUP_COMPLETE 0x0D
@@ -526,21 +526,21 @@ struct hci_qos {
526526
} __attribute__ ((packed));
527527
struct hci_ev_qos_setup_complete {
528528
__u8 status;
529-
__u16 handle;
529+
__le16 handle;
530530
struct hci_qos qos;
531531
} __attribute__ ((packed));
532532

533533
#define HCI_EV_CMD_COMPLETE 0x0E
534534
struct hci_ev_cmd_complete {
535535
__u8 ncmd;
536-
__u16 opcode;
536+
__le16 opcode;
537537
} __attribute__ ((packed));
538538

539539
#define HCI_EV_CMD_STATUS 0x0F
540540
struct hci_ev_cmd_status {
541541
__u8 status;
542542
__u8 ncmd;
543-
__u16 opcode;
543+
__le16 opcode;
544544
} __attribute__ ((packed));
545545

546546
#define HCI_EV_NUM_COMP_PKTS 0x13
@@ -559,9 +559,9 @@ struct hci_ev_role_change {
559559
#define HCI_EV_MODE_CHANGE 0x14
560560
struct hci_ev_mode_change {
561561
__u8 status;
562-
__u16 handle;
562+
__le16 handle;
563563
__u8 mode;
564-
__u16 interval;
564+
__le16 interval;
565565
} __attribute__ ((packed));
566566

567567
#define HCI_EV_PIN_CODE_REQ 0x16
@@ -584,24 +584,24 @@ struct hci_ev_link_key_notify {
584584
#define HCI_EV_RMT_FEATURES 0x0B
585585
struct hci_ev_rmt_features {
586586
__u8 status;
587-
__u16 handle;
587+
__le16 handle;
588588
__u8 features[8];
589589
} __attribute__ ((packed));
590590

591591
#define HCI_EV_RMT_VERSION 0x0C
592592
struct hci_ev_rmt_version {
593593
__u8 status;
594-
__u16 handle;
594+
__le16 handle;
595595
__u8 lmp_ver;
596-
__u16 manufacturer;
597-
__u16 lmp_subver;
596+
__le16 manufacturer;
597+
__le16 lmp_subver;
598598
} __attribute__ ((packed));
599599

600600
#define HCI_EV_CLOCK_OFFSET 0x01C
601601
struct hci_ev_clock_offset {
602602
__u8 status;
603-
__u16 handle;
604-
__u16 clock_offset;
603+
__le16 handle;
604+
__le16 clock_offset;
605605
} __attribute__ ((packed));
606606

607607
#define HCI_EV_PSCAN_REP_MODE 0x20
@@ -638,7 +638,7 @@ struct hci_ev_si_security {
638638
#define HCI_SCO_HDR_SIZE 3
639639

640640
struct hci_command_hdr {
641-
__u16 opcode; /* OCF & OGF */
641+
__le16 opcode; /* OCF & OGF */
642642
__u8 plen;
643643
} __attribute__ ((packed));
644644

@@ -648,22 +648,22 @@ struct hci_event_hdr {
648648
} __attribute__ ((packed));
649649

650650
struct hci_acl_hdr {
651-
__u16 handle; /* Handle & Flags(PB, BC) */
652-
__u16 dlen;
651+
__le16 handle; /* Handle & Flags(PB, BC) */
652+
__le16 dlen;
653653
} __attribute__ ((packed));
654654

655655
struct hci_sco_hdr {
656-
__u16 handle;
656+
__le16 handle;
657657
__u8 dlen;
658658
} __attribute__ ((packed));
659659

660660
/* Command opcode pack/unpack */
661-
#define hci_opcode_pack(ogf, ocf) (__u16)((ocf & 0x03ff)|(ogf << 10))
661+
#define hci_opcode_pack(ogf, ocf) (__u16) ((ocf & 0x03ff)|(ogf << 10))
662662
#define hci_opcode_ogf(op) (op >> 10)
663663
#define hci_opcode_ocf(op) (op & 0x03ff)
664664

665665
/* ACL handle and flags pack/unpack */
666-
#define hci_handle_pack(h, f) (__u16)((h & 0x0fff)|(f << 12))
666+
#define hci_handle_pack(h, f) (__u16) ((h & 0x0fff)|(f << 12))
667667
#define hci_handle(h) (h & 0x0fff)
668668
#define hci_flags(h) (h >> 12)
669669

‎include/net/bluetooth/hci_core.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct inquiry_data {
4444
__u8 pscan_period_mode;
4545
__u8 pscan_mode;
4646
__u8 dev_class[3];
47-
__u16 clock_offset;
47+
__le16 clock_offset;
4848
__s8 rssi;
4949
};
5050

‎net/bluetooth/hci_core.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ static void hci_reset_req(struct hci_dev *hdev, unsigned long opt)
183183
static void hci_init_req(struct hci_dev *hdev, unsigned long opt)
184184
{
185185
struct sk_buff *skb;
186-
__u16 param;
186+
__le16 param;
187187

188188
BT_DBG("%s %ld", hdev->name, opt);
189189

0 commit comments

Comments
 (0)