mirror of
https://github.com/torvalds/linux.git
synced 2026-11-10 17:11:02 +01:00
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 95cdd538e0 ("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>
This commit is contained in:
parent
5bbcc7645f
commit
a979182a24
|
|
@ -1338,16 +1338,19 @@ overlay_rop3_store(struct device *dev, struct device_attribute *attr,
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct device_attribute overlay_sysfs_attrs[] = {
|
static DEVICE_ATTR_RW(overlay_alpha);
|
||||||
__ATTR(ovl_alpha, S_IRUGO|S_IWUSR,
|
static DEVICE_ATTR_RW(overlay_mode);
|
||||||
overlay_alpha_show, overlay_alpha_store),
|
static DEVICE_ATTR_RW(overlay_position);
|
||||||
__ATTR(ovl_mode, S_IRUGO|S_IWUSR,
|
static DEVICE_ATTR_RW(overlay_rop3);
|
||||||
overlay_mode_show, overlay_mode_store),
|
|
||||||
__ATTR(ovl_position, S_IRUGO|S_IWUSR,
|
static struct attribute *overlay_sysfs_attrs[] = {
|
||||||
overlay_position_show, overlay_position_store),
|
&dev_attr_overlay_alpha.attr,
|
||||||
__ATTR(ovl_rop3, S_IRUGO|S_IWUSR,
|
&dev_attr_overlay_mode.attr,
|
||||||
overlay_rop3_show, overlay_rop3_store),
|
&dev_attr_overlay_position.attr,
|
||||||
|
&dev_attr_overlay_rop3.attr,
|
||||||
|
NULL,
|
||||||
};
|
};
|
||||||
|
ATTRIBUTE_GROUPS(overlay_sysfs);
|
||||||
|
|
||||||
static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix = {
|
static const struct fb_fix_screeninfo sh_mobile_lcdc_overlay_fix = {
|
||||||
.id = "SH Mobile LCDC",
|
.id = "SH Mobile LCDC",
|
||||||
|
|
@ -1516,7 +1519,6 @@ sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
|
||||||
{
|
{
|
||||||
struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
|
struct sh_mobile_lcdc_priv *lcdc = ovl->channel->lcdc;
|
||||||
struct fb_info *info = ovl->info;
|
struct fb_info *info = ovl->info;
|
||||||
unsigned int i;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (info == NULL)
|
if (info == NULL)
|
||||||
|
|
@ -1530,12 +1532,6 @@ sh_mobile_lcdc_overlay_fb_register(struct sh_mobile_lcdc_overlay *ovl)
|
||||||
dev_name(lcdc->dev), ovl->index, info->var.xres,
|
dev_name(lcdc->dev), ovl->index, info->var.xres,
|
||||||
info->var.yres, info->var.bits_per_pixel);
|
info->var.yres, info->var.bits_per_pixel);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(overlay_sysfs_attrs); ++i) {
|
|
||||||
ret = device_create_file(info->dev, &overlay_sysfs_attrs[i]);
|
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2641,6 +2637,7 @@ static int sh_mobile_lcdc_probe(struct platform_device *pdev)
|
||||||
static struct platform_driver sh_mobile_lcdc_driver = {
|
static struct platform_driver sh_mobile_lcdc_driver = {
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "sh_mobile_lcdc_fb",
|
.name = "sh_mobile_lcdc_fb",
|
||||||
|
.dev_groups = overlay_sysfs_groups,
|
||||||
.pm = &sh_mobile_lcdc_dev_pm_ops,
|
.pm = &sh_mobile_lcdc_dev_pm_ops,
|
||||||
},
|
},
|
||||||
.probe = sh_mobile_lcdc_probe,
|
.probe = sh_mobile_lcdc_probe,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user