Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp1206383ybi; Fri, 14 Jun 2019 10:23:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdo7J2F2pYZ91Met/XcFULpkzT7Md0XdlR4dczfpiF986mY6P6iYeFLAS2RzJLkamA5Aa8 X-Received: by 2002:a63:4006:: with SMTP id n6mr7823202pga.424.1560533031591; Fri, 14 Jun 2019 10:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560533031; cv=none; d=google.com; s=arc-20160816; b=tdJZa1CgIW25G58ByvXAoApXsn+zcKyPfdwR8dM9F2S1tbaEokU2TX5zAUUtgBXe2F G3ATv9V0MTeAv/kkfClCILpKCFZoyzHKOEN3igphpNMFLQJtFhXxhP68Kfg8RfIdSRe9 TyElbgH/e+mHKXiATu9p5BvXsEJ9QK8HM/zlRqQaSCc9vrert4P6WoPm/VwbVOPz+H1t tjSLqDtaVxbZNc9iC0os5333Qv1oTMhU0BySMvwo5xBzOtbHQ6oO55EF9EH5ZOkAbdpT gd30tEkFM70PpjLmhX2pjix4MP5mxH2d9L0BYXUmnRyA2auXAHOyOvZ9ryCgaDnc/0IG dtVw== 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:references :in-reply-to:message-id:date:subject:cc:to:from; bh=pYR48/AoeQJqS5m+zG0WJkbxxfX7pktlgdWzk+VYVp8=; b=PTsk1/Dn+/ParXuItl+vSbQ9Glr8S5nEFnk4r+vmN+FtBGJF0uz+0jhB5Ty0lzvRc2 U+FrlfBiSX0zN7+3HHsuo90CyMLCSs5LvoXuawOvHlXFo2603g5HneLeeFMo9Q9WYj4J sOY6/Et3R9il7tv9dDKjFaaI/63qBYkjHT/foMBMY2AUcjv4kYnNSV5Ib7gROa40eV/c OKay9jOsRHF4ebpI1Slb7Md6d+XwchnEVIkqQH0Fogok2Swyc3aCy0i7zp//9Nh6xMTt JQtqiMP62R80EuBnK9OM3xRxq81lqyfrdbvQAXEM3duSyxL0wBfVmT23gOqxeu+fH0Aq 4bOQ== 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 y4si3296575pgi.556.2019.06.14.10.23.36; Fri, 14 Jun 2019 10:23:51 -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 S1726184AbfFNRXS (ORCPT + 99 others); Fri, 14 Jun 2019 13:23:18 -0400 Received: from lnfm1.sai.msu.ru ([93.180.26.255]:50801 "EHLO lnfm1.sai.msu.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726370AbfFNRXQ (ORCPT ); Fri, 14 Jun 2019 13:23:16 -0400 X-Greylist: delayed 2129 seconds by postgrey-1.27 at vger.kernel.org; Fri, 14 Jun 2019 13:23:05 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 x5EGl5ZD020147; Fri, 14 Jun 2019 19:47:10 +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 10EF4433F0; Fri, 14 Jun 2019 19:47:06 +0300 (MSK) From: "Matwey V. Kornilov" To: b-liu@ti.com, gregkh@linuxfoundation.org, stern@rowland.harvard.edu Cc: matwey.kornilov@gmail.com, "Matwey V. Kornilov" , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/6] usb: musb: Introduce musb_qh_empty() helper function Date: Fri, 14 Jun 2019 19:45:50 +0300 Message-Id: <20190614164554.27679-3-matwey@sai.msu.ru> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190614164554.27679-1-matwey@sai.msu.ru> References: <20190403185310.8437-1-matwey@sai.msu.ru> <20190614164554.27679-1-matwey@sai.msu.ru> 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