mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-14 12:37:32 +00:00
tty: serial: pch_uart.c: remove debugfs dentry pointer
No need to keep around the dentry pointer for the debugfs file if all it is used for is to remove it when we are wanting to clean up, as the pointer can be looked up directly from debugfs instead. This also removes pointless #ifdef CONFIG_DEBUG_FS brackets as the compiler is smart enough to handle this properly if debugfs is disabled without us having to worry about it. Cc: Jiri Slaby <jirislaby@kernel.org> Cc: linux-serial@vger.kernel.org Link: https://lore.kernel.org/r/20210216145900.3835160-1-gregkh@linuxfoundation.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
a38fd87484
commit
4dec5f1af6
1 changed files with 7 additions and 12 deletions
|
@ -236,7 +236,6 @@ struct eg20t_port {
|
||||||
void *rx_buf_virt;
|
void *rx_buf_virt;
|
||||||
dma_addr_t rx_buf_dma;
|
dma_addr_t rx_buf_dma;
|
||||||
|
|
||||||
struct dentry *debugfs;
|
|
||||||
#define IRQ_NAME_SIZE 17
|
#define IRQ_NAME_SIZE 17
|
||||||
char irq_name[IRQ_NAME_SIZE];
|
char irq_name[IRQ_NAME_SIZE];
|
||||||
|
|
||||||
|
@ -1735,9 +1734,7 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
|
||||||
int fifosize;
|
int fifosize;
|
||||||
int port_type;
|
int port_type;
|
||||||
struct pch_uart_driver_data *board;
|
struct pch_uart_driver_data *board;
|
||||||
#ifdef CONFIG_DEBUG_FS
|
char name[32];
|
||||||
char name[32]; /* for debugfs file name */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
board = &drv_dat[id->driver_data];
|
board = &drv_dat[id->driver_data];
|
||||||
port_type = board->port_type;
|
port_type = board->port_type;
|
||||||
|
@ -1813,11 +1810,9 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto init_port_hal_free;
|
goto init_port_hal_free;
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
snprintf(name, sizeof(name), "uart%d_regs", priv->port.line);
|
||||||
snprintf(name, sizeof(name), "uart%d_regs", board->line_no);
|
debugfs_create_file(name, S_IFREG | S_IRUGO, NULL, priv,
|
||||||
priv->debugfs = debugfs_create_file(name, S_IFREG | S_IRUGO,
|
&port_regs_ops);
|
||||||
NULL, priv, &port_regs_ops);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return priv;
|
return priv;
|
||||||
|
|
||||||
|
@ -1835,10 +1830,10 @@ static struct eg20t_port *pch_uart_init_port(struct pci_dev *pdev,
|
||||||
|
|
||||||
static void pch_uart_exit_port(struct eg20t_port *priv)
|
static void pch_uart_exit_port(struct eg20t_port *priv)
|
||||||
{
|
{
|
||||||
|
char name[32];
|
||||||
|
|
||||||
#ifdef CONFIG_DEBUG_FS
|
snprintf(name, sizeof(name), "uart%d_regs", priv->port.line);
|
||||||
debugfs_remove(priv->debugfs);
|
debugfs_remove(debugfs_lookup(name, NULL));
|
||||||
#endif
|
|
||||||
uart_remove_one_port(&pch_uart_driver, &priv->port);
|
uart_remove_one_port(&pch_uart_driver, &priv->port);
|
||||||
free_page((unsigned long)priv->rxbuf.buf);
|
free_page((unsigned long)priv->rxbuf.buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue