Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp659038rdg; Wed, 11 Oct 2023 01:34:47 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMCI6Jo/xTOJHYz8XsPPsS/texsSIi36i9RlICmvS2pqTkOOZIR62eniPozb7vlfEg4NlV X-Received: by 2002:a9d:7f03:0:b0:6bf:ef0:c69 with SMTP id j3-20020a9d7f03000000b006bf0ef00c69mr21490155otq.34.1697013287749; Wed, 11 Oct 2023 01:34:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697013287; cv=none; d=google.com; s=arc-20160816; b=KQQeQNGJ3iBv70KMqTFzzdDjUmWzukV7QB5/rO5dm+5l0i6HsX/FuH2uT9WUDofuAK Hm+4xbggLSCgHmVRCQ3f0Kaw3DaaMfLMrlGKVtGM1gBoDFGugVCWBsx1whK57yWRBhH0 ZRwwR6hT45aqopTJXs4GNLp/k1CT2A/j3E4eWyFChBJhCnEoshLacNju6uBpVVaOEpAf Q8lVOO38Q2sROaNBuaOikLO0QjOZuEP01jXLQ0gBx+3u98QpCT3xK+C+0Iu0c/+6sNcN wJWdIQx0v1wI0Qhe28DMQarwrzpC0NTK4ZkyR+5KbX6fWFHTLlh89LMBfqfPwjArK78W 5RMw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=DB/czFO3MAC01/VKMTzhfHaXzJe6oSjMj1YBLSE0b8M=; fh=KYfAVph4r8Q0QL8w2PKQM+mlcUaM4t4ymfiVotNlWDE=; b=Gjo9FpUCyfSGb8S6ZWTmz+1q+QaWDJlvo9SMA6lZep+JZWkVyGfoBMtsYV3hSRqcge rHaQE2J1hYttREmWF1ftIlMtYFTLNRiADKQQowLApBPn1+j0Se+jdqoSzfKxucdB1Hwq ZmvqWLtqz8aUdzxYnxCvcKHetX09SAARJhmZRgd2pzSlA2BeHeIsM/eEqjgC42Z9V+z1 iqEulV7AcLbo6TpwN/M3/a4C/S1tMQGVdn/4a5Tl+JLeBgj5DNktVMDqd4pdWPTcvm9O hNhUhx/y+Qz6u5UET66LnHHbxuenD2WxsXPnWMkOXIOlpyjUF414nWuVGP1xEUScqy8m 7BGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EFw91vB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id p6-20020a056a000b4600b0068bf4e83dd8si3502460pfo.313.2023.10.11.01.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Oct 2023 01:34:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EFw91vB4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 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 fry.vger.email (Postfix) with ESMTP id 6674E801D58B; Wed, 11 Oct 2023 01:34:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230413AbjJKIeS (ORCPT + 99 others); Wed, 11 Oct 2023 04:34:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55874 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230455AbjJKIeG (ORCPT ); Wed, 11 Oct 2023 04:34:06 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B09A498; Wed, 11 Oct 2023 01:34:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697013244; x=1728549244; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=v8b36hzg0ZJAEO27CltsIvMZPSTrKWI+beze9I7e8Mo=; b=EFw91vB4/xej0KGUSrFs/tX94qbtFBaqHwlOr21M2Bb/5lzUGMfDZExK A7J7EkCKZkwrmCcoEjlE4JenajXsCx8oXQPf1MMrbLcBlgAhjIEbDxOkq lwIWtikjcNYv3o47iwqHUcp8KDyYYCMKe+CmXHCcgVgJE3V6FWZ3QUtjd N5Qd0mb9q7UfwOAXmX3HvpDsNIa0ftYEPEe+dBAaphbkuJFifDD8aOwmo onfG4F2Z3xbWKgpyPiz4KVSqOBPxpAHi/dFNMlC2ynCjl1x9VpUnBn/fy sZy39cQEZQL9nM4Z3uFoHFHEDQ6gJxWMJGpAD+e2YWc22DWs6+3+5ORkt w==; X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="388480155" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="388480155" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 01:33:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10859"; a="897548169" X-IronPort-AV: E=Sophos;i="6.03,214,1694761200"; d="scan'208";a="897548169" Received: from powerlab.fi.intel.com ([10.237.71.25]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2023 01:32:09 -0700 From: Michal Wilczynski To: linux-acpi@vger.kernel.org Cc: rafael@kernel.org, dan.j.williams@intel.com, vishal.l.verma@intel.com, lenb@kernel.org, dave.jiang@intel.com, ira.weiny@intel.com, rui.zhang@intel.com, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, Michal Wilczynski Subject: [PATCH v3 0/6] Replace acpi_driver with platform_driver Date: Wed, 11 Oct 2023 11:33:28 +0300 Message-ID: <20231011083334.3987477-1-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.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 (fry.vger.email [0.0.0.0]); Wed, 11 Oct 2023 01:34:42 -0700 (PDT) X-Spam-Level: ** Currently there is a number of drivers that somewhat incorrectly register themselves as acpi_driver, while they should be registering as platform_drivers. acpi_device was never meant to represent actual device, it only represents an entry in the ACPI table and ACPI driver should be treated as a driver for the ACPI entry of the particular device, not the device itself. Drivers of the devices itself should register as platform_drivers. Replace acpi_driver with platform_driver for all relevant drivers in drivers/acpi directory. This is just the first part of the change, as many acpi_drivers are present in many files outside of drivers/acpi directory. Additionally during internal review we've decided that it's best to send the relevant patches sequentially, in order not to overwhelm the reviewers. So I'm starting with NFIT and AC drivers. This change is possible thanks to recent .notify callback removal in drivers/acpi [1]. So flow for the remaining acpi_drivers will look like this: 1) Remove .notify callback with separate patchset for drivers/platform and other outstanding places like drivers/hwmon, drivers/iio etc. 2) Replace acpi_driver with platform_driver, as aside for .notify callback they're mostly functionally compatible. Most of the patches in this series could be considered independent, and could be merged separately, with a notable exception of the very first patch in this series that changes notify installer wrappers to be more generic. I decided it would be best not to force the user of this wrappers to pass any specific structure, like acpi_device or platform_device. It makes sense as it is very often the case that drivers declare their own private structure which gets allocated during the .probe() callback, and become the heart of the driver. In that case it makes much more sense to pass this structure to notify handler. Additionally some drivers, like acpi_video that already have custom notify handlers do that already. Link: https://lore.kernel.org/linux-acpi/20230703080252.2899090-1-michal.wilczynski@intel.com/ [1] v3: - in AC transformation patch replaced struct device* with struct acpi_device*, as suggested. v2: - dropped first, second and last commit. Last commit was deemed pointless, first and second are already merged. - rebased on top of modified first commit (changes in the wrappers) Michal Wilczynski (6): ACPI: AC: Remove unnecessary checks ACPI: AC: Use string_choices API instead of ternary operator ACPI: AC: Replace acpi_driver with platform_driver ACPI: AC: Rename ACPI device from device to adev ACPI: NFIT: Replace acpi_driver with platform_driver ACPI: NFIT: Remove redundant call to to_acpi_dev() drivers/acpi/ac.c | 103 +++++++++++++++++---------------------- drivers/acpi/nfit/core.c | 38 +++++++-------- 2 files changed, 64 insertions(+), 77 deletions(-) -- 2.41.0