RE: [PATCH] USB-MUSB: data not sent to TX FIFO + fix crash due to uninitialized pointer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 

> -----Original Message-----
> From: Greg KH [mailto:greg@xxxxxxxxx] 
> Sent: Monday, February 09, 2009 4:59 PM
> To: Felipe Balbi
> Cc: ext Gupta, Ajay Kumar; ext Giuseppe GORGOGLIONE; 
> linux-usb@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH] USB-MUSB: data not sent to TX FIFO
> 
> On Mon, Feb 09, 2009 at 02:13:13PM +0200, Felipe Balbi wrote:
> > On Mon, Feb 09, 2009 at 01:24:17PM +0100, Ajay Kumar Gupta wrote:
> > > As per latest musb tree, this portion of code is done in 
> > > musb_configure_ep0() Due to BlackFin patches. BlackFin 
> version already has this fix.
> > > 
> > > #if BlackFin
> > > static inline void musb_configure_ep0(struct musb *musb) {
> > >         musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE;
> > >         musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE;
> > >         musb->endpoints[0].is_shared_fifo = true; } #else static 
> > > inline void musb_configure_ep0(struct musb *musb) {
> > >         musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE;
> > >         musb->endpoints[0].max_packet_sz_rx = 
> MUSB_EP0_FIFOSIZE; } 
> > > #endif So I think its better to remove this inline function from 
> > > musb_core.h And add it in musb_core.c itself. There is no 
> need for 
> > > BlackFin specific defs.
> > 
> > Hmm, sure... that still in Greg's queue right ?
> 
> Greg's queue is flushed out and is in the linux-next tree.  
> Please just send patches based on that and you should be fine.
> 
> thanks,
> 
> greg k-h

Felipe,
sorry, if you don't mind I think I will unify again in a single patch
my previous two patches:

- USB-MUSB: data not sent to TX FIFO
- USB-MUSB: fix crash due to uninitialized pointer

because I think they are part of the same problem: a code path not very
well tested because triggered by an hardware configuration of the Mentor
device which is not very common (static FIFOs and static endpoint
configuration from hardware register). Also because now they need maybe
a common code revert to be solved properly.

In fact I'm not completely happy with this new patch because I think that
the functions: musb_read_fifosize() and musb_configure_ep0()
were created by BlackFin guys just because they though those issues were
specific to their platform. So they refactored problematic code out of
original functions, saving the original behaviour #ifndef BLACKFIN and
providing a "platform specific workaround" #ifdef BLACKFIN.

In my patch I'm just correcting both bugs in the #ifndef BLACKFIN branch,
but I think that BlackFin guys should consider to completely remove the
other BlackFin specific branch. A more radical solution would be to
completely remove those two inline functions, taking code lines back to
their original place.

Below my patch.

---

From: Giuseppe GORGOGLIONE

Corrected musb_read_fifosize() and musb_configure_ep0() functions
for the #ifndef BLACKFIN branch,

Signed-off-by: Giuseppe	GORGOGLIONE <giuseppe.gorgoglione@xxxxxx>

---

--- drivers/usb/musb/musb_core.h.orig	2009-02-09 20:54:17.000000000 +0100
+++ drivers/usb/musb/musb_core.h	2009-02-09 21:36:25.000000000 +0100
@@ -479,10 +479,11 @@ static inline void musb_configure_ep0(st
 static inline int musb_read_fifosize(struct musb *musb,
 		struct musb_hw_ep *hw_ep, u8 epnum)
 {
+	void *mbase = musb->mregs;
 	u8 reg = 0;
 
 	/* read from core using indexed model */
-	reg = musb_readb(hw_ep->regs, 0x10 + MUSB_FIFOSIZE);
+	reg = musb_readb(mbase, MUSB_EP_OFFSET(epnum, MUSB_FIFOSIZE));
 	/* 0's returned when no more endpoints */
 	if (!reg)
 		return -ENODEV;
@@ -509,6 +510,7 @@ static inline void musb_configure_ep0(st
 {
 	musb->endpoints[0].max_packet_sz_tx = MUSB_EP0_FIFOSIZE;
 	musb->endpoints[0].max_packet_sz_rx = MUSB_EP0_FIFOSIZE;
+	musb->endpoints[0].is_shared_fifo = true;
 }
 #endif /* CONFIG_BLACKFIN */
 



--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux