Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2318898pxa; Mon, 17 Aug 2020 06:53:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqM44g8qULyTBw8ULzxplPYOAqJ27GhI5l6yKgJqIhuYH33o1wNjqI+bQmwUgkXJmlHHYn X-Received: by 2002:a17:906:bcc4:: with SMTP id lw4mr14669354ejb.361.1597672415763; Mon, 17 Aug 2020 06:53:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597672415; cv=none; d=google.com; s=arc-20160816; b=nfLoCS3/mhJNWHlrAn4g9INYKFK62wR1rXFhw9opy5AB2yeZTwH4DmPEWxQVH+uiR/ 0Mbhiig9PoRtP7jH6Q1ZourlvT4zoa/d09/j38R8A91vE0AJChxY9nFFBAGcjZ7USidx VuKaQtIjm3UkbWcNTYoHPK15lysdFaJSADfr7yJ9neFD4mRndj0h+VI8xXsNXsXuxA5D 8E9c60X6MFlGmMbdT6Hpk6aL1cyiHzQtavVaEreriP671wKipPTnx7G3WrD/XUB3Ut8l Rr5ypWX/gJvA1xZv9UlVQlb4MuEAdCMeJSk/r4OMzWgtZYM8akmBDJ4RAJMWKuz/VIgr Rzag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from:dkim-signature; bh=3rReAqNPoddJY9ZCpQTX2crXEyCdsoWAk2NhdRl2zi0=; b=XNyvpq2tvOj/dHvuZnKjYLvNOV/oz3s/nnd2e6zjzIkmrr2Epj3LL8hkF1ngF/nEi8 SgI9bqyL3cQ8kC4C+JDw4ENY0JSAjbYSoMja2t7g7IDwrQ6eD0nCt2rKKIdQBCwmG1C5 TiOL35KqSzJCUNAKYQvFgiLlfJGv/TW554Gtw2/j+PqRFQaG6ehqUSbPpHEz+uc7HKfM dqzRf9AofhzLpdgM5d4XDu6Dk9re0qLbkxEwUoQHb76M0gFCLrjGo+MB3f4+BbjjBprw JuCTqSA3ntEVBmN33zfz+KveuhZox7R2ZBvj+Ppn30//r1lsH6O8uwxrenQ2StEMhWmb Lx+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B2dQcjMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n2si11913218edi.15.2020.08.17.06.53.12; Mon, 17 Aug 2020 06:53:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B2dQcjMv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728730AbgHQNto (ORCPT + 99 others); Mon, 17 Aug 2020 09:49:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:53292 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727953AbgHQNtm (ORCPT ); Mon, 17 Aug 2020 09:49:42 -0400 Received: from saruman (unknown [194.34.132.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 383D72065C; Mon, 17 Aug 2020 13:49:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597672181; bh=neILveBskNIGri0vUIbvh+uU43bAIKbA+3Ui69RMDEs=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=B2dQcjMvHdPr+yGQWxV5pReE59glr540FiC9zAx/WQDn0xn+sIBKD+xL2t18N9sM4 SAWDG5mRanAZS3YXc1SbcOWFN+I++rs+P2t0AF94BeFQC9kUnY534zUyGQ1LVc4sEc Ew7LVl8v3JitXfdLzjWSBWhzkaD1SkxqAUpbWWOg= From: Felipe Balbi To: rentao.bupt@gmail.com, Greg Kroah-Hartman , Joel Stanley , Andrew Jeffery , Benjamin Herrenschmidt , Chunfeng Yun , Stephen Boyd , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, taoren@fb.com Cc: Tao Ren Subject: Re: [PATCH] usb: gadget: aspeed: fixup vhub port irq handling In-Reply-To: <20200528011154.30355-1-rentao.bupt@gmail.com> References: <20200528011154.30355-1-rentao.bupt@gmail.com> Date: Mon, 17 Aug 2020 16:49:32 +0300 Message-ID: <875z9hz8k3.fsf@kernel.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Hi, rentao.bupt@gmail.com writes: > From: Tao Ren > > This is a follow-on patch for commit a23be4ed8f48 ("usb: gadget: aspeed: > improve vhub port irq handling"): for_each_set_bit() is replaced with > simple for() loop because for() loop runs faster on ASPEED BMC. > > Signed-off-by: Tao Ren > --- > drivers/usb/gadget/udc/aspeed-vhub/core.c | 10 +++------- > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 3 +++ > 2 files changed, 6 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadg= et/udc/aspeed-vhub/core.c > index cdf96911e4b1..be7bb64e3594 100644 > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c > @@ -135,13 +135,9 @@ static irqreturn_t ast_vhub_irq(int irq, void *data) >=20=20 > /* Handle device interrupts */ > if (istat & vhub->port_irq_mask) { > - unsigned long bitmap =3D istat; > - int offset =3D VHUB_IRQ_DEV1_BIT; > - int size =3D VHUB_IRQ_DEV1_BIT + vhub->max_ports; > - > - for_each_set_bit_from(offset, &bitmap, size) { > - i =3D offset - VHUB_IRQ_DEV1_BIT; > - ast_vhub_dev_irq(&vhub->ports[i].dev); > + for (i =3D 0; i < vhub->max_ports; i++) { > + if (istat & VHUB_DEV_IRQ(i)) > + ast_vhub_dev_irq(&vhub->ports[i].dev); how have you measured your statement above? for_each_set_bit() does exactly what you did. Unless your architecture has an instruction which helps finds the next set bit (like cls on ARM), which, then, makes it much faster. =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJFBAEBCAAvFiEElLzh7wn96CXwjh2IzL64meEamQYFAl86iuwRHGJhbGJpQGtl cm5lbC5vcmcACgkQzL64meEamQZuXg//doj2VlNrrpXSD2a83iUegA+NRRRKef1U PRfUUrIK4igGr/FiQAhE9Mlilxj/sZTLcQ6qe1EhIY+f5JhyfucZ5Te4WhNFaxtZ UJp24ndXVc0q8NTmSkre+c6GLX/lD4NFlfgMSsdqpvAlYJirzL4GY63EWA9W8I3k cO4Igdvi8ZskhUgX2QBCM4kDxMk+WxV6PrD8L4EykHmXTzFqVJxKM30BO7U0Gdd4 bmImEVCqzUDSivYKC7xwDWnT0HAXjbm38tcb4hq40pePVtDNEGFiNd3NUo953SvP 065liQg/4ats64P21c+PN0qXFovkWoSTJBa1yzcqfWF+Yi8fKI5UVNp49W0CJZ2m lEKNc/H4+qzEysoXCgWCCznDg4RCxE0f4Y5OsNxkf63QvVEAaFRePgNZ6txble7v dJueHYNiEfsgCe2QUCxl4f805gq2+iIMKGnWvEdwcdlpUCmop+CBXouD9MuMt+hB OLDU6hSo/REsEHKVsooiICwfUOuD0xrqiqObcLKwSd0krXnDRkkYjYm4FvN4u43y y+sTwkU5jswAvcBCHDgayGgm37U0QsDLpZW5voCirwaPqdC+09yVQ18/lx4cA+Lq Y2WHyvRRssi5U8G3YHQUoLVJ7umEx5o6k13rBQNBnueyfEsVM3G8V74j+uuYLGzO BbmxKI2a0bY= =TM9v -----END PGP SIGNATURE----- --=-=-=--