Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp4012914rdg; Wed, 18 Oct 2023 12:10:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHApAJUKn745wtcuqF6o07/S4eWOB2UEeuGVHnU9o9tJ2WZ7keN+3aWr8q9MrLMAZn2YUNT X-Received: by 2002:a05:6a20:320e:b0:142:aced:c643 with SMTP id hl14-20020a056a20320e00b00142acedc643mr67163pzc.31.1697656224475; Wed, 18 Oct 2023 12:10:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697656224; cv=none; d=google.com; s=arc-20160816; b=p6y7M7CkWG9ST7ruOq7/yVKs2mWD6/Rv1OpjSU8pgk8R8yfFBsX2RDRBdr6i4IMIue qpbksClSmNGNEv17V/C7MPpagjDdnO9zOC2WQIhYp51rFXSXyy07Tzv87A9sT5QznBkp Mk6Z5t9TbX2jHkgCCbHwavrqTxnIQrd6fr+m83l7iUT75yP3ezMXOjHa8tOTDVPdUZiH TPOCcOLngYeoCzofVSX8NxlHW6cgJCcsupRUY8wLNjvSoSPXNkf3e8bdql/5TmZJ1aLt pCoVkTJ0zxyfHntg4u+31iAnYfFZH14Qb/+O/06mi6d6g+lZ/bvZLafqWxgIKpQl93fw d4Bw== 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=pWzYfB00ON/CvX8BIG0CGFntMdSBCKofQC0ey6q417A=; fh=yqoav7EnEdJ2mT+rtoecryk3HwWdUT86ZBxH2AVEvUc=; b=Y1AHoRJTNVCbD254wG2CUuAPQ+6RmMEu8F2bfB9HjbAU6hD2BhfI9CGOq0NuxQFHt3 gCZjpbSNokDbr+/qfMHs1qRgKl6Z5R5R4jsKYJopvElytAp5RT2gJ7+sKzDZfD1pq4TV 5T/cKHYvZy/SyWrxJuUd4il+A4DPbF4elRk0lVQn95fCYxUPPFQ50O3PDArJEJlu1dAs gDMVk4XOysC9OMghPuV5DnIkMBH5xBW7Gqf1iqDMUgwmAuYOyoI4r56LnOLBamTHsofX srq1q5aDLs7dhumx/fnhtOH7Bdi840nnN8OrUjumGpcDX1XBqmGMSJnR3FQ/zeAtQzbP giWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IDXN7cTJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id f8-20020a170902ce8800b001c9d690baa4si479847plg.532.2023.10.18.12.10.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 12:10:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=IDXN7cTJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 5BA4681BDF02; Wed, 18 Oct 2023 12:10:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230483AbjJRTKP (ORCPT + 99 others); Wed, 18 Oct 2023 15:10:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230489AbjJRTKM (ORCPT ); Wed, 18 Oct 2023 15:10:12 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A198F118; Wed, 18 Oct 2023 12:10:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697656210; x=1729192210; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lEuW3yOtEdU/a1Okhs6bGa5lUXS9niTft/NxC06rI0c=; b=IDXN7cTJTCO41KiM+8cf8PhjVgxbEyVa2fJxQFtizrg1qX0BGLHxgC6t sRsAuKJsQstgj7Lrh+sI4SEeNBNkl/XxDETI+89Egc8ggWS4XXy2U6Lkg 2Dmm1L1xr/384ZK3o91EbCZKFSo3FxdO8fohHjMr96yJy6CX23yCHa2PS SYCmHB/BE924gXJGHC7QbtDvwQW2YDF7FK8Qyyh05+2afVpThtQhli47j g6qtgI87L7LgSx++5ZVmUpl/P22y2xctziVR/vdzAP8e5w+mj/rLAHlNT okMu81zWEQkzBxuiCCHwGpJm3it+cQzqruE548EFd8frOzcYuO03bByOH A==; X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="472323315" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="472323315" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 12:10:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10867"; a="733277283" X-IronPort-AV: E=Sophos;i="6.03,235,1694761200"; d="scan'208";a="733277283" Received: from powerlab.fi.intel.com ([10.237.71.25]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Oct 2023 12:10:08 -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 v2 1/3] ACPI: acpi_pad: Replace acpi_driver with platform_driver Date: Wed, 18 Oct 2023 22:09:43 +0300 Message-ID: <20231018190945.252428-2-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231018190945.252428-1-michal.wilczynski@intel.com> References: <20231018190945.252428-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 18 Oct 2023 12:10:23 -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 | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c index 7a453c5ff303..25068f2c5b4d 100644 --- a/drivers/acpi/acpi_pad.c +++ b/drivers/acpi/acpi_pad.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -430,8 +431,9 @@ 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); acpi_status status; strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME); @@ -450,8 +452,10 @@ 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); @@ -467,13 +471,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 +490,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