From patchwork Wed Sep 26 18:02:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10616491 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-2.web.codeaurora.org (Postfix) with ESMTP id 5DDEB112B for ; Wed, 26 Sep 2018 18:03:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F1CB28EA1 for ; Wed, 26 Sep 2018 18:03:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 427EC2B5F2; Wed, 26 Sep 2018 18:03:35 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 A462328EA1 for ; Wed, 26 Sep 2018 18:03:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726107AbeI0ARk (ORCPT ); Wed, 26 Sep 2018 20:17:40 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:46305 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726230AbeI0ARk (ORCPT ); Wed, 26 Sep 2018 20:17:40 -0400 Received: by mail-pg1-f193.google.com with SMTP id b129-v6so14323159pga.13 for ; Wed, 26 Sep 2018 11:03:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Eg2Mjkb1M+l5w9+ISrAtsAOrO6qEMIH17I1Pv/SmrYg=; b=HE+Tff39dQAvarSfSarMxP10o7T/fKZ7fFZypESU8h08qM8WUAAniAivJLswk6ysXv KVhRbLe7JK9rWYtaRxpMrUNnI1YFoQdo01gXZYhTvPhYD9A7uxGE0h7zwuVepburY1eM FDIEHN+W0PjBPvgPBQ52RmdDEyY4n8fevwsLY= 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:mime-version:content-transfer-encoding; bh=Eg2Mjkb1M+l5w9+ISrAtsAOrO6qEMIH17I1Pv/SmrYg=; b=tb9p4cPVfC/Y/xLorGtbUbB3dd8gSahvSWDkv/FfraDAFjq5pgEXVijrXNAIcz30vB uwR8GeFbZ9Og5oiqP5LqaaQPdgf+3ESBjQpjjNIe1cJHzNVbHjQyT59WiA/CaEiF06y/ E+IUejyFSw16I79yhwU9KPL395gum30zpi7LknJjo5ORY6lfGk3Oo3bemighxszbtoEL Qzcr5PDRpIaSG0YcguQbrr+mNH8EI2qu6OkacMWxdDAqwytXnkJQVPYV6JKJC4BSC9rW erEEhNzsFnl8sGSD8S0IPrls+y2AxU8rM5g26GmkVrwFt8sJsNRf2fZE3o1wIt6kYWkI Ay9w== X-Gm-Message-State: ABuFfoiKr1gVzcurwfXeO8DSCwqaLW98rys0a+/qjyHIV6VKgJg81CZ4 pwtjyHhhqa3wk81uaSdCX7Eehw== X-Google-Smtp-Source: ACcGV61xkjwTo+Zm/vPyTz1GcXwoDQjRSkNoFGmrsaTsh6gbVmvJqOtfnsSE9XJl2N2aoP5A4rlqcA== X-Received: by 2002:a63:fe02:: with SMTP id p2-v6mr6844378pgh.148.1537985012939; Wed, 26 Sep 2018 11:03:32 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:7e28:b9f3:6afc:5326]) by smtp.gmail.com with ESMTPSA id j16-v6sm12246816pfk.125.2018.09.26.11.03.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 11:03:12 -0700 (PDT) From: Stephen Boyd To: Andy Gross Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Mahesh Sivasubramanian , Lina Iyer , Bjorn Andersson , Evan Green Subject: [PATCH v3 1/2] soc: qcom: cmd-db: Remove memcpy()ing from cmd_db_get_header() Date: Wed, 26 Sep 2018 11:02:33 -0700 Message-Id: <20180926180234.55620-2-swboyd@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20180926180234.55620-1-swboyd@chromium.org> References: <20180926180234.55620-1-swboyd@chromium.org> MIME-Version: 1.0 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 The cmd_db_get_header() function is a static local function that doesn't need to copy anything from one place to another. Instead, it can just point into the region by returning pointers to what we're looking for. If we do that, we should mark what we're returning as const so that code can't modify cmd-db without an obvious cast. Cc: Mahesh Sivasubramanian Cc: Lina Iyer Cc: Bjorn Andersson Cc: Evan Green Signed-off-by: Stephen Boyd --- drivers/soc/qcom/cmd-db.c | 60 +++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 34 deletions(-) diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index a6f646295f06..5c9cc6824891 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -101,8 +101,7 @@ static bool cmd_db_magic_matches(const struct cmd_db_header *header) static struct cmd_db_header *cmd_db_header; - -static inline void *rsc_to_entry_header(struct rsc_hdr *hdr) +static inline const void *rsc_to_entry_header(const struct rsc_hdr *hdr) { u16 offset = le16_to_cpu(hdr->header_offset); @@ -110,7 +109,7 @@ static inline void *rsc_to_entry_header(struct rsc_hdr *hdr) } static inline void * -rsc_offset(struct rsc_hdr *hdr, struct entry_header *ent) +rsc_offset(const struct rsc_hdr *hdr, const struct entry_header *ent) { u16 offset = le16_to_cpu(hdr->data_offset); u16 loffset = le16_to_cpu(ent->offset); @@ -134,11 +133,11 @@ int cmd_db_ready(void) } EXPORT_SYMBOL(cmd_db_ready); -static int cmd_db_get_header(const char *id, struct entry_header *eh, - struct rsc_hdr *rh) +static int cmd_db_get_header(const char *id, const struct entry_header **eh, + const struct rsc_hdr **rh) { - struct rsc_hdr *rsc_hdr; - struct entry_header *ent; + const struct rsc_hdr *rsc_hdr; + const struct entry_header *ent; int ret, i, j; u8 query[8]; @@ -146,9 +145,6 @@ static int cmd_db_get_header(const char *id, struct entry_header *eh, if (ret) return ret; - if (!eh || !rh) - return -EINVAL; - /* Pad out query string to same length as in DB */ strncpy(query, id, sizeof(query)); @@ -159,14 +155,13 @@ static int cmd_db_get_header(const char *id, struct entry_header *eh, ent = rsc_to_entry_header(rsc_hdr); for (j = 0; j < le16_to_cpu(rsc_hdr->cnt); j++, ent++) { - if (memcmp(ent->id, query, sizeof(ent->id)) == 0) - break; - } - - if (j < le16_to_cpu(rsc_hdr->cnt)) { - memcpy(eh, ent, sizeof(*ent)); - memcpy(rh, rsc_hdr, sizeof(*rh)); - return 0; + if (memcmp(ent->id, query, sizeof(ent->id)) == 0) { + if (eh) + *eh = ent; + if (rh) + *rh = rsc_hdr; + return 0; + } } } @@ -186,12 +181,11 @@ static int cmd_db_get_header(const char *id, struct entry_header *eh, u32 cmd_db_read_addr(const char *id) { int ret; - struct entry_header ent; - struct rsc_hdr rsc_hdr; + const struct entry_header *ent; - ret = cmd_db_get_header(id, &ent, &rsc_hdr); + ret = cmd_db_get_header(id, &ent, NULL); - return ret < 0 ? 0 : le32_to_cpu(ent.addr); + return ret < 0 ? 0 : le32_to_cpu(ent->addr); } EXPORT_SYMBOL(cmd_db_read_addr); @@ -207,8 +201,8 @@ EXPORT_SYMBOL(cmd_db_read_addr); int cmd_db_read_aux_data(const char *id, u8 *data, size_t len) { int ret; - struct entry_header ent; - struct rsc_hdr rsc_hdr; + const struct entry_header *ent; + const struct rsc_hdr *rsc_hdr; u16 ent_len; if (!data) @@ -218,12 +212,12 @@ int cmd_db_read_aux_data(const char *id, u8 *data, size_t len) if (ret) return ret; - ent_len = le16_to_cpu(ent.len); + ent_len = le16_to_cpu(ent->len); if (len < ent_len) return -EINVAL; len = min_t(u16, ent_len, len); - memcpy(data, rsc_offset(&rsc_hdr, &ent), len); + memcpy(data, rsc_offset(rsc_hdr, ent), len); return len; } @@ -239,12 +233,11 @@ EXPORT_SYMBOL(cmd_db_read_aux_data); size_t cmd_db_read_aux_data_len(const char *id) { int ret; - struct entry_header ent; - struct rsc_hdr rsc_hdr; + const struct entry_header *ent; - ret = cmd_db_get_header(id, &ent, &rsc_hdr); + ret = cmd_db_get_header(id, &ent, NULL); - return ret < 0 ? 0 : le16_to_cpu(ent.len); + return ret < 0 ? 0 : le16_to_cpu(ent->len); } EXPORT_SYMBOL(cmd_db_read_aux_data_len); @@ -258,15 +251,14 @@ EXPORT_SYMBOL(cmd_db_read_aux_data_len); enum cmd_db_hw_type cmd_db_read_slave_id(const char *id) { int ret; - struct entry_header ent; - struct rsc_hdr rsc_hdr; + const struct entry_header *ent; u32 addr; - ret = cmd_db_get_header(id, &ent, &rsc_hdr); + ret = cmd_db_get_header(id, &ent, NULL); if (ret < 0) return CMD_DB_HW_INVALID; - addr = le32_to_cpu(ent.addr); + addr = le32_to_cpu(ent->addr); return (addr >> SLAVE_ID_SHIFT) & SLAVE_ID_MASK; } EXPORT_SYMBOL(cmd_db_read_slave_id); From patchwork Wed Sep 26 18:02:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 10616493 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-2.web.codeaurora.org (Postfix) with ESMTP id 2A12B14BD for ; Wed, 26 Sep 2018 18:04:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1CA3A28EA1 for ; Wed, 26 Sep 2018 18:04:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 10AB32B5F2; Wed, 26 Sep 2018 18:04:18 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 6775C28FAC for ; Wed, 26 Sep 2018 18:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726354AbeI0ASX (ORCPT ); Wed, 26 Sep 2018 20:18:23 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37637 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727105AbeI0ASR (ORCPT ); Wed, 26 Sep 2018 20:18:17 -0400 Received: by mail-pg1-f196.google.com with SMTP id c10-v6so7353764pgq.4 for ; Wed, 26 Sep 2018 11:04:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ntMWu9Fwh/h12KSZAv8z50y9JE1gOFf9M3fxZMoM6T8=; b=D+MpWzVoGe1VgkgRzrmb6bgIepU26/pXpaD9kzC1FQ3+a48YffVsBnO0k0+Pvl9Pw8 NkmHDO9NhhqAspFIrTecMJvPFSq+Sq4TNYfA8k50NdKCnRoYm5vhLN5qCvdjfTVlIVMn N6yMVPhahWf6vJColaH6U18lRGBQzOzVKTFm4= 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:mime-version:content-transfer-encoding; bh=ntMWu9Fwh/h12KSZAv8z50y9JE1gOFf9M3fxZMoM6T8=; b=sfvrPYN6DVdxmaIoD+9C6KWQYAXi1COQIXwduzmchAymBCuvBm8sfXOCmJpnI3T/// IPiyx1+ZnZRP6LV9JXX4498fDBg0cX0vKRLDg4zCN3heADaPZbOxW/lX02OPVgfY2AxT Fm0rszyG4SDjMHwgxN8wBRdfDwNsFswo3DcwC7kjA5jsJ0QyLhHkNz87e91+v6vyqYaD K6K4jfi6N/luxdhhmzBGXHINpY4/6hjxhxyXzPxohaO5pWp/rlw2r7nig61xm81Rm16N Go//xax8HBn9xq129DVXrkiclkB3frv+fDuBujP+bBzGql+M+7Cwlag1+nb1ewz8GUa7 ogCA== X-Gm-Message-State: ABuFfohl7B5/pBP5JsYbNpv58dZM38r9co955FedkUoI8PpqaU5GB3FR Sea/1EyDjQQnFwbkZ32Ncyv06Q== X-Google-Smtp-Source: ACcGV60K62XkVEkBizblZEAWTzuyVYY2E4om4CcWLxIskou/2eubJdLJC4XuyMp31dTrEfOPuu8S1w== X-Received: by 2002:a63:a919:: with SMTP id u25-v6mr6729429pge.211.1537985048508; Wed, 26 Sep 2018 11:04:08 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:7e28:b9f3:6afc:5326]) by smtp.gmail.com with ESMTPSA id j16-v6sm12246816pfk.125.2018.09.26.11.03.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Sep 2018 11:03:42 -0700 (PDT) From: Stephen Boyd To: Andy Gross Cc: linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, Mahesh Sivasubramanian , Lina Iyer , Bjorn Andersson , Evan Green , Jordan Crouse , Rob Clark Subject: [PATCH v3 2/2] soc: qcom: cmd-db: Stop memcpy()ing in cmd_db_read_aux_data() Date: Wed, 26 Sep 2018 11:02:34 -0700 Message-Id: <20180926180234.55620-3-swboyd@chromium.org> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog In-Reply-To: <20180926180234.55620-1-swboyd@chromium.org> References: <20180926180234.55620-1-swboyd@chromium.org> MIME-Version: 1.0 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 Let's change the function signature to return the pointer to memory or an error pointer on failure, and take an argument that lets us return the size of the aux data read. This way we can remove the cmd_db_read_aux_data_len() API entirely and also get rid of the memcpy operation from cmd_db to the caller. Updating the only user of this code shows that making this change allows us to remove a function and put the lookup where the user is. Cc: Mahesh Sivasubramanian Cc: Lina Iyer Cc: Bjorn Andersson Cc: Evan Green Cc: Jordan Crouse Cc: Rob Clark Signed-off-by: Stephen Boyd --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 54 ++++++++++----------------- drivers/soc/qcom/cmd-db.c | 43 ++++----------------- include/soc/qcom/cmd-db.h | 12 ++---- 3 files changed, 30 insertions(+), 79 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index bbb8126ec5c5..dd1cb55949b6 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -859,26 +859,6 @@ static int a6xx_gmu_memory_probe(struct a6xx_gmu *gmu) return ret; } -/* Get the list of RPMh voltage levels from cmd-db */ -static int a6xx_gmu_rpmh_arc_cmds(const char *id, void *vals, int size) -{ - u32 len = cmd_db_read_aux_data_len(id); - - if (!len) - return 0; - - if (WARN_ON(len > size)) - return -EINVAL; - - cmd_db_read_aux_data(id, vals, len); - - /* - * The data comes back as an array of unsigned shorts so adjust the - * count accordingly - */ - return len >> 1; -} - /* Return the 'arc-level' for the given frequency */ static u32 a6xx_gmu_get_arc_level(struct device *dev, unsigned long freq) { @@ -906,11 +886,25 @@ static u32 a6xx_gmu_get_arc_level(struct device *dev, unsigned long freq) } static int a6xx_gmu_rpmh_arc_votes_init(struct device *dev, u32 *votes, - unsigned long *freqs, int freqs_count, - u16 *pri, int pri_count, - u16 *sec, int sec_count) + unsigned long *freqs, int freqs_count, const char *id) { int i, j; + const u16 *pri, *sec; + size_t pri_count, sec_count; + + pri = cmd_db_read_aux_data(id, &pri_count); + /* + * The data comes back as an array of unsigned shorts so adjust the + * count accordingly + */ + pri_count >>= 1; + if (!pri_count) + return -EINVAL; + + sec = cmd_db_read_aux_data("mx.lvl", &sec_count); + sec_count >>= 1; + if (!sec_count) + return -EINVAL; /* Construct a vote for each frequency */ for (i = 0; i < freqs_count; i++) { @@ -969,25 +963,15 @@ static int a6xx_gmu_rpmh_votes_init(struct a6xx_gmu *gmu) struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu); struct adreno_gpu *adreno_gpu = &a6xx_gpu->base; struct msm_gpu *gpu = &adreno_gpu->base; - - u16 gx[16], cx[16], mx[16]; - u32 gxcount, cxcount, mxcount; int ret; - /* Get the list of available voltage levels for each component */ - gxcount = a6xx_gmu_rpmh_arc_cmds("gfx.lvl", gx, sizeof(gx)); - cxcount = a6xx_gmu_rpmh_arc_cmds("cx.lvl", cx, sizeof(cx)); - mxcount = a6xx_gmu_rpmh_arc_cmds("mx.lvl", mx, sizeof(mx)); - /* Build the GX votes */ ret = a6xx_gmu_rpmh_arc_votes_init(&gpu->pdev->dev, gmu->gx_arc_votes, - gmu->gpu_freqs, gmu->nr_gpu_freqs, - gx, gxcount, mx, mxcount); + gmu->gpu_freqs, gmu->nr_gpu_freqs, "gfx.lvl"); /* Build the CX votes */ ret |= a6xx_gmu_rpmh_arc_votes_init(gmu->dev, gmu->cx_arc_votes, - gmu->gmu_freqs, gmu->nr_gmu_freqs, - cx, cxcount, mx, mxcount); + gmu->gmu_freqs, gmu->nr_gmu_freqs, "cx.lvl"); return ret; } diff --git a/drivers/soc/qcom/cmd-db.c b/drivers/soc/qcom/cmd-db.c index 5c9cc6824891..c701b3b010f1 100644 --- a/drivers/soc/qcom/cmd-db.c +++ b/drivers/soc/qcom/cmd-db.c @@ -192,55 +192,28 @@ EXPORT_SYMBOL(cmd_db_read_addr); /** * cmd_db_read_aux_data() - Query command db for aux data. * - * @id: Resource to retrieve AUX Data on. - * @data: Data buffer to copy returned aux data to. Returns size on NULL - * @len: Caller provides size of data buffer passed in. + * @id: Resource to retrieve AUX Data on + * @len: size of data buffer returned * - * Return: size of data on success, errno otherwise + * Return: pointer to data on success, error pointer otherwise */ -int cmd_db_read_aux_data(const char *id, u8 *data, size_t len) +const void *cmd_db_read_aux_data(const char *id, size_t *len) { int ret; const struct entry_header *ent; const struct rsc_hdr *rsc_hdr; - u16 ent_len; - - if (!data) - return -EINVAL; ret = cmd_db_get_header(id, &ent, &rsc_hdr); if (ret) - return ret; - - ent_len = le16_to_cpu(ent->len); - if (len < ent_len) - return -EINVAL; + return ERR_PTR(ret); - len = min_t(u16, ent_len, len); - memcpy(data, rsc_offset(rsc_hdr, ent), len); + if (len) + *len = le16_to_cpu(ent->len); - return len; + return rsc_offset(rsc_hdr, ent); } EXPORT_SYMBOL(cmd_db_read_aux_data); -/** - * cmd_db_read_aux_data_len - Get the length of the auxiliary data stored in DB. - * - * @id: Resource to retrieve AUX Data. - * - * Return: size on success, 0 on error - */ -size_t cmd_db_read_aux_data_len(const char *id) -{ - int ret; - const struct entry_header *ent; - - ret = cmd_db_get_header(id, &ent, NULL); - - return ret < 0 ? 0 : le16_to_cpu(ent->len); -} -EXPORT_SYMBOL(cmd_db_read_aux_data_len); - /** * cmd_db_read_slave_id - Get the slave ID for a given resource address * diff --git a/include/soc/qcom/cmd-db.h b/include/soc/qcom/cmd-db.h index 578180cbc134..af9722223925 100644 --- a/include/soc/qcom/cmd-db.h +++ b/include/soc/qcom/cmd-db.h @@ -18,9 +18,7 @@ enum cmd_db_hw_type { #if IS_ENABLED(CONFIG_QCOM_COMMAND_DB) u32 cmd_db_read_addr(const char *resource_id); -int cmd_db_read_aux_data(const char *resource_id, u8 *data, size_t len); - -size_t cmd_db_read_aux_data_len(const char *resource_id); +const void *cmd_db_read_aux_data(const char *resource_id, size_t *len); enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id); @@ -29,12 +27,8 @@ int cmd_db_ready(void); static inline u32 cmd_db_read_addr(const char *resource_id) { return 0; } -static inline int cmd_db_read_aux_data(const char *resource_id, u8 *data, - size_t len) -{ return -ENODEV; } - -static inline size_t cmd_db_read_aux_data_len(const char *resource_id) -{ return -ENODEV; } +static inline const void *cmd_db_read_aux_data(const char *resource_id, size_t *len) +{ return ERR_PTR(-ENODEV); } static inline enum cmd_db_hw_type cmd_db_read_slave_id(const char *resource_id) { return -ENODEV; }