From patchwork Fri Sep 2 02:55:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 12963585 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FFCAECAAD2 for ; Fri, 2 Sep 2022 03:04:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233862AbiIBDEE (ORCPT ); Thu, 1 Sep 2022 23:04:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233501AbiIBDED (ORCPT ); Thu, 1 Sep 2022 23:04:03 -0400 Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 84BD89F8E7; Thu, 1 Sep 2022 20:04:01 -0700 (PDT) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowADHzkq8cBFjs39uAA--.13267S2; Fri, 02 Sep 2022 10:55:56 +0800 (CST) From: Jiasheng Jiang To: deller@gmx.de, broonie@kernel.org, maarten.lankhorst@linux.intel.com, daniel.vetter@ffwll.ch Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH 1/2] video: fbdev: gbefb: Convert to use dev_groups Date: Fri, 2 Sep 2022 10:55:55 +0800 Message-Id: <20220902025555.3833920-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowADHzkq8cBFjs39uAA--.13267S2 X-Coremail-Antispam: 1UD129KBjvJXoW7Zr4xAF4kJrWkXFWxu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-ID: X-Mailing-List: linux-fbdev@vger.kernel.org The driver core supports the ability to handle the creation and removal of device-specific sysfs files in a race-free manner. Moreover, it can guarantee the success of creation. Therefore, it should be better to convert to use dev_groups. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Jiasheng Jiang --- drivers/video/fbdev/gbefb.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c index 6b4d5a7f3e15..1582c718329c 100644 --- a/drivers/video/fbdev/gbefb.c +++ b/drivers/video/fbdev/gbefb.c @@ -1072,17 +1072,12 @@ static ssize_t gbefb_show_rev(struct device *device, struct device_attribute *at static DEVICE_ATTR(revision, S_IRUGO, gbefb_show_rev, NULL); -static void gbefb_remove_sysfs(struct device *dev) -{ - device_remove_file(dev, &dev_attr_size); - device_remove_file(dev, &dev_attr_revision); -} - -static void gbefb_create_sysfs(struct device *dev) -{ - device_create_file(dev, &dev_attr_size); - device_create_file(dev, &dev_attr_revision); -} +static struct attribute *gbefb_attrs[] = { + &dev_attr_size.attr, + &dev_attr_revision.attr, + NULL, +}; +ATTRIBUTE_GROUPS(gbefb); /* * Initialization @@ -1221,7 +1216,6 @@ static int gbefb_probe(struct platform_device *p_dev) } platform_set_drvdata(p_dev, info); - gbefb_create_sysfs(&p_dev->dev); fb_info(info, "%s rev %d @ 0x%08x using %dkB memory\n", info->fix.id, gbe_revision, (unsigned)GBE_BASE, @@ -1248,7 +1242,6 @@ static int gbefb_remove(struct platform_device* p_dev) gbe_turn_off(); arch_phys_wc_del(par->wc_cookie); release_mem_region(GBE_BASE, sizeof(struct sgi_gbe)); - gbefb_remove_sysfs(&p_dev->dev); framebuffer_release(info); return 0; @@ -1259,6 +1252,7 @@ static struct platform_driver gbefb_driver = { .remove = gbefb_remove, .driver = { .name = "gbefb", + .dev_groups = gbefb_groups, }, }; From patchwork Fri Sep 2 02:56:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiasheng Jiang X-Patchwork-Id: 12963584 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE131ECAAD3 for ; Fri, 2 Sep 2022 03:04:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231954AbiIBDEC (ORCPT ); Thu, 1 Sep 2022 23:04:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55496 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231936AbiIBDEB (ORCPT ); Thu, 1 Sep 2022 23:04:01 -0400 X-Greylist: delayed 471 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Thu, 01 Sep 2022 20:03:59 PDT Received: from cstnet.cn (smtp23.cstnet.cn [159.226.251.23]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E00A89F8E6; Thu, 1 Sep 2022 20:03:59 -0700 (PDT) Received: from localhost.localdomain (unknown [124.16.138.126]) by APP-03 (Coremail) with SMTP id rQCowAD37FHMcBFjLoZuAA--.13835S2; Fri, 02 Sep 2022 10:56:12 +0800 (CST) From: Jiasheng Jiang To: deller@gmx.de, broonie@kernel.org, maarten.lankhorst@linux.intel.com, daniel.vetter@ffwll.ch Cc: linux-fbdev@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jiasheng Jiang Subject: [PATCH 2/2] video: fbdev: gbefb: Remove unproper information Date: Fri, 2 Sep 2022 10:56:12 +0800 Message-Id: <20220902025612.3833972-1-jiasheng@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CM-TRANSID: rQCowAD37FHMcBFjLoZuAA--.13835S2 X-Coremail-Antispam: 1UD129KBjvdXoW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fd2hldfou0/ Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org When drivers are working properly, they are quiet. Therefore, the fb_info() should be removed. Signed-off-by: Jiasheng Jiang --- drivers/video/fbdev/gbefb.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/video/fbdev/gbefb.c b/drivers/video/fbdev/gbefb.c index 1582c718329c..7e39ab939691 100644 --- a/drivers/video/fbdev/gbefb.c +++ b/drivers/video/fbdev/gbefb.c @@ -1217,10 +1217,6 @@ static int gbefb_probe(struct platform_device *p_dev) platform_set_drvdata(p_dev, info); - fb_info(info, "%s rev %d @ 0x%08x using %dkB memory\n", - info->fix.id, gbe_revision, (unsigned)GBE_BASE, - gbe_mem_size >> 10); - return 0; out_gbe_unmap: