Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp316113pxf; Wed, 24 Mar 2021 06:00:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMoHo2E//EcLRAeKISaiAmBTEo9BSRcYAAnEtKitnW/ZmIoNSHcJucBdCJaoF8UGas/RnQ X-Received: by 2002:a17:906:6703:: with SMTP id a3mr3500504ejp.240.1616590815971; Wed, 24 Mar 2021 06:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616590815; cv=none; d=google.com; s=arc-20160816; b=fo9o1xy60OuCheONimCDh7Yix6VCnRwL/8ry9uu48tohl2+1ybJYNv6FrhAAOQ/4AC wkyEDJisuShGR8/8V11EzU90OwnQf0+hlzCytdRkOReg0GR+U+LZgd1F4bzhKyCi7WbR lcDW378Y7qQvo8myGS6ez8pUz1+zaSBXXtavRKvC2KPY7/JrwDoLxQprNxQB2AQh/sdY AYJmzXrKCnh1ns+Gnwp/gIN4zuW9PD6R/zL9K3Lsu5bqLWzQ/+Uk4n/Yh3GuAgV1ZDs8 2PnL7VNpHsbRO4ZgzkxnxUqhYGnTgKQ9DuuVUabqB9UaDXugZ/so/gu3G5p1LIavwXH7 9uOw== 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=vjfeStBI2DcHZmjQrx+N+dsAxgF1a/tnl6rrv3SVE6Q=; b=irDp+XDRrbUvu9/sZKm4F5MMw9xFHayJO/mFr7OYCcIuXlP7zGVjijH7S1Sw62unyE JSPlAozkBCzkWSjhMowotsv+tSA2DG8rZEhb3m/FNufwrQ/dgJ+n0sKKnB6tvhzhf+a+ XhE/x+KA87GJjt7MKB92k7TU3Kw8zozbEhyM2JNI8SWQUDa52BqYZ4qWI6i2d4IfXq6Y rGahNWU8J7FTyzkWimPnT5eja7V6MQooTd+vPenyYZ8TElJoiPXXAJW3SoYF1RpwUCyv 3dSja9g7tQKqZnB31xlhPuPVbH8OtBm/YKpfVn8UN78r/sqGQDteqx/xqzReLq9aC6jE yTSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=tekIiAZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q14si1585136edw.414.2021.03.24.05.59.51; Wed, 24 Mar 2021 06:00:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=tekIiAZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234962AbhCXM4p (ORCPT + 99 others); Wed, 24 Mar 2021 08:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234517AbhCXM4E (ORCPT ); Wed, 24 Mar 2021 08:56:04 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9260EC061763 for ; Wed, 24 Mar 2021 05:56:03 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id o19so27486844edc.3 for ; Wed, 24 Mar 2021 05:56:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vjfeStBI2DcHZmjQrx+N+dsAxgF1a/tnl6rrv3SVE6Q=; b=tekIiAZWW3kwi3DlNvLmMjX9jCWj63bcKAuPkI/Q5kJI1jxRdebmh1n9A/tlN0QDix AhF96gOTxQDa/INulpZewfZFCBHRT32NBq4aN7Wt9iCdCk3hqwXQu0HoXJcnqap2l8rT hp892/IN6CoTYtv4sXGNN0pSbemNt7+zWkpKgHHWadomhZp399P88VkrOkkjNOLK/EO1 7/wbr3XDjeBjDtw3cLPZB8UFskNHxNGG40xlP5icGyEQXICCz1O9EsMJb3DXQOXP3TOD Ci3Pr1aUf75aTPI9Grsc2yKD1Y1687FHnbcYBoFJve456VIQJ2f1B4xhuPoI55jOS2ev k91Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vjfeStBI2DcHZmjQrx+N+dsAxgF1a/tnl6rrv3SVE6Q=; b=nE6c64NpVBgZqY+rI9amo8xMyQWeN3RjKw8BKEwy/k1yo3BX7TugrDv2VMv7Vugzhv W+hX7CW4GTindm3jz2r1aqFLN32XMS84qQHlpsH1qmUMzmqiuQDhK6OTMPtr6N6LHHpM 1d2xKu2e9I6WLC2A209hVaChvTIi8vamt+x/7Oiw61i+2QJcAycALYLoiLLNFGz7Pmlb /gnfBKuLFwBweBVY+/NoR8tKvxag7Vh6pa95mPVTaKuEi2dLhsfEY/pvhfkUl+8bn0AO i6NNKnSh5GS7O+SfPdgrPGo9/9CsQ8UtdYHL+3LKxtZ7yw+0fD2q+/4LCLt1OK39gD/6 O2dQ== X-Gm-Message-State: AOAM533/pNjqxPITTAvOvQwjgaSGpw7/pq6kUizI1lF5Erc1UUmhRbGN 5o0mlgPluaPdHBnCT2zvtwDyyg== X-Received: by 2002:a05:6402:2076:: with SMTP id bd22mr3260352edb.378.1616590562364; Wed, 24 Mar 2021 05:56:02 -0700 (PDT) Received: from localhost.localdomain ([5.2.193.191]) by smtp.gmail.com with ESMTPSA id fi11sm880282ejb.73.2021.03.24.05.56.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 05:56:02 -0700 (PDT) From: Alexandru Ardelean To: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org Cc: coproscefalo@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, jic23@kernel.org, linux@deviqon.com, Alexandru Ardelean Subject: [PATCH 02/10] platform/x86: toshiba_acpi: use devm_add_action_or_reset() for singleton clear Date: Wed, 24 Mar 2021 14:55:40 +0200 Message-Id: <20210324125548.45983-3-aardelean@deviqon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324125548.45983-1-aardelean@deviqon.com> References: <20210324125548.45983-1-aardelean@deviqon.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The only reason to do this is to enforce the ordering of deinitialization, when the conversion of the device-managed functions is done. The singleton object should be cleared right before it is free'd. Signed-off-by: Alexandru Ardelean --- drivers/platform/x86/toshiba_acpi.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 6d298810b7bf..c5284601bc2a 100644 --- a/drivers/platform/x86/toshiba_acpi.c +++ b/drivers/platform/x86/toshiba_acpi.c @@ -2995,9 +2995,6 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev) rfkill_destroy(dev->wwan_rfk); } - if (toshiba_acpi) - toshiba_acpi = NULL; - return 0; } @@ -3012,6 +3009,11 @@ static const char *find_hci_method(acpi_handle handle) return NULL; } +static void toshiba_acpi_singleton_clear(void *data) +{ + toshiba_acpi = NULL; +} + static int toshiba_acpi_add(struct acpi_device *acpi_dev) { struct device *parent = &acpi_dev->dev; @@ -3035,6 +3037,13 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) dev = devm_kzalloc(parent, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; + + ret = devm_add_action_or_reset(parent, + toshiba_acpi_singleton_clear, + NULL); + if (ret) + return ret; + dev->acpi_dev = acpi_dev; dev->method_hci = hci_method; dev->miscdev.minor = MISC_DYNAMIC_MINOR; -- 2.30.2