From patchwork Wed May 2 01:10:19 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 134804 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp124043lji; Tue, 1 May 2018 18:10:57 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqCHQlKGtKYVSSTJMhOoIPp75eCkb9mS9BjcfrQvRdVsy65mdJXlBn/rEUPnfIffdLPY9dF X-Received: by 2002:a63:351:: with SMTP id 78-v6mr14943649pgd.355.1525223457094; Tue, 01 May 2018 18:10:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525223457; cv=none; d=google.com; s=arc-20160816; b=lhGP9RcrRLxamh0XHE4YGDF0hE0wZtCaHgz8YOWI2Gp6z7K0YRQ+HKJQ9RBqvbN5qq buBYCGbgjKIFoB18l1UapGzccNEeI95KA6AvRrrwruJL+gM+ER+b7rgef50FE1pwQjMA TnnVrXjxd2Ix6r4u/n6uFXZ+WlEiUmpBwoAqWJa547e+NTch6tP74J/7ZlxL2ChxONLk KqjHkX2MzFeWDigZON4/toFxuGODhgqIov6Lrhk+EsHjFNxPOm3VxzWB8gXCcB69BBb6 dciBKgv0BHECGvg8PraQ6zbBFPf0H9+haIdLXotWFYiMUOV7b83YYCLFo+lJthwTnpTW gfLQ== 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:arc-authentication-results; bh=vP6QVy68RbIPBEiVACmjoUfOubU/kqO2H87ExNDdRRc=; b=N6qg1rmdqR2qwWuYL2FunDL37kwJdc6IDhVKca/UTE9b6sradWaept1fMfdpvaHH6D GWNMwg0QWal3tTWYr1z0o2Fkf9jXFNBpr3+mmQkXYK6p1crzqpnU0vXLQGAwdDRuqMtO IXNaxF4fnkVBI/dTQSIzCCn0PPYgALtTzGhNV5kglXVoE4uaHXdYIgZYxVHWJ0L0cygH wBLZY5wBK33kleSVdIU3KcIDUDGM87DxHcGqAeBdWbTFKraW41/wrhkK2dOvanKNEDMB 2KTuk6gPzWcUF0irZYsvv1+Hcso58SnLzDR2X9mtwy/sNQaH91YEJ+Sh4SZT+WmZngZC YvOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GhzQXFfL; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g10-v6si10789274plb.272.2018.05.01.18.10.56; Tue, 01 May 2018 18:10:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=GhzQXFfL; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751178AbeEBBKz (ORCPT + 12 others); Tue, 1 May 2018 21:10:55 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:34797 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751331AbeEBBKk (ORCPT ); Tue, 1 May 2018 21:10:40 -0400 Received: by mail-it0-f68.google.com with SMTP id c5-v6so12733248itj.1 for ; Tue, 01 May 2018 18:10:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n/InIgNz2kBb8f3oYAThZXz24YW3M0BOUr4CeynODvU=; b=GhzQXFfLOfvvulRxcoOrr4WSjz43kpueCVRD1gWHqn4ZuBnxM5348SsOWLECyCH9wP R2zoxO6zguIMGlWoxRmNAbAddD6vMjW55FZKFmOCkxJ5pZqJv6h6pHpPqIX978cpe8ys 5VOkThkpLDcTXCDgm1eanurkLtertS3PzZUPo= 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=n/InIgNz2kBb8f3oYAThZXz24YW3M0BOUr4CeynODvU=; b=uAWd/UHUJbVZvh78v04m1ZnZNZPsYrPXIdReyHXUZE1+aoXhsS1kBNNBrvMwFHjwkj Rk2r8ke/EAnFBiQ5QQ+EmI4Ma0rqaMGpFeXjKu4YUMWLhUF7kH9fS7tYknxe4rJPI2dv VMq7ccueUHZdsdumGYO46ec17KTFe0ApzCC/gtVJCXKuly6tQyIMCz5t9fOqAQTaRki/ Uat2sEIM0bCz8WiqjX4iaqoWhF0cSWK9Ix/tamE9go2uxcFxBYnW3REs3UohTlGna3dh Roi5fR7Sm3F2OvpWvfyQj/wX5xZ4QNU92qosUb6vNR+t7hmI3UwI0mA6TRfzFpSngx5J rlkw== X-Gm-Message-State: ALQs6tBbI8NLfxMhpaLnWG9uSY6nyFAWGyb9CQPZ4K9VzihFqmJixf9R Yw18YbofxK3z+kUbGyAyyqPbXw== X-Received: by 2002:a24:a74a:: with SMTP id s10-v6mr6005936iti.92.1525223439501; Tue, 01 May 2018 18:10:39 -0700 (PDT) Received: from presto.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id g200-v6sm2082479itb.26.2018.05.01.18.10.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 May 2018 18:10:39 -0700 (PDT) From: Alex Elder To: andy.gross@linaro.org Cc: clew@codeaurora.org, aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/12] soc: qcom: smem: a few last cleanups Date: Tue, 1 May 2018 20:10:19 -0500 Message-Id: <20180502011019.22812-13-elder@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180502011019.22812-1-elder@linaro.org> References: <20180502011019.22812-1-elder@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org This patch contains several small cleanups: - In qcom_smem_enumerate_partitions(), change the "local_host" argument to have 16 bit unsigned type - Also in qcom_smem_enumerate_partitions(), change the type of the "host0" and "host1" local variables to be u16 - Fix error messages reporting host ids to use the right format specifier - Shorten the error messages as well, to fit on one line - Add a compile-time check to ensure the local host value passed to qcom_smem_enumerate_partitions() is in range Signed-off-by: Alex Elder --- drivers/soc/qcom/smem.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) -- 2.14.1 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c index 7383a0e1b468..0d7f369c3f7a 100644 --- a/drivers/soc/qcom/smem.c +++ b/drivers/soc/qcom/smem.c @@ -819,14 +819,14 @@ static int qcom_smem_set_global_partition(struct qcom_smem *smem) return 0; } -static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, - unsigned int local_host) +static int +qcom_smem_enumerate_partitions(struct qcom_smem *smem, u16 local_host) { struct smem_partition_header *header; struct smem_ptable_entry *entry; struct smem_ptable *ptable; unsigned int remote_host; - u32 host0, host1; + u16 host0, host1; int i; ptable = qcom_smem_get_ptable(smem); @@ -850,16 +850,12 @@ static int qcom_smem_enumerate_partitions(struct qcom_smem *smem, continue; if (remote_host >= SMEM_HOST_COUNT) { - dev_err(smem->dev, - "Invalid remote host %d\n", - remote_host); + dev_err(smem->dev, "bad host %hu\n", remote_host); return -EINVAL; } if (smem->partitions[remote_host]) { - dev_err(smem->dev, - "Already found a partition for host %d\n", - remote_host); + dev_err(smem->dev, "duplicate host %hu\n", remote_host); return -EINVAL; } @@ -956,6 +952,7 @@ static int qcom_smem_probe(struct platform_device *pdev) return -EINVAL; } + BUILD_BUG_ON(SMEM_HOST_APPS >= SMEM_HOST_COUNT); ret = qcom_smem_enumerate_partitions(smem, SMEM_HOST_APPS); if (ret < 0 && ret != -ENOENT) return ret;