From patchwork Thu Jul 29 20:08:44 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Renninger X-Patchwork-Id: 115310 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o6TK8sjX014712 for ; Thu, 29 Jul 2010 20:08:54 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758052Ab0G2UIw (ORCPT ); Thu, 29 Jul 2010 16:08:52 -0400 Received: from cantor2.suse.de ([195.135.220.15]:45522 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757945Ab0G2UIv (ORCPT ); Thu, 29 Jul 2010 16:08:51 -0400 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id 102B788B6C; Thu, 29 Jul 2010 22:08:49 +0200 (CEST) From: Thomas Renninger To: mjg59@srcf.ucam.org Cc: platform-driver-x86@vger.kernel.org, linux-acpi@vger.kernel.org, astarikovskiy@suse.de, akpm@linux-foundation.org, Thomas Renninger Subject: [PATCH 1/2] acpi ec: Fix possible double io port registration Date: Thu, 29 Jul 2010 22:08:44 +0200 Message-Id: <1280434125-11943-2-git-send-email-trenn@suse.de> X-Mailer: git-send-email 1.6.3 In-Reply-To: <1280434125-11943-1-git-send-email-trenn@suse.de> References: <1280434125-11943-1-git-send-email-trenn@suse.de> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 29 Jul 2010 20:08:54 +0000 (UTC) diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 265a99c..1fa0aaf 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c @@ -818,6 +818,12 @@ static int acpi_ec_add(struct acpi_device *device) if (!first_ec) first_ec = ec; device->driver_data = ec; + + WARN(!request_region(ec->data_addr, 1, "EC data"), + "Could not request EC data io port 0x%lx", ec->data_addr); + WARN(!request_region(ec->command_addr, 1, "EC cmd"), + "Could not request EC cmd io port 0x%lx", ec->command_addr); + pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", ec->gpe, ec->command_addr, ec->data_addr); @@ -844,6 +850,8 @@ static int acpi_ec_remove(struct acpi_device *device, int type) kfree(handler); } mutex_unlock(&ec->lock); + release_region(ec->data_addr, 1); + release_region(ec->command_addr, 1); device->driver_data = NULL; if (ec == first_ec) first_ec = NULL; @@ -864,18 +872,10 @@ ec_parse_io_ports(struct acpi_resource *resource, void *context) * the second address region returned is the status/command * port. */ - if (ec->data_addr == 0) { + if (ec->data_addr == 0) ec->data_addr = resource->data.io.minimum; - WARN(!request_region(ec->data_addr, 1, "EC data"), - "Could not request EC data io port %lu", - ec->data_addr); - } - else if (ec->command_addr == 0) { + else if (ec->command_addr == 0) ec->command_addr = resource->data.io.minimum; - WARN(!request_region(ec->command_addr, 1, "EC command"), - "Could not request EC command io port %lu", - ec->command_addr); - } else return AE_CTRL_TERMINATE;