aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Luming <luming.yu@gmail.com>2006-12-19 15:56:15 -0500
committerLen Brown <len.brown@intel.com>2006-12-20 01:42:19 -0500
commit519ab5f2be65b72cf12ae99c89752bbe79b44df6 (patch)
tree6e404b214e426e6ccc08e414df405655fb2b404c
parentf4715189dfb1c381ad36b7e02e3716fb7a7f84db (diff)
ACPI: video: Add dev argument for backlight_device_register
This patch set adds generic abstract layer support for acpi video driver to have generic user interface to control backlight and output switch control by leveraging the existing backlight sysfs class driver, and by adding a new video output sysfs class driver. This patch: Add dev argument for backlight_device_register to link the class device to real device object. The platform specific driver should find a way to get the real device object for their video device. [akpm@osdl.org: build fix] [akpm@osdl.org: fix msi-laptop.c] Signed-off-by: Luming Yu <Luming.yu@intel.com> Cc: "Antonino A. Daplas" <adaplas@pol.net> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Len Brown <len.brown@intel.com>
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/ibm_acpi.c2
-rw-r--r--drivers/acpi/toshiba_acpi.c3
-rw-r--r--drivers/misc/msi-laptop.c3
-rw-r--r--drivers/usb/misc/appledisplay.c2
-rw-r--r--drivers/video/backlight/backlight.c7
-rw-r--r--include/linux/backlight.h2
7 files changed, 13 insertions, 8 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index bf7bc25e680e..11468e46253c 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -1402,7 +1402,7 @@ static int __init asus_acpi_init(void)
1402 return result; 1402 return result;
1403 } 1403 }
1404 1404
1405 asus_backlight_device = backlight_device_register("asus", NULL, 1405 asus_backlight_device = backlight_device_register("asus",NULL,NULL,
1406 &asus_backlight_data); 1406 &asus_backlight_data);
1407 if (IS_ERR(asus_backlight_device)) { 1407 if (IS_ERR(asus_backlight_device)) {
1408 printk(KERN_ERR "Could not register asus backlight device\n"); 1408 printk(KERN_ERR "Could not register asus backlight device\n");
diff --git a/drivers/acpi/ibm_acpi.c b/drivers/acpi/ibm_acpi.c
index 1397efb71341..da08b9c62ffc 100644
--- a/drivers/acpi/ibm_acpi.c
+++ b/drivers/acpi/ibm_acpi.c
@@ -1714,7 +1714,7 @@ static struct backlight_properties ibm_backlight_data = {
1714 1714
1715static int brightness_init(void) 1715static int brightness_init(void)
1716{ 1716{
1717 ibm_backlight_device = backlight_device_register("ibm", NULL, 1717 ibm_backlight_device = backlight_device_register("ibm", NULL, NULL,
1718 &ibm_backlight_data); 1718 &ibm_backlight_data);
1719 if (IS_ERR(ibm_backlight_device)) { 1719 if (IS_ERR(ibm_backlight_device)) {
1720 printk(IBM_ERR "Could not register backlight device\n"); 1720 printk(IBM_ERR "Could not register backlight device\n");
diff --git a/drivers/acpi/toshiba_acpi.c b/drivers/acpi/toshiba_acpi.c
index 2f35f891593f..88aeccbafaaf 100644
--- a/drivers/acpi/toshiba_acpi.c
+++ b/drivers/acpi/toshiba_acpi.c
@@ -590,7 +590,8 @@ static int __init toshiba_acpi_init(void)
590 remove_proc_entry(PROC_TOSHIBA, acpi_root_dir); 590 remove_proc_entry(PROC_TOSHIBA, acpi_root_dir);
591 } 591 }
592 592
593 toshiba_backlight_device = backlight_device_register("toshiba", NULL, 593 toshiba_backlight_device = backlight_device_register("toshiba",NULL,
594 NULL,
594 &toshiba_backlight_data); 595 &toshiba_backlight_data);
595 if (IS_ERR(toshiba_backlight_device)) { 596 if (IS_ERR(toshiba_backlight_device)) {
596 printk(KERN_ERR "Could not register toshiba backlight device\n"); 597 printk(KERN_ERR "Could not register toshiba backlight device\n");
diff --git a/drivers/misc/msi-laptop.c b/drivers/misc/msi-laptop.c
index fdb7153f4426..8e5e07e4c1cf 100644
--- a/drivers/misc/msi-laptop.c
+++ b/drivers/misc/msi-laptop.c
@@ -317,7 +317,8 @@ static int __init msi_init(void)
317 317
318 /* Register backlight stuff */ 318 /* Register backlight stuff */
319 319
320 msibl_device = backlight_device_register("msi-laptop-bl", NULL, &msibl_props); 320 msibl_device = backlight_device_register("msi-laptop-bl", NULL, NULL,
321 &msibl_props);
321 if (IS_ERR(msibl_device)) 322 if (IS_ERR(msibl_device))
322 return PTR_ERR(msibl_device); 323 return PTR_ERR(msibl_device);
323 324
diff --git a/drivers/usb/misc/appledisplay.c b/drivers/usb/misc/appledisplay.c
index 6b23a1def9fe..a4522e6c31ec 100644
--- a/drivers/usb/misc/appledisplay.c
+++ b/drivers/usb/misc/appledisplay.c
@@ -283,7 +283,7 @@ static int appledisplay_probe(struct usb_interface *iface,
283 /* Register backlight device */ 283 /* Register backlight device */
284 snprintf(bl_name, sizeof(bl_name), "appledisplay%d", 284 snprintf(bl_name, sizeof(bl_name), "appledisplay%d",
285 atomic_inc_return(&count_displays) - 1); 285 atomic_inc_return(&count_displays) - 1);
286 pdata->bd = backlight_device_register(bl_name, pdata, 286 pdata->bd = backlight_device_register(bl_name, NULL, NULL,
287 &appledisplay_bl_data); 287 &appledisplay_bl_data);
288 if (IS_ERR(pdata->bd)) { 288 if (IS_ERR(pdata->bd)) {
289 err("appledisplay: Backlight registration failed"); 289 err("appledisplay: Backlight registration failed");
diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c
index 27597c576eff..1d97cdf6f382 100644
--- a/drivers/video/backlight/backlight.c
+++ b/drivers/video/backlight/backlight.c
@@ -190,8 +190,10 @@ static int fb_notifier_callback(struct notifier_block *self,
190 * Creates and registers new backlight class_device. Returns either an 190 * Creates and registers new backlight class_device. Returns either an
191 * ERR_PTR() or a pointer to the newly allocated device. 191 * ERR_PTR() or a pointer to the newly allocated device.
192 */ 192 */
193struct backlight_device *backlight_device_register(const char *name, void *devdata, 193struct backlight_device *backlight_device_register(const char *name,
194 struct backlight_properties *bp) 194 struct device *dev,
195 void *devdata,
196 struct backlight_properties *bp)
195{ 197{
196 int i, rc; 198 int i, rc;
197 struct backlight_device *new_bd; 199 struct backlight_device *new_bd;
@@ -206,6 +208,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda
206 new_bd->props = bp; 208 new_bd->props = bp;
207 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev)); 209 memset(&new_bd->class_dev, 0, sizeof(new_bd->class_dev));
208 new_bd->class_dev.class = &backlight_class; 210 new_bd->class_dev.class = &backlight_class;
211 new_bd->class_dev.dev = dev;
209 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN); 212 strlcpy(new_bd->class_dev.class_id, name, KOBJ_NAME_LEN);
210 class_set_devdata(&new_bd->class_dev, devdata); 213 class_set_devdata(&new_bd->class_dev, devdata);
211 214
diff --git a/include/linux/backlight.h b/include/linux/backlight.h
index 75e91f5b6a04..a5cf1beacb44 100644
--- a/include/linux/backlight.h
+++ b/include/linux/backlight.h
@@ -54,7 +54,7 @@ struct backlight_device {
54}; 54};
55 55
56extern struct backlight_device *backlight_device_register(const char *name, 56extern struct backlight_device *backlight_device_register(const char *name,
57 void *devdata, struct backlight_properties *bp); 57 struct device *dev,void *devdata,struct backlight_properties *bp);
58extern void backlight_device_unregister(struct backlight_device *bd); 58extern void backlight_device_unregister(struct backlight_device *bd);
59 59
60#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev) 60#define to_backlight_device(obj) container_of(obj, struct backlight_device, class_dev)