Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp474487yba; Wed, 3 Apr 2019 12:26:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqwvFNmTHF3RrNrad73FupeUpxmjgtA9lKz9+IZcLE/XkW68favWBEckYUBSB7+Idr6kseW3 X-Received: by 2002:a62:4595:: with SMTP id n21mr1211877pfi.79.1554319612178; Wed, 03 Apr 2019 12:26:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554319612; cv=none; d=google.com; s=arc-20160816; b=sBvqKWKxmpz2B/gJihE9/0Hu2S/rmNHvaZQfJND86vzyIWNlKJFmaJ8WssD3gpN+up WgNc742fJh+HwaFwzjse4Wlqdwp8qhRkqPEEQeVi7ZATovOFZCFA1B942o+qqPsvNL0C i++geiWWJXCmGUlhn/Yhq/wG3w2EY/1S74GXTtMepkfbzlUZklgS83C8B9k8aV2zSo7b rSA+lO8ciSaWhFyapZOErw8HtKMVbvROv6vQ/j6pYhRoue+Z3PWnew65+YPNUgT8hB5A w8pHaGyQAXcHmr4yAHjmmngB/BQHfoTK+R8KUgUuJN315sZQtPahJMwCKhwShOS20eAs FH8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=pYR48/AoeQJqS5m+zG0WJkbxxfX7pktlgdWzk+VYVp8=; b=R8EVxhH/Kisr7oLAxTsGjAq3du71s17JYGEL/EZBvUdADI7qBQ5K+FMJWC+9TZ7XiP EE+/ZbD0RLUOscXyuitiJo/vyrdq9LVSV69X6DB7S7bEiRuYQwPmigZwKXy6R1c50yoC iP6E+AMysdPQkWhD5phfTYDPIb/U1uPhbMHvQkIXDE5g+ulDcJ7gC0RUwNagnr5e8WSA T0T5VNn2veCxq9TvoRUHIFM2RQT9RcHmz8CoUEwS5cuPnEh6tqofj2c35kGYbyXtu54c rsfKOMY6JDrubGe74httBrS1JWFWZArJN6y95pv0ONceUBmM6wdy2HSg/G3m6I4pr5K+ yCHg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s20si14380662pgm.137.2019.04.03.12.26.36; Wed, 03 Apr 2019 12:26:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726858AbfDCTZ5 (ORCPT + 99 others); Wed, 3 Apr 2019 15:25:57 -0400 Received: from lnfm1.sai.msu.ru ([93.180.26.255]:49521 "EHLO lnfm1.sai.msu.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726064AbfDCTZx (ORCPT ); Wed, 3 Apr 2019 15:25:53 -0400 X-Greylist: delayed 1904 seconds by postgrey-1.27 at vger.kernel.org; Wed, 03 Apr 2019 15:25:44 EDT Received: from dragon.sai.msu.ru (dragon.sai.msu.ru [93.180.26.172]) by lnfm1.sai.msu.ru (8.14.1/8.12.8) with ESMTP id x33IrWkL024071; Wed, 3 Apr 2019 21:53:37 +0300 Received: from oak.local (unknown [92.243.181.209]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by dragon.sai.msu.ru (Postfix) with ESMTPSA id 01EFAE74A; Wed, 3 Apr 2019 21:53:33 +0300 (MSK) From: "Matwey V. Kornilov" To: b-liu@ti.com, gregkh@linuxfoundation.org Cc: matwey.kornilov@gmail.com, "Matwey V. Kornilov" , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 2/6] usb: musb: Introduce musb_qh_empty() helper function Date: Wed, 3 Apr 2019 21:53:06 +0300 Message-Id: <20190403185310.8437-3-matwey@sai.msu.ru> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190403185310.8437-1-matwey@sai.msu.ru> References: <20190403185310.8437-1-matwey@sai.msu.ru> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use musb_qh_empty() instead of &qh->hep->urb_list to avoid code duplicating. Signed-off-by: Matwey V. Kornilov --- drivers/usb/musb/musb_host.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/usb/musb/musb_host.c b/drivers/usb/musb/musb_host.c index 3ffea6a5e022..37aa9f6155d9 100644 --- a/drivers/usb/musb/musb_host.c +++ b/drivers/usb/musb/musb_host.c @@ -80,6 +80,11 @@ static void musb_ep_program(struct musb *musb, u8 epnum, struct urb *urb, int is_out, u8 *buf, u32 offset, u32 len); +static bool musb_qh_empty(struct musb_qh *qh) +{ + return list_empty(&qh->hep->urb_list); +} + /* * Clear TX fifo. Needed to avoid BABBLE errors. */ @@ -342,7 +347,7 @@ static void musb_advance_schedule(struct musb *musb, struct urb *urb, /* reclaim resources (and bandwidth) ASAP; deschedule it, and * invalidate qh as soon as list_empty(&hep->urb_list) */ - if (list_empty(&qh->hep->urb_list)) { + if (musb_qh_empty(qh)) { struct list_head *head; struct dma_controller *dma = musb->dma_controller; @@ -2430,7 +2435,7 @@ static int musb_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status) /* If nothing else (usually musb_giveback) is using it * and its URB list has emptied, recycle this qh. */ - if (ready && list_empty(&qh->hep->urb_list)) { + if (ready && musb_qh_empty(qh)) { qh->hep->hcpriv = NULL; list_del(&qh->ring); kfree(qh); @@ -2475,7 +2480,7 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) /* Then nuke all the others ... and advance the * queue on hw_ep (e.g. bulk ring) when we're done. */ - while (!list_empty(&hep->urb_list)) { + while (!musb_qh_empty(qh)) { urb = next_urb(qh); urb->status = -ESHUTDOWN; musb_advance_schedule(musb, urb, qh->hw_ep, is_in); @@ -2485,7 +2490,7 @@ musb_h_disable(struct usb_hcd *hcd, struct usb_host_endpoint *hep) * other transfers, and since !qh->is_ready nothing * will activate any of these as it advances. */ - while (!list_empty(&hep->urb_list)) + while (!musb_qh_empty(qh)) musb_giveback(musb, next_urb(qh), -ESHUTDOWN); hep->hcpriv = NULL; -- 2.16.4