From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Figa Subject: Re: [PATCH v7 2/6] iommu/arm-smmu: Add pm_runtime/sleep ops Date: Wed, 14 Feb 2018 12:45:09 +0900 Message-ID: References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-3-git-send-email-vivek.gautam@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from mail-ua0-f173.google.com ([209.85.217.173]:45831 "EHLO mail-ua0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966671AbeBNDpe (ORCPT ); Tue, 13 Feb 2018 22:45:34 -0500 Received: by mail-ua0-f173.google.com with SMTP id z3so12867754uae.12 for ; Tue, 13 Feb 2018 19:45:34 -0800 (PST) Received: from mail-vk0-f46.google.com (mail-vk0-f46.google.com. [209.85.213.46]) by smtp.gmail.com with ESMTPSA id x33sm2042225uac.31.2018.02.13.19.45.30 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Feb 2018 19:45:30 -0800 (PST) Received: by mail-vk0-f46.google.com with SMTP id w201so12123738vkw.0 for ; Tue, 13 Feb 2018 19:45:30 -0800 (PST) In-Reply-To: Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Vivek Gautam Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Robin Murphy , Will Deacon , Rob Clark "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devicetree@vger.kernel.org, open list , Linux PM , dri-devel , freedreno , David Airlie , Greg KH , Stephen Boyd On Tue, Feb 13, 2018 at 7:25 PM, Vivek Gautam wrote: >>> +static int arm_smmu_init_clks(struct arm_smmu_device *smmu) >>> +{ >>> + int i; >>> + int num = smmu->num_clks; >>> + const struct arm_smmu_match_data *data; >>> + >>> + if (num < 1) >>> + return 0; >>> + >>> + smmu->clocks = devm_kcalloc(smmu->dev, num, >>> + sizeof(*smmu->clocks), GFP_KERNEL); >>> + if (!smmu->clocks) >>> + return -ENOMEM; >>> + >>> + data = of_device_get_match_data(smmu->dev); >>> + >>> + for (i = 0; i < num; i++) >>> + smmu->clocks[i].id = data->clks[i]; >> >> I'd argue that arm_smmu_device_dt_probe() is a better place for all >> the code above, since this function is called regardless of whether >> the device is probed from DT or not. Going further, >> arm_smmu_device_acpi_probe() could fill smmu->num_clks and ->clocks >> using ACPI-like way (as opposed to OF match data) if necessary. > > Right, it's valid to fill the data in arm_smmu_device_dt_probe(). > Perhaps we can just keep the devm_clk_bulk_get() in arm_smmu_device_probe() > at the point where we are currently doing arm_smmu_init_clks(). Sounds good to me. Thanks. Best regards, Tomasz From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1518579933; cv=none; d=google.com; s=arc-20160816; b=vJqczVVWb3crH/WqF8YW4KdazqQfwSrR3alBuDAG2c/lDSSJFUfS+cK5UcLYgdR9Tw vwB3m/957mbSKRO1y2XCJLOjgJMoOHZwqapxZqXuFbwcyDEYAYGWlIPfXCfouRESKCyV 5ep2WodXRm6fbEpngzOrmgcebhMcB2tKnc4VzTFhB2lhRJMpMRSDPFh+U3SKRNSUDrPd 1X/ZPDam0NA2OaaOK7nw5s/Cz2lZPR3Dl0x0M/wiqWfc2Y0t5Azxi+viarX1dKPSNAAP o8iNBwc5HTjfE6dDahyFXUZTnOGMe9o/ayoG/OR9SOtSPj/MG+RiRRb/JpfgJmbbvZ+B 12Wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature:arc-authentication-results; bh=2pvZohrK+95xGqEIlkXKzdUX0yhhrvFu0ruJR5T9nVI=; b=RmrqEYAIduoVxARuca4VyT3GGa5qhO3ldNDs3awTon3u6VVjz/KnUITc9Nbdkfkcd5 far9ExmFB+TXcTlzzKx3Eom+j/Ak96LnLkIKH+nzUi+h0XzdGf6GsI4bAijUCX4R+X9e URbCY/V+hjvEsRFahIUbnZ/NkgxdQVBZ8ZwQEj8hG5LDckLn1nZ2ElXTDclwrRi1iLN9 2oQZQbm3GK5Uz1MZ6YahzzN0mn3g/DHhOVNrnMt5Fgdd+am9phoEcF4atrOKY8V/wcrh n9wXT+Rnk/XEOdunIOl/PEpvaFh7FzVhf9/KP/EygMyrNhlqpqFP2MiCWtehA0Q+I+rJ Tvmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eLg3iSsE; spf=pass (google.com: domain of tfiga@chromium.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=tfiga@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eLg3iSsE; spf=pass (google.com: domain of tfiga@chromium.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=tfiga@chromium.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org X-Google-Smtp-Source: AH8x227WHyjuJheHVPPArtB5p+t9YXJlQ7b3lTKwvbku+F0IVfrSl16IuDwusBs9rzdXF5JPxjkx4w== MIME-Version: 1.0 In-Reply-To: References: <1517999482-17317-1-git-send-email-vivek.gautam@codeaurora.org> <1517999482-17317-3-git-send-email-vivek.gautam@codeaurora.org> From: Tomasz Figa Date: Wed, 14 Feb 2018 12:45:09 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v7 2/6] iommu/arm-smmu: Add pm_runtime/sleep ops To: Vivek Gautam Cc: "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , Rob Herring , Mark Rutland , "Rafael J. Wysocki" , Robin Murphy , Will Deacon , Rob Clark , "list@263.net:IOMMU DRIVERS , Joerg Roedel ," , devicetree@vger.kernel.org, open list , Linux PM , dri-devel , freedreno , David Airlie , Greg KH , Stephen Boyd , linux-arm-msm Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1591737857427495630?= X-GMAIL-MSGID: =?utf-8?q?1592346471772762115?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Tue, Feb 13, 2018 at 7:25 PM, Vivek Gautam wrote: >>> +static int arm_smmu_init_clks(struct arm_smmu_device *smmu) >>> +{ >>> + int i; >>> + int num = smmu->num_clks; >>> + const struct arm_smmu_match_data *data; >>> + >>> + if (num < 1) >>> + return 0; >>> + >>> + smmu->clocks = devm_kcalloc(smmu->dev, num, >>> + sizeof(*smmu->clocks), GFP_KERNEL); >>> + if (!smmu->clocks) >>> + return -ENOMEM; >>> + >>> + data = of_device_get_match_data(smmu->dev); >>> + >>> + for (i = 0; i < num; i++) >>> + smmu->clocks[i].id = data->clks[i]; >> >> I'd argue that arm_smmu_device_dt_probe() is a better place for all >> the code above, since this function is called regardless of whether >> the device is probed from DT or not. Going further, >> arm_smmu_device_acpi_probe() could fill smmu->num_clks and ->clocks >> using ACPI-like way (as opposed to OF match data) if necessary. > > Right, it's valid to fill the data in arm_smmu_device_dt_probe(). > Perhaps we can just keep the devm_clk_bulk_get() in arm_smmu_device_probe() > at the point where we are currently doing arm_smmu_init_clks(). Sounds good to me. Thanks. Best regards, Tomasz