Staging: vt6656: code cleanup in vt6656_suspend()/vt6656_resume()
authorAndres More <more.andres@gmail.com>
Mon, 21 Jun 2010 18:35:43 +0000 (15:35 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 22 Jun 2010 22:42:31 +0000 (15:42 -0700)
Not changed PSDevice priv struct, just fixed style and removed printks.

Signed-off-by: Andres More <more.andres@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/vt6656/main_usb.c

index 099af65ce192a22acda10243bd4d3126ddefd5d9..8e61cfd51d2faba62763bd51d166afe22a57cdc0 100644 (file)
@@ -718,33 +718,32 @@ static BOOL device_release_WPADEV(PSDevice pDevice)
 
 static int vt6656_suspend(struct usb_interface *intf, pm_message_t message)
 {
- PSDevice  pDevice = usb_get_intfdata(intf);
- struct net_device *dev = pDevice->dev;
+       PSDevice device = usb_get_intfdata(intf);
 
- printk("VNTWUSB Suspend Start======>\n");
-if(dev != NULL) {
-  if(pDevice->flags & DEVICE_FLAGS_OPENED)
-     device_close(dev);
-}
+       if (!device || !device->dev)
+               return -ENODEV;
+
+       if (device->flags & DEVICE_FLAGS_OPENED)
+               device_close(device->dev);
+
+       usb_put_dev(interface_to_usbdev(intf));
 
- usb_put_dev(interface_to_usbdev(intf));
- return 0;
+       return 0;
 }
 
 static int vt6656_resume(struct usb_interface *intf)
 {
- PSDevice  pDevice = usb_get_intfdata(intf);
- struct net_device *dev = pDevice->dev;
-
- printk("VNTWUSB Resume Start======>\n");
- if(dev != NULL) {
-  usb_get_dev(interface_to_usbdev(intf));
-  if(!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
-    if(device_open(dev)!=0)
-        printk("VNTWUSB Resume Start======>open fail\n");
-   }
- }
- return 0;
+       PSDevice device = usb_get_intfdata(intf);
+
+       if (!device || !device->dev)
+               return -ENODEV;
+
+       usb_get_dev(interface_to_usbdev(intf));
+
+       if (!(device->flags & DEVICE_FLAGS_OPENED))
+               device_open(device->dev);
+
+       return 0;
 }
 
 #endif /* CONFIG_PM */