)]}'
{"src/jtag/drivers/pe_mu_usb.c":[{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":75,"context_line":""},{"line_number":76,"context_line":"struct pemu_hdr {"},{"line_number":77,"context_line":"\tuint16_t pkt_type;"},{"line_number":78,"context_line":"\tuint16_t len;"},{"line_number":79,"context_line":"} __attribute__ ((packed));"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"struct pemu_pkt {"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_e6987e7e","line":78,"updated":"2017-02-08 22:28:26.000000000","message":"I think you\u0027d be better off declaring these fields as uint8_t[2], since all you do with them is to call h_u16_to_be on them. That would avoid the casts in those calls.\n\nOr even build the packet directly into pemu.buffer as you already do in some cases and remove all these three structs.","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":79,"context_line":"} __attribute__ ((packed));"},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"struct pemu_pkt {"},{"line_number":82,"context_line":"\tstruct pemu_hdr hdr;"},{"line_number":83,"context_line":"\tuint8_t cmd_type;"},{"line_number":84,"context_line":"\tuint8_t cmd_pemu;"},{"line_number":85,"context_line":"\tuint8_t payload[PEMU_MAX_PKT_SIZE - (sizeof(struct pemu_hdr) + 1)];"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_06b4bae3","line":82,"updated":"2017-02-08 22:28:26.000000000","message":"Are you sure that the compiler isn\u0027t free to insert padding after hdr here? It\u0027s only struct pemu_hdr that is packed.\n\nIt wouldn\u0027t be too bad to duplicate the pkt_type and len fields here and below to avoid any potential padding problem. Along with using uint8_t arrays for them.","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":94,"context_line":"};"},{"line_number":95,"context_line":""},{"line_number":96,"context_line":"struct pemu {"},{"line_number":97,"context_line":"\t/* this driver struct must be the first struct field */"},{"line_number":98,"context_line":"\tstruct bdm_cf26_driver bdm_cf26;"},{"line_number":99,"context_line":"\t/* usb handle */"},{"line_number":100,"context_line":"\tstruct jtag_libusb_device_handle *devh;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_86c8aa78","line":97,"range":{"start_line":97,"start_character":1,"end_line":97,"end_character":56},"updated":"2017-02-08 22:28:26.000000000","message":"Or use container_of() to lift that restriction.","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":207,"context_line":""},{"line_number":208,"context_line":"static int pemu_assert_reset(const struct bdm_cf26_driver *bdm)"},{"line_number":209,"context_line":"{"},{"line_number":210,"context_line":"\tstruct pemu *bdev \u003d (struct pemu *)bdm;"},{"line_number":211,"context_line":"\tuint8_t *buff \u003d pemu_get_bdm_buff(bdev);"},{"line_number":212,"context_line":""},{"line_number":213,"context_line":"\tbuff[0] \u003d CMD_PEMU_RESET;"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_66a5aeb1","line":210,"range":{"start_line":210,"start_character":21,"end_line":210,"end_character":36},"updated":"2017-02-08 22:28:26.000000000","message":"Could hide this downcast in a static inline helper, like to_pemu(), for increased type-safety. Even better if the helper uses container_of().","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":304,"context_line":"\tuint8_t *buff \u003d pemu_get_bdm_buff(bdev);"},{"line_number":305,"context_line":""},{"line_number":306,"context_line":"\tbuff[0] \u003d CMD_PEMU_BDM_MEM_R;"},{"line_number":307,"context_line":"\th_u16_to_be((uint8_t *)\u0026buff[1], CMD_BDM_READ_SCM_REG);"},{"line_number":308,"context_line":"\th_u32_to_be((uint8_t *)\u0026buff[3], reg);"},{"line_number":309,"context_line":""},{"line_number":310,"context_line":"\tpemu_send_generic(bdev, CMD_TYPE_DATA, 7);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_46aab283","line":307,"range":{"start_line":307,"start_character":13,"end_line":307,"end_character":24},"updated":"2017-02-08 22:28:26.000000000","message":"Unnecessary cast, it\u0027s already the right type, same in several places below.","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1001310,"name":"Angelo Dureghello","email":"angelo@sysam.it","username":"angelo"},"change_message_id":"e6c349c3ca7cee59f719aea21863a229fad46cb7","unresolved":false,"context_lines":[{"line_number":304,"context_line":"\tuint8_t *buff \u003d pemu_get_bdm_buff(bdev);"},{"line_number":305,"context_line":""},{"line_number":306,"context_line":"\tbuff[0] \u003d CMD_PEMU_BDM_MEM_R;"},{"line_number":307,"context_line":"\th_u16_to_be((uint8_t *)\u0026buff[1], CMD_BDM_READ_SCM_REG);"},{"line_number":308,"context_line":"\th_u32_to_be((uint8_t *)\u0026buff[3], reg);"},{"line_number":309,"context_line":""},{"line_number":310,"context_line":"\tpemu_send_generic(bdev, CMD_TYPE_DATA, 7);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_869f8a62","line":307,"range":{"start_line":307,"start_character":13,"end_line":307,"end_character":24},"in_reply_to":"8e518320_46aab283","updated":"2017-02-09 09:11:26.000000000","message":"Done","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"},{"author":{"_account_id":1000005,"name":"Andreas Fritiofson","email":"andreas.fritiofson@gmail.com","username":"Nattgris"},"change_message_id":"32ef5fe8bf3fac52a7464a6b9f3fe478f94957c2","unresolved":false,"context_lines":[{"line_number":659,"context_line":"\t\tpkt-\u003ecmd_pemu \u003d CMD_PEMU_W_MEM_BLOCK;"},{"line_number":660,"context_line":"\t\th_u16_to_be((uint8_t *)\u0026pkt-\u003ehdr.len, to_send + 8);"},{"line_number":661,"context_line":"\t\th_u16_to_be((uint8_t *)\u0026pkt-\u003edlen, to_send);"},{"line_number":662,"context_line":"\t\th_u32_to_be((uint8_t *)\u0026pkt-\u003eaddress, address);"},{"line_number":663,"context_line":""},{"line_number":664,"context_line":"\t\tmemcpy(bdev-\u003ebuffer + sizeof(struct pemu_pkt_wmem),"},{"line_number":665,"context_line":"\t\t\t       buffer, to_send);"}],"source_content_type":"text/x-csrc","patch_set":1,"id":"8e518320_c6958244","line":662,"range":{"start_line":662,"start_character":31,"end_line":662,"end_character":38},"updated":"2017-02-08 22:28:26.000000000","message":"All the other similar accesses to dlen and address uses another more straight-forward method, why do it differently here? Seems unnecessary to introduce a separate struct just for this one access.","commit_id":"4c2ccf060f20dfdb6bfda51823db8d61e0710f8d"}]}
