From patchwork Thu Dec 26 09:51:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 182452 Delivered-To: patch@linaro.org Received: by 2002:a92:815a:0:0:0:0:0 with SMTP id e87csp1502183ild; Thu, 26 Dec 2019 01:52:43 -0800 (PST) X-Google-Smtp-Source: APXvYqxZQNIuNwRFDfUzT5lo9l+hzfB9EU+GvdWC1a5zf9Ceg7pmlY94FAk7hcjRSx4MGjcFZMxq X-Received: by 2002:a05:6830:4a7:: with SMTP id l7mr45436348otd.372.1577353963361; Thu, 26 Dec 2019 01:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577353963; cv=none; d=google.com; s=arc-20160816; b=QX3D3glPuHsma4m5Hq3SBRGDT7gDI+M3TPA1lvQP8y7l72z+e1klGeiqBFxUnVotp1 j7iqgqCB9g1DrXyZ7xPXPzcchaWr1FI7qsTgSZmjpA8LqcDEe5PfAMMgCPAzw6CsqW7x WtNrGIYWiNshXKm1XUlsh7CzzRFtClF7hbZ4o+wV4XEbfRaxjJDGIYjKjMfXZPw/Mx39 njS2cMoI4BCr/9ELt/7Sa0Mx7b7kAnsD8T05w4JcN1ZZ3oqdrL2HFZRuTXa53rYvBlgq Hpo7bWpnXP+vcgpjw5SXPNfPQBeMLvUcnvsGhKHjSu0j08t8KoJrFEtHka4CI9vCYr1Q X2ng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=KClukxXTuW2tcSXVjPl9rnA5IKVgOInZKdTbkuEgVBI=; b=PeE6Nwab7vdgwneGER+XlykPBvV+D5H98iGM+6l5I7Rk8wQVoFz2F0Yj+qNIyalYCS qoH19tAjlqmfUuz7wfSQU+HFKDLG8U/gPiuP7aYBZBjxQMhA4f0R9Nv8Rvxlnt3YZIJF q6/a3M6x99EqBEQgVV3At3fcBjFHj72XQsDvOOOdsoWa8Bmkm9ETwL8vPdk3Usa2ffeX BwVy+f0pX/4JR25iXcBeuGKLrqWt226ZIHFjt8i2Uj0LnLidFU6uUEEKga93r0FYGkj9 76MumEDRoOnRZBp/zK09OzgoYW6O7hCve/6QL8WGJIn1yocUr00CSpStw5tGGGOGfmOA L9xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=2o6yuETI; 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 t20si15263376otr.64.2019.12.26.01.52.43; Thu, 26 Dec 2019 01:52:43 -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=2o6yuETI; 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 S1726553AbfLZJwm (ORCPT + 27 others); Thu, 26 Dec 2019 04:52:42 -0500 Received: from conuserg-10.nifty.com ([210.131.2.77]:36695 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726023AbfLZJwm (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 xBQ9pgNX023812; Thu, 26 Dec 2019 18:51:43 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com xBQ9pgNX023812 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1577353903; bh=KClukxXTuW2tcSXVjPl9rnA5IKVgOInZKdTbkuEgVBI=; h=From:To:Cc:Subject:Date:From; b=2o6yuETICqz9vX34gn+bLy7yHs1FXSLjOereBev9RZcIhz7gBRb1dmSPm2V5TGAOd dcKNftgZq5cr5rypWcQwqb86ymf7sj43vJq9WIcFvRZIcrz+RvlRRQgk2jiT3yd6pr tbOtHzNjczGhX5lopVT87iMfEPkHVK+lScN3+wpMXy6s4IafhVEEcXABXCVyYHaeph w4oKI+eRzTcZRpp5GATb1PDHNl0SSHhgDGUO56YObn60LMo0VuFrCnv3DUtzgbu030 gqHxr+/Bpmhhr9gHbAxLH+tzOp0P3FTtTUOV7NWVVYRr+J7YlU1EaLyjizoSu8elmv 4eqrco172Ex0g== 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 1/2] iommu/arm-smmu-v3: constify arm_smmu_options[] Date: Thu, 26 Dec 2019 18:51:40 +0900 Message-Id: <20191226095141.30352-1-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a read-only array. Signed-off-by: Masahiro Yamada --- drivers/iommu/arm-smmu-v3.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c index b463599559d2..ed9933960370 100644 --- a/drivers/iommu/arm-smmu-v3.c +++ b/drivers/iommu/arm-smmu-v3.c @@ -673,7 +673,7 @@ struct arm_smmu_option_prop { const char *prop; }; -static struct arm_smmu_option_prop arm_smmu_options[] = { +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}, 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 */