diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index e1c85df31bf..e5b4b0f6aa0 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -513,6 +513,17 @@ struct tui_data_window : public tui_win_info
 
   void erase_data_content (const char *prompt);
 
+  /* Function to display the registers in the content from
+     'start_element_no' until the end of the register content or the
+     end of the display height.  No checking for displaying past the
+     end of the registers is done here.  */
+  void display_registers_from (int start_element_no);
+
+  /* Function to display the registers starting at line line_no in the
+     data window.  Answers the line number that the display actually
+     started from.  If nothing is displayed (-1) is returned.  */
+  int display_registers_from_line (int line_no);
+
 protected:
 
   void do_scroll_vertical (int num_to_scroll) override;
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 9b396e429e2..042563f0495 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -249,14 +249,14 @@ tui_show_register_group (struct reggroup *group,
    of the display height.  No checking for displaying past the end of
    the registers is done here.  */
 void
-tui_display_registers_from (int start_element_no)
+tui_data_window::display_registers_from (int start_element_no)
 {
-  if (!TUI_DATA_WIN->regs_content.empty ())
+  if (!regs_content.empty ())
     {
       int j, item_win_width, cur_y;
 
       int max_len = 0;
-      for (auto &&data_item_win : TUI_DATA_WIN->regs_content)
+      for (auto &&data_item_win : regs_content)
         {
           char *p;
           int len;
@@ -278,28 +278,25 @@ tui_display_registers_from (int start_element_no)
       item_win_width = max_len + 1;
       int i = start_element_no;
 
-      TUI_DATA_WIN->regs_column_count =
-        (TUI_DATA_WIN->width - 2) / item_win_width;
-      if (TUI_DATA_WIN->regs_column_count == 0)
-        TUI_DATA_WIN->regs_column_count = 1;
-      item_win_width =
-        (TUI_DATA_WIN->width - 2) / TUI_DATA_WIN->regs_column_count;
+      regs_column_count = (width - 2) / item_win_width;
+      if (regs_column_count == 0)
+        regs_column_count = 1;
+      item_win_width = (width - 2) / regs_column_count;
 
       /* Now create each data "sub" window, and write the display into
 	 it.  */
       cur_y = 1;
-      while (i < TUI_DATA_WIN->regs_content.size ()
-	     && cur_y <= TUI_DATA_WIN->viewport_height)
+      while (i < regs_content.size ()
+	     && cur_y <= viewport_height)
 	{
 	  for (j = 0;
-	       j < TUI_DATA_WIN->regs_column_count
-		 && i < TUI_DATA_WIN->regs_content.size ();
+	       j < regs_column_count && i < regs_content.size ();
 	       j++)
 	    {
 	      struct tui_data_item_window *data_item_win;
 
 	      /* Create the window if necessary.  */
-	      data_item_win = TUI_DATA_WIN->regs_content[i].get ();
+	      data_item_win = regs_content[i].get ();
               if (data_item_win->handle != NULL
                   && (data_item_win->height != 1
                       || data_item_win->width != item_win_width
@@ -362,7 +359,7 @@ tui_display_reg_element_at_line (int start_element_no,
 	      = (TUI_DATA_WIN->first_reg_element_no_inline
 		 (first_line_on_last_page));
 	}
-      tui_display_registers_from (element_no);
+      TUI_DATA_WIN->display_registers_from (element_no);
     }
 }
 
@@ -372,10 +369,10 @@ tui_display_reg_element_at_line (int start_element_no,
    data window.  Answers the line number that the display actually
    started from.  If nothing is displayed (-1) is returned.  */
 int
-tui_display_registers_from_line (int line_no)
+tui_data_window::display_registers_from_line (int line_no)
 {
-  tui_check_and_display_highlight_if_needed (TUI_DATA_WIN);
-  if (!TUI_DATA_WIN->regs_content.empty ())
+  tui_check_and_display_highlight_if_needed (this);
+  if (!regs_content.empty ())
     {
       int element_no;
 
@@ -385,16 +382,16 @@ tui_display_registers_from_line (int line_no)
 	{
 	  /* Make sure that we don't display off the end of the
 	     registers.  */
-	  if (line_no >= TUI_DATA_WIN->last_regs_line_no ())
+	  if (line_no >= last_regs_line_no ())
 	    {
-	      if ((line_no = TUI_DATA_WIN->line_from_reg_element_no (
-		 TUI_DATA_WIN->regs_content.size () - 1)) < 0)
+	      line_no = line_from_reg_element_no (regs_content.size () - 1);
+	      if (line_no < 0)
 		line_no = 0;
 	    }
 	}
 
-      element_no = TUI_DATA_WIN->first_reg_element_no_inline (line_no);
-      if (element_no < TUI_DATA_WIN->regs_content.size ())
+      element_no = first_reg_element_no_inline (line_no);
+      if (element_no < regs_content.size ())
 	tui_display_reg_element_at_line (element_no, line_no);
       else
 	line_no = (-1);
diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h
index c99910b2c7e..354605c96f2 100644
--- a/gdb/tui/tui-regs.h
+++ b/gdb/tui/tui-regs.h
@@ -26,7 +26,5 @@
 
 extern void tui_check_register_values (struct frame_info *);
 extern void tui_show_registers (struct reggroup *group);
-extern void tui_display_registers_from (int);
-extern int tui_display_registers_from_line (int);
 
 #endif /* TUI_TUI_REGS_H */
diff --git a/gdb/tui/tui-windata.c b/gdb/tui/tui-windata.c
index abbed3f16a1..9256e0e26b6 100644
--- a/gdb/tui/tui-windata.c
+++ b/gdb/tui/tui-windata.c
@@ -103,7 +103,7 @@ tui_data_window::display_all_data ()
       erase_data_content (NULL);
       delete_data_content_windows ();
       tui_check_and_display_highlight_if_needed (this);
-      tui_display_registers_from (0);
+      display_registers_from (0);
     }
 }
 
@@ -127,7 +127,7 @@ tui_data_window::refresh_all ()
 	  if (first_line >= 0)
 	    {
 	      erase_data_content (NULL);
-	      tui_display_registers_from_line (first_line);
+	      display_registers_from_line (first_line);
 	    }
 	}
     }
@@ -154,7 +154,7 @@ tui_data_window::do_scroll_vertical (int num_to_scroll)
       first_line += num_to_scroll;
       erase_data_content (NULL);
       delete_data_content_windows ();
-      tui_display_registers_from_line (first_line);
+      display_registers_from_line (first_line);
     }
 }
 
