From patchwork Fri Jul 29 15:08:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Tissoires X-Patchwork-Id: 9252577 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBD6760757 for ; Fri, 29 Jul 2016 15:08:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE21228336 for ; Fri, 29 Jul 2016 15:08:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2E7B2833A; Fri, 29 Jul 2016 15:08:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E17C028336 for ; Fri, 29 Jul 2016 15:08:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751927AbcG2PIr (ORCPT ); Fri, 29 Jul 2016 11:08:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48906 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751544AbcG2PIq (ORCPT ); Fri, 29 Jul 2016 11:08:46 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 06DBB61E43; Fri, 29 Jul 2016 15:08:46 +0000 (UTC) Received: from plouf.banquise.eu.com (ovpn-112-62.ams2.redhat.com [10.36.112.62]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u6TF8hb4023620; Fri, 29 Jul 2016 11:08:44 -0400 From: Benjamin Tissoires To: "Rafael J. Wysocki" , Lv Zheng Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ACPI / button: remove pointer to old lid_sysfs on unbind Date: Fri, 29 Jul 2016 17:08:41 +0200 Message-Id: <1469804921-23086-1-git-send-email-benjamin.tissoires@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 29 Jul 2016 15:08:46 +0000 (UTC) Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When we removed the procfs dir on error or if the driver is unbound, the two variables acpi_lid_dir and acpi_button_dir were not reset. On the next rebind, those static variables were not null and we couldn't re-register the device again. Signed-off-by: Benjamin Tissoires Acked-by: Lv Zheng --- changes in v2: - put the NULL assignments at their correct place --- drivers/acpi/button.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 5c3b091..a3873b3 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c @@ -191,8 +191,10 @@ remove_dev_dir: acpi_device_dir(device) = NULL; remove_lid_dir: remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); + acpi_lid_dir = NULL; remove_button_dir: remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); + acpi_button_dir = NULL; goto done; } @@ -209,7 +211,9 @@ static int acpi_button_remove_fs(struct acpi_device *device) acpi_lid_dir); acpi_device_dir(device) = NULL; remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); + acpi_lid_dir = NULL; remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); + acpi_button_dir = NULL; return 0; }