From patchwork Thu Dec 26 09:51:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182453 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp1502211ild; Thu, 26 Dec 2019 01:52:45 -0800 (PST) X-Google-Smtp-Source: APXvYqw7VG6i+hpBU9TKOk0Rt0ZWY2Dlk7lAp0HyzlI0vsb/AatHNG0Bz+7S6fSVjiGdel2pN1g2 X-Received: by 2002:a9d:480b:: with SMTP id c11mr36559755otf.283.1577353965621; Thu, 26 Dec 2019 01:52:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577353965; cv=none; d=google.com; s=arc-20160816; b=Qn+vMu6LAjsJaCmL8QhIF8M4ER3KKeH7PKRgYpQ6E6oalZJLUPNLyEVqlZP6EMRYkt 4lkDmtfHgYSCZPXxC6BBFac+ywm5U/5Y9+E+JmjZhKuDUmr2OiFrRMm7XDC2bCc45EHz GgjWAIB6GJ/Rqy6VPkn9jdQmul4mo2+ShRtAYIfUPCSclrnf0aWEhYiRnR98gs8y5Wra tFJEt/1WVZ0CRgHK1YwtNRIAJOQXnjIYkBsm9Izgn74IOjD1913VDJivrHKGQ4hm3hjT tFmBfFlCYrmjh6Y05JPpaxwxcKHRhWaDBcme6TzhIBZHu9Ufh2fVRnPqleVYl7Qdy+TN wQAQ== 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:dkim-signature:dkim-filter; bh=ZLGd9Sa7OALWrLmeWhKg0zq7ZvRRBITnevotAyP+VUY=; b=j8oPUUjfOzpfAyq/jhVgO/c8rpOA82xcynadlTb7a4ek22nPXi01iQ8+JYzmo4jQM/ Le3hs0tCIxfZGyO8nxfHZE7BQFosBl4PdTApgBRGguxywQ0/PG8GnCTSM4xuAdO+mRoH d47JV38BfZKhaJQgaKkAA3ap+J8Mm6omDKbgtHmQ6ODZOZp8pXfakIvT3RLaFi1GyP6x xlcIe/J7g2IZVSIqBVP4pM9q6FGeo73dxnUphlg6lNB2eK4tJTCoaa3rC00s/rhCAN8I 5C90eD8qX1ApsnHAZ0YX3sXUj8Al3cYLlSaT8l++um0sErkBBY+HK5rZ0OVQev/681VX V1Lg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oMWsgAD7; 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 e73si15292690oib.145.2019.12.26.01.52.45; Thu, 26 Dec 2019 01:52:45 -0800 (PST) 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; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=oMWsgAD7; 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 S1726628AbfLZJwo (ORCPT + 27 others); Thu, 26 Dec 2019 04:52:44 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:36691 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726105AbfLZJwm (ORCPT ); Thu, 26 Dec 2019 04:52:42 -0500 Received: from localhost.localdomain (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id xBQ9pgNY023812; Thu, 26 Dec 2019 18:51:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com xBQ9pgNY023812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1577353904; bh=ZLGd9Sa7OALWrLmeWhKg0zq7ZvRRBITnevotAyP+VUY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oMWsgAD7R/WJ2a2AIefVtYY9nZ9TdqVt884C1haeLpabCj7Fd2Xf4zuc3jhuQk30K yjjIxwdEdN2KbihzBeV7tl0m0LqoCaihEX/dETE7W/li8pQqaH85rnWM/s+ojNu2Xz 203MHgdB5eUJBhu9KvHsOKMuWvmQ7KzJycDHx6Fzg7evPmc34l0qY1TdGdVdZvXCrF /aIGwh8lWfh1dMQyXw5GDKKywIecYr1hq+0y47ELlRUPnsV5Ty+IeHMdCDzOb0qgDp LZU34q1ozlbJdJvz++YtUNDTbHztD+AQXSZQ6cKTSxj0w0CkMes0JrI31FZaQCIb9s 5syvPjmEpHsVA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: Will Deacon , Robin Murphy , linux-arm-kernel@lists.infradead.org, Joerg Roedel , iommu@lists.linux-foundation.org Cc: Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] iommu/arm-smmu-v3: simplify parse_driver_options() Date: Thu, 26 Dec 2019 18:51:41 +0900 Message-Id: <20191226095141.30352-2-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20191226095141.30352-1-yamada.masahiro@socionext.com> References: <20191226095141.30352-1-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using ARRAY_SIZE() instead of the sentinel is slightly simpler, IMHO. Signed-off-by: Masahiro Yamada --- drivers/iommu/arm-smmu-v3.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index ed9933960370..b27489b7f9d8 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -676,7 +676,6 @@ struct arm_smmu_option_prop { static const struct arm_smmu_option_prop arm_smmu_options[] = { { ARM_SMMU_OPT_SKIP_PREFETCH, "hisilicon,broken-prefetch-cmd" }, { ARM_SMMU_OPT_PAGE0_REGS_ONLY, "cavium,cn9900-broken-page1-regspace"}, - { 0, NULL}, }; static inline void __iomem *arm_smmu_page1_fixup(unsigned long offset, @@ -696,16 +695,16 @@ static struct arm_smmu_domain *to_smmu_domain(struct iommu_domain *dom) static void parse_driver_options(struct arm_smmu_device *smmu) { - int i = 0; + int i; - do { + for (i = 0; i < ARRAY_SIZE(arm_smmu_options); i++) { if (of_property_read_bool(smmu->dev->of_node, arm_smmu_options[i].prop)) { smmu->options |= arm_smmu_options[i].opt; dev_notice(smmu->dev, "option %s\n", arm_smmu_options[i].prop); } - } while (arm_smmu_options[++i].opt); + }; } /* Low-level queue manipulation functions */