diff options
author | Peter Chen <peter.chen@freescale.com> | 2015-08-17 10:23:03 +0800 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2015-10-13 03:46:06 +0100 |
commit | 586491f5bed09e099499642b3ad3ffdbe6f240b5 (patch) | |
tree | 8112187772d566b000596a2eb73eef3a9f5d30a8 | |
parent | 8ba4fa58a862cb28ad9e014545c1fd7533643c80 (diff) | |
download | kernel_samsung_smdk4412-586491f5bed09e099499642b3ad3ffdbe6f240b5.zip kernel_samsung_smdk4412-586491f5bed09e099499642b3ad3ffdbe6f240b5.tar.gz kernel_samsung_smdk4412-586491f5bed09e099499642b3ad3ffdbe6f240b5.tar.bz2 |
usb: host: ehci-sys: delete useless bus_to_hcd conversion
commit 0521cfd06e1ebcd575e7ae36aab068b38df23850 upstream.
The ehci platform device's drvdata is the pointer of struct usb_hcd
already, so we doesn't need to call bus_to_hcd conversion again.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[bwh: Backported to 3.2: Unfortunately some EHCI platform sub-drivers
point drvdata to a private structure, so only create and remove the
attributes if drvdata has been set as expected.]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r-- | drivers/usb/host/ehci-sysfs.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-sysfs.c b/drivers/usb/host/ehci-sysfs.c index 14ced00..ddaaead 100644 --- a/drivers/usb/host/ehci-sysfs.c +++ b/drivers/usb/host/ehci-sysfs.c @@ -29,7 +29,7 @@ static ssize_t show_companion(struct device *dev, int count = PAGE_SIZE; char *ptr = buf; - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); + ehci = hcd_to_ehci(dev_get_drvdata(dev)); nports = HCS_N_PORTS(ehci->hcs_params); for (index = 0; index < nports; ++index) { @@ -54,7 +54,7 @@ static ssize_t store_companion(struct device *dev, struct ehci_hcd *ehci; int portnum, new_owner; - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); + ehci = hcd_to_ehci(dev_get_drvdata(dev)); new_owner = PORT_OWNER; /* Owned by companion */ if (sscanf(buf, "%d", &portnum) != 1) return -EINVAL; @@ -85,7 +85,7 @@ static ssize_t show_uframe_periodic_max(struct device *dev, struct ehci_hcd *ehci; int n; - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); + ehci = hcd_to_ehci(dev_get_drvdata(dev)); n = scnprintf(buf, PAGE_SIZE, "%d\n", ehci->uframe_periodic_max); return n; } @@ -102,7 +102,7 @@ static ssize_t store_uframe_periodic_max(struct device *dev, unsigned long flags; ssize_t ret; - ehci = hcd_to_ehci(bus_to_hcd(dev_get_drvdata(dev))); + ehci = hcd_to_ehci(dev_get_drvdata(dev)); if (kstrtouint(buf, 0, &uframe_periodic_max) < 0) return -EINVAL; @@ -167,6 +167,9 @@ static inline int create_sysfs_files(struct ehci_hcd *ehci) struct device *controller = ehci_to_hcd(ehci)->self.controller; int i = 0; + if (dev_get_drvdata(controller) != ehci_to_hcd(ehci)) + return 0; + /* with integrated TT there is no companion! */ if (!ehci_is_TDI(ehci)) i = device_create_file(controller, &dev_attr_companion); @@ -182,6 +185,9 @@ static inline void remove_sysfs_files(struct ehci_hcd *ehci) { struct device *controller = ehci_to_hcd(ehci)->self.controller; + if (dev_get_drvdata(controller) != ehci_to_hcd(ehci)) + return; + /* with integrated TT there is no companion! */ if (!ehci_is_TDI(ehci)) device_remove_file(controller, &dev_attr_companion); |