USB: remove fake "address-of" expressions
authorAlan Stern <stern@rowland.harvard.edu>
Thu, 5 Aug 2010 17:12:14 +0000 (13:12 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 10 Aug 2010 21:35:45 +0000 (14:35 -0700)
Fake "address-of" expressions that evaluate to NULL generally confuse
readers and can provoke compiler warnings.  This patch (as1412)
removes three such fake expressions, using "#ifdef"s in their place.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/core/driver.c
drivers/usb/core/usb.c
drivers/usb/host/uhci-debug.c
drivers/usb/host/uhci-hcd.c

index 880f65baf58137ff7c683fe461bce10d175c2d05..d7a4401ef0192e2a0d4870a5d27bee082b35890a 100644 (file)
@@ -1791,15 +1791,13 @@ static const struct dev_pm_ops usb_bus_pm_ops = {
        .runtime_idle =         usb_runtime_idle,
 };
 
-#else
-
-#define usb_bus_pm_ops (*(const struct dev_pm_ops *) NULL)
-
 #endif /* CONFIG_USB_SUSPEND */
 
 struct bus_type usb_bus_type = {
        .name =         "usb",
        .match =        usb_device_match,
        .uevent =       usb_uevent,
+#ifdef CONFIG_USB_SUSPEND
        .pm =           &usb_bus_pm_ops,
+#endif
 };
index 5ae14f6c1e7aca6ecbb860ce795bc4cd8ea1a6d8..fdd4130fbb7d7190a36226f1c96b994f452d0f79 100644 (file)
@@ -317,10 +317,6 @@ static const struct dev_pm_ops usb_device_pm_ops = {
        .restore =      usb_dev_restore,
 };
 
-#else
-
-#define usb_device_pm_ops      (*(struct dev_pm_ops *) NULL)
-
 #endif /* CONFIG_PM */
 
 
@@ -338,7 +334,9 @@ struct device_type usb_device_type = {
        .release =      usb_release_dev,
        .uevent =       usb_dev_uevent,
        .devnode =      usb_devnode,
+#ifdef CONFIG_PM
        .pm =           &usb_device_pm_ops,
+#endif
 };
 
 
index c168999722d148c86cf5e8d55f0f3a3dece10c9b..6e7fb5f38db6379f0318f223f31054798e4640f0 100644 (file)
@@ -17,7 +17,6 @@
 
 #include "uhci-hcd.h"
 
-#define uhci_debug_operations (* (const struct file_operations *) NULL)
 static struct dentry *uhci_debugfs_root;
 
 #ifdef DEBUG
@@ -558,7 +557,6 @@ static int uhci_debug_release(struct inode *inode, struct file *file)
        return 0;
 }
 
-#undef uhci_debug_operations
 static const struct file_operations uhci_debug_operations = {
        .owner =        THIS_MODULE,
        .open =         uhci_debug_open,
@@ -566,6 +564,7 @@ static const struct file_operations uhci_debug_operations = {
        .read =         uhci_debug_read,
        .release =      uhci_debug_release,
 };
+#define UHCI_DEBUG_OPS
 
 #endif /* CONFIG_DEBUG_FS */
 
index b04506036b6421c7c97c727550e80aa09bc4c690..f52d04db28f47f2e0b360ac90a87dd14d39ce7db 100644 (file)
@@ -597,7 +597,7 @@ static int uhci_start(struct usb_hcd *hcd)
        struct uhci_hcd *uhci = hcd_to_uhci(hcd);
        int retval = -EBUSY;
        int i;
-       struct dentry *dentry;
+       struct dentry __maybe_unused *dentry;
 
        hcd->uses_new_polling = 1;
 
@@ -607,18 +607,16 @@ static int uhci_start(struct usb_hcd *hcd)
        INIT_LIST_HEAD(&uhci->idle_qh_list);
        init_waitqueue_head(&uhci->waitqh);
 
-       if (DEBUG_CONFIGURED) {
-               dentry = debugfs_create_file(hcd->self.bus_name,
-                               S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root,
-                               uhci, &uhci_debug_operations);
-               if (!dentry) {
-                       dev_err(uhci_dev(uhci), "couldn't create uhci "
-                                       "debugfs entry\n");
-                       retval = -ENOMEM;
-                       goto err_create_debug_entry;
-               }
-               uhci->dentry = dentry;
+#ifdef UHCI_DEBUG_OPS
+       dentry = debugfs_create_file(hcd->self.bus_name,
+                       S_IFREG|S_IRUGO|S_IWUSR, uhci_debugfs_root,
+                       uhci, &uhci_debug_operations);
+       if (!dentry) {
+               dev_err(uhci_dev(uhci), "couldn't create uhci debugfs entry\n");
+               return -ENOMEM;
        }
+       uhci->dentry = dentry;
+#endif
 
        uhci->frame = dma_alloc_coherent(uhci_dev(uhci),
                        UHCI_NUMFRAMES * sizeof(*uhci->frame),
@@ -732,7 +730,6 @@ err_alloc_frame_cpu:
 err_alloc_frame:
        debugfs_remove(uhci->dentry);
 
-err_create_debug_entry:
        return retval;
 }