@@ -594,7 +594,6 @@ static int ssd1307fb_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
struct backlight_device *bl;
- char bl_name[12];
struct fb_info *info;
struct fb_deferred_io *ssd1307fb_defio;
u32 vmem_size;
@@ -733,31 +732,30 @@ static int ssd1307fb_probe(struct i2c_client *client)
if (ret)
goto regulator_enable_error;
- ret = register_framebuffer(info);
- if (ret) {
- dev_err(dev, "Couldn't register the framebuffer\n");
- goto panel_init_error;
- }
-
- snprintf(bl_name, sizeof(bl_name), "ssd1307fb%d", info->node);
- bl = backlight_device_register(bl_name, dev, par, &ssd1307fb_bl_ops,
+ bl = backlight_device_register("ssd1307fb-bl", dev, par, &ssd1307fb_bl_ops,
NULL);
if (IS_ERR(bl)) {
ret = PTR_ERR(bl);
dev_err(dev, "unable to register backlight device: %d\n", ret);
- goto bl_init_error;
+ goto panel_init_error;
+ }
+ info->bl_dev = bl;
+
+ ret = register_framebuffer(info);
+ if (ret) {
+ dev_err(dev, "Couldn't register the framebuffer\n");
+ goto fb_init_error;
}
bl->props.brightness = par->contrast;
bl->props.max_brightness = MAX_CONTRAST;
- info->bl_dev = bl;
dev_info(dev, "fb%d: %s framebuffer device registered, using %d bytes of video memory\n", info->node, info->fix.id, vmem_size);
return 0;
-bl_init_error:
- unregister_framebuffer(info);
+fb_init_error:
+ backlight_device_unregister(bl);
panel_init_error:
pwm_disable(par->pwm);
pwm_put(par->pwm);