Remove deprecated D-Bus interface

9598b866d8e2 ("Add new D-Bus UART interface") adds the interface that's
described in phosphor-dbus-interface and deprecates the old interface.
Now that the new interface is merged, follow through and delete the
deprecated interface.

Change-Id: I304041d74a5b2218732b32f915efcbc0a5e9aafe
Signed-off-by: Jonathan Doman <jonathan.doman@intel.com>
[AJ: Rebase on master and update changelog]
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0db88ce..ae1ecb1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,7 +17,9 @@
 
 ## [Unreleased]
 
-None.
+### Removed
+
+1. Deprecated D-Bus interface `xyz.openbmc_project.console` is no longer used.
 
 ## [1.1.0] - 2023-06-07
 
diff --git a/console-dbus.c b/console-dbus.c
index 0b82376..dd53908 100644
--- a/console-dbus.c
+++ b/console-dbus.c
@@ -29,7 +29,6 @@
 #define DBUS_NAME   "xyz.openbmc_project.Console.%s"
 #define OBJ_NAME    "/xyz/openbmc_project/console/%s"
 #define UART_INTF   "xyz.openbmc_project.Console.UART"
-#define TTY_INTF    "xyz.openbmc_project.console"
 #define ACCESS_INTF "xyz.openbmc_project.Console.Access"
 
 static void tty_change_baudrate(struct console *console)
@@ -54,39 +53,6 @@
 	}
 }
 
-/* Deprecated */
-static int method_set_baud_rate(sd_bus_message *msg, void *userdata,
-				sd_bus_error *err)
-{
-	struct console *console = userdata;
-	uint32_t baudrate;
-	speed_t speed;
-	int r;
-
-	if (!console) {
-		sd_bus_error_set_const(err, DBUS_ERR, "Internal error");
-		return sd_bus_reply_method_return(msg, "x", 0);
-	}
-
-	r = sd_bus_message_read(msg, "u", &baudrate);
-	if (r < 0) {
-		sd_bus_error_set_const(err, DBUS_ERR, "Bad message");
-		return sd_bus_reply_method_return(msg, "x", -EINVAL);
-	}
-
-	speed = parse_int_to_baud(baudrate);
-	if (!speed) {
-		warnx("Invalid baud rate: '%u'", baudrate);
-		return sd_bus_reply_method_return(msg, "x", -EINVAL);
-	}
-
-	assert(console->tty.type == TTY_DEVICE_UART);
-	console->tty.uart.baud = speed;
-	tty_change_baudrate(console);
-
-	return sd_bus_reply_method_return(msg, "x", r);
-}
-
 static int set_baud_handler(sd_bus *bus, const char *path,
 			    const char *interface, const char *property,
 			    sd_bus_message *msg, void *userdata,
@@ -121,29 +87,6 @@
 	return 1;
 }
 
-/* Deprecated */
-static int get_handler(sd_bus *bus __attribute__((unused)),
-		       const char *path __attribute__((unused)),
-		       const char *interface __attribute__((unused)),
-		       const char *property __attribute__((unused)),
-		       sd_bus_message *reply, void *userdata,
-		       sd_bus_error *error __attribute__((unused)))
-{
-	struct console *console = userdata;
-	uint32_t baudrate;
-	int r;
-
-	assert(console->tty.type == TTY_DEVICE_UART);
-	baudrate = parse_baud_to_int(console->tty.uart.baud);
-	if (!baudrate) {
-		warnx("Invalid baud rate: '%d'", console->tty.uart.baud);
-	}
-
-	r = sd_bus_message_append(reply, "u", baudrate);
-
-	return r;
-}
-
 static int get_baud_handler(sd_bus *bus __attribute__((unused)),
 			    const char *path __attribute__((unused)),
 			    const char *interface __attribute__((unused)),
@@ -197,15 +140,6 @@
 	return rc;
 }
 
-/* Deprecated */
-static const sd_bus_vtable console_tty_vtable[] = {
-	SD_BUS_VTABLE_START(SD_BUS_VTABLE_DEPRECATED),
-	SD_BUS_METHOD("setBaudRate", "u", "x", method_set_baud_rate,
-		      SD_BUS_VTABLE_UNPRIVILEGED),
-	SD_BUS_PROPERTY("baudrate", "u", get_handler, 0, 0),
-	SD_BUS_VTABLE_END,
-};
-
 static const sd_bus_vtable console_uart_vtable[] = {
 	SD_BUS_VTABLE_START(0),
 	SD_BUS_WRITABLE_PROPERTY("Baud", "t", get_baud_handler,
@@ -253,14 +187,6 @@
 	}
 
 	if (console->tty.type == TTY_DEVICE_UART) {
-		/* Register tty interface - Deprecated */
-		r = sd_bus_add_object_vtable(console->bus, NULL, obj_name,
-					     TTY_INTF, console_tty_vtable,
-					     console);
-		if (r < 0) {
-			warnx("Failed to issue method call: %s", strerror(-r));
-			return;
-		}
 		/* Register UART interface */
 		r = sd_bus_add_object_vtable(console->bus, NULL, obj_name,
 					     UART_INTF, console_uart_vtable,