Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3334062pxv; Mon, 28 Jun 2021 02:11:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzD9D2OBUEUQlmZZenV2JjJSrLewTzoVlG4GKA89QGNc1EdW5ljWC9htulTRD7SLrjTXKvi X-Received: by 2002:a02:cc1b:: with SMTP id n27mr8346502jap.121.1624871499605; Mon, 28 Jun 2021 02:11:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624871499; cv=none; d=google.com; s=arc-20160816; b=RJNP7t8tfgWhuwk29dbHV94EYAAVj56D1RT1HNN31jgG00OOlF5/eXwHtPV/iH7/3u z+/HbxlfA/7UnhQx6WqFesfTbYUWs93LryLjtQWA6HteP58QKQcBLzVuWzK46mr8oYSI NvgCvGITrdd2oIgN5uQPB2p/d4bzFzRpMvQPK78RGTsgI5mUj9y29S6HYeUlLVC+T8xf L27t2psHZOzXbaySI1k5ybP+eqTDrNTOVnK1W7pVGNcJcA2SqL1LfdWigq8kO2wKgV7O BZdKlLFSngm3TuI6tpx3hhVPC76F9ngDjeFBqh70PhmD0a/4LuhOLITrSN6rmPGzu1mb 5s5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=IVNESq1fSBydEbZ53PEskstInRVIce9dPPxV9O3uOE8=; b=W4tC3Mq1t0asulrkGWkw1bkXmicZ8Xl2o46djNSmls17aiCskJpgFtu7eF+dSOcLg+ z7KVzNVlyUi+rg/dU5usgKFRFGNeHwXDyHTJLoPwRJxg6D+7+IIVeVejBPluVIt8adiJ 8U+X1A8FOCCjZfxid3Gt5XqmPh9gUoLzKBlABq12EpdzYzQ0pSVXxd7AYgpCTpmfNpxW 5YdV8RoYl07hILaRIV4Bizq5S1fDEvOJcB4tFb5aNFMx0aZ/n4QnCCFrjZmwBnFsPbPA UWF4vY9WIXa/bf6YNZaczGk5AIv16E36Ln3kyZuPSG+p0lc7e3JiEgHR+34AmqCC1z/i vf5g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c4si16222912ilm.10.2021.06.28.02.11.27; Mon, 28 Jun 2021 02:11:39 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232466AbhF1JNK (ORCPT + 99 others); Mon, 28 Jun 2021 05:13:10 -0400 Received: from foss.arm.com ([217.140.110.172]:54496 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232284AbhF1JNJ (ORCPT ); Mon, 28 Jun 2021 05:13:09 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AC2611FB; Mon, 28 Jun 2021 02:10:43 -0700 (PDT) Received: from bogus (unknown [10.57.78.75]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DF5AE3F694; Mon, 28 Jun 2021 02:10:40 -0700 (PDT) Date: Mon, 28 Jun 2021 10:09:56 +0100 From: Sudeep Holla To: Viresh Kumar Cc: Hector Yuan , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, "Rafael J. Wysocki" , Matthias Brugger , Sudeep Holla , Rob Herring , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, wsd_upstream@mediatek.com Subject: Re: [PATCH v12 1/2] cpufreq: mediatek-hw: Add support for CPUFREQ HW Message-ID: <20210628090956.uwkrozdqvawsm3xp@bogus> References: <1622307153-3639-1-git-send-email-hector.yuan@mediatek.com> <1622307153-3639-2-git-send-email-hector.yuan@mediatek.com> <20210614104058.jdwb7godqzhf7rgd@vireshk-i7> <1624781848.1958.16.camel@mtkswgap22> <20210628072641.amqk5d3svwolvhic@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210628072641.amqk5d3svwolvhic@vireshk-i7> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 28, 2021 at 12:56:41PM +0530, Viresh Kumar wrote: > On 27-06-21, 16:17, Hector Yuan wrote: > > On Mon, 2021-06-14 at 16:10 +0530, Viresh Kumar wrote: > > > On 30-05-21, 00:52, Hector Yuan wrote: > > > > +static int mtk_get_related_cpus(int index, struct cpufreq_mtk *c) > > > > +{ > > > > + struct device_node *cpu_np; > > > > + struct of_phandle_args args; > > > > + int cpu, ret; > > > > + > > > > + for_each_possible_cpu(cpu) { > > > > + cpu_np = of_cpu_device_node_get(cpu); > > > > + if (!cpu_np) > > > > + continue; > > > > + > > > > + ret = of_parse_phandle_with_args(cpu_np, "performance-domains", > > > > + "#performance-domain-cells", 0, > > > > + &args); > > > > + of_node_put(cpu_np); > > > > + if (ret < 0) > > > > + continue; > > > > + > > > > + if (index == args.args[0]) { > > > > + cpumask_set_cpu(cpu, &c->related_cpus); > > > > + mtk_freq_domain_map[cpu] = c; > > > > + } > > > > + } > > > > + > > > > + return 0; > > > > +} > > > > > > I really hope this can be moved to a common place as more than one > > > drier should be required to parse this thing. > > > > > > > Yes, this can be a common part for all performance domain users. But may > > I know whats your suggestion? Put this API in another file or? Thanks > > Rob, Sudeep: You guys have a suggestion on where can we keep a routine for this > ? Probably in driver/cpufreq or some related headers if it needs to access related_cpus and is more cpufreq related in that way ? Orthogonal to that, I prefer to make the generic function take list_name and cells_name as generic. I see we can reuse that qcom-cpufreq-hw.c with "qcom,freq-domain" and "#freq-domain-cells". -- Regards, Sudeep