Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3153755yba; Mon, 8 Apr 2019 12:20:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+MZp0VtI83qC3Ymz3Q3NVd0dOZO8PocnnqE/Ang0fnHZJrajYq6tPzIKnAw+mLrjQMB4w X-Received: by 2002:a62:f20e:: with SMTP id m14mr31926308pfh.228.1554751211016; Mon, 08 Apr 2019 12:20:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554751211; cv=none; d=google.com; s=arc-20160816; b=SJe76n+02AjCv/ny1wpHFer5BTPp7KnS9G+Mdj1+8G51ULLnHqOJFNFNCS0s6Bguv2 zIfnKBN49BKN0Pw2s4JJw39NFc7HCYCfRwFaxPAUL5AsAZ1Xop7YG/0as6NMaAc9hhm6 PpxdfZHgU8uXQpTb64hQ+37wNw7RZh0KLS9NJ9CeYz4o0akO6GkyslIcEQM59EsToqqV JuMlOppJBKPHjo934jK8sl/BUiBWXOpp+5vG+oWPNQoPsno1ns7TiEvFeQikwj/I9IyW e4SQfUV+Vfvyl3/wTwP6nBuZj7M1gR3cxOQnt00KDVx3QOt/KEb8f5vfsXpSnBe5330O Hwog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=IoEqp9VXr7ZHjWgHuKuuRapGCnmDj5ipp6Qfksvb9Kg=; b=Ybgekv0pg9I5+V2evhLTWrpgNgSecc1m/61aJgC5gY563VtOH3KOmvWMUYCAf3b/Qw xohIquLcBQbnYf1KwVK6yeBRTHKhMjOynxvsoHvNviPlvk6l/aOrQuWvreFukA6dKHon gJQMfZkQbxm5Xhstf/EWxFJm1LH20KYnkleB3q6G5zKfmokdjL2pF7VoCI74BbUk9f+c 9ICwGqZivqO4YekPZHNjd6zJBZiCLdUaRWGMYsbgh0zRx4f8fSsNpfmxbiFt7zM0f9C5 9eUevYWNfNL4Kbp++aN7NaziVL37UBY54AbdhHdLb9h+5Ho7lTK1KHYVxkKGP008UQvy rWEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cNPTXECW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si28084908pld.32.2019.04.08.12.19.54; Mon, 08 Apr 2019 12:20:10 -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=@gmail.com header.s=20161025 header.b=cNPTXECW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729159AbfDHRHb (ORCPT + 99 others); Mon, 8 Apr 2019 13:07:31 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40156 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727190AbfDHRHb (ORCPT ); Mon, 8 Apr 2019 13:07:31 -0400 Received: by mail-pg1-f194.google.com with SMTP id d31so3142447pgl.7; Mon, 08 Apr 2019 10:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=IoEqp9VXr7ZHjWgHuKuuRapGCnmDj5ipp6Qfksvb9Kg=; b=cNPTXECWXcmiM+EaSME17AYTqoLm9zu1ecJeONWVJ1SBwpTxWlTucK+W9GIw2S+Dgl 7m3Owf9EXIhzXNBmXzrYs5Ah5HLnexKtMSaIyBa2+1JF9owZaHpRh1VB02nqLXxhK52N 3LDsb9NdviMalyTk4AeDCgnl1yTuzybuO0e6aQJQXV2Vdj8GfHRFA14LhhV0aaUfQYaH peReTMFZXD5Xg4qlyN3jMNWU45YgI6de/eWQ8ildWhDrilAkkwKofgzPEsKOPieEFymL SnsLsjfUCEYdn38yHbOB2oApV9ypWCR26LzdFad1yoO+NYHIPSrsMGa03AUVXzdpMbP0 rw9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IoEqp9VXr7ZHjWgHuKuuRapGCnmDj5ipp6Qfksvb9Kg=; b=UIHmcxsXMFizVmoNNcFPFOHYE2wPMIp8UXyVGAhSqIkgMSqyvHRViLLjU6QRvCgLyA gxcCx8iuQH6lU9/ME5c0PhLI+5f3cHKP8o5JOM/5SFuQsMGJ70C2je2F7wRwkTCXEuS7 p2VYEDJDLrCcbz1h0PM0WG7LidzVgWiuETeypN+ClX3Bsb3dGWAU9FI5ND8zcMn+M4VY WYdmGFDHmsWwWguslwdqALNGhTfCxSCW/TjT3TdfjXN+f3bISIbOe0SeCXeacxgJalcb DQKAZm1NLKePXuB7IKouq5/OHyQtZMz8HqlJBBp3nwXBDPxncqaH4ch0sNqEHgrjnG2F GmBw== X-Gm-Message-State: APjAAAWF3GcKGK4QkOkoznSjbDN0UoqwyQPNdh6kZNy/cCXdE0775pEv S3lx5EALzL/yffPM28FBcqtehliP6EiDf2fkVhY= X-Received: by 2002:a65:6210:: with SMTP id d16mr28697627pgv.110.1554743250315; Mon, 08 Apr 2019 10:07:30 -0700 (PDT) MIME-Version: 1.0 References: <20190313222124.229371-1-rajatja@google.com> <20190405203558.19160-1-rajatja@google.com> <20190405203558.19160-3-rajatja@google.com> In-Reply-To: <20190405203558.19160-3-rajatja@google.com> From: Andy Shevchenko Date: Mon, 8 Apr 2019 20:07:19 +0300 Message-ID: Subject: Re: [PATCH v3 3/3] platform/x86: intel_pmc_core: Instantiate pmc_core device on legacy platforms To: Rajat Jain Cc: Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List , Wysocki@google.com, Rafael J , Srinivas Pandruvada , furquan@google.com, evgreen@google.com, Rajat Jain Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 5, 2019 at 11:36 PM Rajat Jain wrote: > > Add code to instantiate the pmc_core platform device and thus attach to > the driver, if the ACPI device for the same ("INT33A1") is not present > in a system where it should be. This was discussed here: > https://www.mail-archive.com/linux-kernel@vger.kernel.org/msg1966991.html > > +#include > +#include > + > +#include > +#include > + > +static struct platform_device pmc_core_device = { > + .name = "pmc_core", > +}; > + > +static int dummy; > +/* > + * INTEL_CPU_FAM6 macro won't take NULL for driver_data (uses &driver_data), > + * thus provide a dummy driver_data. > + */ You may use pmc_core_device instead, right? > +static const struct x86_cpu_id intel_pmc_core_ids[] = { > + INTEL_CPU_FAM6(SKYLAKE_MOBILE, dummy), > + INTEL_CPU_FAM6(SKYLAKE_DESKTOP, dummy), > + INTEL_CPU_FAM6(KABYLAKE_MOBILE, dummy), > + INTEL_CPU_FAM6(KABYLAKE_DESKTOP, dummy), > + INTEL_CPU_FAM6(CANNONLAKE_MOBILE, dummy), > + INTEL_CPU_FAM6(ICELAKE_MOBILE, dummy), > + {} > +}; > +MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids); > + > +static int __init pmc_core_platform_init(void) > +{ > + int ret; > + > + /* Skip creating the platform device if ACPI already has a device */ > + if (acpi_dev_present("INT33A1", NULL, -1) || > + !x86_match_cpu(intel_pmc_core_ids)) > + return -ENODEV; Split it to one conditional per line. > + > + ret = platform_device_register(&pmc_core_device); > + if (ret) > + return ret; > + > + return 0; > +} > + > +static void __exit pmc_core_platform_exit(void) > +{ > + if (!acpi_dev_present("INT33A1", NULL, -1) && > + x86_match_cpu(intel_pmc_core_ids)) Redundant check. > + platform_device_unregister(&pmc_core_device); > +} -- With Best Regards, Andy Shevchenko