Skip to content

Commit

Permalink
usb: dwc2: move debugfs code to a separate file
Browse files Browse the repository at this point in the history
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 <johnyoun@synopsys.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
  • Loading branch information
Mian Yousaf Kaukab authored and Felipe Balbi committed Apr 29, 2015
1 parent b189a21 commit f91eea4
Show file tree
Hide file tree
Showing 6 changed files with 456 additions and 407 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/dwc2/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ ifneq ($(filter y,$(CONFIG_USB_DWC2_PERIPHERAL) $(CONFIG_USB_DWC2_DUAL_ROLE)),)
dwc2-y += gadget.o
endif

ifneq ($(CONFIG_DEBUG_FS),)
dwc2-y += debugfs.o
endif

# NOTE: The previous s3c-hsotg peripheral mode only driver has been moved to
# this location and renamed gadget.c. When building for dynamically linked
# modules, dwc2.ko will get built for host mode, peripheral mode, and dual-role
Expand Down
7 changes: 4 additions & 3 deletions drivers/usb/dwc2/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -615,9 +615,6 @@ struct dwc2_hsotg {
enum dwc2_lx_state lx_state;

struct dentry *debug_root;
struct dentry *debug_file;
struct dentry *debug_testmode;
struct dentry *debug_fifo;

/* DWC OTG HW Release versions */
#define DWC2_CORE_REV_2_71a 0x4f54271a
Expand Down Expand Up @@ -1005,6 +1002,7 @@ extern void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
bool reset);
extern void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg);
extern void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2);
extern int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg, int testmode);
#else
static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
{ return 0; }
Expand All @@ -1018,6 +1016,9 @@ static inline void s3c_hsotg_core_init_disconnected(struct dwc2_hsotg *dwc2,
bool reset) {}
static inline void s3c_hsotg_core_connect(struct dwc2_hsotg *hsotg) {}
static inline void s3c_hsotg_disconnect(struct dwc2_hsotg *dwc2) {}
static inline int s3c_hsotg_set_test_mode(struct dwc2_hsotg *hsotg,
int testmode)
{ return 0; }
#endif

#if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
Expand Down
27 changes: 27 additions & 0 deletions drivers/usb/dwc2/debug.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
* debug.h - Designware USB2 DRD controller debug header
*
* Copyright (C) 2015 Intel Corporation
* Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 of
* the License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#include "core.h"

#ifdef CONFIG_DEBUG_FS
extern int dwc2_debugfs_init(struct dwc2_hsotg *);
extern void dwc2_debugfs_exit(struct dwc2_hsotg *);
#else
static inline int dwc2_debugfs_init(struct dwc2_hsotg *hsotg)
{ return 0; }
static inline void dwc2_debugfs_exit(struct dwc2_hsotg *hsotg)
{ }
#endif
Loading

0 comments on commit f91eea4

Please sign in to comment.