Received: by 10.192.165.156 with SMTP id m28csp312907imm; Tue, 17 Apr 2018 10:32:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx48CyXojtoa0dV1y6CpMCbvr7M54RaHN0x0+sAf0OKc4IZzdVQEaGU9zyM1YHXurnK2TLlgf X-Received: by 2002:a17:902:6b87:: with SMTP id p7-v6mr2870076plk.101.1523986333644; Tue, 17 Apr 2018 10:32:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523986333; cv=none; d=google.com; s=arc-20160816; b=d5G8F1gO2cpgF/ni2gSb84Q6vWYIZ880g8wNtC4GxM4d5eBQCxVjuzL21AXd4iPcn+ EVbOmbwTdi58YKd9rIs3NZAdZWAR5H7FSDCDuFUZ7o/dIRdNtolmvVTszQbDU/fF+NJj /94hRY6CWMMjnN+fZhnm2+C53QXyQ79D0CsmMsG14P746fyxKSr3vlNQs5JqIfa0UY5d XkVJTdFFbQFnVRYD0JTxIqQw0DrUquedDRBhqL8uRZXKf1kB74gm9ssycQ/0ijncpEd1 VhEDogRCUMQSAEgARWu/du+j9rdYZTfI6LYTSgiZobIkhq/zm6QocjKUfHx/zhUQPCBm 3INg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=PG2m4X91Ek7CXnWP+IG3muEWf1IcpSBz0ge9tFWZZAc=; b=OIDvHIUUMWd+R03Rw+g/jB50vkwBdcwRf2o5jUEtBk1ngn9hcmBSbNJKqlLJ9NRXtp 8qr5hnTY+aFuCGbqKtYEeVb6a5x7QVKcRuZkQVCqAhlvRrwxiu3tydYFbLu72WVROa3V jUrBt46wruf1+sxU2roo9AuzAP1ISP65OxJ/SYH5BpOJLo3nSG8blxrVZoglqiin2KOw aYLgo9XxkECnHxSooqpP3/Wq1VncYYLVXuhlum/Xgy7uAvGEX5tJly9rDx2Q4aJFBx/g I7k8FokFdLkwgmulOPEikS5wP5YeW2UJdp1bJmFcUxNMkF/q4nie18pw9M1ewxVvz2Gp hm3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=fGipy+L2; dkim=pass header.i=@codeaurora.org header.s=default header.b=Sxv0ptuG; 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 w67si3736107pgb.447.2018.04.17.10.31.59; Tue, 17 Apr 2018 10:32:13 -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=@codeaurora.org header.s=default header.b=fGipy+L2; dkim=pass header.i=@codeaurora.org header.s=default header.b=Sxv0ptuG; 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 S1752741AbeDQRag (ORCPT + 99 others); Tue, 17 Apr 2018 13:30:36 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:49922 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbeDQRae (ORCPT ); Tue, 17 Apr 2018 13:30:34 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id E7CD160310; Tue, 17 Apr 2018 17:30:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523986233; bh=O5mV07vDKK7bORdWyAImPdW0wsqBMIwEgOoewkXgOjM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=fGipy+L27627Ja1GxP6aEOGxmxLZkcMwEYET8w7GUmkOO60k9KpqU+Oaa86Eda0NW 6JKv9ekHl7UVS/+tWjwc+FFI1w+9qDf0tlSUAUwGfIVgI3I3MyO0Ung+si/NvFr++U jtl/9KTfp6gKX8BUyXlLDEJE3GbPEwqguP5HW5Gw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from localhost (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C88FC60117; Tue, 17 Apr 2018 17:30:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1523986230; bh=O5mV07vDKK7bORdWyAImPdW0wsqBMIwEgOoewkXgOjM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Sxv0ptuGJHHmN7x6QH6wkfDQ7xBpMS5DPYyrAL2D1JazPA1FpeYRqnFmAoQnrCdG1 SKDYh8+Z20CURDm5OMQct1f16XXFGEac/W8kUTmv486Kjb0dqNkkxn7WL2441Obtyn dYPBUamKKizfoKswdsu25phEByGtwf/3qT+lg1uU= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C88FC60117 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org Date: Tue, 17 Apr 2018 11:30:28 -0600 From: Lina Iyer To: Stephen Boyd Cc: Andy Gross , linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org, Mahesh Sivasubramanian , Bjorn Andersson , Evan Green Subject: Re: [PATCH] soc: qcom: cmd-db: Make endian-agnostic Message-ID: <20180417173028.GB29077@codeaurora.org> References: <20180412224111.35216-1-swboyd@chromium.org> <20180417172234.GA29077@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20180417172234.GA29077@codeaurora.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 17 2018 at 11:22 -0600, Lina Iyer wrote: >On Thu, Apr 12 2018 at 16:41 -0600, Stephen Boyd wrote: >>This driver deals with memory that is stored in little-endian format. >>Update the structures with the proper little-endian types and then >>do the proper conversions when reading the fields. Note that we compare >>the ids with a memcmp() because we already pad out the string 'id' field >>to exactly 8 bytes with the strncpy() onto the stack. >> >>Cc: Mahesh Sivasubramanian >>Cc: Lina Iyer >>Cc: Bjorn Andersson >>Cc: Evan Green >>Signed-off-by: Stephen Boyd >>--- >> >>Changes from inline patch: >>* Fixed magic >>* Made function for memcmp() >>* >> >>drivers/soc/qcom/cmd-db.c | 116 +++++++++++++++++++++----------------- >>1 file changed, 65 insertions(+), 51 deletions(-) >> >>@@ -99,8 +90,34 @@ struct cmd_db_header { >> * h/w accelerator and request a resource state. >> */ >> >>+static const char CMD_DB_MAGIC[] = { 0xdb, 0x30, 0x03, 0x0c }; >>+ >This works now. > >>+static bool cmd_db_magic_matches(struct cmd_db_header *header) >>+{ >>+ __le32 *magic = &header->magic_num; >>+ >>+ return memcmp(magic, CMD_DB_MAGIC, sizeof(CMD_DB_MAGIC)) == 0; >>+} >>+ >>static struct cmd_db_header *cmd_db_header; >Could you move this up, along with other declarations? >> >>+ >>+static inline void *rsc_to_entry_header(struct rsc_hdr *hdr) >>+{ >>+ u16 offset = le16_to_cpu(hdr->header_offset); >>+ >>+ return cmd_db_header->data + offset; > >I noticed that the data was incorrect, with the above and I did it to >read the correct data. > Spoke too soon. Let me test more and report. -- Lina >return ((void*)cmd_db_header + sizeof(*cmd_db_header) + offset); >>+} >>+ >>+static inline void * >>+rsc_offset(struct rsc_hdr *hdr, struct entry_header *ent) >>+{ >>+ u16 offset = le16_to_cpu(hdr->header_offset); >>+ u16 loffset = le16_to_cpu(ent->offset); >>+ >>+ return cmd_db_header->data + offset + loffset; >As well here - >return ((void*)cmd_db_header + sizeof(*cmd_db_header) + offset + >loffset); >>+} >>+ > >Thanks, >Lina >