[Cbe-oss-dev] [PATCH 1/5 v2] usb: Fix PS3 EHCI suspend

Antonio Ospite ospite at studenti.unina.it
Fri Dec 2 20:30:21 EST 2011


On Thu, 1 Dec 2011 16:19:18 -0800
Geoff Levand <geoff at infradead.org> wrote:

[...]
> @@ -236,6 +240,30 @@ static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
>  	int error;
>  
>  	error = handshake(ehci, ptr, mask, done, usec);
> +
> +	/*
> +	 * The EHCI controller of the Cell Super Companion Chip used in the
> +	 * PS3 will stop the root hub after all root hub ports are suspended.
> +	 * When in this condition handshake will return -ETIMEDOUT.  The
> +	 * STS_HLT bit will not be set, so inspection of the frame index is
> +	 * used here to test for the condition.  If the condition is found
> +	 * return success to allow the USB suspend to complete.
> +	 */
> +
> +#if defined(CONFIG_USB_SUSPEND) && defined(CONFIG_PPC_PS3)
> +	if (firmware_has_feature(FW_FEATURE_PS3_LV1) && error == -ETIMEDOUT) {
> +#else
> +	if (0) {
> +#endif

Sometime I still have these doubts, forgive me:
Geoff is this done this way to keep the #endif as near as possible to
the #if? I mean wouldn't it be equivalent (even if one would be left out
by the preprocessor and the other by the compiler) to put the whole
conditional block inside the #if defined(CONFIG_PPC_PS3)?

Thanks,
   Antonio

> +		unsigned int old_index = ehci_read_frame_index(ehci);
> +
> +		error = handshake(ehci, ptr, mask, done, usec);
> +
> +		if (error == -ETIMEDOUT
> +			&& (ehci_read_frame_index(ehci) == old_index))
> +			return 0;
> +	}
> +
>  	if (error) {
>  		ehci_halt(ehci);
>  		ehci->rh_state = EHCI_RH_HALTED;
> -- 
> 


-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20111202/06caa8e0/attachment.pgp>


More information about the cbe-oss-dev mailing list