From patchwork Thu Sep 5 02:32:19 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Hutchings X-Patchwork-Id: 2853877 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0775F9F494 for ; Thu, 5 Sep 2013 02:32:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6A2A7202FE for ; Thu, 5 Sep 2013 02:32:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 61C4120259 for ; Thu, 5 Sep 2013 02:32:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754972Ab3IECcW (ORCPT ); Wed, 4 Sep 2013 22:32:22 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:44455 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754538Ab3IECcW (ORCPT ); Wed, 4 Sep 2013 22:32:22 -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 1VHPMr-0000d8-04; Thu, 05 Sep 2013 03:32:21 +0100 Received: from ben by deadeye.wl.decadent.org.uk with local (Exim 4.80) (envelope-from ) id 1VHPMq-00061g-7d; Thu, 05 Sep 2013 03:32:20 +0100 Message-ID: <1378348339.27597.17.camel@deadeye.wl.decadent.org.uk> Subject: [PATCH v2 3/4] [media] lirc_bt829: Enable and disable device From: Ben Hutchings To: Jarod Wilson , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, devel@driverdev.osuosl.org Date: Thu, 05 Sep 2013 03:32:19 +0100 In-Reply-To: <1378348215.27597.14.camel@deadeye.wl.decadent.org.uk> References: <1378348215.27597.14.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 a61d233..623f10e 100644 --- a/drivers/staging/media/lirc/lirc_bt829.c +++ b/drivers/staging/media/lirc/lirc_bt829.c @@ -126,9 +126,13 @@ int init_module(void) if (pdev == NULL) return -ENODEV; + rc = pci_enable_device(pdev); + if (rc) + goto err_put_dev; + if (!atir_init_start()) { rc = -ENODEV; - goto err_put_dev; + goto err_disable; } strcpy(atir_driver.name, "ATIR"); @@ -154,6 +158,8 @@ int init_module(void) err_unmap: iounmap(pci_addr_lin); +err_disable: + pci_disable_device(pdev); err_put_dev: pci_dev_put(pdev); return rc; @@ -166,6 +172,7 @@ void cleanup_module(void) lirc_unregister_driver(atir_minor); iounmap(pci_addr_lin); + pci_disable_device(pdev); pci_dev_put(pdev); }