From patchwork Sat Apr 30 14:18:05 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Tobias Schandinat X-Patchwork-Id: 743522 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p3UE1kTU016192 for ; Sat, 30 Apr 2011 14:01:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756761Ab1D3OBr (ORCPT ); Sat, 30 Apr 2011 10:01:47 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:50658 "HELO mailout-de.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1755146Ab1D3OBq (ORCPT ); Sat, 30 Apr 2011 10:01:46 -0400 Received: (qmail invoked by alias); 30 Apr 2011 14:01:44 -0000 Received: from dslb-088-066-135-062.pools.arcor-ip.net (EHLO localhost.localdomain) [88.66.135.62] by mail.gmx.net (mp016) with SMTP; 30 Apr 2011 16:01:44 +0200 X-Authenticated: #10250065 X-Provags-ID: V01U2FsdGVkX1+E4vM4x8iEnlwpsPLusatN4zKa1sm2g+EauT8720 9Ypwzlo/Y8ZdK6 From: Florian Tobias Schandinat To: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Florian Tobias Schandinat Subject: [PATCH 2/3] viafb: try to map less memory in case of failure Date: Sat, 30 Apr 2011 14:18:05 +0000 Message-Id: <1304173086-3434-3-git-send-email-FlorianSchandinat@gmx.de> X-Mailer: git-send-email 1.6.3.2 In-Reply-To: <1304173086-3434-1-git-send-email-FlorianSchandinat@gmx.de> References: <1304173086-3434-1-git-send-email-FlorianSchandinat@gmx.de> X-Y-GMX-Trusted: 0 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 30 Apr 2011 14:01:49 +0000 (UTC) The current code might result in trying to remap 512MB video ram on a 32 bit system which is quite likely to fail. This patch tries to map less of it down to 8MB as this should still be enough to get a reasonably well working framebuffer. This should make viafb work for many people without requiring them to manually allocate more space. Signed-off-by: Florian Tobias Schandinat --- drivers/video/via/via-core.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/drivers/video/via/via-core.c b/drivers/video/via/via-core.c index 5b0129b..eb112b6 100644 --- a/drivers/video/via/via-core.c +++ b/drivers/video/via/via-core.c @@ -505,7 +505,14 @@ static int __devinit via_pci_setup_mmio(struct viafb_dev *vdev) ret = vdev->fbmem_len = viafb_get_fb_size_from_pci(vdev->chip_type); if (ret < 0) goto out_unmap; - vdev->fbmem = ioremap_wc(vdev->fbmem_start, vdev->fbmem_len); + + /* try to map less memory on failure, 8 MB should be still enough */ + for (; vdev->fbmem_len >= 8 << 20; vdev->fbmem_len /= 2) { + vdev->fbmem = ioremap_wc(vdev->fbmem_start, vdev->fbmem_len); + if (vdev->fbmem) + break; + } + if (vdev->fbmem == NULL) { ret = -ENOMEM; goto out_unmap;