From patchwork Sat Sep 1 14:08:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 964940 Return-Path: X-Original-To: incoming-imx@patchwork.ozlabs.org Delivered-To: patchwork-incoming-imx@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="XtRNpxtg"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="GwrGh/Yt"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 422dQh5gP6z9s4V for ; Sun, 2 Sep 2018 00:09:48 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:MIME-Version:Subject:From:References :In-Reply-To:Message-Id:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=7Ud/9v+zflJuY+OpdbFSgZXOCRchfCZ271flyoS5F8s=; b=XtRNpxtg6VQ5vL XGXrlwIb3S8Mremv14chyjSByrNRqCAJOpWbeTcE2pc9aIUahauaT1S9+NVijDnTsiZaY76f045wd j7fmThSq29rY6fljtR38ROwbm73gLI9fkD2WMahI/wqVBeZr34HlS3JHWff7UxTOMNqP70oHfNJnt hVKkqWFkpmMt86oYbhPMuZI252cMtTUz83AcRz0eieveRDVbZkKKOt0QFlO5Ie1z/XFA6LE9UD67V U/HV+0P0syG+IwLCVKkqoK31cHbmWiuAxcjnSkHc0YHQV3DXEexRYe0SElMcdtm8QVZRBkBPG8OcW 3kRKQHPPcxGn3XH+jM9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fw6ap-000175-2M; Sat, 01 Sep 2018 14:09:39 +0000 Received: from rere.qmqm.pl ([91.227.64.183]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fw6a7-0000er-TZ for linux-arm-kernel@lists.infradead.org; Sat, 01 Sep 2018 14:08:57 +0000 Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 422dNk5rGtzbZ; Sat, 1 Sep 2018 16:08:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1535810886; bh=Eh3NwSBhd/6qo4Gal61knpd5lppRQQ+HPCEaYA1Bwwk=; h=Date:In-Reply-To:References:From:Subject:To:Cc:Cc:From; b=GwrGh/YtptzEKnqzQqlj6eNtUbcHx+yBKOqzGhNsXXgky4lLMy2VLDGWdTUi3gXi1 /+9En/gUXDjiQggYxobxLqvB7qLASHq+ExpBbWb7kxcRoSKy7da3hm37sJsPn04iJ1 wyqTTqkQGglNvP4wWX+84y04g7zYZIPXK9WU+D3qwq23SLuklp4tETLGf019Ypc1dx nk0O1SwXDt6xGG7fL+NVf+23nCY96EuUUG07gCbREPyibeW7Jb9SnQsLtKvmLmCjqd v/zeBPZkNhJxAg8s2hvvUJW+pB80bX9W1FiJTNj2dorzH5ZgsoSzPo2iwPKYxs5eBM IiGOiMOAVAWdQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.100.0 at mail Date: Sat, 01 Sep 2018 16:08:44 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= Subject: [PATCH v3 02/13] fbdev: allow apertures == NULL in remove_conflicting_framebuffers() MIME-Version: 1.0 To: dri-devel@lists.freedesktop.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180901_070856_136132_9FFA04D7 X-CRM114-Status: UNSURE ( 8.76 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-fbdev@vger.kernel.org, linux-tegra@vger.kernel.org, Bartlomiej Zolnierkiewicz , David Airlie , amd-gfx@lists.freedesktop.org, Jonathan Hunter , Eric Anholt , Thierry Reding , Gerd Hoffmann , Alex Deucher , Dave Airlie , Maxime Ripard , virtualization@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+incoming-imx=patchwork.ozlabs.org@lists.infradead.org List-Id: linux-imx-kernel.lists.patchwork.ozlabs.org Interpret (otherwise-invalid) NULL apertures argument to mean all-memory range. This will allow to remove several duplicates of this code from drivers in following patches. Signed-off-by: Michał Mirosław Acked-by: Bartlomiej Zolnierkiewicz --- v2: added kerneldoc to corresponding DRM helper v3: split kerneldoc to another patch --- drivers/video/fbdev/core/fbmem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 30a18d4c9de4..0df148eb4699 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1779,11 +1779,25 @@ int remove_conflicting_framebuffers(struct apertures_struct *a, const char *name, bool primary) { int ret; + bool do_free = false; + + if (!a) { + a = alloc_apertures(1); + if (!a) + return -ENOMEM; + + a->ranges[0].base = 0; + a->ranges[0].size = ~0; + do_free = true; + } mutex_lock(®istration_lock); ret = do_remove_conflicting_framebuffers(a, name, primary); mutex_unlock(®istration_lock); + if (do_free) + kfree(a); + return ret; } EXPORT_SYMBOL(remove_conflicting_framebuffers);