From patchwork Wed Nov 23 01:09:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy McNicoll X-Patchwork-Id: 9442451 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E99A360237 for ; Wed, 23 Nov 2016 01:19:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCFF420564 for ; Wed, 23 Nov 2016 01:19:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D19282074F; Wed, 23 Nov 2016 01:19:22 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 393D720564 for ; Wed, 23 Nov 2016 01:19:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755401AbcKWBTV (ORCPT ); Tue, 22 Nov 2016 20:19:21 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59444 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753620AbcKWBTU (ORCPT ); Tue, 22 Nov 2016 20:19:20 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4B3A315561; Wed, 23 Nov 2016 01:09:59 +0000 (UTC) Received: from mini-rhel.redhat.com (ovpn-116-17.phx2.redhat.com [10.3.116.17]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAN19s7c008042; Tue, 22 Nov 2016 20:09:58 -0500 From: Jeremy McNicoll To: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-mmc@vger.kernel.org Cc: andy.gross@linaro.org, sboyd@codeaurora.org, robh@kernel.org, arnd@arndb.de, bjorn.andersson@linaro.org, riteshh@codeaurora.org, jeremymc@redhat.com Subject: [PATCH 2/5] smd: Make packet size a constant Date: Tue, 22 Nov 2016 17:09:45 -0800 Message-Id: <1479863388-23678-3-git-send-email-jeremymc@redhat.com> In-Reply-To: <1479863388-23678-1-git-send-email-jeremymc@redhat.com> References: <1479863388-23678-1-git-send-email-jeremymc@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 Nov 2016 01:09:59 +0000 (UTC) Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use a macro to define the maximum size of a RPM message. Signed-off-by: Jeremy McNicoll --- drivers/soc/qcom/smd-rpm.c | 2 +- include/linux/soc/qcom/smd.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c index 6609d7e..b5a2836 100644 --- a/drivers/soc/qcom/smd-rpm.c +++ b/drivers/soc/qcom/smd-rpm.c @@ -114,7 +114,7 @@ int qcom_rpm_smd_write(struct qcom_smd_rpm *rpm, size_t size = sizeof(*pkt) + count; /* SMD packets to the RPM may not exceed 256 bytes */ - if (WARN_ON(size >= 256)) + if (WARN_ON(size >= SMD_RPM_MAX_SIZE)) return -EINVAL; pkt = kmalloc(size, GFP_KERNEL); diff --git a/include/linux/soc/qcom/smd.h b/include/linux/soc/qcom/smd.h index f148e0f..8039015 100644 --- a/include/linux/soc/qcom/smd.h +++ b/include/linux/soc/qcom/smd.h @@ -4,6 +4,13 @@ #include #include + +/* + * SMD packets to the RPM may not exceed 256 bytes + */ +#define SMD_RPM_MAX_SIZE 256 + + struct qcom_smd; struct qcom_smd_channel; struct qcom_smd_lookup;