From patchwork Mon Sep 2 00:40:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 2852633 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 973ABC0AB5 for ; Mon, 2 Sep 2013 00:40:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0270120212 for ; Mon, 2 Sep 2013 00:40:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 623952020A for ; Mon, 2 Sep 2013 00:40:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757840Ab3IBAkq (ORCPT ); Sun, 1 Sep 2013 20:40:46 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:60586 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757553Ab3IBAkq (ORCPT ); Sun, 1 Sep 2013 20:40:46 -0400 Received: from deadeye.wl.decadent.org.uk ([192.168.4.101]) by shadbolt.decadent.org.uk with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1VGICC-0005GP-PG; Mon, 02 Sep 2013 01:40:44 +0100 Received: from ben by deadeye.wl.decadent.org.uk with local (Exim 4.80) (envelope-from ) id 1VGICB-0005DP-KD; Mon, 02 Sep 2013 01:40:43 +0100 Message-ID: <1378082443.25743.63.camel@deadeye.wl.decadent.org.uk> Subject: [PATCH 4/4] [media] lirc_bt829: Enable and disable memory BAR From: Ben Hutchings To: Jarod Wilson , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org Date: Mon, 02 Sep 2013 01:40:43 +0100 In-Reply-To: <1378082213.25743.58.camel@deadeye.wl.decadent.org.uk> References: <1378082213.25743.58.camel@deadeye.wl.decadent.org.uk> X-Mailer: Evolution 3.4.4-3 Mime-Version: 1.0 X-SA-Exim-Connect-IP: 192.168.4.101 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-9.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We must not assume that the PCI device is already enabled. Signed-off-by: Ben Hutchings --- drivers/staging/media/lirc/lirc_bt829.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/media/lirc/lirc_bt829.c b/drivers/staging/media/lirc/lirc_bt829.c index 76e6cfb..b386628 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -118,11 +118,15 @@ static int atir_pci_probe(struct pci_dev *pdev, dev_info(&pdev->dev, "memory at 0x%08llX\n", (unsigned long long)pci_addr_phys); + rc = pci_enable_device_mem(pdev); + if (rc) + goto err_free; + atir->pci_addr_lin = ioremap(pci_addr_phys + DATA_PCI_OFF, 0x400); if (atir->pci_addr_lin == 0) { dev_err(&pdev->dev, "pci mem must be mapped\n"); rc = -ENODEV; - goto err_free; + goto err_disable; } strcpy(atir->driver.name, "ATIR"); @@ -148,6 +152,8 @@ static int atir_pci_probe(struct pci_dev *pdev, err_unmap: iounmap(atir->pci_addr_lin); +err_disable: + pci_disable_device(pdev); err_free: pci_set_drvdata(pdev, NULL); kfree(atir); @@ -161,6 +167,7 @@ static void atir_pci_remove(struct pci_dev *pdev) lirc_unregister_driver(atir->minor); iounmap(atir->pci_addr_lin); + pci_disable_device(pdev); pci_set_drvdata(pdev, NULL); kfree(atir); }