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, From patchwork Fri Aug 14 13:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 11714647 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 39CB8722 for ; Fri, 14 Aug 2020 13:51:05 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0A111207DA for ; Fri, 14 Aug 2020 13:51:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0A111207DA 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 DBD196B0007; Fri, 14 Aug 2020 09:51:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D43CB6B0008; Fri, 14 Aug 2020 09:51:02 -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 B4ADF6B000A; Fri, 14 Aug 2020 09:51:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0248.hostedemail.com [216.40.44.248]) by kanga.kvack.org (Postfix) with ESMTP id 9B9CC6B0007 for ; Fri, 14 Aug 2020 09:51:02 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 5BD5F824805A for ; Fri, 14 Aug 2020 13:51:02 +0000 (UTC) X-FDA: 77149310364.08.rail54_5c00b2026ffd Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id 2F6A01819E621 for ; Fri, 14 Aug 2020 13:51:02 +0000 (UTC) X-Spam-Summary: 1,0,0,,d41d8cd98f00b204,andriy.shevchenko@linux.intel.com,,RULES_HIT:30012:30029:30054:30070,0,RBL:134.134.136.31:@linux.intel.com:.lbl8.mailshell.net-64.95.201.95 62.18.0.100;04yf1trjxhhwj55nkgxgd6m761xhiocbjhqjommyo8j3js8a3ok79x6zcf6sump.dw8k9npzb9yn7ahtc3hkgtoy3ur6uxsr164sdtr5c9sj4ueuy4omcxmikhgaaws.w-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:25,LUA_SUMMARY:none X-HE-Tag: rail54_5c00b2026ffd X-Filterd-Recvd-Size: 5177 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:01 +0000 (UTC) IronPort-SDR: VAxOzAmC4QuUCgGVQzNZ6MK7/ctuCPjoTJ8+e4I/GeCQ1RADCJp2a0ISrQXP38pdEJoOGIc25z hy+oE74O9e9g== X-IronPort-AV: E=McAfee;i="6000,8403,9712"; a="215926429" X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="215926429" 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: ftQ07F6IXSlgVp0/MIZweGEv72j/i7eOAsFKZSNq6L226eor5scQxM4uzm9hhT5B7CUAIkdqUn o04MAZ1szu8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,312,1592895600"; d="scan'208";a="369905341" 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 1E25915D; Fri, 14 Aug 2020 16:50:56 +0300 (EEST) From: Andy Shevchenko To: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox Cc: Andy Shevchenko Subject: [PATCH v2 2/2] mm/dmapool.c: Replace hard coded function name with __func__ Date: Fri, 14 Aug 2020 16:50:55 +0300 Message-Id: <20200814135055.24898-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200814135055.24898-1-andriy.shevchenko@linux.intel.com> References: <20200814135055.24898-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 2F6A01819E621 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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: No need to hard code function name when __func__ can be used. While here, replace specifiers for special types like dma_addr_t. Signed-off-by: Andy Shevchenko --- v2: new patch mm/dmapool.c | 40 ++++++++++++++++++---------------------- 1 file changed, 18 insertions(+), 22 deletions(-) diff --git a/mm/dmapool.c b/mm/dmapool.c index 7716a7a42a1c..a97c97232337 100644 --- a/mm/dmapool.c +++ b/mm/dmapool.c @@ -285,11 +285,10 @@ void dma_pool_destroy(struct dma_pool *pool) list_for_each_entry_safe(page, tmp, &pool->page_list, page_list) { if (is_page_busy(page)) { if (pool->dev) - dev_err(pool->dev, - "dma_pool_destroy %s, %p busy\n", + dev_err(pool->dev, "%s %s, %p busy\n", __func__, pool->name, page->vaddr); else - pr_err("dma_pool_destroy %s, %p busy\n", + pr_err("%s %s, %p busy\n", __func__, pool->name, page->vaddr); /* leak the still-in-use consistent memory */ list_del(&page->page_list); @@ -353,12 +352,11 @@ void *dma_pool_alloc(struct dma_pool *pool, gfp_t mem_flags, if (data[i] == POOL_POISON_FREED) continue; if (pool->dev) - dev_err(pool->dev, - "dma_pool_alloc %s, %p (corrupted)\n", - pool->name, retval); + dev_err(pool->dev, "%s %s, %p (corrupted)\n", + __func__, pool->name, retval); else - pr_err("dma_pool_alloc %s, %p (corrupted)\n", - pool->name, retval); + pr_err("%s %s, %p (corrupted)\n", + __func__, pool->name, retval); /* * Dump the first 4 bytes even if they are not @@ -414,12 +412,11 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t dma) if (!page) { spin_unlock_irqrestore(&pool->lock, flags); if (pool->dev) - dev_err(pool->dev, - "dma_pool_free %s, %p/%lx (bad dma)\n", - pool->name, vaddr, (unsigned long)dma); + dev_err(pool->dev, "%s %s, %p/%pad (bad dma)\n", + __func__, pool->name, vaddr, &dma); else - pr_err("dma_pool_free %s, %p/%lx (bad dma)\n", - pool->name, vaddr, (unsigned long)dma); + pr_err("%s %s, %p/%pad (bad dma)\n", + __func__, pool->name, vaddr, &dma); return; } @@ -430,12 +427,11 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t dma) if ((dma - page->dma) != offset) { spin_unlock_irqrestore(&pool->lock, flags); if (pool->dev) - dev_err(pool->dev, - "dma_pool_free %s, %p (bad vaddr)/%pad\n", - pool->name, vaddr, &dma); + dev_err(pool->dev, "%s %s, %p (bad vaddr)/%pad\n", + __func__, pool->name, vaddr, &dma); else - pr_err("dma_pool_free %s, %p (bad vaddr)/%pad\n", - pool->name, vaddr, &dma); + pr_err("%s %s, %p (bad vaddr)/%pad\n", + __func__, pool->name, vaddr, &dma); return; } { @@ -447,11 +443,11 @@ void dma_pool_free(struct dma_pool *pool, void *vaddr, dma_addr_t dma) } spin_unlock_irqrestore(&pool->lock, flags); if (pool->dev) - dev_err(pool->dev, "dma_pool_free %s, dma %pad already free\n", - pool->name, &dma); + dev_err(pool->dev, "%s %s, dma %pad already free\n", + __func__, pool->name, &dma); else - pr_err("dma_pool_free %s, dma %pad already free\n", - pool->name, &dma); + pr_err("%s %s, dma %pad already free\n", + __func__, pool->name, &dma); return; } }