From patchwork Fri Jun 30 20:57:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudip Mukherjee X-Patchwork-Id: 9820487 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 49E8A603D7 for ; Fri, 30 Jun 2017 20:57:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B98026247 for ; Fri, 30 Jun 2017 20:57:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C73328437; Fri, 30 Jun 2017 20:57:54 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 C08A826247 for ; Fri, 30 Jun 2017 20:57:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752658AbdF3U5w (ORCPT ); Fri, 30 Jun 2017 16:57:52 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34559 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752633AbdF3U5v (ORCPT ); Fri, 30 Jun 2017 16:57:51 -0400 Received: by mail-wm0-f67.google.com with SMTP id p204so9914970wmg.1; Fri, 30 Jun 2017 13:57:50 -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=TIkoxjGEshq9s5LlHXBirKN833tjKTYQam+w2rV3JpY=; b=DYh7Mvwa4W4C6zYmkRxk9tfazWiCqMWwV3+nvI9wAjbw+NDraYj901g5G2Hr8Jr61R ZVOXhg8gLWTOA8XgMhWZ7myrPOjp4pOIh/Adso35ZifczWew4SW5+hOg9o5/PUnQ0Rky GhLdFhn44guFlDrkEyNU1alEv3G5QIoHNzVSNxLN28WSMGDVIevFWAOjq094nCmsaFTr SzPFz++trDrHFAL/JmpbZ3ZBwJPeP9JtNSGYsqrNYW2bAx32NwDqcFLqlQIVNJVVOUqz DI4aye644rDPARKAZjjzHHwCATyQxI5KJKKXZjyafcQ/JkwZIdvXfw8j+IXhS5Bj4Art 09Pw== 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=TIkoxjGEshq9s5LlHXBirKN833tjKTYQam+w2rV3JpY=; b=Fcm0uE6eEEVMQ1wzevHtPFkga2EOAkFor4pjEgw4IubCkYLoUKdPG3K5uTrsH/IZUs VGW5lA30WXrNll78SSywyEXO6Iqum0TqhVfJfUeSIIhUMM05ZUAFx8hMquoQET0fHv5+ 8pIps57GwPbEZnAbx1qu/pf7TWLAhYJNPA+avJ7uim3C2GgkuMuOhJ+rADP5lCijnZ2J wdEvsS5SBtHcz687Ft8Cf8+yadfnEYETvD9sTiEUoX7+Vi0eHWmtRS+DwuK5YMZlccPS utQx+G5nncbwXyCSEdKPh85iGTfw3VYWflKnY99gVTFOxt/ccEAcyNtTR2u+Yil9ZuGA rH2A== X-Gm-Message-State: AKS2vOzJboXwO7DrCS+ooq+oPjl+tzccdl3B0pq53tQ5QoM9SCdnkb0w clHOolXdXtWD8Q== X-Received: by 10.28.1.81 with SMTP id 78mr17361094wmb.100.1498856269867; Fri, 30 Jun 2017 13:57:49 -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 w96sm6995059wrc.33.2017.06.30.13.57.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jun 2017 13:57:49 -0700 (PDT) From: Sudip Mukherjee To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, devel@driverdev.osuosl.org, Teddy Wang , , Sudip Mukherjee Subject: [PATCH RESEND] staging: sm750fb: avoid conflicting vesafb Date: Fri, 30 Jun 2017 21:57:43 +0100 Message-Id: <1498856263-4544-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. Cc: # v4.4+ Signed-off-by: Teddy Wang Signed-off-by: Sudip Mukherjee --- In the previous send, why #ifdef is used was asked. https://lkml.org/lkml/2017/6/25/57 Answered at: https://lkml.org/lkml/2017/6/25/69 Also pasting here for reference. 'Did a quick research into "why". The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags for a default VGA device and that is being done only for x86. And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that needs to be checked only for a x86 and not for other arch.' 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)