From patchwork Tue Jun 26 00:58:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 139900 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp4616233lji; Mon, 25 Jun 2018 17:59:58 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLzubfaOkf+A2b3jtjGkF+BZg2bSAoglDTjX1u5w9bjTt4PkA2abrMUs13JC3VjYI1Gqxhm X-Received: by 2002:a17:902:3281:: with SMTP id z1-v6mr14659830plb.226.1529974798505; Mon, 25 Jun 2018 17:59:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529974798; cv=none; d=google.com; s=arc-20160816; b=fGtLYL3AtLC2yRo+q/XcsrZDlFRaq4qJqDu1CLmbColoIPHWOvP1Ogk2wbNhE5stRy zgkGrZ/WzwIdGEuEN40g+SfcN2+OPmE0EY3fR11p8sTIjc4enGwpFBc9+LBxKegnTI4Q 7JF2F5XQTx9Nav1vpAKRjtyGvlfuInwQHdbcrA+WxkZn/Cf2/FW8D8Yq2cbNBmtbgU1f GcgnjfWdu1/evdEOkF4NV5djM/34DbuotD+2qTyJGcIkMEuNyeIE0m1oUwaD8Y3qG8LH UtXAQ6oV1OQAqjndWLKQ+3m92g6tW8xO9G/f36+eUc9w8AHTHnZNwiNUGNMOebe7g7iT aWIw== 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=Q/oytLGFLVRRIBLXYs4209CjepSv9RVJ004ROdrEisY=; b=kROwYU8jUESii9uH3tVbtsDnmS4qoa1k/Uid7rovxelkTwxt1RITH49kmXsmTS6yoL p89Fa33aa1GOKIPFJUZaB6RAr9WHXvUhxXk5786ibVbr4gPjo3QxhfL5CIEo2KtrOMRj sLeur4W2PTKCeregCWRCvg1p2Tf6a5cLQXgwLF6/ewHkBf+IPloZXUrgXf4zgQm3d9FZ sMY7hVsky0UKUouk93DHgp0qi+8VWxCvTYE8kf9HXcgRLy7S+nh3ENi4CiJJ3UeiT0h7 Kkm66/F+rvcfcvrFAPXfaNE2aXxGbCSqovmyr4z9DVt1UQhNlbgAAlyJ/M5M4xuhR77f Tx2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=B0Oyxgxv; 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; dmarc=pass (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 n9-v6si273291pgp.558.2018.06.25.17.59.58; Mon, 25 Jun 2018 17:59:58 -0700 (PDT) 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=@linaro.org header.s=google header.b=B0Oyxgxv; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964916AbeFZA7n (ORCPT + 31 others); Mon, 25 Jun 2018 20:59:43 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:53811 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935032AbeFZA7N (ORCPT ); Mon, 25 Jun 2018 20:59:13 -0400 Received: by mail-it0-f68.google.com with SMTP id a195-v6so15194709itd.3 for ; Mon, 25 Jun 2018 17:59:13 -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=Q/oytLGFLVRRIBLXYs4209CjepSv9RVJ004ROdrEisY=; b=B0Oyxgxv42nR+j95ZjkMjf/e78vZgYARaa38mgsIf3Y78JDQrFB3MYS7s7NF65Fwqa CfgVnnEf3RS7uUGltwgrAD2KURFoDHspBof/yDHATp9xdx3BiRV7POk8KTjOLN2KzEnc Ll98jXq340RyujuGoS9dqZ9z9dPBoGjjaNBwI= 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=Q/oytLGFLVRRIBLXYs4209CjepSv9RVJ004ROdrEisY=; b=Jy2SfNc72xPbHd5L17IJBuW8HArVL8jd7LIaxwVWc3vc1M4mE+j1CHMlYw3WluvI/w XCJ+Eq1nIgtLw2hp2+PIWb/mPXx825OD0ixnops/G0RR7SZ5UtmNQbsy6TLP4XlU5yzf f5jCsPVJ44IQDRwLElR2nBvvVJFsC+fAi2ZIUSA/AGCznqzaN7/vlPHkCrN4KbhIMtN3 65mKzVkTp/XsuHFDmyLKdB9VViQmrHawGXqI8EaKowENlh5kia1A4hdkz4usRhEDAOfg VfVJR41GLnGKGWPGV+tM2Q+iiWzKAJHBmZqkLs1mLk9zxAPVIommdT64ONkcR1K5JDY9 Ij3A== X-Gm-Message-State: APt69E1fvKiw6HxkWZP2cWjuGUfYQFUVQ96/XFkIGi99IJpofpLnviu3 9Lrcy69+U8F9IqyzhB4o/y66YA== X-Received: by 2002:a02:6f47:: with SMTP id b7-v6mr9563847jae.32.1529974752662; Mon, 25 Jun 2018 17:59:12 -0700 (PDT) Received: from localhost.localdomain (c-71-195-29-92.hsd1.mn.comcast.net. [71.195.29.92]) by smtp.gmail.com with ESMTPSA id f193-v6sm372556itf.9.2018.06.25.17.59.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Jun 2018 17:59:12 -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 resend 12/12] soc: qcom: smem: a few last cleanups Date: Mon, 25 Jun 2018 19:58:56 -0500 Message-Id: <20180626005856.14174-13-elder@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180626005856.14174-1-elder@linaro.org> References: <20180626005856.14174-1-elder@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.17.1 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;