From patchwork Fri May 12 14:01:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Wilczynski X-Patchwork-Id: 681249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56F9CC7EE2A for ; Fri, 12 May 2023 14:03:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241353AbjELODJ (ORCPT ); Fri, 12 May 2023 10:03:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241397AbjELODG (ORCPT ); Fri, 12 May 2023 10:03:06 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2CBE1710 for ; Fri, 12 May 2023 07:03:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1683900182; x=1715436182; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cKUWfqMu2Js1onBYo4CIiZvIbK10uMibsAiFvs+BEGU=; b=mlEYoXxxOiLGTKrjxsgeGbnXp6plnaoD9r7dx7QKlMlc0GaklYqtYhdS Gp8HkUXi5Lbed25YRJsWMa6Bz/roO6rDXqrtN2UxT1LvZjDZNtPxOQi3o yUTtmduCrvwi9bjQ9FgpGBbHm55Ya4jh6YFTR+73hfJecM1PBwSanvbyb 3EhMXLziqPsSJGNo83i0AOyH0kRY6MFuFmQQUNOEE7e4n2c8jgUxrYgeu YRZf0Yz6wISQstCXlhTPkKUNk2ogB3kYW4JCHIlc2K3CrV94uOs1d4wAj y31WQBSxI/y30bhrcc0y0/5CHLHA46TWd/MgA+ZWZePUVCGrH3rWhhnwz w==; X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="378931044" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="378931044" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 07:02:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10708"; a="650648925" X-IronPort-AV: E=Sophos;i="5.99,269,1677571200"; d="scan'208";a="650648925" Received: from hextor.igk.intel.com ([10.123.220.6]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2023 07:02:58 -0700 From: Michal Wilczynski To: linux-acpi@vger.kernel.org Cc: rafael@kernel.org, Michal Wilczynski Subject: [PATCH v1 07/34] acpi/nfit: Move handler installing logic to driver Date: Fri, 12 May 2023 16:01:55 +0200 Message-Id: <20230512140222.124868-8-michal.wilczynski@intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230512140222.124868-1-michal.wilczynski@intel.com> References: <20230512140222.124868-1-michal.wilczynski@intel.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Currently logic for installing notifications from ACPI devices is implemented using notify callback in struct acpi_driver. Preparations are being made to replace acpi_driver with more generic struct platform_driver, which doesn't contain notify callback. Furthermore as of now handlers are being called indirectly through acpi_notify_device(), which decreases performance. Call acpi_device_install_event_handler() at the end of .add() callback. Call acpi_device_remove_event_handler() at the beginning of .remove() callback. Change arguments passed to the notify callback to match with what's required by acpi_device_install_event_handler(). Signed-off-by: Michal Wilczynski --- drivers/acpi/nfit/core.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 07204d482968..2029f0fca9bc 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c @@ -3368,11 +3368,17 @@ static int acpi_nfit_add(struct acpi_device *adev) if (rc) return rc; - return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc); + + rc = devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc); + if (rc) + return rc; + + return acpi_device_install_event_handler(device, ACPI_DEVICE_NOTIFY, acpi_nfit_notify); } static void acpi_nfit_remove(struct acpi_device *adev) { + acpi_device_remove_event_handler(device, ACPI_DEVICE_NOTIFY, acpi_nfit_notify); /* see acpi_nfit_unregister */ } @@ -3446,7 +3452,7 @@ void __acpi_nfit_notify(struct device *dev, acpi_handle handle, u32 event) } EXPORT_SYMBOL_GPL(__acpi_nfit_notify); -static void acpi_nfit_notify(struct acpi_device *adev, u32 event) +static void acpi_nfit_notify(acpi_handle handle, u32 event, void *data) { device_lock(&adev->dev); __acpi_nfit_notify(&adev->dev, adev->handle, event); @@ -3465,7 +3471,6 @@ static struct acpi_driver acpi_nfit_driver = { .ops = { .add = acpi_nfit_add, .remove = acpi_nfit_remove, - .notify = acpi_nfit_notify, }, };