[PATCH v1 2/3] target/s390x: introduce function when exiting PV

Gautam Gala posted 3 patches 7 months, 1 week ago
[PATCH v1 2/3] target/s390x: introduce function when exiting PV
Posted by Gautam Gala 7 months, 1 week ago
introduce a static function when exiting PV. The function replaces an
existing macro (s390_pv_cmd_exit).

Signed-off-by: Gautam Gala <ggala@linux.ibm.com>
---
 target/s390x/kvm/pv.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/target/s390x/kvm/pv.c b/target/s390x/kvm/pv.c
index 3a0a971f0b..b4abda2cef 100644
--- a/target/s390x/kvm/pv.c
+++ b/target/s390x/kvm/pv.c
@@ -59,14 +59,15 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data,
  */
 #define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data, NULL)
 #define s390_pv_cmd_pvrc(cmd, data, pvrc) __s390_pv_cmd(cmd, #cmd, data, pvrc)
-#define s390_pv_cmd_exit(cmd, data)    \
-{                                      \
-    int rc;                            \
-                                       \
-    rc = __s390_pv_cmd(cmd, #cmd, data, NULL); \
-    if (rc) {                          \
-        exit(1);                       \
-    }                                  \
+
+static void s390_pv_cmd_exit(uint32_t cmd, void *data)
+{
+    int rc;
+
+    rc = s390_pv_cmd(cmd, data);
+    if (rc) {
+        exit(1);
+    }
 }
 
 int s390_pv_query_info(void)
-- 
2.49.0
Re: [PATCH v1 2/3] target/s390x: introduce function when exiting PV
Posted by Steffen Eiden 7 months ago
On Fri, Apr 11, 2025 at 11:22:32AM +0200, Gautam Gala wrote:
> introduce a static function when exiting PV. The function replaces an
> existing macro (s390_pv_cmd_exit).
> 
> Signed-off-by: Gautam Gala <ggala@linux.ibm.com>
> ---
>  target/s390x/kvm/pv.c | 17 +++++++++--------
>  1 file changed, 9 insertions(+), 8 deletions(-)
> 
> diff --git a/target/s390x/kvm/pv.c b/target/s390x/kvm/pv.c
> index 3a0a971f0b..b4abda2cef 100644
> --- a/target/s390x/kvm/pv.c
> +++ b/target/s390x/kvm/pv.c
> @@ -59,14 +59,15 @@ static int __s390_pv_cmd(uint32_t cmd, const char *cmdname, void *data,
>   */
>  #define s390_pv_cmd(cmd, data) __s390_pv_cmd(cmd, #cmd, data, NULL)
>  #define s390_pv_cmd_pvrc(cmd, data, pvrc) __s390_pv_cmd(cmd, #cmd, data, pvrc)
> -#define s390_pv_cmd_exit(cmd, data)    \
> -{                                      \
> -    int rc;                            \
> -                                       \
> -    rc = __s390_pv_cmd(cmd, #cmd, data, NULL); \
> -    if (rc) {                          \
> -        exit(1);                       \
> -    }                                  \
> +
> +static void s390_pv_cmd_exit(uint32_t cmd, void *data)
> +{
> +    int rc;
> +
> +    rc = s390_pv_cmd(cmd, data);
> +    if (rc) {

I am not sure if that violates Qemu coding style but you could inline the rc
variable here to reduce LoC.

> +        exit(1);
> +    }
>  }
>  
>  int s390_pv_query_info(void)
> -- 
> 2.49.0
> 
>