diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/video/backlight/progear_bl.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/video/backlight/progear_bl.c')
-rw-r--r-- | drivers/video/backlight/progear_bl.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/drivers/video/backlight/progear_bl.c b/drivers/video/backlight/progear_bl.c index 9edaf24fd82d..809278c90738 100644 --- a/drivers/video/backlight/progear_bl.c +++ b/drivers/video/backlight/progear_bl.c | |||
@@ -54,15 +54,17 @@ static int progearbl_get_intensity(struct backlight_device *bd) | |||
54 | return intensity - HW_LEVEL_MIN; | 54 | return intensity - HW_LEVEL_MIN; |
55 | } | 55 | } |
56 | 56 | ||
57 | static struct backlight_ops progearbl_ops = { | 57 | static const struct backlight_ops progearbl_ops = { |
58 | .get_brightness = progearbl_get_intensity, | 58 | .get_brightness = progearbl_get_intensity, |
59 | .update_status = progearbl_set_intensity, | 59 | .update_status = progearbl_set_intensity, |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static int progearbl_probe(struct platform_device *pdev) | 62 | static int progearbl_probe(struct platform_device *pdev) |
63 | { | 63 | { |
64 | struct backlight_properties props; | ||
64 | u8 temp; | 65 | u8 temp; |
65 | struct backlight_device *progear_backlight_device; | 66 | struct backlight_device *progear_backlight_device; |
67 | int ret; | ||
66 | 68 | ||
67 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); | 69 | pmu_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101, NULL); |
68 | if (!pmu_dev) { | 70 | if (!pmu_dev) { |
@@ -73,28 +75,37 @@ static int progearbl_probe(struct platform_device *pdev) | |||
73 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); | 75 | sb_dev = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); |
74 | if (!sb_dev) { | 76 | if (!sb_dev) { |
75 | printk("ALI 1533 SB not found.\n"); | 77 | printk("ALI 1533 SB not found.\n"); |
76 | pci_dev_put(pmu_dev); | 78 | ret = -ENODEV; |
77 | return -ENODEV; | 79 | goto put_pmu; |
78 | } | 80 | } |
79 | 81 | ||
80 | /* Set SB_MPS1 to enable brightness control. */ | 82 | /* Set SB_MPS1 to enable brightness control. */ |
81 | pci_read_config_byte(sb_dev, SB_MPS1, &temp); | 83 | pci_read_config_byte(sb_dev, SB_MPS1, &temp); |
82 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); | 84 | pci_write_config_byte(sb_dev, SB_MPS1, temp | 0x20); |
83 | 85 | ||
86 | memset(&props, 0, sizeof(struct backlight_properties)); | ||
87 | props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
84 | progear_backlight_device = backlight_device_register("progear-bl", | 88 | progear_backlight_device = backlight_device_register("progear-bl", |
85 | &pdev->dev, NULL, | 89 | &pdev->dev, NULL, |
86 | &progearbl_ops); | 90 | &progearbl_ops, |
87 | if (IS_ERR(progear_backlight_device)) | 91 | &props); |
88 | return PTR_ERR(progear_backlight_device); | 92 | if (IS_ERR(progear_backlight_device)) { |
93 | ret = PTR_ERR(progear_backlight_device); | ||
94 | goto put_sb; | ||
95 | } | ||
89 | 96 | ||
90 | platform_set_drvdata(pdev, progear_backlight_device); | 97 | platform_set_drvdata(pdev, progear_backlight_device); |
91 | 98 | ||
92 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; | 99 | progear_backlight_device->props.power = FB_BLANK_UNBLANK; |
93 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | 100 | progear_backlight_device->props.brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; |
94 | progear_backlight_device->props.max_brightness = HW_LEVEL_MAX - HW_LEVEL_MIN; | ||
95 | progearbl_set_intensity(progear_backlight_device); | 101 | progearbl_set_intensity(progear_backlight_device); |
96 | 102 | ||
97 | return 0; | 103 | return 0; |
104 | put_sb: | ||
105 | pci_dev_put(sb_dev); | ||
106 | put_pmu: | ||
107 | pci_dev_put(pmu_dev); | ||
108 | return ret; | ||
98 | } | 109 | } |
99 | 110 | ||
100 | static int progearbl_remove(struct platform_device *pdev) | 111 | static int progearbl_remove(struct platform_device *pdev) |