From d25446c995e2c562d62d832bc8da58d13b731974 Mon Sep 17 00:00:00 2001 From: dinglimin Date: Mon, 10 Jun 2024 20:00:42 +0800 Subject: [PATCH] s390x/sclp: Simplify get_sclp_device() cheery-pick from 3d9836e46dbe1e46c39fe76a62d3085a71ddbf7a get_sclp_device() scans the whole machine to find a TYPE_SCLP object. Now that the SCLPDevice instance is available under the machine state, use it to simplify the lookup. While at it, remove the inline to let the compiler decide on how to optimize. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Cédric Le Goater Message-ID: <20240502131533.377719-4-clg@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Thomas Huth Signed-off-by: dinglimin --- hw/s390x/sclp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c index 89c30a8a91..24e29e8cda 100644 --- a/hw/s390x/sclp.c +++ b/hw/s390x/sclp.c @@ -20,13 +20,14 @@ #include "hw/s390x/event-facility.h" #include "hw/s390x/s390-pci-bus.h" #include "hw/s390x/ipl.h" +#include "hw/s390x/s390-virtio-ccw.h" -static inline SCLPDevice *get_sclp_device(void) +static SCLPDevice *get_sclp_device(void) { static SCLPDevice *sclp; if (!sclp) { - sclp = SCLP(object_resolve_path_type("", TYPE_SCLP, NULL)); + sclp = S390_CCW_MACHINE(qdev_get_machine())->sclp; } return sclp; } -- 2.27.0