From patchwork Wed Nov 30 19:34:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benjamin Gaignard X-Patchwork-Id: 85911 Delivered-To: patch@linaro.org Received: by 10.182.112.6 with SMTP id im6csp485895obb; Wed, 30 Nov 2016 11:34:57 -0800 (PST) X-Received: by 10.99.50.67 with SMTP id y64mr62457642pgy.146.1480534497890; Wed, 30 Nov 2016 11:34:57 -0800 (PST) Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id z62si65541313pgz.214.2016.11.30.11.34.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 11:34:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CA7006E43F; Wed, 30 Nov 2016 19:34:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com [IPv6:2a00:1450:400c:c09::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 27D8B6E43D for ; Wed, 30 Nov 2016 19:34:35 +0000 (UTC) Received: by mail-wm0-x22d.google.com with SMTP id f82so228221176wmf.1 for ; Wed, 30 Nov 2016 11:34:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=WZI2Danddvs4JnfONZldNh/ljVeslm4DnWc6sAjER54=; b=cOBQVPiEt2xzWEjgRn9/YFvZ/YsyCE3rjwbvL5XURrN9IVl28KN8wRUW5EfMzkrMAS xIMF5JkoX/5nZDo9563g6Hwgft3JWwyYcl3AtN7ASxt5jlFRFkpU4M7MSrSYJGENNWSb NUkZhlwVVPbGDNJoeTD1HG5zaBHeSh34eCvfI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=WZI2Danddvs4JnfONZldNh/ljVeslm4DnWc6sAjER54=; b=l89bnyTrymhfjxDX3Ysg0Xh8nVvj8JlU2irEx6JPkSsP5rdO6pUEYcNmFZabOIqRvN tOUEPyXIR3OIvXJRhcE26vqRPf8aFJlLsnlYDRn8S9fnKisqNo9zbO+Gvfdsdzks+o8v gFcv1bXBS0+uA5TUGK56Z4FpvDL8VCC3yBJgWAyq030VtxHfTBEqYZGDG3PWYsryl8YM lmlAi00qzWJDdzTSEn0mZauvsHeX21JSUdNw22rkKkfr7bcLpK3hAysgEtCD8q28dQN5 U9+lCl7e+2Rc9lIPIxaDYhPMMjjpN36uLhGjN6OMxLz5Qk3Cn9aZx795AUY8cAjFnsK5 /c6A== X-Gm-Message-State: AKaTC03wBVqh0yswqDC7KWSDtneYSWDKCZi2PkJdGl+myiZ4RnTYxmliFPdtU8lw5PJ98Oci X-Received: by 10.28.138.137 with SMTP id m131mr29170930wmd.118.1480534473535; Wed, 30 Nov 2016 11:34:33 -0800 (PST) Received: from lmenx321.st.com. (lya72-2-88-175-155-153.fbx.proxad.net. [88.175.155.153]) by smtp.gmail.com with ESMTPSA id k11sm9429333wmb.18.2016.11.30.11.34.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Nov 2016 11:34:32 -0800 (PST) From: Benjamin Gaignard To: dri-devel@lists.freedesktop.org, airlied@redhat.com, daniel@ffwll.ch, robdclark@gmail.com, laurent.pinchart@ideasonboard.com Subject: [RFC v3 1/3] fbmem: add default get_fb_unmapped_area function Date: Wed, 30 Nov 2016 20:34:17 +0100 Message-Id: <1480534459-7239-2-git-send-email-benjamin.gaignard@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480534459-7239-1-git-send-email-benjamin.gaignard@linaro.org> References: <1480534459-7239-1-git-send-email-benjamin.gaignard@linaro.org> Cc: yannick.fertre@st.com, linaro-kernel@lists.linaro.org, philippe.cornu@st.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" If HAVE_ARCH_FB_UNMAPPED_AREA is set and get_fb_unmapped_area function not defined in platform architecture let use a default function. Signed-off-by: Benjamin Gaignard --- drivers/video/fbdev/core/fbmem.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 76c1ad9..54488ee 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1492,6 +1492,21 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd, return 0; } +#if defined(HAVE_ARCH_FB_UNMAPPED_AREA) && !defined(get_fb_unmapped_area) +unsigned long get_fb_unmapped_area(struct file *filp, + unsigned long addr, unsigned long len, + unsigned long pgoff, unsigned long flags) +{ + struct fb_info * const info = filp->private_data; + unsigned long fb_size = PAGE_ALIGN(info->fix.smem_len); + + if (pgoff > fb_size || len > fb_size - pgoff) + return -EINVAL; + + return (unsigned long)info->screen_base + pgoff; +} +#endif + static const struct file_operations fb_fops = { .owner = THIS_MODULE, .read = fb_read,