From patchwork Fri Aug 27 10:00:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12461803 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 32ECEC43216 for ; Fri, 27 Aug 2021 10:00:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1C1A960F4F for ; Fri, 27 Aug 2021 10:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244771AbhH0KBk (ORCPT ); Fri, 27 Aug 2021 06:01:40 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:59279 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244762AbhH0KBh (ORCPT ); Fri, 27 Aug 2021 06:01:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630058448; h=from:from:reply-to:subject:subject: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=foW7usJ3woghuCkc/3vNgB/OwFOj3a3CXY41KP8I0wQ=; b=Hkinb06twqHN8H5bDDJXDyOmvgbEm0FZyg9Du+9+ee5GvkW3r3Y9Z5mzF9ZAk+Fqa7LYbu egF3IvjbmZuB7xuUKxE2h+8V4XxDiQdE2fqRLRIBuc+qqiudp/Dsy9VR1hn8gTLhLsXMU5 VGwoD2a9CUSVQyMMVv1WAGyW+zsdgmk= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-289-hTBbNCnRN5yPkzTseOdYZg-1; Fri, 27 Aug 2021 06:00:47 -0400 X-MC-Unique: hTBbNCnRN5yPkzTseOdYZg-1 Received: by mail-wr1-f69.google.com with SMTP id n18-20020adfe792000000b00156ae576abdso1682820wrm.9 for ; Fri, 27 Aug 2021 03:00:47 -0700 (PDT) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=foW7usJ3woghuCkc/3vNgB/OwFOj3a3CXY41KP8I0wQ=; b=sKAthe3q9YlyLaW2IGa6X9YIrh8KznQkAFcmvox8XQOt7ipo5s+BFCq8sugsea4mAZ 8+8Hfom6r0ETezckMHXuEkPMDpg/0IhzZOISaYOPaBYOpGNk3bCbtevzQR97tLsW3VC4 XzGMnfOQo4WdFteRP8ICYniSOwObVLBSqKIDhiN7eAMCcZB5nk9a3+y90ykweHl+Sb5j 5Hmhkv0Bsblt1CyG7eeCYxGKvareM5/ijvlKEKTGCbdbkUici7Iy7DYbsxe+M8BL+Zg7 6fSJyJbAliOsAIrpfspOKHGE9ZUCdwxUcPj31P6x2jfoA/Iz9ErsWAnm8g4bqzMquZJc mD9Q== X-Gm-Message-State: AOAM531M3GLA4Upim6G5nbL9nmv73XkzH0hc8UcvoXUcjsc3WpEylSpF h87amrtqKu2112jfgWDhQWmv4WhlZSUMrV50E1QHtkzZGqOAPcBAkGre4Aw2x42DYHfz0i8XuOT na+4VZQS6DFbCXylo18Lh5PI= X-Received: by 2002:a1c:f314:: with SMTP id q20mr18904186wmq.154.1630058443405; Fri, 27 Aug 2021 03:00:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFlYp1BMQ77FCjlALBardwbtrf8PR3eyfLYaynSRZe3DMWKOKmTwk3yQe4c5MOPI7tPuHpLw== X-Received: by 2002:a1c:f314:: with SMTP id q20mr18904160wmq.154.1630058443199; Fri, 27 Aug 2021 03:00:43 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id z17sm1121267wrh.66.2021.08.27.03.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 03:00:42 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "H . Peter Anvin" , Maarten Lankhorst , x86@kernel.org, Greg Kroah-Hartman , linux-fbdev@vger.kernel.org, Thomas Gleixner , Maxime Ripard , Borislav Petkov , Peter Robinson , Hans de Goede , dri-devel@lists.freedesktop.org, Thomas Zimmermann , Daniel Vetter , Ingo Molnar , David Airlie , Javier Martinez Canillas Subject: [RFC PATCH 1/4] fbdev: Rename fb_*_device() functions names to match what they do Date: Fri, 27 Aug 2021 12:00:24 +0200 Message-Id: <20210827100027.1577561-2-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210827100027.1577561-1-javierm@redhat.com> References: <20210827100027.1577561-1-javierm@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The fb_init_device() and fb_cleanup_device() functions only register and unregister sysfs attributes as their initialization and cleanup logic. Let's rename these functions to better match what they actually do. There's only a call to dev_set_drvdata() that's not related to the sysfs registration, so move it to the do_register_framebuffer() function which is where the device is created. Signed-off-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fbmem.c | 8 +++++--- drivers/video/fbdev/core/fbsysfs.c | 6 ++---- include/linux/fb.h | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index 71fb710f1ce..d886582c0a4 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -1602,8 +1602,10 @@ static int do_register_framebuffer(struct fb_info *fb_info) /* Not fatal */ printk(KERN_WARNING "Unable to create device for framebuffer %d; errno = %ld\n", i, PTR_ERR(fb_info->dev)); fb_info->dev = NULL; - } else - fb_init_device(fb_info); + } else { + dev_set_drvdata(fb_info->dev, fb_info); + fb_register_sysfs(fb_info); + } if (fb_info->pixmap.addr == NULL) { fb_info->pixmap.addr = kmalloc(FBPIXMAPSIZE, GFP_KERNEL); @@ -1701,7 +1703,7 @@ static void do_unregister_framebuffer(struct fb_info *fb_info) fb_destroy_modelist(&fb_info->modelist); registered_fb[fb_info->node] = NULL; num_registered_fb--; - fb_cleanup_device(fb_info); + fb_unregister_sysfs(fb_info); #ifdef CONFIG_GUMSTIX_AM200EPD { struct fb_event event; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index 65dae05fff8..a040d6bd6c3 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -507,12 +507,10 @@ static struct device_attribute device_attrs[] = { #endif }; -int fb_init_device(struct fb_info *fb_info) +int fb_register_sysfs(struct fb_info *fb_info) { int i, error = 0; - dev_set_drvdata(fb_info->dev, fb_info); - fb_info->class_flag |= FB_SYSFS_FLAG_ATTR; for (i = 0; i < ARRAY_SIZE(device_attrs); i++) { @@ -531,7 +529,7 @@ int fb_init_device(struct fb_info *fb_info) return 0; } -void fb_cleanup_device(struct fb_info *fb_info) +void fb_unregister_sysfs(struct fb_info *fb_info) { unsigned int i; diff --git a/include/linux/fb.h b/include/linux/fb.h index 5950f8f5dc7..96111248a25 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -689,8 +689,8 @@ static inline bool fb_be_math(struct fb_info *info) /* drivers/video/fbsysfs.c */ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); extern void framebuffer_release(struct fb_info *info); -extern int fb_init_device(struct fb_info *fb_info); -extern void fb_cleanup_device(struct fb_info *head); +extern int fb_register_sysfs(struct fb_info *fb_info); +extern void fb_unregister_sysfs(struct fb_info *head); extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); /* drivers/video/fbmon.c */ From patchwork Fri Aug 27 10:05:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12461809 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D3BCC432BE for ; Fri, 27 Aug 2021 10:05:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 82A1C60F58 for ; Fri, 27 Aug 2021 10:05:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244708AbhH0KGL (ORCPT ); Fri, 27 Aug 2021 06:06:11 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45899 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233121AbhH0KGL (ORCPT ); Fri, 27 Aug 2021 06:06:11 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630058722; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=lZeoDfGlQri5XDPiQdcQrgFtTksnEzEKvvSetj4F1YU=; b=gBQecQhLgo0tW8xsfWWg+w87ZD1qFtOT2EIlDAo4+fqc2McS4KDAfaE5qAg2ocsQAq+IyL 96ruJYYcaGoQE12ArrUu71nA/YvhO58QZkYG0trYnX45dshHgEa9ul6DSnDzEiERFp4ydi hpVp8lIX26ggUXJs2ZUhG8E89yJHFSU= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-332-MYXVIDWeMv-na1JS-mO_FQ-1; Fri, 27 Aug 2021 06:05:21 -0400 X-MC-Unique: MYXVIDWeMv-na1JS-mO_FQ-1 Received: by mail-wr1-f72.google.com with SMTP id h14-20020a056000000e00b001575b00eb08so1680499wrx.13 for ; Fri, 27 Aug 2021 03:05:20 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=lZeoDfGlQri5XDPiQdcQrgFtTksnEzEKvvSetj4F1YU=; b=T2worpyezAdmhdEMTEJ6yVIgUfQxIotxLejZHRCMA58a1ZZbZIqQoQFCjOjLYLMBNU pqgP+aMjmj9caPZMW9d1TTXD+BefmktzcBLVa6hdc5hCo04S0TRfaKGBuOvnHkPIhwug mKP/+o7mq++CklwuEwfM6CBlX5gTvLGGnB5DOlM/G1L+EwlNahBph5yiS2YiRxWheljf mlfceS0af5K3lG/sdjnH10PcDJTFH3zgZV3KindI0RfIOkjB8hxNyVQpw0pNVz21I/Rr H/uJwwTqsKC9BtFoRikcw9nHcfEaXeo1h3+LuTf02VPPUUO9jdFnf6PNoRpARtj1uzia RyZg== X-Gm-Message-State: AOAM5307qmsKz/hcJTPybtpvPc41jT6duAVVib80OPyuw2/JA8Gk/jnK KlY2a8taP2PxtlAU0GfbmgaL2SnGq2cNltn8Kc+ADz75xUaBJcCQitZR+fCSRFLzzykT8UK0MmN 9qxiv9TPNjCzxlud591886Io= X-Received: by 2002:adf:df08:: with SMTP id y8mr9392594wrl.124.1630058719698; Fri, 27 Aug 2021 03:05:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYBGwA75JVWOcmJT5hsoigsXYLcUTaODP/05DgoTOGDrSnXVpxO4l4S8a8RqPK/jBwF3ToxQ== X-Received: by 2002:adf:df08:: with SMTP id y8mr9392561wrl.124.1630058719405; Fri, 27 Aug 2021 03:05:19 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id e26sm6215156wrc.6.2021.08.27.03.05.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 03:05:18 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "H . Peter Anvin" , Peter Robinson , Thomas Zimmermann , Maxime Ripard , Hans de Goede , Daniel Vetter , x86@kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, David Airlie , Maarten Lankhorst , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Greg Kroah-Hartman , Javier Martinez Canillas Subject: [RFC PATCH 2/4] fbdev: Move framebuffer_{alloc,release}() functions to fbmem.c Date: Fri, 27 Aug 2021 12:05:10 +0200 Message-Id: <20210827100510.1578493-1-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The framebuffer_alloc() and framebuffer_release() functions are much more related with the functions in drivers/fbdev/core/fbmem.c than the ones in drivers/fbdev/core/fbsysfs.c, that are only to manage sysfs attributes. Signed-off-by: Javier Martinez Canillas --- drivers/video/fbdev/core/fbmem.c | 65 +++++++++++++++++++++++++++ drivers/video/fbdev/core/fbsysfs.c | 71 ------------------------------ 2 files changed, 65 insertions(+), 71 deletions(-) diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c index d886582c0a4..2b22e46b815 100644 --- a/drivers/video/fbdev/core/fbmem.c +++ b/drivers/video/fbdev/core/fbmem.c @@ -57,6 +57,71 @@ bool fb_center_logo __read_mostly; int fb_logo_count __read_mostly = -1; +/** + * framebuffer_alloc - creates a new frame buffer info structure + * + * @size: size of driver private data, can be zero + * @dev: pointer to the device for this fb, this can be NULL + * + * Creates a new frame buffer info structure. Also reserves @size bytes + * for driver private data (info->par). info->par (if any) will be + * aligned to sizeof(long). + * + * Returns the new structure, or NULL if an error occurred. + * + */ +struct fb_info *framebuffer_alloc(size_t size, struct device *dev) +{ +#define BYTES_PER_LONG (BITS_PER_LONG/8) +#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) + int fb_info_size = sizeof(struct fb_info); + struct fb_info *info; + char *p; + + if (size) + fb_info_size += PADDING; + + p = kzalloc(fb_info_size + size, GFP_KERNEL); + + if (!p) + return NULL; + + info = (struct fb_info *) p; + + if (size) + info->par = p + fb_info_size; + + info->device = dev; + info->fbcon_rotate_hint = -1; + +#if IS_ENABLED(CONFIG_FB_BACKLIGHT) + mutex_init(&info->bl_curve_mutex); +#endif + + return info; +#undef PADDING +#undef BYTES_PER_LONG +} +EXPORT_SYMBOL(framebuffer_alloc); + +/** + * framebuffer_release - marks the structure available for freeing + * + * @info: frame buffer info structure + * + * Drop the reference count of the device embedded in the + * framebuffer info structure. + * + */ +void framebuffer_release(struct fb_info *info) +{ + if (!info) + return; + kfree(info->apertures); + kfree(info); +} +EXPORT_SYMBOL(framebuffer_release); + static struct fb_info *get_fb_info(unsigned int idx) { struct fb_info *fb_info; diff --git a/drivers/video/fbdev/core/fbsysfs.c b/drivers/video/fbdev/core/fbsysfs.c index a040d6bd6c3..2c1e3f0effe 100644 --- a/drivers/video/fbdev/core/fbsysfs.c +++ b/drivers/video/fbdev/core/fbsysfs.c @@ -5,12 +5,6 @@ * Copyright (c) 2004 James Simmons */ -/* - * Note: currently there's only stubs for framebuffer_alloc and - * framebuffer_release here. The reson for that is that until all drivers - * are converted to use it a sysfsification will open OOPSable races. - */ - #include #include #include @@ -20,71 +14,6 @@ #define FB_SYSFS_FLAG_ATTR 1 -/** - * framebuffer_alloc - creates a new frame buffer info structure - * - * @size: size of driver private data, can be zero - * @dev: pointer to the device for this fb, this can be NULL - * - * Creates a new frame buffer info structure. Also reserves @size bytes - * for driver private data (info->par). info->par (if any) will be - * aligned to sizeof(long). - * - * Returns the new structure, or NULL if an error occurred. - * - */ -struct fb_info *framebuffer_alloc(size_t size, struct device *dev) -{ -#define BYTES_PER_LONG (BITS_PER_LONG/8) -#define PADDING (BYTES_PER_LONG - (sizeof(struct fb_info) % BYTES_PER_LONG)) - int fb_info_size = sizeof(struct fb_info); - struct fb_info *info; - char *p; - - if (size) - fb_info_size += PADDING; - - p = kzalloc(fb_info_size + size, GFP_KERNEL); - - if (!p) - return NULL; - - info = (struct fb_info *) p; - - if (size) - info->par = p + fb_info_size; - - info->device = dev; - info->fbcon_rotate_hint = -1; - -#if IS_ENABLED(CONFIG_FB_BACKLIGHT) - mutex_init(&info->bl_curve_mutex); -#endif - - return info; -#undef PADDING -#undef BYTES_PER_LONG -} -EXPORT_SYMBOL(framebuffer_alloc); - -/** - * framebuffer_release - marks the structure available for freeing - * - * @info: frame buffer info structure - * - * Drop the reference count of the device embedded in the - * framebuffer info structure. - * - */ -void framebuffer_release(struct fb_info *info) -{ - if (!info) - return; - kfree(info->apertures); - kfree(info); -} -EXPORT_SYMBOL(framebuffer_release); - static int activate(struct fb_info *fb_info, struct fb_var_screeninfo *var) { int err; From patchwork Fri Aug 27 10:05:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12461811 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D9DBC4320A for ; Fri, 27 Aug 2021 10:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ECA5760F58 for ; Fri, 27 Aug 2021 10:05:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244741AbhH0KGc (ORCPT ); Fri, 27 Aug 2021 06:06:32 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:45074 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244653AbhH0KGa (ORCPT ); Fri, 27 Aug 2021 06:06:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630058741; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=EXPxGlvkpHmnHEK7OKsOddraGW7pm1nQZapyJTQunr0=; b=IHC2UbjC99thvUImE6M42oE49ieC25+PXlpC3YX+sWZze1WpxQCpkm5SFw2yyNg6ZE/iRf SWtulqG8fQXssC4XK5G0Z55oKbYzT90uX02JtSwhXiWK2Dne/aVCEaMorbWpfpXRAtlJ3A vN4AK+tDtinfBg/XcgHIfDLjO7S8WjI= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-518-B3-rfjkfO_emi_G7gLil3g-1; Fri, 27 Aug 2021 06:05:40 -0400 X-MC-Unique: B3-rfjkfO_emi_G7gLil3g-1 Received: by mail-wr1-f71.google.com with SMTP id a9-20020a0560000509b029015485b95d0cso1710305wrf.5 for ; Fri, 27 Aug 2021 03:05:40 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=EXPxGlvkpHmnHEK7OKsOddraGW7pm1nQZapyJTQunr0=; b=MvdtXXWodwCfSM3wHqqIoeS1m95MQgj6+SOY4MNKLtcFHFyphBfCztVSYie3kc8+Yb Mm2HxeZ5jC3DVF9QGZQKB3Td0/zHZBMNMTUtmXkNbiD/6nK+nAfSnEg4tg9lERY8NlY1 peYRVts2555um6POQW18SJCYVRf2yz2GDZO+35PybScK0aXnRDHFcvytTd1nJpmBJYT5 apyv5+5QG35ozGHhLWxQwA0Ce68UDBY7GcuDiNehV+SgS6PINre2Do7o/5dqme5dOHoO IbhMcLSFgIa8OQ4YBCz9sn4y+N306iY+jJyOOWKYEd2mDKER0EUg+SlxtjS+dQT270tg 6T0Q== X-Gm-Message-State: AOAM533E3uo+iAYSze+rBpWAonukOsbq3B0ODPLKDqLnGYswVzct14tZ xUGZMd1tEznDUEBcdUM+s0xJDx79CMdNrFH4J5rOl0kdTw2kpV+7KVPIB5TpLUJOAUaqBY9syDg ehkjcegCQ3nTvPRYEVyb0BPY= X-Received: by 2002:a5d:4309:: with SMTP id h9mr9106849wrq.299.1630058737166; Fri, 27 Aug 2021 03:05:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6JdgxUEqVQvWbLK8LE9lw2ijxb9tPU/9Zb2lUFyehWm5LdPhMOjL+HnOK1KX40fmwm9S6tw== X-Received: by 2002:a5d:4309:: with SMTP id h9mr9106825wrq.299.1630058736889; Fri, 27 Aug 2021 03:05:36 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id p5sm6658888wrd.25.2021.08.27.03.05.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 03:05:36 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "H . Peter Anvin" , Peter Robinson , Thomas Zimmermann , Maxime Ripard , Hans de Goede , Daniel Vetter , x86@kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, David Airlie , Maarten Lankhorst , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Greg Kroah-Hartman , Javier Martinez Canillas Subject: [RFC PATCH 3/4] fbdev: Split frame buffer support in FB and FB_CORE symbols Date: Fri, 27 Aug 2021 12:05:31 +0200 Message-Id: <20210827100531.1578604-1-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Currently the CONFIG_FB option has to be enabled even if no legacy fbdev drivers are needed, in order to have support for a framebuffer console. The DRM subsystem has a fbdev emulation layer, but depends on CONFIG_FB and so it can only be enabled if that dependency is enabled as well. That means fbdev drivers have to be explicitly disabled if users want to enable CONFIG_FB, only to use fbcon with the DRM fbdev emulation layer. This patch introduces a CONFIG_FB_CORE option that could be enabled just to have the core support needed for CONFIG_DRM_FBDEV_EMULATION, allowing CONFIG_FB to be disabled (and automatically disabling all fbdev drivers). The fbsysfs.o object is left out of fb_core.o, because that's not needed for KMS drivers and the DRM fbdev emulation layer. Signed-off-by: Javier Martinez Canillas --- arch/x86/Makefile | 2 +- arch/x86/video/Makefile | 2 +- drivers/video/console/Kconfig | 2 +- drivers/video/fbdev/Kconfig | 57 ++++++++++++++++++------------- drivers/video/fbdev/core/Makefile | 13 ++++--- include/linux/fb.h | 14 ++++++++ 6 files changed, 59 insertions(+), 31 deletions(-) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 44dd071d836..dc409539218 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -229,7 +229,7 @@ drivers-$(CONFIG_PCI) += arch/x86/pci/ # suspend and hibernation support drivers-$(CONFIG_PM) += arch/x86/power/ -drivers-$(CONFIG_FB) += arch/x86/video/ +drivers-$(CONFIG_FB_CORE) += arch/x86/video/ #### # boot loader support. Several targets are kept for legacy purposes diff --git a/arch/x86/video/Makefile b/arch/x86/video/Makefile index 11640c11611..cb0735bd662 100644 --- a/arch/x86/video/Makefile +++ b/arch/x86/video/Makefile @@ -1,2 +1,2 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_FB) += fbdev.o +obj-$(CONFIG_FB_CORE) += fbdev.o diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 840d9813b0b..0c562ed3495 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig @@ -71,7 +71,7 @@ config DUMMY_CONSOLE_ROWS config FRAMEBUFFER_CONSOLE bool "Framebuffer Console support" - depends on FB && !UML + depends on FB_CORE && !UML select VT_HW_CONSOLE_BINDING select CRC32 select FONT_SUPPORT diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig index d33c5cd684c..cb9e8b503a5 100644 --- a/drivers/video/fbdev/Kconfig +++ b/drivers/video/fbdev/Kconfig @@ -9,10 +9,8 @@ config FB_CMDLINE config FB_NOTIFY bool -menuconfig FB - tristate "Support for frame buffer devices" - select FB_CMDLINE - select FB_NOTIFY +menuconfig FB_CORE + tristate "Core support for frame buffer devices" help The frame buffer device provides an abstraction for the graphics hardware. It represents the frame buffer of some video hardware and @@ -36,6 +34,19 @@ menuconfig FB for more information. + This options enables the core support for frame buffer devices. + +menuconfig FB + tristate "Support for frame buffer device drivers" + depends on FB_CORE + select FB_CMDLINE + select FB_NOTIFY + help + This enables support for frame buffer devices (fbdev) drivers. + + The DRM subsystem provides an option to emulate fbdev devices but + this option allows legacy fbdev drivers to be enabled as well. + Say Y here and to the driver for your graphics board below if you are compiling a kernel for a non-x86 architecture. @@ -47,7 +58,7 @@ menuconfig FB config FIRMWARE_EDID bool "Enable firmware EDID" - depends on FB + depends on FB_CORE help This enables access to the EDID transferred from the firmware. On the i386, this is from the Video BIOS. Enable this if DDC/I2C @@ -62,7 +73,7 @@ config FIRMWARE_EDID config FB_DDC tristate - depends on FB + depends on FB_CORE select I2C_ALGOBIT select I2C @@ -75,7 +86,7 @@ config FB_BOOT_VESA_SUPPORT config FB_CFB_FILLRECT tristate - depends on FB + depends on FB_CORE help Include the cfb_fillrect function for generic software rectangle filling. This is used by drivers that don't provide their own @@ -83,7 +94,7 @@ config FB_CFB_FILLRECT config FB_CFB_COPYAREA tristate - depends on FB + depends on FB_CORE help Include the cfb_copyarea function for generic software area copying. This is used by drivers that don't provide their own (accelerated) @@ -91,7 +102,7 @@ config FB_CFB_COPYAREA config FB_CFB_IMAGEBLIT tristate - depends on FB + depends on FB_CORE help Include the cfb_imageblit function for generic software image blitting. This is used by drivers that don't provide their own @@ -99,7 +110,7 @@ config FB_CFB_IMAGEBLIT config FB_CFB_REV_PIXELS_IN_BYTE bool - depends on FB + depends on FB_CORE help Allow generic frame-buffer functions to work on displays with 1, 2 and 4 bits per pixel depths which has opposite order of pixels in @@ -107,7 +118,7 @@ config FB_CFB_REV_PIXELS_IN_BYTE config FB_SYS_FILLRECT tristate - depends on FB + depends on FB_CORE help Include the sys_fillrect function for generic software rectangle filling. This is used by drivers that don't provide their own @@ -115,7 +126,7 @@ config FB_SYS_FILLRECT config FB_SYS_COPYAREA tristate - depends on FB + depends on FB_CORE help Include the sys_copyarea function for generic software area copying. This is used by drivers that don't provide their own (accelerated) @@ -123,7 +134,7 @@ config FB_SYS_COPYAREA config FB_SYS_IMAGEBLIT tristate - depends on FB + depends on FB_CORE help Include the sys_imageblit function for generic software image blitting. This is used by drivers that don't provide their own @@ -131,14 +142,14 @@ config FB_SYS_IMAGEBLIT config FB_PROVIDE_GET_FB_UNMAPPED_AREA bool - depends on FB + depends on FB_CORE help Allow generic frame-buffer to provide get_fb_unmapped_area function. menuconfig FB_FOREIGN_ENDIAN bool "Framebuffer foreign endianness support" - depends on FB + depends on FB_CORE help This menu will let you enable support for the framebuffers with non-native endianness (e.g. Little-Endian framebuffer on a @@ -162,36 +173,36 @@ endchoice config FB_SYS_FOPS tristate - depends on FB + depends on FB_CORE config FB_DEFERRED_IO bool - depends on FB + depends on FB_CORE config FB_HECUBA tristate - depends on FB + depends on FB_CORE depends on FB_DEFERRED_IO config FB_SVGALIB tristate - depends on FB + depends on FB_CORE help Common utility functions useful to fbdev drivers of VGA-based cards. config FB_MACMODES tristate - depends on FB + depends on FB_CORE config FB_BACKLIGHT tristate - depends on FB + depends on FB_CORE select BACKLIGHT_CLASS_DEVICE config FB_MODE_HELPERS bool "Enable Video Mode Handling Helpers" - depends on FB + depends on FB_CORE help This enables functions for handling video modes using the Generalized Timing Formula and the EDID parser. A few drivers rely @@ -201,7 +212,7 @@ config FB_MODE_HELPERS config FB_TILEBLITTING bool "Enable Tile Blitting Support" - depends on FB + depends on FB_CORE help This enables tile blitting. Tile blitting is a drawing technique where the screen is divided into rectangular sections (tiles), whereas diff --git a/drivers/video/fbdev/core/Makefile b/drivers/video/fbdev/core/Makefile index 26cbc965497..328a017c78b 100644 --- a/drivers/video/fbdev/core/Makefile +++ b/drivers/video/fbdev/core/Makefile @@ -1,22 +1,25 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_FB_CMDLINE) += fb_cmdline.o obj-$(CONFIG_FB_NOTIFY) += fb_notify.o +obj-$(CONFIG_FB_CORE) += fb_core.o obj-$(CONFIG_FB) += fb.o -fb-y := fbmem.o fbmon.o fbcmap.o fbsysfs.o \ +fb_core-y := fbmem.o fbmon.o fbcmap.o \ modedb.o fbcvt.o -fb-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o +fb_core-$(CONFIG_FB_DEFERRED_IO) += fb_defio.o ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE),y) -fb-y += fbcon.o bitblit.o softcursor.o +fb_core-y += fbcon.o bitblit.o softcursor.o ifeq ($(CONFIG_FB_TILEBLITTING),y) -fb-y += tileblit.o +fb_core-y += tileblit.o endif ifeq ($(CONFIG_FRAMEBUFFER_CONSOLE_ROTATION),y) -fb-y += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ +fb_core-y += fbcon_rotate.o fbcon_cw.o fbcon_ud.o \ fbcon_ccw.o endif endif +fb-y := fbsysfs.o + obj-$(CONFIG_FB_CFB_FILLRECT) += cfbfillrect.o obj-$(CONFIG_FB_CFB_COPYAREA) += cfbcopyarea.o obj-$(CONFIG_FB_CFB_IMAGEBLIT) += cfbimgblt.o diff --git a/include/linux/fb.h b/include/linux/fb.h index 96111248a25..f66eefbf1ee 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -689,9 +689,23 @@ static inline bool fb_be_math(struct fb_info *info) /* drivers/video/fbsysfs.c */ extern struct fb_info *framebuffer_alloc(size_t size, struct device *dev); extern void framebuffer_release(struct fb_info *info); +#if IS_ENABLED(CONFIG_FB) extern int fb_register_sysfs(struct fb_info *fb_info); extern void fb_unregister_sysfs(struct fb_info *head); extern void fb_bl_default_curve(struct fb_info *fb_info, u8 off, u8 min, u8 max); +#else +static inline int fb_register_sysfs(struct fb_info *fb_info) +{ + return 0; +} +static inline void fb_unregister_sysfs(struct fb_info *head) +{ +} +static inline void fb_bl_default_curve(struct fb_info *fb_info, u8 off, + u8 min, u8 max) +{ +} +#endif /* drivers/video/fbmon.c */ #define FB_MAXTIMINGS 0 From patchwork Fri Aug 27 10:05:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Martinez Canillas X-Patchwork-Id: 12461813 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A00FAC432BE for ; Fri, 27 Aug 2021 10:06:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8630660EBC for ; Fri, 27 Aug 2021 10:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244801AbhH0KGz (ORCPT ); Fri, 27 Aug 2021 06:06:55 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:47250 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244788AbhH0KGx (ORCPT ); Fri, 27 Aug 2021 06:06:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630058763; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=p4aikmi0g6nX7SuLm/Bk6aLBr61zFNCjsy8EnVkGMSU=; b=gjSHhqy3Vn41gF5/dSYnOI1kao7HgOOJRZSMePSoYIGLhNRArnCedE6XMVtvqytsu+LkBQ Kiw02mc9x6ZmsiIMjzjbS3JS+GMLnN8IO80nYV8YFaFyC/JCISR7LTEWmICNAIXwWcAbaE HQ5Wgy358MUsV2lUNYIA5a/ojffhdmQ= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-581-I_eJTddKPWaDhzR9sezaLQ-1; Fri, 27 Aug 2021 06:06:02 -0400 X-MC-Unique: I_eJTddKPWaDhzR9sezaLQ-1 Received: by mail-wm1-f69.google.com with SMTP id z18-20020a1c7e120000b02902e69f6fa2e0so1892202wmc.9 for ; Fri, 27 Aug 2021 03:06:01 -0700 (PDT) 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:mime-version :content-transfer-encoding; bh=p4aikmi0g6nX7SuLm/Bk6aLBr61zFNCjsy8EnVkGMSU=; b=GKfOeGFMYivVaVZKbP5Tx/AWn/ljcYTrU4hsQBJ15ssXvswVpZMd8ncnDA8FPJchfK Ggql8dil76UCFaPhAWqYTd8ZUpK4583GoJj8nMy2YVXhaecHnJI0RViqdI/vTFmHnmxR 2o3ABamJwd+FNLs0aDmVDLOWorF9EQNTVGtFIcGykfEluJSTJsBZupwUda62Fhgb5uT0 j39rhFN+OrjjwzP1gBd9oCLYB6NrSoMkcqnTX9+ZzJkVFgi+reRmdkfrlm5UV+IZQsun wUq5f52/xMulkL09dizR+hwERiDQaw6Y1AcFoZ00vIHywTtbs8y1TjVueZzjikwIredQ RRZA== X-Gm-Message-State: AOAM530GNaWL9V5tu6hdZimo1IqNL1TI5Bv57XTvqU9NydM41cLYNpRA oCKmk/lESndYIRpNoTzX0sDgEMMh83EdSXY+UVPjaN6OHodyKWRvOoV+vzyGBeVcodyWWtPGOTL R4q2xqmIIa14g+SlxYEO+MHQ= X-Received: by 2002:a05:600c:2215:: with SMTP id z21mr13186002wml.47.1630058760665; Fri, 27 Aug 2021 03:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJweQKtGcTVQCT5oK+T9jojfllLFKvn1d+zXGWWo3Yar8zcxTOTUijovtCiHgZqBsq9Js5k20w== X-Received: by 2002:a05:600c:2215:: with SMTP id z21mr13185978wml.47.1630058760467; Fri, 27 Aug 2021 03:06:00 -0700 (PDT) Received: from minerva.home ([92.176.231.106]) by smtp.gmail.com with ESMTPSA id d28sm4834317wrc.4.2021.08.27.03.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Aug 2021 03:06:00 -0700 (PDT) From: Javier Martinez Canillas To: linux-kernel@vger.kernel.org Cc: "H . Peter Anvin" , Peter Robinson , Thomas Zimmermann , Maxime Ripard , Hans de Goede , Daniel Vetter , x86@kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, David Airlie , Maarten Lankhorst , Borislav Petkov , Ingo Molnar , Thomas Gleixner , Greg Kroah-Hartman , Javier Martinez Canillas Subject: [RFC PATCH 4/4] drm: Make fbdev emulation depend on FB_CORE instead of FB Date: Fri, 27 Aug 2021 12:05:57 +0200 Message-Id: <20210827100557.1578746-1-javierm@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org Now that the fbdev core has been split in FB_CORE and FB, make DRM fbdev emulation layer to just depend on the former. This allows to disable the CONFIG_FB option if is not needed, which will avoid the need to explicitly disable all the legacy fbdev drivers. Signed-off-by: Javier Martinez Canillas --- drivers/gpu/drm/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index 8fc40317f2b..7806adb02f1 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -103,7 +103,7 @@ config DRM_DEBUG_DP_MST_TOPOLOGY_REFS config DRM_FBDEV_EMULATION bool "Enable legacy fbdev support for your modesetting driver" depends on DRM - depends on FB + depends on FB_CORE select DRM_KMS_HELPER select FB_CFB_FILLRECT select FB_CFB_COPYAREA