Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754566AbcKJIWk (ORCPT ); Thu, 10 Nov 2016 03:22:40 -0500 Received: from mail-co1nam03on0056.outbound.protection.outlook.com ([104.47.40.56]:6608 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751725AbcKJIWg (ORCPT ); Thu, 10 Nov 2016 03:22:36 -0500 Authentication-Results: spf=none (sender IP is 192.88.168.50) smtp.mailfrom=lvd5587.freescale.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=fail action=none header.from=nxp.com; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:1022;Count:11 From: Sriram Dash To: , CC: , , , , , , Arnd Bergmann , Sriram Dash Subject: [PATCH v3 5/6] usb: dwc3: use bus->sysdev for DMA configuration Date: Thu, 10 Nov 2016 13:50:00 +0530 Message-ID: <1478766001-26463-6-git-send-email-sriram.dash@nxp.com> X-Mailer: git-send-email 1.7.7.4 In-Reply-To: <1478766001-26463-1-git-send-email-sriram.dash@nxp.com> References: <1478766001-26463-1-git-send-email-sriram.dash@nxp.com> X-IncomingHeaderCount: 11 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131232397527556835;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(6039001)(7916002)(2980300002)(428002)(189002)(199003)(356003)(626004)(4720700003)(46386002)(2906002)(7846002)(8666005)(81156014)(8676002)(5660300001)(4326007)(305945005)(81166006)(6666003)(103686003)(33646002)(92566002)(105586002)(106466001)(7416002)(42186005)(5001770100001)(97736004)(42882006)(36756003)(2950100002)(47776003)(68736007)(90966002)(586003)(50986999)(76176999)(86372001)(48376002)(50466002)(575784001)(50226002)(8936002)(45336002)(101416001)(52956003)(189998001)(5003940100001)(87936001)(7059030);DIR:OUT;SFP:1101;SCL:1;SRVR:CY4PR03MB2744;H:tx30smr01.am.freescale.net;FPR:;SPF:None;PTR:InfoDomainNonexistent;MX:1;A:0;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1AFFO11OLC003;1:ZvADoWkG1tSBMkb8UhU1BA5jCjb2IVF7Mh+KY42i2Ldvde57BT7P+QhQJ8Md4bsYKHjEXcaemvS8C/Wp9ywmzgXO30b2Qe1k26eHxbqhHaBL0NTpm281M4KmifSDPosTgd98wZeDeiI8iQ9HAyHoE0FJ5pXahfAC2Sye4ZwdUAVPm6h4uSvqVWtt8gnv7e9qDtez7BGBnfUnWihNyXPoSECOKzTodD4J518OVVqXLJSScjtJ3lUNPuhAgp0dQ3lFurUG20/P/jLn+4IeHV0jDLrzPZ01SeJ2pmZgfEL/ovQ1sD+Uz0hjd7x3NYXeOC9cqvh8TioiXI1Yq4CyEu8J7SsycgN9hvvyKDJ1UN24SdmqvRPKGRcS8ONHnHJ0kI10yndN4Y2iDQXnelu5idXUgjV7uUrn6TO/kgbem3cwXota9W1GDo6q3hE9LDRDwGPkJSaAYu+jdRu+Dbdrif3W0E8PTDl8VA7UYz6YtER7kR2YL1xaJxpsx6XBkukxjhiYXaUoA7IZSVl2PC4pmxhAPtS5ATGG/mRpm/xzFhJd2UhObzo4az2+e6OZ1iuH1+QCe4QOjkabfdlBJ3VuTrN6Ul4aA7XOjZxYO/5+N7wF1zJNvRQFJn//K2qGFzKx02Q6BEqe93xado/ROhWeO7s1BQ== MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2744;2:r0JPM20IURZN6JYdbgHCGCKUsvdLvBmXcfgaUZUxHNgTB04b1oCFCk2+uHPeR1/8FJ+zMUcOb3NGjqoZ5TteUtBFpu4R60x7bLAq/NWoXfbZ2KsSxHt/0QBrf7BAgUT3Y5UP2EApFO0cnkIAE1877dt7jIZwMduLThbG9hcz1wI=;3:6fRuolyQmN3m0M+C7Ui+m3M782J96hNGaEfIKNLddQYt53i6yAYSnDe2O9+iLfewOknIhZ7FZp4ZLthF2FA7/hS8i2Tl4WOa/6Vnhz7pJyi1yP+HKS52bdQ7sn8wd18NI7Kofmec5Bonx6sV6xJAOKBUtk81FZwwCXDrs1OgoMOTUuGdsjrAQuzhLtHYroElJOZTfrMXWolMAR1tAK9eICzGy/jIrb82QPIKCYtG5PnRp6OX93PP86LnEd+1MQ+v+PZX9Z7/1CbuzVTATBwSPw==;25:NdAVZSNbQONU/0fD5bBQ9P5QNt/3ft7Mk3vkVh5DOKHKo0FG4mztNtUDNbMGYMxxesiwQkG8eZb2+P0Se29k7IuNPgT2TBjWLX0rnahJJyJdmie7rISFlrCNENhkzRJoFyKR/AwsBMsowaLhs2lxwT3Qp63Kuv1htPDry7XrtnaT/7iCPhfJqxT87FGJh1Pd8+6hsA7ep3IJNRlSizPkNVtVAqkCj2rEq1DDb/6CjKkL2Hr4SHheCv9ghFX4ZPp6GNbmBhA9ld/ZalekkwEhcdVcZ9WkbJWoXTIBCMFCj7ZEKQw+xRdYoKgmWrStJYceS5XHoki7lneX/ZS2KFdu/1zOn800PoezboS2Q+nEegkMBNuQ46gxFEXeQVv/u/Q4Qpua2Eot5FEy9GnQf2SfXb3qmgqazuvlopwkeN4oN7g5s0crwr9tbnzcCSnBQdy7qLG1Bk3CPQJrR74JXxZduA== X-MS-Office365-Filtering-Correlation-Id: 3dc8320a-01f5-4f3a-17eb-08d40942b80b X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY4PR03MB2744; X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2744;31:/Ybyye6a4r8E4NcnShUIc0P+RJ5JYSfdNMGvyGLh1ubgoaOi9Zs152LzhohzwhbrOtmXBdjYUjCgCZ4q/JaF5k2/cDR6eClbG1TbqpIRt9Y8txs/BJYaECHj4Yl8KAhGeBrqKvx4spdRkZj5r/eNAzsQ9sjJb9inp+g+9wx77jYxM9WpJ8J3ZxQagPcjkI2vhZDl0YJh+wScnDbXapBaRKh4xaD22+oUUMPf//6Q7d5cNICVXLJoEgkuAcDn8oMSHPDaEEJddwf/QBLj//ji9nMtnpaMsDciAwLBQ9TxmuE=;4:YsyOajcexQSi/s0bkZu3hMkKO/sSvEgIc1En8yp7j9PaB4lD1cu5KYwem4BTa8aMI2r90LP4XNIVlZ67+DzBDbguNk17EXEhVTIdfLPP/QWVq74cUtUNKicJmAazXwTFIv6OkmuQzSkZWV2bhoXcStRK7EXQi+jkFdVpmFkrheZYYcyWFtIdcyFsXbN7gDthn53xQVKOBcqjDsCXTp+Z9rD4lf4UT9cUCv9wzS68bEpQZ6ZPeX03VNGxczBdzR+OxvUN0n0VHUyqGZ20kks/gmRo7qQQU3u4hNja4F0byMNMeoEZK+9grmCoroeNDnq93yNF5qztYjYB9ZGjYo4DP9yAMBDZeQwoNC8bfRLiUOWnRKfJb+bu98Ft/7H5s9hXLa2rddzUnZ9nWkTd/wAyEvm5b+X54wjRsu+69/tyw/3dCZBuwUGVVjdkKmCfHdw4CYJWaD/TXmAPE5U1w+0NsddbkjWVks6LwEP7Me8DsSku0JvgXGrJdSwWjBHIba6Ylxqm3uGOizcZTQDT94RB2T4KZWXd0AKybNDvFFNj8rFCHfn3zesZrpJwW0ebxlAw X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(13024025)(8121501046)(13018025)(13017025)(13015025)(13023025)(3002001)(10201501046)(6055026);SRVR:CY4PR03MB2744;BCL:0;PCL:0;RULEID:(400006);SRVR:CY4PR03MB2744; X-Forefront-PRVS: 01221E3973 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;CY4PR03MB2744;23:CM8eKDomGoYSKKfI392V4Bf2nJYclmqXaNdyEIEYu?= =?us-ascii?Q?6wToDl4gfXcLQ/Ay8G/xeEPfdf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etadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY4PR03MB2744;7:cSePw6e9lNQCZnV1gdP67ZBjqnjtUAcgrTrm6TVnR6f5bCJGqwLJVPuoPfT87W9imfGDR6J21Uv53kUZmGJo8vUqayNxODv2CAWRhQOa7OF6Lux/wKOfIYF8eUjT7izu+gPM3d6s09iU06Lzii2POTKoOEarKCDaHMWm0tNxpdibhBsSuMDJb6FNwvh0lrVUO2wehOA2/MWX+q1gtAPIdVXy99fctzmIwWQqrWFjARMutHqkuX+1Kv7nJ8duQemG1tSCpmr6XEl4NMfoRlVIVcZlXDSf62PSEV4NqL8Kp2EWeMPjX691L4O3Q02V0kCPdaPG7elM0MUFOFtY1kJLp55OdSTy56jJn+0l0/wQxvU= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Nov 2016 08:22:32.4592 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR03MB2744 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10436 Lines: 318 From: Arnd Bergmann The dma ops for dwc3 devices are not set properly. So, use a physical device sysdev, which will be inherited from parent, to set the hardware / firmware parameters like dma. Signed-off-by: Arnd Bergmann Signed-off-by: Sriram Dash --- Changes in v3: - No update Changes in v2: - integrate dwc3 driver changes together drivers/usb/dwc3/core.c | 28 +++++++++++++++------------- drivers/usb/dwc3/core.h | 1 + drivers/usb/dwc3/ep0.c | 8 ++++---- drivers/usb/dwc3/gadget.c | 37 +++++++++++++++++++------------------ drivers/usb/dwc3/host.c | 12 ++++-------- 5 files changed, 43 insertions(+), 43 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 7287a76..0af0dc0 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -229,7 +230,7 @@ static void dwc3_frame_length_adjustment(struct dwc3 *dwc) static void dwc3_free_one_event_buffer(struct dwc3 *dwc, struct dwc3_event_buffer *evt) { - dma_free_coherent(dwc->dev, evt->length, evt->buf, evt->dma); + dma_free_coherent(dwc->sysdev, evt->length, evt->buf, evt->dma); } /** @@ -251,7 +252,7 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, evt->dwc = dwc; evt->length = length; - evt->buf = dma_alloc_coherent(dwc->dev, length, + evt->buf = dma_alloc_coherent(dwc->sysdev, length, &evt->dma, GFP_KERNEL); if (!evt->buf) return ERR_PTR(-ENOMEM); @@ -370,11 +371,11 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) if (!WARN_ON(dwc->scratchbuf)) return 0; - scratch_addr = dma_map_single(dwc->dev, dwc->scratchbuf, + scratch_addr = dma_map_single(dwc->sysdev, dwc->scratchbuf, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); - if (dma_mapping_error(dwc->dev, scratch_addr)) { - dev_err(dwc->dev, "failed to map scratch buffer\n"); + if (dma_mapping_error(dwc->sysdev, scratch_addr)) { + dev_err(dwc->sysdev, "failed to map scratch buffer\n"); ret = -EFAULT; goto err0; } @@ -398,7 +399,7 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc) return 0; err1: - dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch * + dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); err0: @@ -417,7 +418,7 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc) if (!WARN_ON(dwc->scratchbuf)) return; - dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch * + dma_unmap_single(dwc->sysdev, dwc->scratch_addr, dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL); kfree(dwc->scratchbuf); } @@ -943,6 +944,13 @@ static int dwc3_probe(struct platform_device *pdev) dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1); dwc->mem = mem; dwc->dev = dev; +#ifdef CONFIG_PCI + /* TODO: or some other way of detecting this? */ + if (dwc->dev->parent && dwc->dev->parent->bus == &pci_bus_type) + dwc->sysdev = dwc->dev->parent; + else +#endif + dwc->sysdev = dwc->dev; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { @@ -1051,12 +1059,6 @@ static int dwc3_probe(struct platform_device *pdev) spin_lock_init(&dwc->lock); - if (!dev->dma_mask) { - dev->dma_mask = dev->parent->dma_mask; - dev->dma_parms = dev->parent->dma_parms; - dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask); - } - pm_runtime_set_active(dev); pm_runtime_use_autosuspend(dev); pm_runtime_set_autosuspend_delay(dev, DWC3_DEFAULT_AUTOSUSPEND_DELAY); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 6b60e42..b166b0a 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -851,6 +851,7 @@ struct dwc3 { spinlock_t lock; struct device *dev; + struct device *sysdev; struct platform_device *xhci; struct resource xhci_resources[DWC3_XHCI_RESOURCES_NUM]; diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c index fe79d77..4d13723 100644 --- a/drivers/usb/dwc3/ep0.c +++ b/drivers/usb/dwc3/ep0.c @@ -974,8 +974,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, u32 transfer_size = 0; u32 maxpacket; - ret = usb_gadget_map_request(&dwc->gadget, &req->request, - dep->number); + ret = usb_gadget_map_request_by_dev(dwc->sysdev, + &req->request, dep->number); if (ret) { dwc3_trace(trace_dwc3_ep0, "failed to map request"); return; @@ -1002,8 +1002,8 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc, dwc->ep0_bounce_addr, transfer_size, DWC3_TRBCTL_CONTROL_DATA, false); } else { - ret = usb_gadget_map_request(&dwc->gadget, &req->request, - dep->number); + ret = usb_gadget_map_request_by_dev(dwc->sysdev, + &req->request, dep->number); if (ret) { dwc3_trace(trace_dwc3_ep0, "failed to map request"); return; diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 1dfa56a5f..84fff5e 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -185,8 +185,8 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req, if (dwc->ep0_bounced && dep->number == 0) dwc->ep0_bounced = false; else - usb_gadget_unmap_request(&dwc->gadget, &req->request, - req->direction); + usb_gadget_unmap_request_by_dev(dwc->sysdev, + &req->request, req->direction); trace_dwc3_gadget_giveback(req); @@ -365,7 +365,7 @@ static int dwc3_alloc_trb_pool(struct dwc3_ep *dep) if (dep->trb_pool) return 0; - dep->trb_pool = dma_alloc_coherent(dwc->dev, + dep->trb_pool = dma_alloc_coherent(dwc->sysdev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, &dep->trb_pool_dma, GFP_KERNEL); if (!dep->trb_pool) { @@ -381,7 +381,7 @@ static void dwc3_free_trb_pool(struct dwc3_ep *dep) { struct dwc3 *dwc = dep->dwc; - dma_free_coherent(dwc->dev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, + dma_free_coherent(dwc->sysdev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM, dep->trb_pool, dep->trb_pool_dma); dep->trb_pool = NULL; @@ -989,8 +989,8 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param) * here and stop, unmap, free and del each of the linked * requests instead of what we do now. */ - usb_gadget_unmap_request(&dwc->gadget, &req->request, - req->direction); + usb_gadget_unmap_request_by_dev(dwc->sysdev, + &req->request, req->direction); list_del(&req->list); return ret; } @@ -1063,8 +1063,8 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) trace_dwc3_ep_queue(req); - ret = usb_gadget_map_request(&dwc->gadget, &req->request, - dep->direction); + ret = usb_gadget_map_request_by_dev(dwc->sysdev, &req->request, + dep->direction); if (ret) return ret; @@ -2889,7 +2889,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc->irq_gadget = irq; - dwc->ctrl_req = dma_alloc_coherent(dwc->dev, sizeof(*dwc->ctrl_req), + dwc->ctrl_req = dma_alloc_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), &dwc->ctrl_req_addr, GFP_KERNEL); if (!dwc->ctrl_req) { dev_err(dwc->dev, "failed to allocate ctrl request\n"); @@ -2897,8 +2897,9 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err0; } - dwc->ep0_trb = dma_alloc_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, - &dwc->ep0_trb_addr, GFP_KERNEL); + dwc->ep0_trb = dma_alloc_coherent(dwc->sysdev, + sizeof(*dwc->ep0_trb) * 2, + &dwc->ep0_trb_addr, GFP_KERNEL); if (!dwc->ep0_trb) { dev_err(dwc->dev, "failed to allocate ep0 trb\n"); ret = -ENOMEM; @@ -2911,7 +2912,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) goto err2; } - dwc->ep0_bounce = dma_alloc_coherent(dwc->dev, + dwc->ep0_bounce = dma_alloc_coherent(dwc->sysdev, DWC3_EP0_BOUNCE_SIZE, &dwc->ep0_bounce_addr, GFP_KERNEL); if (!dwc->ep0_bounce) { @@ -2983,18 +2984,18 @@ int dwc3_gadget_init(struct dwc3 *dwc) err4: dwc3_gadget_free_endpoints(dwc); - dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, + dma_free_coherent(dwc->sysdev, DWC3_EP0_BOUNCE_SIZE, dwc->ep0_bounce, dwc->ep0_bounce_addr); err3: kfree(dwc->setup_buf); err2: - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, dwc->ep0_trb, dwc->ep0_trb_addr); err1: - dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req), + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), dwc->ctrl_req, dwc->ctrl_req_addr); err0: @@ -3009,16 +3010,16 @@ void dwc3_gadget_exit(struct dwc3 *dwc) dwc3_gadget_free_endpoints(dwc); - dma_free_coherent(dwc->dev, DWC3_EP0_BOUNCE_SIZE, + dma_free_coherent(dwc->sysdev, DWC3_EP0_BOUNCE_SIZE, dwc->ep0_bounce, dwc->ep0_bounce_addr); kfree(dwc->setup_buf); kfree(dwc->zlp_buf); - dma_free_coherent(dwc->dev, sizeof(*dwc->ep0_trb) * 2, + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ep0_trb) * 2, dwc->ep0_trb, dwc->ep0_trb_addr); - dma_free_coherent(dwc->dev, sizeof(*dwc->ctrl_req), + dma_free_coherent(dwc->sysdev, sizeof(*dwc->ctrl_req), dwc->ctrl_req, dwc->ctrl_req_addr); } diff --git a/drivers/usb/dwc3/host.c b/drivers/usb/dwc3/host.c index f6533c6..045ec27 100644 --- a/drivers/usb/dwc3/host.c +++ b/drivers/usb/dwc3/host.c @@ -72,11 +72,7 @@ int dwc3_host_init(struct dwc3 *dwc) return -ENOMEM; } - dma_set_coherent_mask(&xhci->dev, dwc->dev->coherent_dma_mask); - xhci->dev.parent = dwc->dev; - xhci->dev.dma_mask = dwc->dev->dma_mask; - xhci->dev.dma_parms = dwc->dev->dma_parms; dwc->xhci = xhci; @@ -112,9 +108,9 @@ int dwc3_host_init(struct dwc3 *dwc) return 0; err2: phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", - dev_name(&xhci->dev)); + dev_name(dwc->dev)); phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", - dev_name(&xhci->dev)); + dev_name(dwc->dev)); err1: platform_device_put(xhci); return ret; @@ -123,8 +119,8 @@ int dwc3_host_init(struct dwc3 *dwc) void dwc3_host_exit(struct dwc3 *dwc) { phy_remove_lookup(dwc->usb2_generic_phy, "usb2-phy", - dev_name(&dwc->xhci->dev)); + dev_name(dwc->dev)); phy_remove_lookup(dwc->usb3_generic_phy, "usb3-phy", - dev_name(&dwc->xhci->dev)); + dev_name(dwc->dev)); platform_device_unregister(dwc->xhci); } -- 2.1.0