Received: by 10.213.65.68 with SMTP id h4csp163800imn; Fri, 6 Apr 2018 18:25:12 -0700 (PDT) X-Google-Smtp-Source: AIpwx49e23OMN48qGkegdBKhkAOPNqZVspFV2n0RG6teKrkMadcuAwGbObVY1TyTcZwgSvQ8YQn1 X-Received: by 2002:a17:902:ab98:: with SMTP id f24-v6mr28976127plr.331.1523064311978; Fri, 06 Apr 2018 18:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523064311; cv=none; d=google.com; s=arc-20160816; b=W8z5kgCaOIgFHD5LriRZDVWX+P4NvuZrL6KH+OEEsFKQrsRH0xkv2Bu16lIs61G3I+ eSzijj6HtMUfEc6tJGWY4YM1sChEJSDvL+xFgHzAFL9l+bizvzvkni4EG38212BV79AO vHzswv0mGhxL6iE6ABnbF3BzImeAbFZkLkbFVQGdyUq4aBorOwV3h+qeUK7wqJ5oeCeK XLThvTktN3A2pm9m2a9Qu/MXpfidUUPM509TjLOHchBSSXIAan3CFZ3HQUmpWKb+zua+ YOKZ2ES6yoqEqeIf1DXCZzoL3AuEtjO2mORk0+XpZXo5Z3e0B4bejw4xd5wFIPID3hUx F2TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:user-agent:message-id :references:cc:in-reply-to:from:to:content-transfer-encoding :mime-version:dkim-signature:arc-authentication-results; bh=3x49u+iBBryOdWlwrmbPmO3KBKd7jrceezWgjKBHLJw=; b=ZTxIhuQiIG2DczcyDX78fJhNvqn8BBImh6JqbEkwSI0IZIu6SDHZZaFnpyv4suvIvn qv1MkvrQYbLK4mILdzQk7AqNqzasyiPGK9uI/Jh1LI9Eur2MKRUpubdPDniIhtbv7iwR NWBzUbePlO/G2kLw7z1x8a7ngXT7fs22MzjIdUwf13tPGcH8H0D9khZMFL6BXvL9nm1P WzIGcYK1vYMTEIa79HUv6QTI6e95f+e55fP0XdnDh8uBP+YkOVtUfjTjKJlOTbuaLhmi 4qOvhTR+JAAsVCKwExn8Zyy6adXIIMOVCx5NlZe6PhBcZVRCfr0ED73tZW3VGE0cvhAE tP7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=buoiKdtt; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si7700208pgv.822.2018.04.06.18.24.34; Fri, 06 Apr 2018 18:25:11 -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=@chromium.org header.s=google header.b=buoiKdtt; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751573AbeDGBVo (ORCPT + 99 others); Fri, 6 Apr 2018 21:21:44 -0400 Received: from mail-pl0-f66.google.com ([209.85.160.66]:46044 "EHLO mail-pl0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751329AbeDGBVm (ORCPT ); Fri, 6 Apr 2018 21:21:42 -0400 Received: by mail-pl0-f66.google.com with SMTP id v18-v6so1644625ply.12 for ; Fri, 06 Apr 2018 18:21:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:content-transfer-encoding:to:from:in-reply-to:cc :references:message-id:user-agent:subject:date; bh=3x49u+iBBryOdWlwrmbPmO3KBKd7jrceezWgjKBHLJw=; b=buoiKdttjBqPyZ8MqrM2y9gPNjquGosPDml5kUhgDt+ghzNMfH3CGzMKlGQ9KihCuz ckboYi149GQI5/jWhKzcto6jgICBq3hsTk6czm5BITiODzfIRXwBECVX5ahEDGvM2mJt yVjGKBw+i8DuRUxAjpw527f6UjrnXNQRgd3EU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:content-transfer-encoding:to:from :in-reply-to:cc:references:message-id:user-agent:subject:date; bh=3x49u+iBBryOdWlwrmbPmO3KBKd7jrceezWgjKBHLJw=; b=eSi28jcBW0eVPpDtDtBIR+uBk5+b3lmPnRnBc5x7+oGFl6QJkpBnxHmgxS4MqZstId sZjR6alouo5ibrhmbNPc51tm6d1P0boFetkqFiQ6XTLOSAhCy4Xo9FxdONTFE+p8yEzJ l/lvdEbTZimxsE+40+P4e80rCSK5jWkuHH8pvAXfw3E0ymY1OfCGot4nihkB3aGJMXiP /n/1UHWYunUGeOH1l0a6T3ix3OkJ3vh1lBWPtdzu/igDJnEhH8Q4/77OPaesuxj5Q+dl Ie9EkM6GMAxV/R33H9PN3y242teCerEdrbn4rNJ3gMcSib5EbKnoBllpj7D/CV4giPzx vaRA== X-Gm-Message-State: AElRT7Gm3rrF++Fi1NgsyLim4170yekiukjsJd/UMdImt36LCiu83RgC txexeBmpFokBFYw9qXfHiVVkZg== X-Received: by 2002:a17:902:8ec8:: with SMTP id x8-v6mr30105457plo.179.1523064101945; Fri, 06 Apr 2018 18:21:41 -0700 (PDT) Received: from localhost ([2620:0:1000:1511:d30e:62c6:f82c:ff40]) by smtp.gmail.com with ESMTPSA id j11sm20060461pgs.13.2018.04.06.18.21.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 06 Apr 2018 18:21:41 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: Lina Iyer , andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org From: Stephen Boyd In-Reply-To: <20180405161834.3850-5-ilina@codeaurora.org> Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, evgreen@chromium.org, dianders@chromium.org, Lina Iyer References: <20180405161834.3850-1-ilina@codeaurora.org> <20180405161834.3850-5-ilina@codeaurora.org> Message-ID: <152306410070.94378.2738189478665128271@swboyd.mtv.corp.google.com> User-Agent: alot/0.7 Subject: Re: [PATCH v5 04/10] drivers: qcom: rpmh: add RPMH helper functions Date: Fri, 06 Apr 2018 18:21:40 -0700 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Lina Iyer (2018-04-05 09:18:28) > diff --git a/include/soc/qcom/rpmh.h b/include/soc/qcom/rpmh.h > new file mode 100644 > index 000000000000..95334d4c1ede > --- /dev/null > +++ b/include/soc/qcom/rpmh.h > @@ -0,0 +1,34 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +/* > + * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved. > + */ > + > +#ifndef __SOC_QCOM_RPMH_H__ > +#define __SOC_QCOM_RPMH_H__ > + > +#include > +#include > + > +struct rpmh_client; > + > +#if IS_ENABLED(CONFIG_QCOM_RPMH) > +int rpmh_write(struct rpmh_client *rc, enum rpmh_state state, > + const struct tcs_cmd *cmd, u32 n); > + > +struct rpmh_client *rpmh_get_client(struct platform_device *pdev); > + > +void rpmh_release(struct rpmh_client *rc); Please get rid of this 'client' layer and fold it into the rpmh driver. Everything that uses the rpmh_client is a child device of the rpmh device so they should be able to just pass in their device pointer as their 'handle' and have the rpmh driver take that, get the parent device pointer, and pull an rpmh_drv structure out of there. The 'common' code can go into the base rpmh driver and get used from there and then we don't have to hop between two files to see how rpmh is used by the consumers. Code complexity goes down this way.