Skip to content

Commit

Permalink
fix up the "if we don't find the device, what do we do?" logic a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
gregkh committed Aug 14, 2009
1 parent 9045774 commit 0b769c0
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions samsung-backlight.c
@@ -1,5 +1,5 @@
/*
* Samsung N130 Laptop Backlight driver
* Samsung N130 and NC10 Laptop Backlight driver
*
* Copyright (C) 2009 Greg Kroah-Hartman (gregkh@suse.de)
* Copyright (C) 2009 Novell Inc.
Expand Down Expand Up @@ -49,8 +49,6 @@ static int update_status(struct backlight_device *bd)
{
if (!pci_device)
return -ENODEV;
if (!backlight_device)
return -ENODEV;

current_brightness = bd->props.brightness;
set_brightness();
Expand All @@ -67,13 +65,17 @@ static int find_video_card(void)
struct pci_dev *dev = NULL;

while ((dev = pci_get_device(0x8086, 0x27ae, dev)) != NULL) {
/* Found one, so let's save it off */
if (!pci_device)
pci_device = pci_dev_get(dev);
/*
* Found one, so let's save it off and break
* Note that the reference is still raised on
* the PCI device here.
*/
pci_device = dev;
break;
}

if (!pci_device)
return 0;
return -ENODEV;

/* create a backlight device to talk to this one */
backlight_device = backlight_device_register("samsung",
Expand Down Expand Up @@ -148,7 +150,7 @@ module_init(samsung_init);
module_exit(samsung_exit);

MODULE_AUTHOR("Greg Kroah-Hartman <gregkh@suse.de>");
MODULE_DESCRIPTION("Samsung N130 Backlight driver");
MODULE_DESCRIPTION("Samsung Backlight driver");
MODULE_LICENSE("GPL");
module_param(offset, int, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(offset, "The offset into the PCI device for the brightness control");
Expand Down

0 comments on commit 0b769c0

Please sign in to comment.