LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
Cc: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, balbi@ti.com
Subject: Re: [PATCH] usb: gadget: fsl_udc_core: remove mapped flag
Date: Wed, 05 Sep 2012 16:31:51 +0400	[thread overview]
Message-ID: <50474637.6000800@mvista.com> (raw)
In-Reply-To: <1346779499-6085-1-git-send-email-enrico.scholz@sigma-chemnitz.de>

Hello.

On 04-09-2012 21:24, Enrico Scholz wrote:

> The 'mapped' flag in 'struct fsl_req' flag is redundant with checking
> for 'req.dma != DMA_ADDR_INVALID' and it was also set to a wrong value
> (see 2nd hunk of patch).

> Replacing it in the way described above saves 60 bytes:

>    function                                     old     new   delta
>    fsl_udc_irq                                 2952    2940     -12
>    ep0_prime_status                             380     368     -12
>    done                                         448     432     -16
>    fsl_ep_queue                                 668     648     -20

> and has same (or less) runtime costs like evaluating 'req->mapped'.

> Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de>
> ---
>   drivers/usb/gadget/fsl_udc_core.c | 10 ++--------
>   drivers/usb/gadget/fsl_usb2_udc.h |  1 -
>   2 files changed, 2 insertions(+), 9 deletions(-)

> diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
> index 55c4a61..1282a11 100644
> --- a/drivers/usb/gadget/fsl_udc_core.c
> +++ b/drivers/usb/gadget/fsl_udc_core.c
> @@ -195,14 +195,13 @@ static void done(struct fsl_ep *ep, struct fsl_req *req, int status)
>   		dma_pool_free(udc->td_pool, curr_td, curr_td->td_dma);
>   	}
>
> -	if (req->mapped) {
> +	if (req->req.dma != DMA_ADDR_INVALID) {
>   		dma_unmap_single(ep->udc->gadget.dev.parent,
>   			req->req.dma, req->req.length,
>   			ep_is_in(ep)
>   				? DMA_TO_DEVICE
>   				: DMA_FROM_DEVICE);
>   		req->req.dma = DMA_ADDR_INVALID;
> -		req->mapped = 0;
>   	} else
>   		dma_sync_single_for_cpu(ep->udc->gadget.dev.parent,
>   			req->req.dma, req->req.length,
> @@ -915,15 +914,12 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
>   					req->req.length, ep_is_in(ep)
>   						? DMA_TO_DEVICE
>   						: DMA_FROM_DEVICE);
> -		req->mapped = 1;
> -	} else {
> +	} else

    You should keep the { here, according to the Documentation/CodingStyle.
If one branch of the *if* statement uses {}, so should the other.

WBR, Sergei

  parent reply	other threads:[~2012-09-05 12:33 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-04 17:24 [PATCH] usb: gadget: fsl_udc_core: remove mapped flag Enrico Scholz
2012-09-05  2:17 ` Chen Peter-B29397
2012-09-06 14:32   ` Enrico Scholz
2012-09-06 14:32     ` Felipe Balbi
2012-09-05 12:31 ` Sergei Shtylyov [this message]
2012-09-05 12:36 ` Felipe Balbi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50474637.6000800@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=balbi@ti.com \
    --cc=enrico.scholz@sigma-chemnitz.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox