From patchwork Mon Jun 19 20:32:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9797767 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 099A2601C8 for ; Mon, 19 Jun 2017 20:33:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F021527E5A for ; Mon, 19 Jun 2017 20:33:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E2B6428451; Mon, 19 Jun 2017 20:33:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A332127E5A for ; Mon, 19 Jun 2017 20:33:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752152AbdFSUdH (ORCPT ); Mon, 19 Jun 2017 16:33:07 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:33348 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751965AbdFSUdH (ORCPT ); Mon, 19 Jun 2017 16:33:07 -0400 Received: by mail-wm0-f68.google.com with SMTP id f90so18910715wmh.0; Mon, 19 Jun 2017 13:33:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=BH1s8nwZZU+gX0Ypn93VirTq2Wf3CCnTnTLLdl+74m0=; b=ZM4xLh7RwKwHYvCbF1nBoQZTEjQVOVXWOuvVcUV5l68anXLbYIgRGmqRWjLb9YB78E q459gMPqFAlj9p5nI/rxb66p5mGMFYIo0VPR+uqtmoPzfCpZ2xIeOGTbJtgJRzfgJSm+ LHCOxTZhfzmjGNSsBQZbqW68XTeWcnmhI4c6y6W5aGKN09s13w77fHEZW17U3QBHPvbB Le/yZycvpPGxAY5VEsdkx+nmoAowqptOEI4TVY9TenwORjomyg3noBCqqiBkRE0i3snH OStdYyMVI60PGMjtDPvpOb/zdrYwZuhsDNTaV0nrttdyjgo/uyE5n3muYSclazjy8H6w UjUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=BH1s8nwZZU+gX0Ypn93VirTq2Wf3CCnTnTLLdl+74m0=; b=eu2+IZuEQScPjquqscyXdRaK+AFkLbHO7GRM+ao4RNZCsqObyrV1pZsrrtSbd4Ix5I 4XOKlc/R3s/1krEtfe9LsH5ZMG1ja4kPcwB3LE3jeurBGxzuV7jxOgo5kXGaiRuoLxny DwFgsXa4UbreCHI4JCsdHAJZnh2XTp14CIhIUPeAOaLLV7b3ri7/MpaFbsDjQImU2wG5 eqQoFr9X5Ax8DyGqLnvbPgaytAai7VxqpBd66KXRMe/IwLrDXaF5CjtMke3gBfdWe6kA GygxKng4f+v9/QRGcFqnp/ThsjF3M+WNwwqeLng4ZdP4IjoNdqV1VZ3opwiWQp4p6teX jHhA== X-Gm-Message-State: AKS2vOy4Z0Oy4dzB/hRoqKz2ohFtLIs48yH6Sodd+uGX6ddVXHJqyaNQ Wk18q9bjAzPeX+A9 X-Received: by 10.28.191.155 with SMTP id o27mr302761wmi.7.1497904385322; Mon, 19 Jun 2017 13:33:05 -0700 (PDT) Received: from localhost.localdomain (cpc101300-bagu16-2-0-cust362.1-3.cable.virginm.net. [86.21.41.107]) by smtp.gmail.com with ESMTPSA id l17sm5719400wre.25.2017.06.19.13.33.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 Jun 2017 13:33:04 -0700 (PDT) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org Subject: [PATCH 1/2] staging: sm750fb: avoid conflicting vesafb Date: Mon, 19 Jun 2017 21:32:57 +0100 Message-Id: <1497904378-4808-1-git-send-email-sudipm.mukherjee@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Teddy Wang If vesafb is enabled in the config then /dev/fb0 is created by vesa and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to effectively work with xorg. So if it has been alloted fb1, then try to remove the other fb0. Signed-off-by: Teddy Wang Signed-off-by: Sudip Mukherjee --- drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index d5934f3..8199dbe 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -1053,6 +1053,26 @@ static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx) return err; } +static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev) +{ + struct apertures_struct *ap; + bool primary = false; + + ap = alloc_apertures(1); + if (!ap) + return -ENOMEM; + + ap->ranges[0].base = pci_resource_start(pdev, 0); + ap->ranges[0].size = pci_resource_len(pdev, 0); +#ifdef CONFIG_X86 + primary = pdev->resource[PCI_ROM_RESOURCE].flags & + IORESOURCE_ROM_SHADOW; +#endif + remove_conflicting_framebuffers(ap, "sm750_fb1", primary); + kfree(ap); + return 0; +} + static int lynxfb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { @@ -1061,6 +1081,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev, int fbidx; int err; + err = lynxfb_kick_out_firmware_fb(pdev); + if (err) + return err; + /* enable device */ err = pcim_enable_device(pdev); if (err)