From patchwork Fri Aug 14 13:50:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11714645 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1F17E722 for ; Fri, 14 Aug 2020 13:51:03 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D8A1120885 for ; Fri, 14 Aug 2020 13:51:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D8A1120885 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id CF5E56B0005; Fri, 14 Aug 2020 09:51:01 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id C7F786B0007; Fri, 14 Aug 2020 09:51:01 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6E656B0008; Fri, 14 Aug 2020 09:51:01 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0226.hostedemail.com [216.40.44.226]) by kanga.kvack.org (Postfix) with ESMTP id 9EAE26B0005 for ; Fri, 14 Aug 2020 09:51:01 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 52E024403 for ; Fri, 14 Aug 2020 13:51:01 +0000 (UTC) X-FDA: 77149310322.28.brake96_5807f1f26ffd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id 171066D73 for ; Fri, 14 Aug 2020 13:51:01 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,andriy.shevchenko@linux.intel.com,,RULES_HIT:30012:30054,0,RBL:134.134.136.31:@linux.intel.com:.lbl8.mailshell.net-62.18.0.100 64.95.201.95;04yf5t1mgdh15aiqfjikjm4gxoicuocw8i9rrnqu9br5bmzhr9uswt9aoj8ntkp.6oynbxuutnqk43dhpuzw7m5yw68nfnb3tsigcbtynu7w5gppdr6mnwebisqt5nh.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: brake96_5807f1f26ffd X-Filterd-Recvd-Size: 2778 Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Fri, 14 Aug 2020 13:51:00 +0000 (UTC) IronPort-SDR: 7/EZzyR38JBX0TsiGpMYNvvYO7bcDpa6UOlVpT+ra8B/oR3XLJRQjppZ77vDqDlVbqiPLj/xHH FiulAXXlAoWQ== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="215926430" X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="215926430" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Aug 2020 06:50:58 -0700 IronPort-SDR: 2CCFlb8oa+Ep2+j22a8m04JJp3JZbCiuSajoVHJ6fLKkZHt49kUxh9kzjfe+OJTjfx5Z9i4Yw2 eHbi9jr9QKVQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="369905340" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga001.jf.intel.com with ESMTP; 14 Aug 2020 06:50:56 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 13656163; Fri, 14 Aug 2020 16:50:55 +0300 (EEST) From: Andy Shevchenko To: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox Cc: Andy Shevchenko Subject: [PATCH v2 1/2] mm/dmapool.c: Replace open-coded list_for_each_entry_safe() Date: Fri, 14 Aug 2020 16:50:54 +0300 Message-Id: <20200814135055.24898-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 171066D73 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: There is a place in the code where open-coded version of list_for_each_entry_safe() is used. Replace that with the standard macro. Signed-off-by: Andy Shevchenko --- v2: replaced complete open coded list_for_each_entry_safe() mm/dmapool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index f9fb9bbd733e..7716a7a42a1c 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -266,6 +266,7 @@ static void pool_free_page(struct dma_pool *pool, struct dma_page *page) */ void dma_pool_destroy(struct dma_pool *pool) { + struct dma_page *page, *tmp; bool empty = false; if (unlikely(!pool)) @@ -281,10 +282,7 @@ void dma_pool_destroy(struct dma_pool *pool) device_remove_file(pool->dev, &dev_attr_pools); mutex_unlock(&pools_reg_lock); - while (!list_empty(&pool->page_list)) { - struct dma_page *page; - page = list_entry(pool->page_list.next, - struct dma_page, page_list); + list_for_each_entry_safe(page, tmp, &pool->page_list, page_list) { if (is_page_busy(page)) { if (pool->dev) dev_err(pool->dev,