Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp234442ybm; Thu, 28 May 2020 21:47:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZmC7RVkfwBhyYpiUyXuRXYYeGnbSH9PwkfWcwWTShGaudMIMfrMRfhZiLkPb0VpuQGVEU X-Received: by 2002:a05:6402:b0b:: with SMTP id bm11mr6608475edb.92.1590727621698; Thu, 28 May 2020 21:47:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590727621; cv=none; d=google.com; s=arc-20160816; b=i08EjnEW3aa0Ix/UggWTiPHUSJwtwsd/zn7fygEbGnblL8sENQYTCG4FtwheGtdsnx jGSVat/+PwyMP8snxzH9DpQlqSMVbu4spu2P75E8Ta6XEbx24XVUfwqDcHflfzpZ/vFT mt0dVh0VNO7KBzH5szcNf2p5tnsjXYTmlYzgHAD/YuQKD4yYuVaHZzu9/xFVjhGb4AMu jDIJ1mgZvo0RCXL7aH6iX1z0EBKNe774nsy7nwwPMyn7DfIKC8/gjs1sfW6Uxt7TdO6t CH4oWy/+Jc7qkPXpElf7A9dBvsPEG/QLHoC8UUDioIdqKJKhVBRq5b8ZINLduVTk8Vqz mzvg== 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:dkim-signature; bh=TSemzb3dqlu5hiVSHS+Hj5ocpjzPNZhkfK/fQHweg94=; b=SSO1pvXOv2mGxpij5BOeYh8kPEhibSSJy/MBljqgi7QIdsYE0L8aHQRSYRujKD5NtS vmFCHdnd3jBbgYcaADrxAI2dxL7XltXzy8NicO5FYCxyc+E4ISO0YWGW2xnQHbwRCaPo LwuPIXz9nqMsdvNMgvIVf+LtZE2w6kRRBV62fUIKVE45KHdaJlGcxCcTLClXmcLjftUQ HQ/mkU864C2rS+qlX7v/hIfwgYPuSxgIZxJWcRxrwM4Zhk6vJQ/NyCrzWxZUui7YJdZm jOqB5wEejm9f9qbR5zYFUw+agfH7VpsENDfN7TKAdpzTqiHQvLFqzCbasjstZkfy4oIK 4gdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gc9GC/q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id p11si4673972edx.300.2020.05.28.21.46.37; Thu, 28 May 2020 21:47:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Gc9GC/q6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1725834AbgE2Eon (ORCPT + 99 others); Fri, 29 May 2020 00:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbgE2Eom (ORCPT ); Fri, 29 May 2020 00:44:42 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3698CC08C5C9 for ; Thu, 28 May 2020 21:44:41 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id n15so623869pjt.4 for ; Thu, 28 May 2020 21:44:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TSemzb3dqlu5hiVSHS+Hj5ocpjzPNZhkfK/fQHweg94=; b=Gc9GC/q6JIDcq5qCFx6QtKtFBG9pGJ0jswzlU/WU8bSCq3SiaZtPd7/Y7qvLkVvBQt uUCo8VLB6Eeq4FyWlmRY11LqDDZDBRvyZpv87uWcewyMPVYZa28pWzHgVymu93yZ6+Mp qU2sJZg0VP2Yv+wPBP4reiFPcwrkXwek2ZdT4kUiP0HYzM+TBpgRLmnymK54xDv0omAR VoEhvuuknaO1ud6O1YBCpipSThcvpKcqHvVceKnmZraUO2dMXbrh65QnHHpnOvvDXsdJ ydH9WtErG7aeMUFRxSyYhSTATX8yjfxjEQdlqnQU205ZHcAY4/B4/U22fi3XL+p9+fFo 5u4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TSemzb3dqlu5hiVSHS+Hj5ocpjzPNZhkfK/fQHweg94=; b=QxDnyX+wZW88bXnxeNtj7DaRqVEqUDKfEOOkZikeDyVOzRpc4jHW8zpSdHBQcEOp9w thOicxu9od38xAoKzyC7vZdztrgwviEjB+RovhtkB0jU45gUWLhvOFRkL8TRZReJWkCd 2w+y+ly7170ACXzLTRv+j+u1NQsi5pSA7gGxRmGSm4sbxaVxzjgnvwYasBdj5yxe2tjq xb/yLZPshfaU+bnkeeK2KmFnkRK/PaJgRF0Rxw1yIzCBPCWLj9nPacdbznhFXhA+/039 DAunHJ6apooOVtUgtHJrE9FfFUKu0cAfEwOQcxDC0DTS/0KdFPty8YQffjqENpOm424l /WZg== X-Gm-Message-State: AOAM530Xkc8Lta1u8udonI+YHBJOdvnC08FrjAN+pFeFN3HfrAVEXgLq rPgA5KAgWqFSvAmKL8jvRayN0w== X-Received: by 2002:a17:90a:2242:: with SMTP id c60mr7784943pje.224.1590727480482; Thu, 28 May 2020 21:44:40 -0700 (PDT) Received: from localhost ([122.172.60.59]) by smtp.gmail.com with ESMTPSA id t4sm3157356pfh.5.2020.05.28.21.44.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 May 2020 21:44:39 -0700 (PDT) Date: Fri, 29 May 2020 10:14:37 +0530 From: Viresh Kumar To: Georgi Djakov Cc: vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, rjw@rjwysocki.net, saravanak@google.com, sibis@codeaurora.org, mka@chromium.org, robh+dt@kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, vincent.guittot@linaro.org, jcrouse@codeaurora.org, evgreen@chromium.org, linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v8 04/10] OPP: Add support for parsing interconnect bandwidth Message-ID: <20200529044437.5wmbbews2vn66dia@vireshk-i7> References: <20200512125327.1868-1-georgi.djakov@linaro.org> <20200512125327.1868-5-georgi.djakov@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200512125327.1868-5-georgi.djakov@linaro.org> User-Agent: NeoMutt/20180716-391-311a52 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12-05-20, 15:53, Georgi Djakov wrote: > struct dev_pm_opp *_opp_allocate(struct opp_table *table) > { > struct dev_pm_opp *opp; > - int count, supply_size; > + int supply_count, supply_size, icc_size; > > /* Allocate space for at least one supply */ > - count = table->regulator_count > 0 ? table->regulator_count : 1; > - supply_size = sizeof(*opp->supplies) * count; > + supply_count = table->regulator_count > 0 ? table->regulator_count : 1; > + supply_size = sizeof(*opp->supplies) * supply_count; > + icc_size = sizeof(*opp->bandwidth) * table->path_count; > > /* allocate new OPP node and supplies structures */ > - opp = kzalloc(sizeof(*opp) + supply_size, GFP_KERNEL); > + opp = kzalloc(sizeof(*opp) + supply_size + icc_size, GFP_KERNEL); > + > if (!opp) > return NULL; > > /* Put the supplies at the end of the OPP structure as an empty array */ > opp->supplies = (struct dev_pm_opp_supply *)(opp + 1); > + opp->bandwidth = (struct dev_pm_opp_icc_bw *)(opp->supplies + supply_count); > INIT_LIST_HEAD(&opp->node); Added this delta here. diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 7302f2631f8d..dfbd3d10410c 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1330,7 +1330,8 @@ struct dev_pm_opp *_opp_allocate(struct opp_table *table) /* Put the supplies at the end of the OPP structure as an empty array */ opp->supplies = (struct dev_pm_opp_supply *)(opp + 1); - opp->bandwidth = (struct dev_pm_opp_icc_bw *)(opp->supplies + supply_count); + if (icc_size) + opp->bandwidth = (struct dev_pm_opp_icc_bw *)(opp->supplies + supply_count); INIT_LIST_HEAD(&opp->node); return opp; -- viresh