cosmetic: remove trailing whitespaces
[openwrt/staging/chunkeey.git] / target / linux / bcm53xx / patches-3.18 / 810-USB-bcma-make-helper-creating-platform-dev-more-gene.patch
1 From 5b4fed9fc917cc2bfc5297eeab03aeba5d340618 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= <zajec5@gmail.com>
3 Date: Tue, 16 Jun 2015 12:33:46 +0200
4 Subject: [PATCH] USB: bcma: make helper creating platform dev more generic
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Having "bool ohci" argument bounded us to two cases only and didn't
10 allow re-using this code for XHCI.
11
12 Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
13 ---
14 drivers/usb/host/bcma-hcd.c | 24 +++++++++++++-----------
15 1 file changed, 13 insertions(+), 11 deletions(-)
16
17 --- a/drivers/usb/host/bcma-hcd.c
18 +++ b/drivers/usb/host/bcma-hcd.c
19 @@ -249,7 +249,10 @@ static const struct usb_ehci_pdata ehci_
20 static const struct usb_ohci_pdata ohci_pdata = {
21 };
22
23 -static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev, bool ohci, u32 addr)
24 +static struct platform_device *bcma_hcd_create_pdev(struct bcma_device *dev,
25 + const char *name, u32 addr,
26 + const void *data,
27 + size_t size)
28 {
29 struct platform_device *hci_dev;
30 struct resource hci_res[2];
31 @@ -264,8 +267,7 @@ static struct platform_device *bcma_hcd_
32 hci_res[1].start = dev->irq;
33 hci_res[1].flags = IORESOURCE_IRQ;
34
35 - hci_dev = platform_device_alloc(ohci ? "ohci-platform" :
36 - "ehci-platform" , 0);
37 + hci_dev = platform_device_alloc(name, 0);
38 if (!hci_dev)
39 return ERR_PTR(-ENOMEM);
40
41 @@ -276,12 +278,8 @@ static struct platform_device *bcma_hcd_
42 ARRAY_SIZE(hci_res));
43 if (ret)
44 goto err_alloc;
45 - if (ohci)
46 - ret = platform_device_add_data(hci_dev, &ohci_pdata,
47 - sizeof(ohci_pdata));
48 - else
49 - ret = platform_device_add_data(hci_dev, &ehci_pdata,
50 - sizeof(ehci_pdata));
51 + if (data)
52 + ret = platform_device_add_data(hci_dev, data, size);
53 if (ret)
54 goto err_alloc;
55 ret = platform_device_add(hci_dev);
56 @@ -334,11 +332,15 @@ static int bcma_hcd_probe(struct bcma_de
57 && chipinfo->rev == 0)
58 ohci_addr = 0x18009000;
59
60 - usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr);
61 + usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, "ohci-platform",
62 + ohci_addr, &ohci_pdata,
63 + sizeof(ohci_pdata));
64 if (IS_ERR(usb_dev->ohci_dev))
65 return PTR_ERR(usb_dev->ohci_dev);
66
67 - usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr);
68 + usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, "ehci-platform",
69 + dev->addr, &ehci_pdata,
70 + sizeof(ehci_pdata));
71 if (IS_ERR(usb_dev->ehci_dev)) {
72 err = PTR_ERR(usb_dev->ehci_dev);
73 goto err_unregister_ohci_dev;