Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp29170ybm; Wed, 27 May 2020 18:14:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7IkLfAaU+z5MsqCL8nDJ4N06gFs7MpnhhM+4bjfafkA1a+F6XB/r0ACzdLtfdxLxdb9TI X-Received: by 2002:a17:906:b750:: with SMTP id fx16mr863354ejb.35.1590628475847; Wed, 27 May 2020 18:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590628475; cv=none; d=google.com; s=arc-20160816; b=D21yjFWzIk9aksxyxfBsqo+jDqd6y/0RLGbSnBTImCwHu6L0d7rAVt9fnjLKGI3Lh0 BSRm0OZKsCOEmqMUxwFLGlZ/4Z0I+pz5u8HMgP5xMEs+wFI9KbCKiPONPJwKg5ppCXNi v/2wFR8msCxn9O37MTKB4AYNjj3HUC8G5plDbRFkTML8htcHGXNYe9kWnDgTzdjoamrh 6OqG4B9v7Uy6QskBdOLRa7un/H4Sx5TWFZ2SIi8Zah1RITbZkAKVpeO9GuJt8nvd6Lb3 b/McE2x2aFhFwSqbzZZlhbfFU7BnUmQcS9Xk3LqL2yLzbUuOu9TJnDXPM+CmTrnolUmJ XgMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=YeymCYJxoRhG3T4Xxmf2TbPWXKoHneVDsox17Vc/EmI=; b=Ac4OSx6c9h3HsO7GNr1aQSblv0lbQHprecddrGnS54wshJjrSiB+56jh6Zeh3tq4dz b71c+/mV6TSaESu5p5BQ5PndG3QtiieZX06sOcSfHpMd4unq0Wl75LFvx4TFYgghQiDL qQcOCaAYkwP92tioCzqE2FHaB4wlZmEIV4RNoyYtxZIYnOazpc/Dihft+z+tvCDVyIk9 lhJKgysb2m0tyqzuV8y4jigQfNqCpF4wkhiC4y0OL3cy69BrexG/svio0u/ac2Kr3Ulh zOnbwHIPgSHcmE7HErytvuE0CtcXTq9OzXlucYOq542CLmAq345wH+P7C/DP9miLRUEO LNIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SF0kMaXB; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id qp5si2772358ejb.629.2020.05.27.18.14.12; Wed, 27 May 2020 18:14: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=@gmail.com header.s=20161025 header.b=SF0kMaXB; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725960AbgE1BMJ (ORCPT + 99 others); Wed, 27 May 2020 21:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59702 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725294AbgE1BMJ (ORCPT ); Wed, 27 May 2020 21:12:09 -0400 Received: from mail-pl1-x644.google.com (mail-pl1-x644.google.com [IPv6:2607:f8b0:4864:20::644]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0768C05BD1E; Wed, 27 May 2020 18:12:08 -0700 (PDT) Received: by mail-pl1-x644.google.com with SMTP id t16so10831475plo.7; Wed, 27 May 2020 18:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YeymCYJxoRhG3T4Xxmf2TbPWXKoHneVDsox17Vc/EmI=; b=SF0kMaXBitrTfXs4ZYGL0gj3rU3facXD9Z2fTnLLHkcmaelUp4j2JlQxp0kJdzFUjc MFxy8X0b+8eBqTreQbnNvD1iIZjyLpLsDWTMXyrR9oFv/PhAbPXcLSGAgh0MnZ7mh5qM 5kq+IwiSeCKTtTNiKSv6Ed1nL43SC+4g0HY3BT0kgs3Hdrssj46/+4FGcbAre1o5of1T bl1yOBNY0mJhv/nL+NVWjIbezYFYztnlEd18gTY/FRsl0gn4cZtTUpVHu6rZ/C3jxrzs rqHH1ko28u+HcZ3UNrY2cTskl/pmAlTvOCtLGF/zRlsWA9YWkdUJoHvY1SFbDlSv6Rza 3VDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YeymCYJxoRhG3T4Xxmf2TbPWXKoHneVDsox17Vc/EmI=; b=lCncpQAl86hsn8qZAwpmeQ2UYhSNfMKFIeYZqtv+U+XWl81Qj7q0Gx0f7esyvV6EFz PDdeewY3gMmgsxjzFoTXFJ8HLMcAoXNthScWjrRiM1xNFjeXhwlZ2qAoeHenzImzj8uO fcAo1hggtp64sKN4lQAYKSayQWV1fOV1K5gqCxfVLpzubpZXHG2AXiYqbLZwwopkYXw+ bVteEv4bIkJMFYb+vDGUYAtuLgEuIhvvm5NCgJIVD+9l8omtK8odCfihqGl4G3f3P9+g 1sfNxcrPCvkRku6NeiZKsQMOs9jSyYrhNHwmqHKaK83UE6yJyFNp7JSVGgB3cifUsfKh cpRw== X-Gm-Message-State: AOAM5305iFfwEB7Fchl6NM4/C377pZpmXgQH8hW0SJjoBnjdegSyVOr0 klCz7nOyNAZqIO3WAx4rTBQ= X-Received: by 2002:a17:90a:dd43:: with SMTP id u3mr1018695pjv.221.1590628327909; Wed, 27 May 2020 18:12:07 -0700 (PDT) Received: from taoren-ubuntu-R90MNF91.thefacebook.com ([2620:10d:c090:400::5:ccc9]) by smtp.gmail.com with ESMTPSA id gd1sm3570640pjb.14.2020.05.27.18.12.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2020 18:12:07 -0700 (PDT) From: rentao.bupt@gmail.com To: Felipe Balbi , 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: [PATCH] usb: gadget: aspeed: fixup vhub port irq handling Date: Wed, 27 May 2020 18:11:54 -0700 Message-Id: <20200528011154.30355-1-rentao.bupt@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/gadget/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) /* Handle device interrupts */ if (istat & vhub->port_irq_mask) { - unsigned long bitmap = istat; - int offset = VHUB_IRQ_DEV1_BIT; - int size = VHUB_IRQ_DEV1_BIT + vhub->max_ports; - - for_each_set_bit_from(offset, &bitmap, size) { - i = offset - VHUB_IRQ_DEV1_BIT; - ast_vhub_dev_irq(&vhub->ports[i].dev); + for (i = 0; i < vhub->max_ports; i++) { + if (istat & VHUB_DEV_IRQ(i)) + ast_vhub_dev_irq(&vhub->ports[i].dev); } } diff --git a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h index 2e5a1ef14a75..87a5dea12d3c 100644 --- a/drivers/usb/gadget/udc/aspeed-vhub/vhub.h +++ b/drivers/usb/gadget/udc/aspeed-vhub/vhub.h @@ -67,6 +67,9 @@ #define VHUB_IRQ_HUB_EP0_SETUP (1 << 0) #define VHUB_IRQ_ACK_ALL 0x1ff +/* Downstream device IRQ mask. */ +#define VHUB_DEV_IRQ(n) (VHUB_IRQ_DEVICE1 << (n)) + /* SW reset reg */ #define VHUB_SW_RESET_EP_POOL (1 << 9) #define VHUB_SW_RESET_DMA_CONTROLLER (1 << 8) -- 2.17.1