Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp4091655ybc; Thu, 14 Nov 2019 21:36:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwPXlBuA65nriEkab3qm96u7U2HxU76ZnwZclO0skDGoERq3RfU+yunXDkaXASTXxqWISpO X-Received: by 2002:a17:906:505:: with SMTP id j5mr11095227eja.167.1573796191318; Thu, 14 Nov 2019 21:36:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573796191; cv=none; d=google.com; s=arc-20160816; b=WpKVGTxcXd70TtfKE5sd+FOa/L6dgSU7JIyQgHeibaPonGZ1yV2jvns1wiLduFQA8f jQHk8J2onoSH9qlKlWcWiAtate/76xxX93mDQkxC9CRBP0vU/n5g391Pww8x3SyvvYO4 pZaZcx8OXhEbNc/r4xpkoIizr4O5kA5XM+AQl/aCLQlt752mFtTWsaMortJBsgqsoyHw unLzjWFtCwH4N3DFqIO1I/XuUsWtMFcqrF2jKP4Cm7YV9qjhhUAztr4oY5V73ScG2Ozo vFMY6wvz4MqsuaUj17C37TvrUwi3PpyxNnalUzstSS+p45bkROTytdad0LNDlAJqcLTT fuWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=Aoa9SVW6MbhCwRSLI8SfLbFRzoUG60DPK0ES7yYMn3M=; b=ky8GmMx4FiqQ7WimsxHRsem3RmPJ7DmF2+KD+6eH++1K+W7nvhovK1ThSkmWrlZILl YUJaqtLaFoWaTACcnHEMRCT3uIVbv5NfM7OuklRe+FsWpJyWyoU0syJ86ceVG5kNOT1u Ka29jtMaIAJpuZGq4EIy0Y/QvctRrkAg/wTFh8WDtO8+Miw+yZRp7Iw5gC38chX2yL6S xnioALbTBddvT3PhkVS06NtMPqL3+GjGgF5nrQbQ8+kVToAU5NHF4+8F9xieUt8VuSxO qOUVRij0b3ohz9TwMROOhA0SNo/99HWWgGN8jlGyRcb7gmLFJDrCNuZzBzyM17cbwtCR DN9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h49si5974888edh.2.2019.11.14.21.36.05; Thu, 14 Nov 2019 21:36:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727137AbfKOFe5 (ORCPT + 99 others); Fri, 15 Nov 2019 00:34:57 -0500 Received: from mail5.windriver.com ([192.103.53.11]:48684 "EHLO mail5.wrs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbfKOFe5 (ORCPT ); Fri, 15 Nov 2019 00:34:57 -0500 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id xAF5Yh0X027136 (version=TLSv1 cipher=AES128-SHA bits=128 verify=FAIL); Thu, 14 Nov 2019 21:34:43 -0800 Received: from pek-lpggp6.wrs.com (128.224.153.40) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.468.0; Thu, 14 Nov 2019 21:34:42 -0800 From: Yongxin Liu To: , , , CC: Subject: [PATCH] Revert "platform/x86: wmi: Destroy on cleanup rather than unregister" Date: Fri, 15 Nov 2019 13:27:10 +0800 Message-ID: <20191115052710.46880-1-yongxin.liu@windriver.com> X-Mailer: git-send-email 2.14.4 MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 7b11e8989618581bc0226ad313264cdc05d48d86. Consider the following hardware setting. |-PNP0C14:00 | |-- device #1 |-PNP0C14:01 | |-- device #2 When unloading wmi driver module, device #2 will be first unregistered. But device_destroy() using MKDEV(0, 0) will locate PNP0C14:00 first and unregister it. This is incorrect. Should use device_unregister() to unregister the real parent device. Signed-off-by: Yongxin Liu --- drivers/platform/x86/wmi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/wmi.c b/drivers/platform/x86/wmi.c index 59e9aa0f9643..e16f660aa117 100644 --- a/drivers/platform/x86/wmi.c +++ b/drivers/platform/x86/wmi.c @@ -1347,7 +1347,7 @@ static int acpi_wmi_remove(struct platform_device *device) acpi_remove_address_space_handler(acpi_device->handle, ACPI_ADR_SPACE_EC, &acpi_wmi_ec_space_handler); wmi_free_devices(acpi_device); - device_destroy(&wmi_bus_class, MKDEV(0, 0)); + device_unregister((struct device *)dev_get_drvdata(&device->dev)); return 0; } @@ -1401,7 +1401,7 @@ static int acpi_wmi_probe(struct platform_device *device) return 0; err_remove_busdev: - device_destroy(&wmi_bus_class, MKDEV(0, 0)); + device_unregister(wmi_bus_dev); err_remove_notify_handler: acpi_remove_notify_handler(acpi_device->handle, ACPI_DEVICE_NOTIFY, -- 2.14.4