Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4635958yba; Wed, 17 Apr 2019 16:05:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqzPEU6Ti0UU+u9hlhVHhe7TLFrSR0glvk8v+Gocko3JL5LzfvfpwHg9UxjPjHquNga/+xYU X-Received: by 2002:a17:902:b181:: with SMTP id s1mr84259933plr.9.1555542353471; Wed, 17 Apr 2019 16:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555542353; cv=none; d=google.com; s=arc-20160816; b=G+rWrTid36To15/iwjwYBh5mdCmlGvyneh/the188D08cjbMPLnkSDNeGitbSEifZP sZgmhoc7xQhJG9mxdPTFgVsfLZErpDO0RWebuNBFWywUG3a5LicTTgS+ueGGXvBqFlcW ry1F1YcPXVXv7WN3gl6sjVU8FzGmbzKq1+P1kTeS4NfzK+DEu5Rsdpd7p8aWkE/Xzape LpRXRv6AId9XwKpwaXnnsKgUU8nhKWO/wdGOh3P5nI0gqyqPQ9bVNKOIpg//13Zh+bVR neZBY7STvKcHr5o7K3ZiXq7p5XTXle6+6XWfyO5MKD7vBh5XcUBbFTrVEMx5h9/w8YCZ i8TQ== 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=jC2Jn+LpFd0JnUIlQRM35BrQxEoioUtdtP0up1XOsQQ=; b=n3O1+87sOJCS2MxEZX0ZAUsgGhzGi35Cuf2RPkgBkrVFJX+gqbxrWOwiwaVSYcpYnL rKvJ+cKhuBBHV8+2q7pjkJka27xrePBZOl6lR8x6om3tB1AnVQsG5bQVZ0JkoIndMqpT /Ukfk9v7yW/hMyx9zYDDzmsO+qq1bguUPT7omlgO2Ten7CQrBv3+ribWPkqWOOX2YguE WaAC7UP68kMzWFMfZamMiocJ6N3SVTYYMdsJFRvu0L1xoio+B+v3jhyC22cn38f3sCF0 qozszNix6WIYMKtmGUTaAb0mTJFVcOCp+Xe+Sw+7U6FXQweLjzDRVLYeJnfx0QCRhPzu lXWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Vu06x774; 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 a3si253874pln.353.2019.04.17.16.05.37; Wed, 17 Apr 2019 16:05:53 -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=Vu06x774; 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 S2387595AbfDQXEc (ORCPT + 99 others); Wed, 17 Apr 2019 19:04:32 -0400 Received: from mail-lj1-f196.google.com ([209.85.208.196]:33467 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729079AbfDQXEc (ORCPT ); Wed, 17 Apr 2019 19:04:32 -0400 Received: by mail-lj1-f196.google.com with SMTP id f23so220389ljc.0 for ; Wed, 17 Apr 2019 16:04:30 -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=jC2Jn+LpFd0JnUIlQRM35BrQxEoioUtdtP0up1XOsQQ=; b=Vu06x774zxETdVg4hvGZi9ihg8a5g7BUV3mk3HWv7inaK5nBSwbOxIy8pIFLtIy5SO 6CeD6Cvfidd0b9kPG23LGfsT0ZCxeSAADEKTx5xIjlmKAQNT6Fi0FKkc39EhY+HDSZKj OBMuPVy77nMWgrY+y5MmdHNMzj/V8kz+DSa1FxnDws1uWbRfpdZIfR3alCDHf7fGdTCx uIg5e3FhoOPILdlIYo1Mn81I++UbKUskzrMbQcOq8WOxdAuCCn9Bb/7RfbLNFDWYe1ok VeAyec4nFUa8UFoFuZuqMIsx4SpZd7o6sT1CyEhwhL8cQcHbMQ1oXZuRA/aWgcAmS02T FbDg== 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=jC2Jn+LpFd0JnUIlQRM35BrQxEoioUtdtP0up1XOsQQ=; b=Xkd96j4Vm53xGQODpHgOIU7DrNkdp/g6l+zDc+vM62g0/pBWeivtkK54pkwSajG7Qi e2L2SeJ/gwap1JNiPDqTlBBnWm3fpKtUzIPtOMK9r+oD2LnKc6mT7/JE4tcRTaFmKLnn dZX++UaHciyUwqGkTBWPk1JKEJf8iY55u4wQTys3CnsaWKj19Tk6ikf430xGN4F7AhIx CgIsip9lxP2LGHdOEeo46xJLDt0TyeiGYImRQmSQlbgirijM7eisZx8dHAoMf9LMlFuz d06sjaGua2DMq+ljpr/pXkeeLu7kR7kMqDRvWjrcpl7uEBP9COwh5epYzxLaFPYYpwAw 6Bxw== X-Gm-Message-State: APjAAAXQzHyFgzp9HQ6N6spbvS18movK8Nrb1bEvbxoPMhXMpzhj6t4O Oe9VBRboucJ8ro1+WthZFIEr8eREyLeHrSzQ6xZu+w== X-Received: by 2002:a2e:90c9:: with SMTP id o9mr10826061ljg.102.1555542269313; Wed, 17 Apr 2019 16:04:29 -0700 (PDT) MIME-Version: 1.0 References: <20190313222124.229371-1-rajatja@google.com> <20190411003738.55073-1-rajatja@google.com> In-Reply-To: From: Rajat Jain Date: Wed, 17 Apr 2019 16:03:52 -0700 Message-ID: Subject: Re: [PATCH v5 1/3] platform/x86: intel_pmc_core: Convert to a platform_driver To: Andy Shevchenko Cc: Rajneesh Bhardwaj , Vishwanath Somayaji , Darren Hart , Andy Shevchenko , Platform Driver , Linux Kernel Mailing List , Rafael J Wysocki , 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 Thu, Apr 11, 2019 at 6:44 AM Andy Shevchenko wrote: > > On Thu, Apr 11, 2019 at 3:37 AM Rajat Jain wrote: > > > > Convert the intel_pmc_core driver to a platform driver, and attach using > > the ACPI enumeration method (via the ACPI device "INT33A1"). > > > cpu_id = x86_match_cpu(intel_pmc_core_ids); > > if (!cpu_id) > > return -ENODEV; > > @@ -888,28 +893,49 @@ static int __init pmc_core_probe(void) > > mutex_init(&pmcdev->lock); > > pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); > > > > + dmi_check_system(pmc_core_dmi_table); > > + platform_set_drvdata(pdev, pmcdev); > > + > > err = pmc_core_dbgfs_register(pmcdev); > > if (err < 0) { > > - pr_warn(" debugfs register failed.\n"); > > + dev_warn(&pdev->dev, "debugfs register failed.\n"); > > iounmap(pmcdev->regbase); > > return err; > > } > > > > - dmi_check_system(pmc_core_dmi_table); > > - pr_info(" initialized\n"); > > > + dev_info(&pdev->dev, " initialized\n"); > > + device_initialized = true; > > First you do something, then print it's done, and not other way around. done > > > + > > return 0; > > } > > -module_init(pmc_core_probe) > > > > -static void __exit pmc_core_remove(void) > > +static int pmc_core_remove(struct platform_device *pdev) > > { > > - struct pmc_dev *pmcdev = &pmc; > > + struct pmc_dev *pmcdev = platform_get_drvdata(pdev); > > > > + platform_set_drvdata(pdev, NULL); > > pmc_core_dbgfs_unregister(pmcdev); > > mutex_destroy(&pmcdev->lock); > > iounmap(pmcdev->regbase); > > + return 0; > > } > > -module_exit(pmc_core_remove) > > + > > +static const struct acpi_device_id pmc_core_acpi_ids[] = { > > + {"INT33A1", 0}, /* _HID for Intel Power Engine, _CID PNP0D80*/ > > + { } > > +}; > > +MODULE_DEVICE_TABLE(acpi, pmc_core_acpi_ids); > > + > > +static struct platform_driver pmc_core_driver = { > > + .driver = { > > + .name = "pmc_core", > > + .acpi_match_table = ACPI_PTR(pmc_core_acpi_ids), > > + }, > > + .probe = pmc_core_probe, > > + .remove = pmc_core_remove, > > +}; > > + > > +module_platform_driver(pmc_core_driver); > > So, this patch has a bisectability issue. After it AFAIU some > platforms will not be able to enumerate the device. > > To avoid such you have to reconsider logic behind this conversion, i.e. > 1. Split the driver to core part and current initialization mechanism > 2. Add platform driver as a separate module. done. > > -- > With Best Regards, > Andy Shevchenko