From patchwork Sat Mar 28 09:03:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 6113471 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 12DE19F32E for ; Sat, 28 Mar 2015 09:04:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 450722038E for ; Sat, 28 Mar 2015 09:04:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4B28820386 for ; Sat, 28 Mar 2015 09:04:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751574AbbC1JEA (ORCPT ); Sat, 28 Mar 2015 05:04:00 -0400 Received: from mail-pd0-f172.google.com ([209.85.192.172]:35122 "EHLO mail-pd0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751456AbbC1JD6 (ORCPT ); Sat, 28 Mar 2015 05:03:58 -0400 Received: by pddn5 with SMTP id n5so4302122pdd.2; Sat, 28 Mar 2015 02:03:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=gR42tJaUdV2AFAHNdrgVUOjHWYHuLOr1iAql4crhHjA=; b=0zb77jZtsX1YBhr+7l9RIRD1yZHYZBA8BfSx+lO/RkoDILPyde4bJkJeNojfgsXzau ZpGG2KN/AVsCuVtFPS0lngF7AcYGyPPhKTsJmpA8u8goSuDMpQK1UjH89Jcc0kDXD7sJ j4CL9O6cxGymy1UcfMjn0tDOzAojBFOdssGRDLetK3dymI2mrkyn+WJQHc9gY3J6dSaC 36UmWEidH+zBzvw9H71S+8mjM1BDyr5x1LQHmgumD8YAiAfnef2z7Q0cu+dMX8UOpgBa v6Eis2P+F0ow/pIc+USrsBH9O8r67V1CpzqHbOBoJflLScHPQoeti7rHEus2I7TLQZlY UgVw== X-Received: by 10.66.221.194 with SMTP id qg2mr42540323pac.106.1427533437742; Sat, 28 Mar 2015 02:03:57 -0700 (PDT) Received: from localhost.localdomain ([122.169.136.248]) by mx.google.com with ESMTPSA id y5sm4428789pdh.21.2015.03.28.02.03.55 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 28 Mar 2015 02:03:57 -0700 (PDT) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, Sudip Mukherjee Subject: [PATCH 1/2] staging: sm7xxfb: reserve PCI resource Date: Sat, 28 Mar 2015 14:33:40 +0530 Message-Id: <1427533421-9751-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.8.1.2 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 before starting to access any address inside the PCI region we should reserve the resource and release the resource when the module exits. Signed-off-by: Sudip Mukherjee --- drivers/staging/sm7xxfb/sm7xxfb.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/staging/sm7xxfb/sm7xxfb.c b/drivers/staging/sm7xxfb/sm7xxfb.c index 5b3e614..149286e 100644 --- a/drivers/staging/sm7xxfb/sm7xxfb.c +++ b/drivers/staging/sm7xxfb/sm7xxfb.c @@ -776,6 +776,12 @@ static int smtcfb_pci_probe(struct pci_dev *pdev, if (err) return err; + err = pci_request_region(pdev, 0, "sm7xxfb"); + if (err < 0) { + dev_err(&pdev->dev, "cannot reserve framebuffer region\n"); + goto failed_regions; + } + sprintf(smtcfb_fix.id, "sm%Xfb", ent->device); sfb = smtc_alloc_fb_info(pdev); @@ -905,6 +911,9 @@ failed_fb: smtc_free_fb_info(sfb); failed_free: + pci_release_region(pdev, 0); + +failed_regions: pci_disable_device(pdev); return err; @@ -933,6 +942,7 @@ static void smtcfb_pci_remove(struct pci_dev *pdev) smtc_unmap_mmio(sfb); unregister_framebuffer(&sfb->fb); smtc_free_fb_info(sfb); + pci_release_region(pdev, 0); } #ifdef CONFIG_PM