From patchwork Thu Apr 6 14:30:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Zimmermann X-Patchwork-Id: 80264 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1071623vqo; Thu, 6 Apr 2023 07:31:43 -0700 (PDT) X-Google-Smtp-Source: AKy350Yg/kXTKNqa3rb7XApJBKZyjIM5PYaoJrBjBt4JCCipkQpag+k7bPJgifgW2sQMTcorf9Rn X-Received: by 2002:aa7:c74e:0:b0:501:d6d4:ef33 with SMTP id c14-20020aa7c74e000000b00501d6d4ef33mr4715575eds.40.1680791502947; Thu, 06 Apr 2023 07:31:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680791502; cv=none; d=google.com; s=arc-20160816; b=WbUl4gI9UbTUdac2KBV+Jg9/g+5GjEbBFh93h9ScrwD7qcUPbVmf1qv/ra8LmPH8WI nLHWhuDemrW+CKCu3O/gj38U94jWY4wezF7cb/XSfB6FRylkwwWKCNOdd3j386UHnYmv GN/I9NEPJkvRyknmn0mKIKfjOf0dt7m4qtdPvKgQWZc0IbJOWjDZN+miMeqv28FoKmyM g96vRP9hfeFZZi82nfhxtHc82g+eMlRJ9QJR5V74tiPekDZW/mkssa9W8VHcqX6bnNQs gIgNgGVoayvIhTznPeppLXT77nS0tTotF4C3YQsVASTGPsS5uhYoSbapDM253/nCXLEJ XPjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=lm4tB/qBx4Xl9gLv3tvzFp8gznBLvt7Ce6BUC7qY1PU=; b=s6H3KiCszvbSM3H02uRbhV/HaIgy9Fc1lCaxi5s8I27ZsDKFSEWh6pTcGJ+l4+s7Kt gSLYx2ri3667Jcx4hXfIX47X+b0nqqjsMbO5OCbDHgRaxj++onNRXkzy9XN8mRFAwGH9 u1UjgcYNhwSIsTkHMs3mtOwf14v9RLePhIRFYKlMLptWcwf06BzyjZYnv2nCg3gC3DiZ YupVgiPYlanyqSmZCtDMUnLYpUctMwnuYTAtim81iHr2k8g9z2KTUsD9RfVL7VByJ6Zq w7IMyK6y8hp7xl+JRDlzAkchfqpeZww2/gMvl/GxLF163+o2pjT/WSIxaWA4UJ8OaA3T DYHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ELZbBCFG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=hBIBxlKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x16-20020aa7dad0000000b005021f0d0ce1si1163518eds.241.2023.04.06.07.31.17; Thu, 06 Apr 2023 07:31:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ELZbBCFG; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=hBIBxlKr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229769AbjDFOa0 (ORCPT + 99 others); Thu, 6 Apr 2023 10:30:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229838AbjDFOaY (ORCPT ); Thu, 6 Apr 2023 10:30:24 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 60DFB9017; Thu, 6 Apr 2023 07:30:23 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D3F9422591; Thu, 6 Apr 2023 14:30:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1680791421; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lm4tB/qBx4Xl9gLv3tvzFp8gznBLvt7Ce6BUC7qY1PU=; b=ELZbBCFGsxjsM5z83YlFc2d5Yul8exK2LYWxEFUAwwbTozT9CYMUIyIdNQ27RFNpYoEolu CkGR/6aqkpLC61JwIgiwn6YSNaQNooEVmQ2rh4XD59bfW57bnCtp8JV/8/fuLH4jRrVgzG mIqmtgFcDaouDL9ieXaxdWmvzF4/xUE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1680791421; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lm4tB/qBx4Xl9gLv3tvzFp8gznBLvt7Ce6BUC7qY1PU=; b=hBIBxlKrsXljHVJEgdBNSo/HiM/JPqzuP43nSlwibirDu7CMLMMyXyL6ElXVCuZKfxi5u6 b1qGLFxgU9kyF6CQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 76D5913A1D; Thu, 6 Apr 2023 14:30:21 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id iNocHH3XLmS4LgAAMHmgww (envelope-from ); Thu, 06 Apr 2023 14:30:21 +0000 From: Thomas Zimmermann To: arnd@arndb.de, daniel.vetter@ffwll.ch, deller@gmx.de, javierm@redhat.com, gregkh@linuxfoundation.org Cc: linux-arch@vger.kernel.org, linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-snps-arc@lists.infradead.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-ia64@vger.kernel.org, loongarch@lists.linux.dev, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org, Thomas Zimmermann Subject: [PATCH v2 01/19] fbdev: Prepare generic architecture helpers Date: Thu, 6 Apr 2023 16:30:01 +0200 Message-Id: <20230406143019.6709-2-tzimmermann@suse.de> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230406143019.6709-1-tzimmermann@suse.de> References: <20230406143019.6709-1-tzimmermann@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762437631174190730?= X-GMAIL-MSGID: =?utf-8?q?1762437631174190730?= Generic implementations of fb_pgprotect() and fb_is_primary_device() have been in the source code for a long time. Prepare the header file to make use of them. Improve the code by using an inline function for fb_pgprotect() and by removing include statements. The default mode set by fb_pgprotect() is now writecombine, which is what most platforms want. Symbols are protected by preprocessor guards. Architectures that provide a symbol need to define a preprocessor token of the same name and value. Otherwise the header file will provide a generic implementation. This pattern has been taken from . v2: * use writecombine mappings by default (Arnd) Signed-off-by: Thomas Zimmermann Acked-by: Arnd Bergmann --- include/asm-generic/fb.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/asm-generic/fb.h b/include/asm-generic/fb.h index f9f18101ed36..631d97c507ca 100644 --- a/include/asm-generic/fb.h +++ b/include/asm-generic/fb.h @@ -1,13 +1,32 @@ /* SPDX-License-Identifier: GPL-2.0 */ + #ifndef __ASM_GENERIC_FB_H_ #define __ASM_GENERIC_FB_H_ -#include -#define fb_pgprotect(...) do {} while (0) +/* + * Only include this header file from your architecture's . + */ + +#include + +struct fb_info; +struct file; + +#ifndef fb_pgprotect +#define fb_pgprotect fb_pgprotect +static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma, + unsigned long off) +{ + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); +} +#endif +#ifndef fb_is_primary_device +#define fb_is_primary_device fb_is_primary_device static inline int fb_is_primary_device(struct fb_info *info) { return 0; } +#endif #endif /* __ASM_GENERIC_FB_H_ */