Skip to content

Commit

Permalink
simplefb: Disable and release clocks and regulators in destroy callback
Browse files Browse the repository at this point in the history
simplefb gets unregister when a proper framebuffer driver comes in and
kicks it out. However the claimed clocks and regulators stay enabled
as they are only released in the platform device remove function, which
in theory would never get called.

Move the clock/regulator cleanup into the framebuffer destroy callback,
which gets called as part of the framebuffer unregister process.

Note this introduces asymmetry in how the resources are claimed and
released.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
  • Loading branch information
Chen-Yu Tsai authored and Tomi Valkeinen committed Sep 27, 2016
1 parent ca9384c commit 7c9806e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/video/fbdev/simplefb.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,14 @@ static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
return 0;
}

struct simplefb_par;
static void simplefb_clocks_destroy(struct simplefb_par *par);
static void simplefb_regulators_destroy(struct simplefb_par *par);

static void simplefb_destroy(struct fb_info *info)
{
simplefb_regulators_destroy(info->par);
simplefb_clocks_destroy(info->par);
if (info->screen_base)
iounmap(info->screen_base);
}
Expand Down Expand Up @@ -487,11 +493,8 @@ static int simplefb_probe(struct platform_device *pdev)
static int simplefb_remove(struct platform_device *pdev)
{
struct fb_info *info = platform_get_drvdata(pdev);
struct simplefb_par *par = info->par;

unregister_framebuffer(info);
simplefb_regulators_destroy(par);
simplefb_clocks_destroy(par);
framebuffer_release(info);

return 0;
Expand Down

0 comments on commit 7c9806e

Please sign in to comment.