diff mbox series

xen/serial: Drop serial_{put,get}c

Message ID 20240208141601.78023-1-michal.orzel@amd.com (mailing list archive)
State New, archived
Headers show
Series xen/serial: Drop serial_{put,get}c | expand

Commit Message

Michal Orzel Feb. 8, 2024, 2:16 p.m. UTC
After removal of gdbstub by commit d182f9feae6d ("x86: Remove gdbstub"),
we no longer have users of serial_{put,get}c functions, so remove them.

Signed-off-by: Michal Orzel <michal.orzel@amd.com>
---
 xen/drivers/char/serial.c | 72 ---------------------------------------
 xen/include/xen/serial.h  | 10 ------
 2 files changed, 82 deletions(-)

Comments

Stefano Stabellini Feb. 8, 2024, 9:05 p.m. UTC | #1
On Thu, 8 Feb 2024, Michal Orzel wrote:
> After removal of gdbstub by commit d182f9feae6d ("x86: Remove gdbstub"),
> we no longer have users of serial_{put,get}c functions, so remove them.
> 
> Signed-off-by: Michal Orzel <michal.orzel@amd.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/drivers/char/serial.c | 72 ---------------------------------------
>  xen/include/xen/serial.h  | 10 ------
>  2 files changed, 82 deletions(-)
> 
> diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
> index 324024c29a10..93e217d34859 100644
> --- a/xen/drivers/char/serial.c
> +++ b/xen/drivers/char/serial.c
> @@ -196,36 +196,6 @@ static void __serial_putc(struct serial_port *port, char c)
>      }
>  }
>  
> -void serial_putc(int handle, char c)
> -{
> -    struct serial_port *port;
> -    unsigned long flags;
> -
> -    if ( handle == -1 )
> -        return;
> -
> -    port = &com[handle & SERHND_IDX];
> -    if ( !port->driver || !port->driver->putc )
> -        return;
> -
> -    spin_lock_irqsave(&port->tx_lock, flags);
> -
> -    if ( (c == '\n') && (handle & SERHND_COOKED) )
> -        __serial_putc(port, '\r' | ((handle & SERHND_HI) ? 0x80 : 0x00));
> -
> -    if ( handle & SERHND_HI )
> -        c |= 0x80;
> -    else if ( handle & SERHND_LO )
> -        c &= 0x7f;
> -
> -    __serial_putc(port, c);
> -
> -    if ( port->driver->flush )
> -        port->driver->flush(port);
> -
> -    spin_unlock_irqrestore(&port->tx_lock, flags);
> -}
> -
>  void serial_puts(int handle, const char *s, size_t nr)
>  {
>      struct serial_port *port;
> @@ -261,48 +231,6 @@ void serial_puts(int handle, const char *s, size_t nr)
>      spin_unlock_irqrestore(&port->tx_lock, flags);
>  }
>  
> -char serial_getc(int handle)
> -{
> -    struct serial_port *port;
> -    char c;
> -    unsigned long flags;
> -
> -    if ( handle == -1 )
> -        return '\0';
> -
> -    port = &com[handle & SERHND_IDX];
> -    if ( !port->driver || !port->driver->getc )
> -        return '\0';
> -
> -    do {
> -        for ( ; ; )
> -        {
> -            spin_lock_irqsave(&port->rx_lock, flags);
> -            
> -            if ( port->rxbufp != port->rxbufc )
> -            {
> -                c = port->rxbuf[mask_serial_rxbuf_idx(port->rxbufc++)];
> -                spin_unlock_irqrestore(&port->rx_lock, flags);
> -                break;
> -            }
> -            
> -            if ( port->driver->getc(port, &c) )
> -            {
> -                spin_unlock_irqrestore(&port->rx_lock, flags);
> -                break;
> -            }
> -
> -            spin_unlock_irqrestore(&port->rx_lock, flags);
> -
> -            cpu_relax();
> -            udelay(100);
> -        }
> -    } while ( ((handle & SERHND_LO) &&  (c & 0x80)) ||
> -              ((handle & SERHND_HI) && !(c & 0x80)) );
> -    
> -    return c & 0x7f;
> -}
> -
>  int __init serial_parse_handle(const char *conf)
>  {
>      int handle, flags = 0;
> diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
> index 12ef24351d0f..7548bb73249b 100644
> --- a/xen/include/xen/serial.h
> +++ b/xen/include/xen/serial.h
> @@ -112,19 +112,9 @@ void serial_endboot(void);
>  /* Takes a config string and creates a numeric handle on the COM port. */
>  int serial_parse_handle(const char *conf);
>  
> -/* Transmit a single character via the specified COM port. */
> -void serial_putc(int handle, char c);
> -
>  /* Transmit a string via the specified COM port. */
>  void serial_puts(int handle, const char *s, size_t nr);
>  
> -/*
> - * An alternative to registering a character-receive hook. This function
> - * will not return until a character is available. It can safely be
> - * called with interrupts disabled.
> - */
> -char serial_getc(int handle);
> -
>  /* Forcibly prevent serial lockup when the system is in a bad way. */
>  /* (NB. This also forces an implicit serial_start_sync()). */
>  void serial_force_unlock(int handle);
> -- 
> 2.25.1
>
diff mbox series

Patch

diff --git a/xen/drivers/char/serial.c b/xen/drivers/char/serial.c
index 324024c29a10..93e217d34859 100644
--- a/xen/drivers/char/serial.c
+++ b/xen/drivers/char/serial.c
@@ -196,36 +196,6 @@  static void __serial_putc(struct serial_port *port, char c)
     }
 }
 
