From patchwork Fri Sep 14 14:39:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10600861 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2E28C14BD for ; Fri, 14 Sep 2018 14:44:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DE832B890 for ; Fri, 14 Sep 2018 14:44:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 014AB2B893; Fri, 14 Sep 2018 14:44:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8862D2B890 for ; Fri, 14 Sep 2018 14:44:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=LtK98uOl3ZAUfGBQz1/TUquKPb/3SWs4QgjGc7zHoxg=; b=oqHgraRrDeCr2wOc7IaM99lorc VY/k/OWmDTw+PCxvGK2Dum6TVXfBZNod+YGAj4vUCzY5heqVLIUMA6Pq3JpDnh0wYtlj7K5PQcUOm 2HcR7Tpidc5ZVaV2qFVe18cB0yzufJDAfKtqzJHn5iBbl8wSjGGefgceRsjXkOCMFxTLBj4tcOWWT xAmDu55JUzjLgR1VuTuVQNma9Gu3qifT2f5/6qKpxPm29NIJY2QXqXNAV+t2ofbK/pds1XAA1Goqq o11hUKPs1nps92ogUELuHVaZ5nzm33zDyYc2UE85x/2NHqMvLF2neaOMYrwLpLjwZo7Xbs5Tpp+MV S37bUYYg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0pKV-0002Na-62; Fri, 14 Sep 2018 14:44:19 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1g0pGx-0000py-DU for linux-arm-kernel@lists.infradead.org; Fri, 14 Sep 2018 14:40:41 +0000 Received: by mail-wm1-x343.google.com with SMTP id n11-v6so2188359wmc.2 for ; Fri, 14 Sep 2018 07:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=j5VzygIMcTmrTIR1xvM1gLa6GSilUZBltKq95M6HHPU=; b=NuUWQ0egq5rhjpw96ov2rRI14N6D+0MsBMpOYkRNZtSP5snOGM0p0hOHaB5O6RxBMH UnChgkAplDVWzwWnmdYoiUN/Oe7vq2SPZTD7/8GHCfvrGE654PuT8T6nYE7PljvqAknR FqmA2v39WYp7tPjBST6OL7uuk0Rxk2tqjOiQ3xFbriEEfYepT/ZJJrE0h4+Ov5KX1RdE KeLnkxgAPMzY5Fwt/Dqx1EAIY/MbTMIkhutJmW3japw7DI5c+W+X7KE1Xc6pZPOPm1LH diS9rHT5V1shii+T12U/vdn2MmgQDFLMBGqGeekoYvZBWXPz59o0ERbhGGUEbdsUuuoF qhHQ== 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:in-reply-to :references; bh=j5VzygIMcTmrTIR1xvM1gLa6GSilUZBltKq95M6HHPU=; b=lGzXtDWPtduh27Mc/szKUFNtIk5q0S984tKT9amCXX9tN7zXyg6QPXshgq9OW32EF4 NE0LS0pC7d8kkRIEeSp2AuPMSycqx9hgEfG1c1uWn3iUiBz5QqxQU9Or19UVKydfzhGR EksAjGM3yQ6r8Iz2LQaNbLsU6XYOw74/g1ncAO9WrMCyu5CsUJM4I1XBfXs0BUPv/mTt ZfC5FrVKb8UFLOQsMO200nRddovJ9ETSIe8eZl0tMMuiUBqq5+Mx4lzOpE97rBIL9MtB cQIX8tLWbBT8N79f0UtJBONEdBQ4UUpI86zFXcKMFuPjOwovIra/a1jUR5BtYuD4kZ3P Bw/A== X-Gm-Message-State: APzg51DHM3uKGwOAkc8m/h+7yqcsL+PHqkMFs97X28k9pnZAzi60KeRt Fd6VyGdOGtmdUdJnqcFcSM0uUQ== X-Google-Smtp-Source: ANB0VdZlclLE5F7JZ+fJ/2PhQs9vzg3y/gJAwDStgrA06ANeyynHGGfYQpupAayEc+5lWmP4KuUM4w== X-Received: by 2002:a1c:c501:: with SMTP id v1-v6mr2681386wmf.115.1536936027782; Fri, 14 Sep 2018 07:40:27 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id v46-v6sm10313526wrc.63.2018.09.14.07.40.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Sep 2018 07:40:27 -0700 (PDT) From: Bartosz Golaszewski To: Srinivas Kandagatla , "David S . Miller" , Mauro Carvalho Chehab , Greg Kroah-Hartman , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Sekhar Nori , Kevin Hilman , David Lechner , Boris Brezillon , Andrew Lunn , Alban Bedel , Maxime Ripard , Chen-Yu Tsai Subject: [PATCH v4 03/22] nvmem: use list_for_each_entry_safe in nvmem_device_remove_all_cells() Date: Fri, 14 Sep 2018 16:39:52 +0200 Message-Id: <20180914144011.27614-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180914144011.27614-1-brgl@bgdev.pl> References: <20180914144011.27614-1-brgl@bgdev.pl> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180914_074039_493093_95F18AFD X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Use the provided helper for iterating over list entries without having to use the list_entry() macro. Signed-off-by: Bartosz Golaszewski --- drivers/nvmem/core.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c index 8987da0f7456..b69005367908 100644 --- a/drivers/nvmem/core.c +++ b/drivers/nvmem/core.c @@ -308,14 +308,11 @@ static void nvmem_cell_drop(struct nvmem_cell *cell) static void nvmem_device_remove_all_cells(const struct nvmem_device *nvmem) { - struct nvmem_cell *cell; - struct list_head *p, *n; + struct nvmem_cell *cell, *p; - list_for_each_safe(p, n, &nvmem_cells) { - cell = list_entry(p, struct nvmem_cell, node); + list_for_each_entry_safe(cell, p, &nvmem_cells, node) if (cell->nvmem == nvmem) nvmem_cell_drop(cell); - } } static void nvmem_cell_add(struct nvmem_cell *cell)