aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/video/backlight
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@rpsys.net>2007-02-07 19:32:14 -0500
committerRichard Purdie <rpurdie@rpsys.net>2007-02-20 03:38:44 -0500
commitda7a747125ff80e13c00b231602e7c86b6bb8741 (patch)
tree57a323187590c8158421309ae277a6e96539d8a0 /drivers/video/backlight
parent90968e8ebc4611896ff7f2ef0c0bf8455e845cd1 (diff)
backlight: Minor code cleanups for corgi_bl.c
Since people use this code as an example, clean it up to to use platform_*_drvdata and remove an unneeded function. Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/video/backlight')
-rw-r--r--drivers/video/backlight/corgi_bl.c30
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/video/backlight/corgi_bl.c b/drivers/video/backlight/corgi_bl.c
index 4ca24e261578..c1eba0e8a1b0 100644
--- a/drivers/video/backlight/corgi_bl.c
+++ b/drivers/video/backlight/corgi_bl.c
@@ -61,17 +61,21 @@ static int corgibl_send_intensity(struct backlight_device *bd)
61} 61}
62 62
63#ifdef CONFIG_PM 63#ifdef CONFIG_PM
64static int corgibl_suspend(struct platform_device *dev, pm_message_t state) 64static int corgibl_suspend(struct platform_device *pdev, pm_message_t state)
65{ 65{
66 struct backlight_device *bd = platform_get_drvdata(pdev);
67
66 corgibl_flags |= CORGIBL_SUSPENDED; 68 corgibl_flags |= CORGIBL_SUSPENDED;
67 corgibl_send_intensity(corgi_backlight_device); 69 corgibl_send_intensity(bd);
68 return 0; 70 return 0;
69} 71}
70 72
71static int corgibl_resume(struct platform_device *dev) 73static int corgibl_resume(struct platform_device *pdev)
72{ 74{
75 struct backlight_device *bd = platform_get_drvdata(pdev);
76
73 corgibl_flags &= ~CORGIBL_SUSPENDED; 77 corgibl_flags &= ~CORGIBL_SUSPENDED;
74 corgibl_send_intensity(corgi_backlight_device); 78 corgibl_send_intensity(bd);
75 return 0; 79 return 0;
76} 80}
77#else 81#else
@@ -84,12 +88,6 @@ static int corgibl_get_intensity(struct backlight_device *bd)
84 return corgibl_intensity; 88 return corgibl_intensity;
85} 89}
86 90
87static int corgibl_set_intensity(struct backlight_device *bd)
88{
89 corgibl_send_intensity(corgi_backlight_device);
90 return 0;
91}
92
93/* 91/*
94 * Called when the battery is low to limit the backlight intensity. 92 * Called when the battery is low to limit the backlight intensity.
95 * If limit==0 clear any limit, otherwise limit the intensity 93 * If limit==0 clear any limit, otherwise limit the intensity
@@ -107,7 +105,7 @@ EXPORT_SYMBOL(corgibl_limit_intensity);
107 105
108static struct backlight_properties corgibl_data = { 106static struct backlight_properties corgibl_data = {
109 .get_brightness = corgibl_get_intensity, 107 .get_brightness = corgibl_get_intensity,
110 .update_status = corgibl_set_intensity, 108 .update_status = corgibl_send_intensity,
111}; 109};
112 110
113static int corgibl_probe(struct platform_device *pdev) 111static int corgibl_probe(struct platform_device *pdev)
@@ -124,6 +122,8 @@ static int corgibl_probe(struct platform_device *pdev)
124 if (IS_ERR (corgi_backlight_device)) 122 if (IS_ERR (corgi_backlight_device))
125 return PTR_ERR (corgi_backlight_device); 123 return PTR_ERR (corgi_backlight_device);
126 124
125 platform_set_drvdata(pdev, corgi_backlight_device);
126
127 corgibl_data.power = FB_BLANK_UNBLANK; 127 corgibl_data.power = FB_BLANK_UNBLANK;
128 corgibl_data.brightness = machinfo->default_intensity; 128 corgibl_data.brightness = machinfo->default_intensity;
129 corgibl_send_intensity(corgi_backlight_device); 129 corgibl_send_intensity(corgi_backlight_device);
@@ -132,13 +132,15 @@ static int corgibl_probe(struct platform_device *pdev)
132 return 0; 132 return 0;
133} 133}
134 134
135static int corgibl_remove(struct platform_device *dev) 135static int corgibl_remove(struct platform_device *pdev)
136{ 136{
137 struct backlight_device *bd = platform_get_drvdata(pdev);
138
137 corgibl_data.power = 0; 139 corgibl_data.power = 0;
138 corgibl_data.brightness = 0; 140 corgibl_data.brightness = 0;
139 corgibl_send_intensity(corgi_backlight_device); 141 corgibl_send_intensity(bd);
140 142
141 backlight_device_unregister(corgi_backlight_device); 143 backlight_device_unregister(bd);
142 144
143 printk("Corgi Backlight Driver Unloaded\n"); 145 printk("Corgi Backlight Driver Unloaded\n");
144 return 0; 146 return 0;