mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	usb: gadget: function: f_fs: pass companion descriptor along
If we're dealing with SuperSpeed endpoints, we need to make sure to pass along the companion descriptor and initialize fields needed by the Gadget API. Eventually, f_fs.c should be converted to use config_ep_by_speed() like all other functions, though. Cc: <stable@vger.kernel.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
		
							parent
							
								
									7369090a9f
								
							
						
					
					
						commit
						2bfa0719ac
					
				
					 1 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -1834,11 +1834,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
 | 
			
		|||
	spin_lock_irqsave(&func->ffs->eps_lock, flags);
 | 
			
		||||
	while(count--) {
 | 
			
		||||
		struct usb_endpoint_descriptor *ds;
 | 
			
		||||
		struct usb_ss_ep_comp_descriptor *comp_desc = NULL;
 | 
			
		||||
		int needs_comp_desc = false;
 | 
			
		||||
		int desc_idx;
 | 
			
		||||
 | 
			
		||||
		if (ffs->gadget->speed == USB_SPEED_SUPER)
 | 
			
		||||
		if (ffs->gadget->speed == USB_SPEED_SUPER) {
 | 
			
		||||
			desc_idx = 2;
 | 
			
		||||
		else if (ffs->gadget->speed == USB_SPEED_HIGH)
 | 
			
		||||
			needs_comp_desc = true;
 | 
			
		||||
		} else if (ffs->gadget->speed == USB_SPEED_HIGH)
 | 
			
		||||
			desc_idx = 1;
 | 
			
		||||
		else
 | 
			
		||||
			desc_idx = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -1855,6 +1858,14 @@ static int ffs_func_eps_enable(struct ffs_function *func)
 | 
			
		|||
 | 
			
		||||
		ep->ep->driver_data = ep;
 | 
			
		||||
		ep->ep->desc = ds;
 | 
			
		||||
 | 
			
		||||
		comp_desc = (struct usb_ss_ep_comp_descriptor *)(ds +
 | 
			
		||||
				USB_DT_ENDPOINT_SIZE);
 | 
			
		||||
		ep->ep->maxburst = comp_desc->bMaxBurst + 1;
 | 
			
		||||
 | 
			
		||||
		if (needs_comp_desc)
 | 
			
		||||
			ep->ep->comp_desc = comp_desc;
 | 
			
		||||
 | 
			
		||||
		ret = usb_ep_enable(ep->ep);
 | 
			
		||||
		if (likely(!ret)) {
 | 
			
		||||
			epfile->ep = ep;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue