/* The generated TKID consist of two parts: the device's authenicated address (or 0 or a GTK); and an incrementing number. This ensures that TKIDs cannot be shared between devices and by the time the incrementing number wraps around the older TKIDs will no longer be in use (a maximum of two keys may be active at any one time).  */
static u32 wusbhc_next_tkid(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
/* The generated TKID consist of two parts: the device's authenicated address (or 0 or a GTK); and an incrementing number. This ensures that TKIDs cannot be shared between devices and by the time the incrementing number wraps around the older TKIDs will no longer be in use (a maximum of two keys may be active at any one time).  */
static u32 wusbhc_next_tkid(struct wusbhc *wusbhc, struct wusb_dev *wusb_dev)
{
	u32 *tkid;
	u32 addr;
	if (wusb_dev == NULL) {
		tkid = &wusbhc->gtk_tkid;
		addr = 0;
	} else {
		tkid = &wusb_port_by_idx(wusbhc, wusb_dev->port_idx)->ptk_tkid;
		addr = wusb_dev->addr & 0x7f;
	}
	*tkid = (addr << 8) | ((*tkid + 1) & 0xff);
	return *tkid;
}