Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2835643imm; Thu, 24 May 2018 17:12:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrw/kEP/EgEZL02OOCpD3pdXKF6C9TAtokKe63QLFm+uGUaLj+x3O1WFObhJVDjG3XUYmDb X-Received: by 2002:a62:883:: with SMTP id 3-v6mr168065pfi.154.1527207157789; Thu, 24 May 2018 17:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527207157; cv=none; d=google.com; s=arc-20160816; b=jymhExaEqsC23AXykmqrG9mBhUSSZJWxmmBeQq4y7R+UNI+1vNe7xP2MkqWseCd3jW H36tJlRV8HxLdwDZJkU5HACvtJVbpg+2FuogZ5i6WQBgdhCEP6umk/T6KnsCG+jhY8ho ZYq4erUmn2aO9uS/LJWJrLREYdcTSyfbSJx9F59f2pHmTjE3s6rhlBRsVdEE4CyCWnZy t92gAnsslYdGFExceb7ildLPXCYZ9+DBSMEFP4HumJP3v1rv8y0twoALef9WvL+cZsSX KwA4pORKcOocBflZqQXQ4OiUFle7b/OJoC3tJEAGdfGUZiWLbvJ8mUXZwGOscMQ4njTJ D5Uw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:to:subject:cc :arc-authentication-results; bh=1R4eMQwTWLa5E9iZuQqr4KtEDR9HdQf6ds8Q6tANH0E=; b=FRwm0onuLmLjlV9WLAmt7EdE4ZckHulo3PgU57/K+RxvjG52/QoRS5dPTp00tmdiMt sfNytvebNvpT1Zj39mQYd3Wo0i9TpQmPbwsP0+izhhbUZbWo3D0LTE4i/5K8VLt2K2ss LR8rR+uhovKLJ4YLLP9DwAsmAKoaD3xrbakQ3BomBu3XzBmFtST9PqHIAgyvkthOY7pQ aQ/jfuasku0e5AGAsLkdCIs9p2I2tDVMdJfCyVoeHLkbQ+IYQXM6is1Wxn5p8ah2vtWP g2vK6Brw1X0zn+ipw7T+0nZ7xc7/W/UGnEdw0O56hfqHKQGNtCj8lppmC+CRO8dZXuXe lXYA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l11-v6si8797571pgs.218.2018.05.24.17.12.23; Thu, 24 May 2018 17:12:37 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S970263AbeEXOBV (ORCPT + 99 others); Thu, 24 May 2018 10:01:21 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45344 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965515AbeEXOBU (ORCPT ); Thu, 24 May 2018 10:01:20 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id DB1A81596; Thu, 24 May 2018 07:01:19 -0700 (PDT) Received: from [10.1.210.28] (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5CD463F24A; Thu, 24 May 2018 07:01:17 -0700 (PDT) Cc: Sudeep Holla , linux-pm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 1/2] cpufreq: Add Kryo CPU scaling driver To: ilialin@codeaurora.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, robh@kernel.org, mark.rutland@arm.com, rjw@rjwysocki.net References: <1527152242-31281-1-git-send-email-ilialin@codeaurora.org> <1527152242-31281-2-git-send-email-ilialin@codeaurora.org> <860be68b-cac0-9efc-b3c7-cc75b391a4c3@arm.com> <000501d3f35f$96794910$c36bdb30$@codeaurora.org> From: Sudeep Holla Organization: ARM Message-ID: Date: Thu, 24 May 2018 15:01:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <000501d3f35f$96794910$c36bdb30$@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 24/05/18 14:03, ilialin@codeaurora.org wrote: > > [...] >>> + >>> + ret = PTR_ERR_OR_ZERO(platform_device_register_simple( >>> + "qcom-cpufreq-kryo", -1, NULL, 0)); >> >> >> You simply can't do this unconditionally here. This will blow up on platforms >> where this driver is not supposed to work. The probe will be called on non- >> QCOM or non-Kryo QCOM platforms and I reckon it will crash trying to >> execute something in qcom_smem_get. > > What do you mean by 'unconditionally'? Why should you even add/register a device "qcom-cpufreq-kryo" on other platforms. Drivers can get registered, but only devices that are present or required by the platform need to be registered. > The driver depends on the smem and nvmem drivers, which depend on ARCH_QCOM: > + depends on QCOM_QFPROM > + depends on QCOM_SMEM > Sure, but we have something called single image for all ARM64 platforms. May be QCOM still used to tweeking config to build binary for your particular mobile platform but the distro kernel need single binary to work on all platforms. We have moved far away from platform specific builds long back now IIRC. > And if SMEM read in the probe returns something other than Kryo, it will exit. > Check what this driver does ? msm_id = qcom_smem_get(QCOM_SMEM_HOST_ANY, MSM_ID_SMEM, &len); msm_id++; switch ((enum _msm_id)*msm_id) I think it *will and should* crash here ? You need to check the return value for sure. But since qcom_smem_get return -EPROBE_DEFER, we keep retrying even on non QCOM platforms which is something I would like to avoid. Therefore that's not the main concern. Why do I have to see "qcom-cpufreq-kryo" device registered on my non QCOM platform ? -- Regards, Sudeep