From: Tao Ren <rentao.bupt@gmail.com>
To: linux-aspeed@lists.ozlabs.org
Subject: [PATCH v2] usb: gadget: aspeed: improve vhub port irq handling
Date: Wed, 11 Mar 2020 17:09:31 -0700 [thread overview]
Message-ID: <20200312000930.GA3956@taoren-ubuntu-R90MNF91> (raw)
In-Reply-To: <481e9b7d40c51505518a34ddc2515d3200dbf158.camel@kernel.crashing.org>
Hi Ben,
On Wed, Mar 11, 2020 at 12:31:22PM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2020-03-05 at 15:47 -0800, rentao.bupt at gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> >
> > This patch evaluates vhub ports' irq mask before going through per-port
> > irq handling one by one, which helps to speed up irq handling in case
> > there is no port interrupt.
> >
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> > Changes in v2:
> > - use "for_each_set_bit" to speed up port irq handling.
> >
> > drivers/usb/gadget/udc/aspeed-vhub/core.c | 11 ++++++++---
> > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 8 +++-----
> > 2 files changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > index f8d35dd60c34..af2dbd405361 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > @@ -134,11 +134,14 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
> > }
> >
> > /* Handle device interrupts */
> > - for (i = 0; i < vhub->max_ports; i++) {
> > - u32 dev_mask = VHUB_IRQ_DEVICE1 << i;
> > + if (istat & vhub->port_irq_mask) {
> > + int offset = VHUB_IRQ_DEV1_BIT;
> > + int size = VHUB_IRQ_DEV1_BIT + vhub->max_ports;
> >
> > - if (istat & dev_mask)
> > + for_each_set_bit_from(offset, (unsigned long *)&istat, size)
>
> That type cast is very bad. It will not work on big endian for example
> (yes this driver isn't used on big endian today but still).
>
> Please assign istat to an unsigned long (or make it unsigned long to
> begin with).
Thanks for pointing it out. Will fix it in v3.
Cheers,
Tao
WARNING: multiple messages have this Message-ID (diff)
From: Tao Ren <rentao.bupt@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Felipe Balbi <balbi@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@aj.id.au>,
Chunfeng Yun <chunfeng.yun@mediatek.com>,
Stephen Boyd <swboyd@chromium.org>,
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
Subject: Re: [PATCH v2] usb: gadget: aspeed: improve vhub port irq handling
Date: Wed, 11 Mar 2020 17:09:31 -0700 [thread overview]
Message-ID: <20200312000930.GA3956@taoren-ubuntu-R90MNF91> (raw)
In-Reply-To: <481e9b7d40c51505518a34ddc2515d3200dbf158.camel@kernel.crashing.org>
Hi Ben,
On Wed, Mar 11, 2020 at 12:31:22PM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2020-03-05 at 15:47 -0800, rentao.bupt@gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> >
> > This patch evaluates vhub ports' irq mask before going through per-port
> > irq handling one by one, which helps to speed up irq handling in case
> > there is no port interrupt.
> >
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> > Changes in v2:
> > - use "for_each_set_bit" to speed up port irq handling.
> >
> > drivers/usb/gadget/udc/aspeed-vhub/core.c | 11 ++++++++---
> > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 8 +++-----
> > 2 files changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > index f8d35dd60c34..af2dbd405361 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > @@ -134,11 +134,14 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
> > }
> >
> > /* Handle device interrupts */
> > - for (i = 0; i < vhub->max_ports; i++) {
> > - u32 dev_mask = VHUB_IRQ_DEVICE1 << i;
> > + if (istat & vhub->port_irq_mask) {
> > + int offset = VHUB_IRQ_DEV1_BIT;
> > + int size = VHUB_IRQ_DEV1_BIT + vhub->max_ports;
> >
> > - if (istat & dev_mask)
> > + for_each_set_bit_from(offset, (unsigned long *)&istat, size)
>
> That type cast is very bad. It will not work on big endian for example
> (yes this driver isn't used on big endian today but still).
>
> Please assign istat to an unsigned long (or make it unsigned long to
> begin with).
Thanks for pointing it out. Will fix it in v3.
Cheers,
Tao
WARNING: multiple messages have this Message-ID (diff)
From: Tao Ren <rentao.bupt@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Felipe Balbi <balbi@kernel.org>,
linux-aspeed@lists.ozlabs.org, Andrew Jeffery <andrew@aj.id.au>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Stephen Boyd <swboyd@chromium.org>,
Joel Stanley <joel@jms.id.au>,
taoren@fb.com, Chunfeng Yun <chunfeng.yun@mediatek.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2] usb: gadget: aspeed: improve vhub port irq handling
Date: Wed, 11 Mar 2020 17:09:31 -0700 [thread overview]
Message-ID: <20200312000930.GA3956@taoren-ubuntu-R90MNF91> (raw)
In-Reply-To: <481e9b7d40c51505518a34ddc2515d3200dbf158.camel@kernel.crashing.org>
Hi Ben,
On Wed, Mar 11, 2020 at 12:31:22PM +1100, Benjamin Herrenschmidt wrote:
> On Thu, 2020-03-05 at 15:47 -0800, rentao.bupt@gmail.com wrote:
> > From: Tao Ren <rentao.bupt@gmail.com>
> >
> > This patch evaluates vhub ports' irq mask before going through per-port
> > irq handling one by one, which helps to speed up irq handling in case
> > there is no port interrupt.
> >
> > Signed-off-by: Tao Ren <rentao.bupt@gmail.com>
> > ---
> > Changes in v2:
> > - use "for_each_set_bit" to speed up port irq handling.
> >
> > drivers/usb/gadget/udc/aspeed-vhub/core.c | 11 ++++++++---
> > drivers/usb/gadget/udc/aspeed-vhub/vhub.h | 8 +++-----
> > 2 files changed, 11 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/usb/gadget/udc/aspeed-vhub/core.c b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > index f8d35dd60c34..af2dbd405361 100644
> > --- a/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > +++ b/drivers/usb/gadget/udc/aspeed-vhub/core.c
> > @@ -134,11 +134,14 @@ static irqreturn_t ast_vhub_irq(int irq, void *data)
> > }
> >
> > /* Handle device interrupts */
> > - for (i = 0; i < vhub->max_ports; i++) {
> > - u32 dev_mask = VHUB_IRQ_DEVICE1 << i;
> > + if (istat & vhub->port_irq_mask) {
> > + int offset = VHUB_IRQ_DEV1_BIT;
> > + int size = VHUB_IRQ_DEV1_BIT + vhub->max_ports;
> >
> > - if (istat & dev_mask)
> > + for_each_set_bit_from(offset, (unsigned long *)&istat, size)
>
> That type cast is very bad. It will not work on big endian for example
> (yes this driver isn't used on big endian today but still).
>
> Please assign istat to an unsigned long (or make it unsigned long to
> begin with).
Thanks for pointing it out. Will fix it in v3.
Cheers,
Tao
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-03-12 0:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-05 23:47 [PATCH v2] usb: gadget: aspeed: improve vhub port irq handling rentao.bupt
2020-03-05 23:47 ` rentao.bupt
2020-03-05 23:47 ` rentao.bupt
2020-03-11 1:31 ` Benjamin Herrenschmidt
2020-03-11 1:31 ` Benjamin Herrenschmidt
2020-03-11 1:31 ` Benjamin Herrenschmidt
2020-03-12 0:09 ` Tao Ren [this message]
2020-03-12 0:09 ` Tao Ren
2020-03-12 0:09 ` Tao Ren
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=20200312000930.GA3956@taoren-ubuntu-R90MNF91 \
--to=rentao.bupt@gmail.com \
--cc=linux-aspeed@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.