[RFC,v2,08/23] hw/display/ramfb: Emit warning when old code is used
diff mbox series

Message ID 20200704153908.12118-9-philmd@redhat.com
State New
Headers show
Series
  • hw/qdev: Warn when using pre-qdev/QOM devices
Related show

Commit Message

Philippe Mathieu-Daudé July 4, 2020, 3:38 p.m. UTC
This code hasn't been QOM'ified yet. Warn the user.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/display/ramfb.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Gerd Hoffmann July 6, 2020, 2:15 p.m. UTC | #1
On Sat, Jul 04, 2020 at 05:38:53PM +0200, Philippe Mathieu-Daudé wrote:
> This code hasn't been QOM'ified yet. Warn the user.

False positive IMHO.  This is designed to be integrated into other
devices for boot display.  vfio/display.c uses it that way.  There
also is a standalone version (initially meant to be used for testing
only, but turned out to be useful on arm) in ramfb-standalone.c which
is a proper QOM object too.

take care,
  Gerd
Philippe Mathieu-Daudé July 6, 2020, 2:18 p.m. UTC | #2
On 7/6/20 4:15 PM, Gerd Hoffmann wrote:
> On Sat, Jul 04, 2020 at 05:38:53PM +0200, Philippe Mathieu-Daudé wrote:
>> This code hasn't been QOM'ified yet. Warn the user.
> 
> False positive IMHO.  This is designed to be integrated into other
> devices for boot display.  vfio/display.c uses it that way.  There
> also is a standalone version (initially meant to be used for testing
> only, but turned out to be useful on arm) in ramfb-standalone.c which
> is a proper QOM object too.

OK, good to know.

I guess I should take the time to comment the false positives too in the
code (Paolo made various other comments too). So next developer won't
have to ask again.

Patch
diff mbox series

diff --git a/hw/display/ramfb.c b/hw/display/ramfb.c
index 79b9754a58..a4a427e5c7 100644
--- a/hw/display/ramfb.c
+++ b/hw/display/ramfb.c
@@ -18,6 +18,7 @@ 
 #include "hw/display/bochs-vbe.h" /* for limits */
 #include "ui/console.h"
 #include "sysemu/reset.h"
+#include "hw/qdev-deprecated.h"
 
 struct QEMU_PACKED RAMFBCfg {
     uint64_t addr;
@@ -120,6 +121,8 @@  RAMFBState *ramfb_setup(Error **errp)
     FWCfgState *fw_cfg = fw_cfg_find();
     RAMFBState *s;
 
+    qdev_warn_deprecated_function_used();
+
     if (!fw_cfg || !fw_cfg->dma_enabled) {
         error_setg(errp, "ramfb device requires fw_cfg with DMA");
         return NULL;