Skip to content

Commit f91eea4

Browse files
Mian Yousaf KaukabFelipe Balbi
authored andcommitted
usb: dwc2: move debugfs code to a separate file
Prepare to add more debug code. Moreover, don't save dentry * for each file in struct dwc2_hsotg as clean up is done with debugfs_remove_recursive(). s3c_hsotg_delete_debug() is removed altogether for the same reason. Acked-by: John Youn <[email protected]> Signed-off-by: Mian Yousaf Kaukab <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
1 parent b189a21 commit f91eea4

File tree

6 files changed

+456
-407
lines changed

6 files changed

+456
-407
lines changed

drivers/usb/dwc2/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
1313
dwc2-y += gadget.o
1414
endif
1515

16+
ifneq ($(CONFIG_DEBUG_FS),)
17+
dwc2-y += debugfs.o
18+
endif
19+
1620
# NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to
1721
# this location and renamed gadget.c. When building for dynamically linked
1822
# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role

drivers/usb/dwc2/core.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,9 +615,6 @@ struct dwc2_hsotg {
615615
enum dwc2_lx_state lx_state;
616616

617617
struct dentry *debug_root;
618-
struct dentry *debug_file;
619-
struct dentry *debug_testmode;
620-
struct dentry *debug_fifo;
621618

622619
/* DWC OTG HW Release versions */
623620
#define DWC2_CORE_REV_2_71a 0x4f54271a
@@ -1005,6 +1002,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
10051002
bool reset);
10061003
extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
10071004
extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2);
1005+
extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode);
10081006
#else
10091007
static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
10101008
{ return 0; }
@@ -1018,6 +1016,9 @@ static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
10181016
bool reset) {}
10191017
static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
10201018
static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {}
1019+
static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg,
1020+
int testmode)
1021+
{ return 0; }
10211022
#endif
10221023

10231024
#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)

drivers/usb/dwc2/debug.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/**
2+
* debug.h - Designware USB2 DRD controller debug header
3+
*
4+
* Copyright (C) 2015 Intel Corporation
5+
* Mian Yousaf Kaukab <[email protected]>
6+
*
7+
* This program is free software: you can redistribute it and/or modify
8+
* it under the terms of the GNU General Public License version 2 of
9+
* the License as published by the Free Software Foundation.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*/
16+
17+
#include "core.h"
18+
19+
#ifdef CONFIG_DEBUG_FS
20+
extern int dwc2_debugfs_init(struct dwc2_hsotg *);
21+
extern void dwc2_debugfs_exit(struct dwc2_hsotg *);
22+
#else
23+
static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
24+
{ return 0; }
25+
static inline void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg)
26+
{ }
27+
#endif

0 commit comments

Comments
 (0)