Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp21040116rwd; Thu, 29 Jun 2023 10:06:00 -0700 (PDT) X-Google-Smtp-Source: APBJJlEhINp1u3MDT3SfwBTCwV3cn/oz4TRWbcZT0ELjz1rIshUiNNfnRiLditHUCBRf1+xOzpQ7 X-Received: by 2002:a17:903:32c8:b0:1b8:5bca:8267 with SMTP id i8-20020a17090332c800b001b85bca8267mr2201113plr.25.1688058360336; Thu, 29 Jun 2023 10:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688058360; cv=none; d=google.com; s=arc-20160816; b=nYrsElGw0XozmOQG6ZWW9nY9vPEnH6Jk2cVg1Wqjvu0MHXJ3vm+1xXZIo8v2xalGZD VADiZhBorPQmEijyPnpw1SmvJbsIRu4tX7O9vWzZAcNb2TqyQPF4wqXado1eHu2d2kB3 7Tz+BTq6sJYzAy8E4g6f+ZPNBCQ17K25IvZAJEBKMPzHGKgrIkh3vHY9uN51eorBU/WN YfIyPz812WmruvMDZiR83g8z9lkrRbnL249kflF0xJXTi1TQSXcGobxk/Md878OV6fEB vdjPy4SWhwcvvMSfQ3mjfjP7PCq8cv0nu6SlSwxVAboJzj/V0EfKv89NPOVmMtLOwGCx 6Gjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=hvv86p7Je8G1jxZaVODybH51btnVMItRCI1f88m7vVU=; fh=pndOYlRywpyf1i5QffNLR6Ei8g6YgrRjkT+LrHThq9A=; b=zcrake6fHLloRD8J7QiipTxB7H8fheDI1OUapOXcqXiyc3sB24qwMQOcLjBwctD1KL 13b1n/Jd9+/eDjXEPqJe/N6KYZLyxiOZQppEgipJW0CXNNEvySp0xpXeh9NboIJpCUgZ 40MZ+7jG637rK5+Yqi1L5AK+rDWsBweKyP2cVWffjqCKfviCDnn4X6XV1cnYxNZ0dQaN 98G9F0KfMF9KULeL27sHBQ2h65wGgI2akOB5C7HhtfQSjrVpFYRnsSkipdbF3QsrEaNm 7xyYhvzaADUfa+hPoWw/mDsEMn584vNRlned6f35t6tiXJNTKvyY7PBIunTSz4BH5qJE f6ew== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a170903211500b001b8433a86c2si2446793ple.72.2023.06.29.10.05.43; Thu, 29 Jun 2023 10:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231550AbjF2QSR convert rfc822-to-8bit (ORCPT + 99 others); Thu, 29 Jun 2023 12:18:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39904 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230401AbjF2QSQ (ORCPT ); Thu, 29 Jun 2023 12:18:16 -0400 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64BD6CF; Thu, 29 Jun 2023 09:18:14 -0700 (PDT) Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-991f9148334so25016866b.1; Thu, 29 Jun 2023 09:18:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688055493; x=1690647493; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eKddrYb9Xcx4IoLqdTI5tk2rwMAekQcgu+s3gWevaEw=; b=ThG38RP32xKZ+PWuCnCBfiwPRYgc1M/xWk/BMrEJaV8BYcfwGNK7Zm1kwoPueRNhgn z+f0qmxed7ySjDgTfMV8UXFJkvhlaUrpkYNSek1CxICQKdk61BZvUOfmfjc5cO2YiL2u a7sP10kS++uf73AesejacvimbX/1KQoVg+CqeauxXjQMsJHYmHROdF1NCpFVPQ31B6ZO dggMDDj0r41P1T9W71lSM/tNkmvGRks28G62aM+rB0GrWXFeSedoSBppgDQ343dHaFg3 ZiH/WTrPjt2WV8d6jZ7QKPMN80GDVBLYtqc0bWCMh4JzGE9RCeiQifpY325UE3dUIDf2 bzqQ== X-Gm-Message-State: AC+VfDzs/sZ/KwpCuMucAdBh7MsYJbIS111fhulSrDbsDH1kr7opOUu5 va45CAyC7IDfmKtLSToTXLx8/tjNZzM0ANseTc8= X-Received: by 2002:a17:906:73dd:b0:989:1ed3:d00b with SMTP id n29-20020a17090673dd00b009891ed3d00bmr21389315ejl.4.1688055492790; Thu, 29 Jun 2023 09:18:12 -0700 (PDT) MIME-Version: 1.0 References: <20230616165034.3630141-1-michal.wilczynski@intel.com> <20230616165034.3630141-10-michal.wilczynski@intel.com> In-Reply-To: <20230616165034.3630141-10-michal.wilczynski@intel.com> From: "Rafael J. Wysocki" Date: Thu, 29 Jun 2023 18:18:01 +0200 Message-ID: Subject: Re: [PATCH v5 09/10] acpi/nfit: Move handler installing logic to driver To: Michal Wilczynski Cc: linux-acpi@vger.kernel.org, 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, "Rafael J . Wysocki" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Fri, Jun 16, 2023 at 6:51 PM Michal Wilczynski wrote: > > 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_dev_install_notify_handler() at the end of .add() callback. > Call acpi_dev_remove_notify_handler() at the beginning of .remove() > callback. Change arguments passed to the notify function to match with > what's required by acpi_install_notify_handler(). Remove .notify > callback initialization in acpi_driver. > > Suggested-by: Rafael J. Wysocki > Signed-off-by: Michal Wilczynski > --- > drivers/acpi/nfit/core.c | 24 ++++++++++++++++++------ > 1 file changed, 18 insertions(+), 6 deletions(-) > > diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c > index 95930e9d776c..a281bdfee8a0 100644 > --- a/drivers/acpi/nfit/core.c > +++ b/drivers/acpi/nfit/core.c > @@ -3312,11 +3312,13 @@ void acpi_nfit_shutdown(void *data) > } > EXPORT_SYMBOL_GPL(acpi_nfit_shutdown); > > -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); > - device_unlock(&adev->dev); It's totally not necessary to rename the ACPI device variable here. Just add struct acpi_device *adev = data; to this function. > + struct acpi_device *device = data; > + > + device_lock(&device->dev); > + __acpi_nfit_notify(&device->dev, handle, event); > + device_unlock(&device->dev); > } > > static int acpi_nfit_add(struct acpi_device *adev) > @@ -3375,12 +3377,23 @@ 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_dev_install_notify_handler(adev, > + ACPI_DEVICE_NOTIFY, > + acpi_nfit_notify); > } > > static void acpi_nfit_remove(struct acpi_device *adev) > { > /* see acpi_nfit_unregister */ > + > + acpi_dev_remove_notify_handler(adev, > + ACPI_DEVICE_NOTIFY, > + acpi_nfit_notify); > } > > static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle) > @@ -3465,7 +3478,6 @@ static struct acpi_driver acpi_nfit_driver = { > .ops = { > .add = acpi_nfit_add, > .remove = acpi_nfit_remove, > - .notify = acpi_nfit_notify, > }, > }; > > --