Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fbdev: lcdcfb: Register sysfs groups through driver core

[WHY]
1. The driver forgot to call device_remove_file()
in sh_mobile_lcdc_overlay_fb_unregister(), and there was
no error handling when calling device_create_file() failed.

2. This should probably use device_add_group() instead of
individual files to simplify both creation and removal. [Arnd]

3. The driver core can register and cleanup sysfs groups already.
as commit 95cdd538e0e5 ("fbdev: efifb: Register sysfs groups
through driver core").

[HOW]
Register sysfs groups through driver core.

Signed-off-by: Shixiong Ou <oushixiong@kylinos.cn>
Signed-off-by: Helge Deller <deller@gmx.de>

authored by

Shixiong Ou and committed by
Helge Deller
a979182a 5bbcc764

+13 -16
+13 -16
drivers/video/fbdev/sh_mobile_lcdcfb.c
··· 1338 1338 return count; 1339 1339 } 1340 1340 1341 - static const struct device_attribute overlay_sysfs_attrs[] = { 1342 - __ATTR(ovl_alpha, S_IRUGO|S_IWUSR, 1343 - overlay_alpha_show, overlay_alpha_store), 1344 - __ATTR(ovl_mode, S_IRUGO|S_IWUSR, 1345 - overlay_mode_show, overlay_mode_store), 1346 - __ATTR(ovl_position, S_IRUGO|S_IWUSR, 1347 - overlay_position_show, overlay_position_store), 1348 - __ATTR(ovl_rop3, S_IRUGO|S_IWUSR, 1349 - overlay_rop3_show, overlay_rop3_store), 1341 + static DEVICE_ATTR_RW(overlay_alpha); 1342 + static DEVICE_ATTR_RW(overlay_mode); 1343 + static DEVICE_ATTR_RW(overlay_position); 1344 + static DEVICE_ATTR_RW(overlay_rop3); 1345 + 1346 + static struct attribute *overlay_sysfs_attrs[] = { 1347 + &dev_attr_overlay_alpha.attr, 1348 + &dev_attr_overlay_mode.attr, 1349 + &dev_attr_overlay_position.attr, 1350 + &dev_attr_overlay_rop3.attr, 1351 + NULL, 1350 1352 }; 1353 + ATTRIBUTE_GROUPS(overlay_sysfs); 1351 1354 1352 1355 static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix = { 1353 1356 .id = "SH Mobile LCDC", ··· 1519 1516 { 1520 1517 struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc; 1521 1518 struct fb_info *info = ovl->info; 1522 - unsigned int i; 1523 1519 int ret; 1524 1520 1525 1521 if (info == NULL) ··· 1531 1529 dev_info(lcdc->dev, "registered %s/overlay %u as %dx%d %dbpp.\n", 1532 1530 dev_name(lcdc->dev), ovl->index, info->var.xres, 1533 1531 info->var.yres, info->var.bits_per_pixel); 1534 - 1535 - for (i = 0; i < ARRAY_SIZE(overlay_sysfs_attrs); ++i) { 1536 - ret = device_create_file(info->dev, &overlay_sysfs_attrs[i]); 1537 - if (ret < 0) 1538 - return ret; 1539 - } 1540 1532 1541 1533 return 0; 1542 1534 } ··· 2637 2641 static struct platform_driver sh_mobile_lcdc_driver = { 2638 2642 .driver = { 2639 2643 .name = "sh_mobile_lcdc_fb", 2644 + .dev_groups = overlay_sysfs_groups, 2640 2645 .pm = &sh_mobile_lcdc_dev_pm_ops, 2641 2646 }, 2642 2647 .probe = sh_mobile_lcdc_probe,