Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3211115yba; Mon, 8 Apr 2019 13:36:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU5PtOVx6amqDRBtgmn1cpF2bcyBxFFBrJtzXv+5+S6PPiaAvdSdXh7DXJ1CNFkRmViuXn X-Received: by 2002:a62:70c6:: with SMTP id l189mr32495716pfc.139.1554755804935; Mon, 08 Apr 2019 13:36:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554755804; cv=none; d=google.com; s=arc-20160816; b=q5YFYpNkGJk9ctPRnBKC7+FAH9VP9uQuYeWPk4VHiB6H3NI/l2lK4EDD88MtqO2ktz c+VX3VeWuS9gaEPCobH+QLNpJl26G36wvbhsPn2qcE30XnKB7lHrDymXBcqLvDgE9OAu GgHCgpl3F4/DZ/3SZvL/9/aiimQllYmw+1tEChPMs9RXiq2UG1Z1+gbm8ToujsmQ0aaT 4EUcms/1SKEGtv/yKjpLh/w+Rs+BMMY2wp9Pl8JYTsWSrwTZ522Ytio6UUIH+vf5em74 CSdMLfzCs5F2N/0OG8XaaIE2vqRCrkTz5STRpPpJMrKV2Sn8lxc0DeJM2MFKES9lFTu4 gXfg== 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=ioqyPLefu+BxB1btErZNPPP2b3rtWQsxHiixDIGWVt4=; b=0Uds9pn3CTo8GEOki7qZUxB5ENRNa6CHcSrW4MvfGGrENvQwXQ2RwuCXsW8ZpWrhkc FBd2PftlK36KRLvbsE1vLQyg0CfEgwDYu2SRjudwNCsLvnvntSlUpaZABxVfDiLb2Bi7 oP4A8kZxD5deX/TQAz0/b6N1X613LNqSInVSNskgmte0XazUf5XGkXBtcaN8tqIfaVS9 ThFpPEsBTP2wMJ0lQucm5Hxy+GKBrYaSe26v5ctEh/IeL6IEmmAqtFN27kfe4i3g6r9G O+Vqu/RbJSYgnlnoa3XaRzam1To47sUg+BMUqehARKdS65509kNUdFstdYgB2p9GPm/C xJ5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=h4YiSACt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si28030820pfc.46.2019.04.08.13.36.29; Mon, 08 Apr 2019 13:36:44 -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=@google.com header.s=20161025 header.b=h4YiSACt; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728994AbfDHSZv (ORCPT + 99 others); Mon, 8 Apr 2019 14:25:51 -0400 Received: from mail-lf1-f66.google.com ([209.85.167.66]:44341 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726753AbfDHSZv (ORCPT ); Mon, 8 Apr 2019 14:25:51 -0400 Received: by mail-lf1-f66.google.com with SMTP id h18so1825886lfj.11 for ; Mon, 08 Apr 2019 11:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ioqyPLefu+BxB1btErZNPPP2b3rtWQsxHiixDIGWVt4=; b=h4YiSACtJBsNh7Jvj89f7neW5IkZPq958jVyhsS2NijiF6A9qUA6TNXCPinetgPuOb 9lIpDvgzQkcc8ArhIf3T/rN4NMPKkNGmPkj6HfKtYKfmc3zMqZSmjOd1dQY0H+kGb8Gz efEOfQSfh6J47l/xGVkUfyJRwBWtFCSVyMPAjKhldXatyk6NufjKbvUB1p1O7q5cVipI 9qc5r1xL/OSRbOR8fsJcHQX4CGtYBoFiqhZjuSVXgygJdvo7IOlIYRrAnF8Xsu8znZtT TgtCzjvEHahWW8Sf+P9SXKuY1hqqKCnKKmmfVk8yozsJWnVVs1ONlf1tunDdBtT1LLgT cbBg== 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=ioqyPLefu+BxB1btErZNPPP2b3rtWQsxHiixDIGWVt4=; b=V47GXqvXCSPnNK6mjyZAR08Qo6IAPRH16ER7dzRLN8wDP9FEkndOUcpJ9A4LK5Oo4E D36osa5jxOcb1zEY96TELUpEOkbCYfp9YbkBbA725LQVz/hRaQLxJvXWghZYGJGYstTZ 8146Qqrjotrrnqg3wrpXX7xVNowIufOiN0ehnB/uqILKQm7Ay1adcqaZImQb/8DKonxz 48VJRzDgpvJr29HKJUZjTIDsM2atzP5wz069CmkNO/DqBhFD5+7vfB2gFxQ2EKM6AUI2 Pn27qdDMdERlTrDenLUV+cCJbfmWg74k1ud/KkWkRtK0Zd7v82kO+X/yVcQlF4I4rHsE QlgQ== X-Gm-Message-State: APjAAAW+jy6AguKxnPUEEHmAHFS1b+SV++kCoUYdxyrOGaQkZ3pvSS9S 7F1imIOPol5EAJFvoxUQ66TTCAWIRfWZALE/powxOQ== X-Received: by 2002:ac2:50d8:: with SMTP id h24mr16224439lfm.7.1554747949091; Mon, 08 Apr 2019 11:25:49 -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: From: Rajat Jain Date: Mon, 8 Apr 2019 11:25:12 -0700 Message-ID: Subject: Re: [PATCH v3 3/3] platform/x86: intel_pmc_core: Instantiate pmc_core device on legacy platforms To: Andy Shevchenko Cc: Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List , Wysocki@google.com, Rafael J , Srinivas Pandruvada , Furquan Shaikh , Evan Green , 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 Mon, Apr 8, 2019 at 10:07 AM Andy Shevchenko wrote: > > 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? sure, will do. > > > +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. sure, will do. > > > + > > + 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. will fix. > > > + platform_device_unregister(&pmc_core_device); > > +} > > -- > With Best Regards, > Andy Shevchenko