]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/video/backlight/cr_bllcd.c
[ARM] pxa: corgi backlight driver should not select ssp drivers
[linux-2.6-omap-h63xx.git] / drivers / video / backlight / cr_bllcd.c
index 1b3f6586bc9f433295ccee5bf5c32d5868e6d461..26add8898605e0bc08789e6bdf4a7961886e575b 100644 (file)
@@ -36,7 +36,6 @@
 #include <linux/backlight.h>
 #include <linux/lcd.h>
 #include <linux/pci.h>
-#include <asm/uaccess.h>
 
 /* The LVDS- and panel power controls sits on the
  * GPIO port of the ISA bridge.
@@ -171,13 +170,11 @@ static struct lcd_ops cr_lcd_ops = {
 
 static int cr_backlight_probe(struct platform_device *pdev)
 {
+       struct backlight_device *bdp;
+       struct lcd_device *ldp;
        struct cr_panel *crp;
        u8 dev_en;
 
-       crp = kzalloc(sizeof(*crp), GFP_KERNEL);
-       if (crp == NULL)
-               return -ENOMEM;
-
        lpc_dev = pci_get_device(PCI_VENDOR_ID_INTEL,
                                        CRVML_DEVICE_LPC, NULL);
        if (!lpc_dev) {
@@ -193,27 +190,34 @@ static int cr_backlight_probe(struct platform_device *pdev)
                return -ENODEV;
        }
 
-       crp->cr_backlight_device = backlight_device_register("cr-backlight",
-                                                            &pdev->dev, NULL,
-                                                            &cr_backlight_ops);
-       if (IS_ERR(crp->cr_backlight_device)) {
+       bdp = backlight_device_register("cr-backlight",
+                                       &pdev->dev, NULL, &cr_backlight_ops);
+       if (IS_ERR(bdp)) {
                pci_dev_put(lpc_dev);
-               return PTR_ERR(crp->cr_backlight_device);
+               return PTR_ERR(bdp);
        }
 
-       crp->cr_lcd_device = lcd_device_register("cr-lcd",
-                                                       &pdev->dev,
-                                                       &cr_lcd_ops);
-
-       if (IS_ERR(crp->cr_lcd_device)) {
+       ldp = lcd_device_register("cr-lcd", &pdev->dev, NULL, &cr_lcd_ops);
+       if (IS_ERR(ldp)) {
+               backlight_device_unregister(bdp);
                pci_dev_put(lpc_dev);
-               return PTR_ERR(crp->cr_backlight_device);
+               return PTR_ERR(bdp);
        }
 
        pci_read_config_dword(lpc_dev, CRVML_REG_GPIOBAR,
                              &gpio_bar);
        gpio_bar &= ~0x3F;
 
+       crp = kzalloc(sizeof(*crp), GFP_KERNEL);
+       if (!crp) {
+               lcd_device_unregister(ldp);
+               backlight_device_unregister(bdp);
+               pci_dev_put(lpc_dev);
+               return -ENOMEM;
+       }
+
+       crp->cr_backlight_device = bdp;
+       crp->cr_lcd_device = ldp;
        crp->cr_backlight_device->props.power = FB_BLANK_UNBLANK;
        crp->cr_backlight_device->props.brightness = 0;
        crp->cr_backlight_device->props.max_brightness = 0;