summaryrefslogtreecommitdiff
path: root/drivers/staging/sm750fb/sm750.c
diff options
context:
space:
mode:
authorMike Rapoport <mike.rapoport@gmail.com>2016-01-17 19:59:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 18:50:53 -0800
commit9324f9193bc3ba7a07e70ac6e01b3257fb17f390 (patch)
treeb5cf4fb059dfd8e87d639f9be0fbee3d4f7ad86b /drivers/staging/sm750fb/sm750.c
parenta3f92cc94c6126d243d1cfc4f198e101f89bd46b (diff)
staging: sm750fb: introduce sm750fb_frambuffer_release
Use a function to unregister framebuffer info and release its resources. Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/sm750fb/sm750.c')
-rw-r--r--drivers/staging/sm750fb/sm750.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 1b3ab04d8f06..88a640507d7f 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1002,6 +1002,18 @@ NO_PARAM:
}
}
+static void sm750fb_frambuffer_release(struct sm750_dev *sm750_dev)
+{
+ struct fb_info *fb_info;
+
+ while (sm750_dev->fb_count) {
+ fb_info = sm750_dev->fbinfo[sm750_dev->fb_count - 1];
+ unregister_framebuffer(fb_info);
+ framebuffer_release(fb_info);
+ sm750_dev->fb_count--;
+ }
+}
+
static int lynxfb_pci_probe(struct pci_dev *pdev,
const struct pci_device_id *ent)
{
@@ -1138,22 +1150,11 @@ disable_pci:
static void lynxfb_pci_remove(struct pci_dev *pdev)
{
- struct fb_info *info;
struct sm750_dev *sm750_dev;
- int cnt;
- cnt = 2;
sm750_dev = pci_get_drvdata(pdev);
- while (cnt-- > 0) {
- info = sm750_dev->fbinfo[cnt];
- if (!info)
- continue;
-
- unregister_framebuffer(info);
- /* release frame buffer */
- framebuffer_release(info);
- }
+ sm750fb_frambuffer_release(sm750_dev);
arch_phys_wc_del(sm750_dev->mtrr.vram);
iounmap(sm750_dev->pvReg);