Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp2638557rdg; Mon, 16 Oct 2023 10:06:23 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE8TkQ71YZVH9QcrgLTFOyEvXobNagGQCNjjiibZh4wNmxU0VqFA2Sw+PVpSJ0vEJIR9DTm X-Received: by 2002:a17:903:228f:b0:1c7:66a4:27ba with SMTP id b15-20020a170903228f00b001c766a427bamr43361330plh.48.1697475982726; Mon, 16 Oct 2023 10:06:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697475982; cv=none; d=google.com; s=arc-20160816; b=eIMwTZ1HhsHBoYO96Jo6wKUDucPvJpeS6hmsvRbPuoxSRt7YvltYR4yoatJvd8YbgD vx6l80EoagXDVVqebzkauzcHvyq3oY9WBLID14F6S4r5F2O7mNVcrZXCd0xAvqLqh0iI pmmgmWKbOz4GXoiqBD99IUzTrdCyDOreCajGUfSgNY8ePYObhNHIiDx5V8a+K37gR3OC TRALTsYNFFpJ2BJMBVacujt2bMNDO0aJ0yPSa5ZOSoYuF+k/lszDmBcBH7cukJSOS/Ct 8ZH12XLldHRGr28SGq8roxxtHtmbMTOz38P1AexWmsD1c9/RmD3npgyG9ACQ+8t08v80 X57g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BL8Fi3ACg3CpNP0hmmvcXmbEwMeMrcL1ZKo0pCshWXU=; fh=yqoav7EnEdJ2mT+rtoecryk3HwWdUT86ZBxH2AVEvUc=; b=T9XicW4I97LQG46ybNg6PX7GBLcth80W/WJvRsBT1kOccWLZRrr8CCuMwZ9dfHGsau fCj+UgP8zLw2TTQz7SkpBFt55gyNeUJGy42AkoIND8W4+h8dKXtvLCurBymRXDL4kJVo ILoNkaeOoMWZ4TdgX/yybwLUb85hUve5r+FPSJlVEbjx1FyottTd4lK1cipqD09qbpGw 6wJHjrrm6gxMHbYgJYIhdyNpM1efM1+W9rlZfF3mp3rp8MvrW2dJXyH137ppCp44sh9c lFJiCn/XfN05zM03GPnrPUZ2G8gtgc0zxWV0yzIjG/RXph18Aym97wuhcJP9RcKdWefO q9pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KDzwNO9l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id d8-20020a170902cec800b001bf01fee6bcsi2847950plg.610.2023.10.16.10.06.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 10:06:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=KDzwNO9l; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B52C680A2831; Mon, 16 Oct 2023 10:06:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234552AbjJPRFt (ORCPT + 99 others); Mon, 16 Oct 2023 13:05:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232967AbjJPRFW (ORCPT ); Mon, 16 Oct 2023 13:05:22 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1964330E9; Mon, 16 Oct 2023 10:01:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697475712; x=1729011712; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cWrZJva5wG+790MFHsyIaJ0RzDiu+hSencDWcGkJyIg=; b=KDzwNO9lsyyJoPY3Q75oWjJ8J+Sdiy9sNzjK1EW0wOIZ8F++QBZZsLBn xs5GSgWvwv49npEfAr+2lxNADv4gsFYCRJkjVpoNp0Il15KQd2Q0yh01C Zm0YVCHRsyMfEJzA4OeMbuUnnA/+vFXsfV2iNO9rxFtxibF28mWHe9/Ti HtAYj1GyOMUg4GL8+IxMGGFo6tBODQQBVpKHWCpGByifhzWZvSSPhjYOh Z/xYq/zGYWczopGMMYjA/NhNhJHdn5QfHhPTY/SeOap9Xf3eooeub3gI7 TK5n1HOGR2LYQSg5ld1bzjhXd1B/5vD9fLkn63Mh9qbKg7y05dNtOLTIp A==; X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="385427243" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="385427243" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 10:01:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10865"; a="1087133858" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="1087133858" Received: from powerlab.fi.intel.com ([10.237.71.25]) by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 10:01:35 -0700 From: Michal Wilczynski To: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: rafael.j.wysocki@intel.com, andriy.shevchenko@linux.intel.com, lenb@kernel.org, Michal Wilczynski Subject: [PATCH v1 1/3] ACPI: acpi_pad: Replace acpi_driver with platform_driver Date: Mon, 16 Oct 2023 20:01:23 +0300 Message-ID: <20231016170125.576159-2-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231016170125.576159-1-michal.wilczynski@intel.com> References: <20231016170125.576159-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Mon, 16 Oct 2023 10:06:20 -0700 (PDT) The acpi_pad driver uses struct acpi_driver to register itself while it would be more logically consistent to use struct platform_driver for this purpose, because the corresponding platform device is present and the role of struct acpi_device is to amend the other bus types. ACPI devices are not meant to be used as proper representation of hardware entities, but to collect information on those hardware entities provided by the platform firmware. Use struct platform_driver for registering the acpi_pad driver. Suggested-by: Rafael J. Wysocki Signed-off-by: Michal Wilczynski --- drivers/acpi/acpi_pad.c | 41 ++++++++++++++++++++++++----------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 7a453c5ff303..36e1049833a3 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -413,16 +414,16 @@ static void acpi_pad_handle_notify(acpi_handle handle) mutex_unlock(&isolated_cpus_lock); } -static void acpi_pad_notify(acpi_handle handle, u32 event, - void *data) +static void acpi_pad_notify(acpi_handle handle, u32 event, void *data) { - struct acpi_device *device = data; + struct device *dev = data; + struct acpi_device *device = ACPI_COMPANION(dev); switch (event) { case ACPI_PROCESSOR_AGGREGATOR_NOTIFY: acpi_pad_handle_notify(handle); acpi_bus_generate_netlink_event(device->pnp.device_class, - dev_name(&device->dev), event, 0); + dev_name(dev), event, 0); break; default: pr_warn("Unsupported event [0x%x]\n", event); @@ -430,8 +431,10 @@ static void acpi_pad_notify(acpi_handle handle, u32 event, } } -static int acpi_pad_add(struct acpi_device *device) +static int acpi_pad_probe(struct platform_device *pdev) { + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); + struct device *dev = &pdev->dev; acpi_status status; strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME); @@ -441,7 +444,9 @@ static int acpi_pad_add(struct acpi_device *device) return -ENODEV; status = acpi_install_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, acpi_pad_notify, device); + ACPI_DEVICE_NOTIFY, + acpi_pad_notify, + dev); if (ACPI_FAILURE(status)) { acpi_pad_remove_sysfs(device); return -ENODEV; @@ -450,14 +455,17 @@ static int acpi_pad_add(struct acpi_device *device) return 0; } -static void acpi_pad_remove(struct acpi_device *device) +static void acpi_pad_remove(struct platform_device *pdev) { + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); + mutex_lock(&isolated_cpus_lock); acpi_pad_idle_cpus(0); mutex_unlock(&isolated_cpus_lock); acpi_remove_notify_handler(device->handle, - ACPI_DEVICE_NOTIFY, acpi_pad_notify); + ACPI_DEVICE_NOTIFY, + acpi_pad_notify); acpi_pad_remove_sysfs(device); } @@ -467,13 +475,12 @@ static const struct acpi_device_id pad_device_ids[] = { }; MODULE_DEVICE_TABLE(acpi, pad_device_ids); -static struct acpi_driver acpi_pad_driver = { - .name = "processor_aggregator", - .class = ACPI_PROCESSOR_AGGREGATOR_CLASS, - .ids = pad_device_ids, - .ops = { - .add = acpi_pad_add, - .remove = acpi_pad_remove, +static struct platform_driver acpi_pad_driver = { + .probe = acpi_pad_probe, + .remove_new = acpi_pad_remove, + .driver = { + .name = "processor_aggregator", + .acpi_match_table = pad_device_ids, }, }; @@ -487,12 +494,12 @@ static int __init acpi_pad_init(void) if (power_saving_mwait_eax == 0) return -EINVAL; - return acpi_bus_register_driver(&acpi_pad_driver); + return platform_driver_register(&acpi_pad_driver); } static void __exit acpi_pad_exit(void) { - acpi_bus_unregister_driver(&acpi_pad_driver); + platform_driver_unregister(&acpi_pad_driver); } module_init(acpi_pad_init); -- 2.41.0