of: Always use 'struct device.of_node' to get device node pointer.
[safe/jmp/linux-2.6] / drivers / usb / host / fhci-hcd.c
index 0951818..6135732 100644 (file)
@@ -27,6 +27,7 @@
 #include <linux/usb.h>
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
+#include <linux/slab.h>
 #include <asm/qe.h>
 #include <asm/fsl_gtm.h>
 #include "../core/hcd.h"
@@ -242,9 +243,10 @@ err:
 static void fhci_usb_free(void *lld)
 {
        struct fhci_usb *usb = lld;
-       struct fhci_hcd *fhci = usb->fhci;
+       struct fhci_hcd *fhci;
 
        if (usb) {
+               fhci = usb->fhci;
                fhci_config_transceiver(fhci, FHCI_PORT_POWER_OFF);
                fhci_ep0_free(usb);
                kfree(usb->actual_frame);
@@ -432,7 +434,7 @@ static int fhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb,
                return -ENOMEM;
 
        /* allocate the private part of the URB */
-       urb_priv->tds = kzalloc(size * sizeof(struct td), mem_flags);
+       urb_priv->tds = kcalloc(size, sizeof(*urb_priv->tds), mem_flags);
        if (!urb_priv->tds) {
                kfree(urb_priv);
                return -ENOMEM;
@@ -563,7 +565,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
                                   const struct of_device_id *ofid)
 {
        struct device *dev = &ofdev->dev;
-       struct device_node *node = ofdev->node;
+       struct device_node *node = dev->of_node;
        struct usb_hcd *hcd;
        struct fhci_hcd *fhci;
        struct resource usb_regs;
@@ -668,7 +670,7 @@ static int __devinit of_fhci_probe(struct of_device *ofdev,
        }
 
        for (j = 0; j < NUM_PINS; j++) {
-               fhci->pins[j] = qe_pin_request(ofdev->node, j);
+               fhci->pins[j] = qe_pin_request(node, j);
                if (IS_ERR(fhci->pins[j])) {
                        ret = PTR_ERR(fhci->pins[j]);
                        dev_err(dev, "can't get pin %d: %d\n", j, ret);
@@ -804,7 +806,7 @@ static int __devexit of_fhci_remove(struct of_device *ofdev)
        return fhci_remove(&ofdev->dev);
 }
 
-static struct of_device_id of_fhci_match[] = {
+static const struct of_device_id of_fhci_match[] = {
        { .compatible = "fsl,mpc8323-qe-usb", },
        {},
 };