-void serial_putc(int handle, char c)
-{
-    struct serial_port *port;
-    unsigned long flags;
-
-    if ( handle == -1 )
-        return;
-
-    port = &com[handle & SERHND_IDX];
-    if ( !port->driver || !port->driver->putc )
-        return;
-
-    spin_lock_irqsave(&port->tx_lock, flags);
-
-    if ( (c == '\n') && (handle & SERHND_COOKED) )
-        __serial_putc(port, '\r' | ((handle & SERHND_HI) ? 0x80 : 0x00));
-
-    if ( handle & SERHND_HI )
-        c |= 0x80;
-    else if ( handle & SERHND_LO )
-        c &= 0x7f;
-
-    __serial_putc(port, c);
-
-    if ( port->driver->flush )
-        port->driver->flush(port);
-
-    spin_unlock_irqrestore(&port->tx_lock, flags);
-}
-
 void serial_puts(int handle, const char *s, size_t nr)
 {
     struct serial_port *port;
@@ -261,48 +231,6 @@  void serial_puts(int handle, const char *s, size_t nr)
     spin_unlock_irqrestore(&port->tx_lock, flags);
 }
 
-char serial_getc(int handle)
-{
-    struct serial_port *port;
-    char c;
-    unsigned long flags;
-
-    if ( handle == -1 )
-        return '\0';
-
-    port = &com[handle & SERHND_IDX];
-    if ( !port->driver || !port->driver->getc )
-        return '\0';
-
-    do {
-        for ( ; ; )
-        {
-            spin_lock_irqsave(&port->rx_lock, flags);
-            
-            if ( port->rxbufp != port->rxbufc )
-            {
-                c = port->rxbuf[mask_serial_rxbuf_idx(port->rxbufc++)];
-                spin_unlock_irqrestore(&port->rx_lock, flags);
-                break;
-            }
-            
-            if ( port->driver->getc(port, &c) )
-            {
-                spin_unlock_irqrestore(&port->rx_lock, flags);
-                break;
-            }
-
-            spin_unlock_irqrestore(&port->rx_lock, flags);
-
-            cpu_relax();
-            udelay(100);
-        }
-    } while ( ((handle & SERHND_LO) &&  (c & 0x80)) ||
-              ((handle & SERHND_HI) && !(c & 0x80)) );
-    
-    return c & 0x7f;
-}
-
 int __init serial_parse_handle(const char *conf)
 {
     int handle, flags = 0;
diff --git a/xen/include/xen/serial.h b/xen/include/xen/serial.h
index 12ef24351d0f..7548bb73249b 100644
--- a/xen/include/xen/serial.h
+++ b/xen/include/xen/serial.h
@@ -112,19 +112,9 @@  void serial_endboot(void);
 /* Takes a config string and creates a numeric handle on the COM port. */
 int serial_parse_handle(const char *conf);
 
-/* Transmit a single character via the specified COM port. */
-void serial_putc(int handle, char c);
-
 /* Transmit a string via the specified COM port. */
 void serial_puts(int handle, const char *s, size_t nr);
 
-/*
- * An alternative to registering a character-receive hook. This function
- * will not return until a character is available. It can safely be
- * called with interrupts disabled.
- */
-char serial_getc(int handle);
-
 /* Forcibly prevent serial lockup when the system is in a bad way. */
 /* (NB. This also forces an implicit serial_start_sync()). */
 void serial_force_unlock(int handle);