Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp750901ybi; Fri, 21 Jun 2019 07:34:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5NCA4kDxO+XX39Eb30bfFEhBiBWM/Epi9s2p6WdrJ+QKPkpnzXhqyul53HeaxfKHVrEnj X-Received: by 2002:a17:90a:109:: with SMTP id b9mr6768091pjb.112.1561127660818; Fri, 21 Jun 2019 07:34:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561127660; cv=none; d=google.com; s=arc-20160816; b=aqpd0CVJhKhM02nOeR6BsbFOk/Ony14gs18x1YzFbIGb5Rhp4SXwJFI5SlK5H/W4nC juascgQxvhj/G2O33Bqf+ZHUOU66Pk/W6R+LYkk6CyHW1GosSySF82Cy1WfumBsjtHPn 1JPbO3YBX+O7FPUINvRW/kcYzYJE9SSGNMF0zo9yemEVUDVsUtVfiH2JtfM0qc6FhIi5 Lljp+hJ1r0EB48sVRAXV6VueffHN1xXhYu/83vpznGoYyji5rq86JamnON76llxd9n8g v8uj995fMPj2rwvsSHrzztrv4xuf/BRNy1ooetZV0iGy6/2WNcigD86wKCmPzvMJogYt bLGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject; bh=Sb70T1huiMtL3sCizOdQU4oH2x6HxIecKElJdSImfnc=; b=uJNd3YExTkVqacvMdU3doMQDYRX+k9ceHTM+5QETsIyeOeEX7u6sAy0N4cHhkfHV1e 15/UGtHKIOzWJQB7uSmI5XBXb7qEJOE8S569Lq8Vfq2O92XIcvX/DZKj/B/YcTjIUoRv KMayr+BP828CqKHnDoEhbRbawLpeps/VnIVV6MYIrDAW8LpUZRZZAGUzMdFXPpsQWmTl qtg5pkZVGFiH1hL1lw2CBNHQ/xp69ecUgSjqHW3vT3wcdkLvhjVNZ+u5ls5V3aGEjoz8 Eaxmc+Nk79mFOqOaOoOaWUby1dCy5RZKouJkdMSjplYlvlE9VgjLd+FFDjwtZlrK8fv5 pKKQ== 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 w23si2851358ply.230.2019.06.21.07.34.05; Fri, 21 Jun 2019 07:34:20 -0700 (PDT) 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 S1726382AbfFUOdu (ORCPT + 99 others); Fri, 21 Jun 2019 10:33:50 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51086 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725985AbfFUOdu (ORCPT ); Fri, 21 Jun 2019 10:33:50 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 56FAA15A5690BFCC3BED; Fri, 21 Jun 2019 22:33:46 +0800 (CST) Received: from [127.0.0.1] (10.202.227.238) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.439.0; Fri, 21 Jun 2019 22:33:36 +0800 Subject: Re: [PATCH 4/5] bus: hisi_lpc: Add .remove method to avoid driver unbind crash To: Bjorn Helgaas References: <1561026716-140537-1-git-send-email-john.garry@huawei.com> <1561026716-140537-5-git-send-email-john.garry@huawei.com> <20190621135619.GE82584@google.com> CC: , , , , , , , "Rafael J. Wysocki" From: John Garry Message-ID: <919b0b6f-1c37-47d5-1853-cb297d68aae7@huawei.com> Date: Fri, 21 Jun 2019 15:33:30 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 In-Reply-To: <20190621135619.GE82584@google.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.202.227.238] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 21/06/2019 14:56, Bjorn Helgaas wrote: >> >> > +static void hisi_lpc_acpi_remove(struct device *hostdev) >> > +{ >> > + struct acpi_device *adev = ACPI_COMPANION(hostdev); >> > + struct acpi_device *child; >> > + >> > + device_for_each_child(hostdev, NULL, hisi_lpc_acpi_remove_subdev); >> > + >> > + list_for_each_entry(child, &adev->children, node) Hi Bjorn, >> > + acpi_device_clear_enumerated(child); > There are only two other non-ACPI core callers of > acpi_device_clear_enumerated() (i2c and spi). That always makes me > wonder if we're getting too deep in ACPI internals. It's no coincidence that i2c and spi are the only other two non-ACPI core callers. For getting ACPI support for the hisi-lpc driver, we modeled the driver to have the same ACPI enumeration method as i2c and spi hosts. That is, allow the host driver to enumerate the child devices. You can check drivers/acpi/scan.c::acpi_device_enumeration_by_parent() for where we make the check on the host and how it is used. Thanks, John > >> > +} >> > + >> > /* >> > * hisi_lpc_acpi_probe - probe children for ACPI FW >> > * @hostdev: LPC host device pointer >> > @@ -555,8 +566,7 @@ static int hisi_lpc_acpi_probe(struct device *hostdev) >> > return 0; >> > >> > fail: >> > - device_for_each_child(hostdev, NULL, >> > - hisi_lpc_acpi_remove_subdev); >> > + hisi_lpc_acpi_remove(hostdev); >> > return ret;