mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 16:15:11 +00:00
xhci: dbc: Don't call dbc_tty_init() on every dbc tty probe
The current workaround to call the dbc_tty_init() in probe is not working in case we have several xhci devices with dbc enabled. dbc_tty_init() should be called only once by a module init call when module is loaded. until dbgtty is its own module call dbc_tty_init() from xhci module init call. Same is true for unloading and dbc_tty_exit() Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20220216095153.1303105-5-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
5c44d9d757
commit
6aec50009d
4 changed files with 30 additions and 20 deletions
|
@ -1087,3 +1087,13 @@ int xhci_dbc_resume(struct xhci_hcd *xhci)
|
|||
return ret;
|
||||
}
|
||||
#endif /* CONFIG_PM */
|
||||
|
||||
int xhci_dbc_init(void)
|
||||
{
|
||||
return dbc_tty_init();
|
||||
}
|
||||
|
||||
void xhci_dbc_exit(void)
|
||||
{
|
||||
dbc_tty_exit();
|
||||
}
|
||||
|
|
|
@ -196,6 +196,10 @@ static inline struct dbc_ep *get_out_ep(struct xhci_dbc *dbc)
|
|||
#ifdef CONFIG_USB_XHCI_DBGCAP
|
||||
int xhci_create_dbc_dev(struct xhci_hcd *xhci);
|
||||
void xhci_remove_dbc_dev(struct xhci_hcd *xhci);
|
||||
int xhci_dbc_init(void);
|
||||
void xhci_dbc_exit(void);
|
||||
int dbc_tty_init(void);
|
||||
void dbc_tty_exit(void);
|
||||
int xhci_dbc_tty_probe(struct device *dev, void __iomem *res, struct xhci_hcd *xhci);
|
||||
void xhci_dbc_tty_remove(struct xhci_dbc *dbc);
|
||||
struct xhci_dbc *xhci_alloc_dbc(struct device *dev, void __iomem *res,
|
||||
|
@ -219,7 +223,13 @@ static inline int xhci_create_dbc_dev(struct xhci_hcd *xhci)
|
|||
static inline void xhci_remove_dbc_dev(struct xhci_hcd *xhci)
|
||||
{
|
||||
}
|
||||
|
||||
static inline int xhci_dbc_init(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
static inline void xhci_dbc_exit(void)
|
||||
{
|
||||
}
|
||||
static inline int xhci_dbc_suspend(struct xhci_hcd *xhci)
|
||||
{
|
||||
return 0;
|
||||
|
|
|
@ -14,9 +14,6 @@
|
|||
#include "xhci.h"
|
||||
#include "xhci-dbgcap.h"
|
||||
|
||||
static int dbc_tty_init(void);
|
||||
static void dbc_tty_exit(void);
|
||||
|
||||
static struct tty_driver *dbc_tty_driver;
|
||||
|
||||
static inline struct dbc_port *dbc_to_port(struct xhci_dbc *dbc)
|
||||
|
@ -474,16 +471,12 @@ int xhci_dbc_tty_probe(struct device *dev, void __iomem *base, struct xhci_hcd *
|
|||
struct dbc_port *port;
|
||||
int status;
|
||||
|
||||
/* dbc_tty_init will be called by module init() in the future */
|
||||
status = dbc_tty_init();
|
||||
if (status)
|
||||
return status;
|
||||
if (!dbc_tty_driver)
|
||||
return -ENODEV;
|
||||
|
||||
port = kzalloc(sizeof(*port), GFP_KERNEL);
|
||||
if (!port) {
|
||||
status = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
if (!port)
|
||||
return -ENOMEM;
|
||||
|
||||
dbc_tty_driver->driver_state = port;
|
||||
|
||||
|
@ -501,9 +494,7 @@ int xhci_dbc_tty_probe(struct device *dev, void __iomem *base, struct xhci_hcd *
|
|||
return 0;
|
||||
out2:
|
||||
kfree(port);
|
||||
out:
|
||||
/* dbc_tty_exit will be called by module_exit() in the future */
|
||||
dbc_tty_exit();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -517,12 +508,9 @@ void xhci_dbc_tty_remove(struct xhci_dbc *dbc)
|
|||
|
||||
xhci_dbc_remove(dbc);
|
||||
kfree(port);
|
||||
|
||||
/* dbc_tty_exit will be called by module_exit() in the future */
|
||||
dbc_tty_exit();
|
||||
}
|
||||
|
||||
static int dbc_tty_init(void)
|
||||
int dbc_tty_init(void)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -552,7 +540,7 @@ static int dbc_tty_init(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void dbc_tty_exit(void)
|
||||
void dbc_tty_exit(void)
|
||||
{
|
||||
if (dbc_tty_driver) {
|
||||
tty_unregister_driver(dbc_tty_driver);
|
||||
|
|
|
@ -5495,6 +5495,7 @@ static int __init xhci_hcd_init(void)
|
|||
return -ENODEV;
|
||||
|
||||
xhci_debugfs_create_root();
|
||||
xhci_dbc_init();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -5506,6 +5507,7 @@ static int __init xhci_hcd_init(void)
|
|||
static void __exit xhci_hcd_fini(void)
|
||||
{
|
||||
xhci_debugfs_remove_root();
|
||||
xhci_dbc_exit();
|
||||
}
|
||||
|
||||
module_init(xhci_hcd_init);
|
||||
|
|
Loading…
Reference in a new issue