From patchwork Sat Aug 8 07:26:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 40097 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n787QQUt021611 for ; Sat, 8 Aug 2009 07:26:27 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754448AbZHHH0Y (ORCPT ); Sat, 8 Aug 2009 03:26:24 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754453AbZHHH0Y (ORCPT ); Sat, 8 Aug 2009 03:26:24 -0400 Received: from rv-out-0506.google.com ([209.85.198.239]:39667 "EHLO rv-out-0506.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754448AbZHHH0X (ORCPT ); Sat, 8 Aug 2009 03:26:23 -0400 Received: by rv-out-0506.google.com with SMTP id f6so594921rvb.1 for ; Sat, 08 Aug 2009 00:26:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:subject:to:cc:date :in-reply-to:references:user-agent:mime-version:content-type :content-transfer-encoding:message-id; bh=/2vY00ZYv0duXBzsuea8lh/FutBhsKvjhR9oQvCa0BA=; b=tSH/Y1Vs8vgmVSnmTleTIbf64SAvZFFYyJARvnnS46a09niN8/XHgykRAt+VHrQ5jw ytULbOk8Cf95lRSnVy67wjEk6Xwy+Rp38zCzNdXkkudw2PnUZ/dyGugLNrcFJB/JIxVU txo3e5LsVa0lpi6/d89z1GuDjpvYGF/Z+/rac= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:subject:to:cc:date:in-reply-to:references:user-agent :mime-version:content-type:content-transfer-encoding:message-id; b=ptnaqZERD8zsWQF3jaB7nHJkhdlhNLvnw2nfqC5tpeDo5dsGypH9q3LskHiovvl7qy OBTU1Ck5TatABLC5Xa2P06OWobS79DKDIAoQx9tN8dhl1SYvrZKBm9Sdg0Esqhr/SBH/ sf9eRVJ9Kk9Ca18EEbn8vwr200MZbCUc2+XM8= Received: by 10.141.22.21 with SMTP id z21mr836205rvi.279.1249716384027; Sat, 08 Aug 2009 00:26:24 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-24-6-153-137.hsd1.ca.comcast.net [24.6.153.137]) by mx.google.com with ESMTPS id k41sm8133848rvb.18.2009.08.08.00.26.22 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 08 Aug 2009 00:26:23 -0700 (PDT) From: Dmitry Torokhov Subject: [PATCH 1/4] ACPI: video - fix oops when unloading module To: Len Brown Cc: Zhang Rui , linux-acpi@vger.kernel.org Date: Sat, 08 Aug 2009 00:26:20 -0700 In-Reply-To: <20090808072150.2980.3863.stgit@localhost.localdomain> References: <20090808072150.2980.3863.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Message-Id: <20090808075631.77F4F526EC9@mailhub.coreip.homeip.net> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org Don't assume that backlight is always present. Signed-off-by: Dmitry Torokhov --- drivers/acpi/video.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 8851315..d8e64cf 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c @@ -2004,8 +2004,12 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) status = acpi_remove_notify_handler(device->dev->handle, ACPI_DEVICE_NOTIFY, acpi_video_device_notify); - sysfs_remove_link(&device->backlight->dev.kobj, "device"); - backlight_device_unregister(device->backlight); + + if (device->backlight) { + sysfs_remove_link(&device->backlight->dev.kobj, "device"); + backlight_device_unregister(device->backlight); + } + if (device->cdev) { sysfs_remove_link(&device->dev->dev.kobj, "thermal_cooling"); @@ -2014,6 +2018,7 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) thermal_cooling_device_unregister(device->cdev); device->cdev = NULL; } + video_output_unregister(device->output_dev); return 0;