From nobody Sat May 4 04:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554188655056595.2466047823486; Tue, 2 Apr 2019 00:04:15 -0700 (PDT) Received: from localhost ([127.0.0.1]:39848 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDSt-000254-RS for importer@patchew.org; Tue, 02 Apr 2019 03:04:11 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51264) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDQs-0000vx-4n for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDQq-0005j5-Nt for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46652) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC0-0005Qf-L9 for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2BD7F308A968 for ; Tue, 2 Apr 2019 06:46:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D270162478; Tue, 2 Apr 2019 06:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id E4E04A1E2; Tue, 2 Apr 2019 08:46:39 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:35 +0200 Message-Id: <20190402064639.27108-2-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Tue, 02 Apr 2019 06:46:43 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/5] Revert "audio: fix pc speaker init" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This reverts commit bd56d378842c238c8901536c06c20a4a51ee9761. Turned out it isn't that simple as the device needs the pit object link. So "-device isa-pcspk" isn't going wo work anyway. We are in freeze, so just reverting the thing is the best way to handle this for now, trying to come up with something better can be done in the 4.1 devel cycle. Also add a comment noting the object link. Reported-by: Dr. David Alan Gilbert Signed-off-by: Gerd Hoffmann Message-id: 20190328071121.21147-1-kraxel@redhat.com --- hw/audio/pcspk.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c index fdbb4b6e9923..9c7fd74aeba7 100644 --- a/hw/audio/pcspk.c +++ b/hw/audio/pcspk.c @@ -57,6 +57,7 @@ typedef struct { } PCSpkState; =20 static const char *s_spk =3D "pcspk"; +static PCSpkState *pcspk_state; =20 static inline void generate_samples(PCSpkState *s) { @@ -110,6 +111,22 @@ static void pcspk_callback(void *opaque, int free) } } =20 +static int pcspk_audio_init(ISABus *bus) +{ + PCSpkState *s =3D pcspk_state; + struct audsettings as =3D {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0}; + + AUD_register_card(s_spk, &s->card); + + s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); + if (!s->voice) { + AUD_log(s_spk, "Could not open voice\n"); + return -1; + } + + return 0; +} + static uint64_t pcspk_io_read(void *opaque, hwaddr addr, unsigned size) { @@ -162,20 +179,12 @@ static void pcspk_initfn(Object *obj) =20 static void pcspk_realizefn(DeviceState *dev, Error **errp) { - struct audsettings as =3D {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0}; ISADevice *isadev =3D ISA_DEVICE(dev); PCSpkState *s =3D PC_SPEAKER(dev); =20 isa_register_ioport(isadev, &s->ioport, s->iobase); =20 - AUD_register_card(s_spk, &s->card); - - s->voice =3D AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback= , &as); - if (!s->voice) { - error_setg(errp, "Initializing audio voice failed"); - AUD_remove_card(&s->card); - return; - } + pcspk_state =3D s; } =20 static bool migrate_needed(void *opaque) @@ -212,6 +221,9 @@ static void pcspk_class_initfn(ObjectClass *klass, void= *data) set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->vmsd =3D &vmstate_spk; dc->props =3D pcspk_properties; + /* Reason: realize sets global pcspk_state */ + /* Reason: pit object link */ + dc->user_creatable =3D false; } =20 static const TypeInfo pcspk_info =3D { @@ -222,12 +234,6 @@ static const TypeInfo pcspk_info =3D { .class_init =3D pcspk_class_initfn, }; =20 -static int pcspk_audio_init(ISABus *bus) -{ - isa_create_simple(bus, TYPE_PC_SPEAKER); - return 0; -} - static void pcspk_register(void) { type_register_static(&pcspk_info); --=20 2.18.1 From nobody Sat May 4 04:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554188700541179.44019675223444; Tue, 2 Apr 2019 00:05:00 -0700 (PDT) Received: from localhost ([127.0.0.1]:40030 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDTc-0002i0-Aj for importer@patchew.org; Tue, 02 Apr 2019 03:04:56 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDQp-0000rc-0o for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:04 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDQn-0005bJ-1Y for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:02:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42328) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC0-0005Qi-L3 for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:44 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C79B30820EA; Tue, 2 Apr 2019 06:46:43 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3BB65C290; Tue, 2 Apr 2019 06:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id EE0CBA1E3; Tue, 2 Apr 2019 08:46:39 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:36 +0200 Message-Id: <20190402064639.27108-3-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Tue, 02 Apr 2019 06:46:43 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/5] hw/usb/bus.c: Handle "no speed matched" case in usb_mask_to_str() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Peter Maydell In usb_mask_to_str() we convert a mask of USB speeds into a human-readable string (like "full+high") for use in tracing and error messages. However the conversion code doesn't do anything to the string buffer if the passed in speedmask doesn't match any of the recognized speeds, which means that the tracing and error messages will end up with random garbage in them. This can happen if we're doing USB device passthrough. Handle the "unrecognized speed" case by using the string "unknown". Fixes: https://bugs.launchpad.net/qemu/+bug/1603785 Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20190328133503.6490-1-peter.maydell@linaro.org Signed-off-by: Gerd Hoffmann --- hw/usb/bus.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/hw/usb/bus.c b/hw/usb/bus.c index 6fffab7bfa44..9a74dc956010 100644 --- a/hw/usb/bus.c +++ b/hw/usb/bus.c @@ -500,6 +500,10 @@ static void usb_mask_to_str(char *dest, size_t size, speeds[i].name); } } + + if (pos =3D=3D 0) { + snprintf(dest, size, "unknown"); + } } =20 void usb_check_attach(USBDevice *dev, Error **errp) --=20 2.18.1 From nobody Sat May 4 04:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554190646037502.50444435999907; Tue, 2 Apr 2019 00:37:26 -0700 (PDT) Received: from localhost ([127.0.0.1]:48730 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDz0-0000Qm-Ry for importer@patchew.org; Tue, 02 Apr 2019 03:37:22 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59517) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDtw-00051S-SH for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:32:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDnm-0003vD-RO for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:25:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35542) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC2-0005VH-LW for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:46 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E954F3082B71 for ; Tue, 2 Apr 2019 06:46:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D5CDF83EB8; Tue, 2 Apr 2019 06:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 047A1A1E4; Tue, 2 Apr 2019 08:46:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:37 +0200 Message-Id: <20190402064639.27108-4-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Tue, 02 Apr 2019 06:46:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/5] usb-mtp: fix return status of delete X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan Das , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Das Spotted by Coverity: CID 1399414 mtp delete allows the return status of delete succeeded, partial_delete or readonly - when none of the objects could be deleted. Give more meaningful names to return values of the delete function. Some initiators recurse over the objects themselves. In that case, only READ_ONLY can be returned. Signed-off-by: Bandan Das Message-Id: <20190401211712.19012-2-bsd@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/usb/dev-mtp.c | 62 ++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 28 deletions(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 06e376bcd211..91b820baafd8 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1135,11 +1135,19 @@ static MTPData *usb_mtp_get_object_prop_value(MTPSt= ate *s, MTPControl *c, return d; } =20 -/* Return correct return code for a delete event */ +/* + * Return values when object @o is deleted. + * If at least one of the deletions succeeded, + * DELETE_SUCCESS is set and if at least one + * of the deletions failed, DELETE_FAILURE is + * set. Both bits being set (DELETE_PARTIAL) + * signifies a RES_PARTIAL_DELETE being sent + * back to the initiator. + */ enum { - ALL_DELETE, - PARTIAL_DELETE, - READ_ONLY, + DELETE_SUCCESS =3D (1 << 0), + DELETE_FAILURE =3D (1 << 1), + DELETE_PARTIAL =3D (DELETE_FAILURE | DELETE_SUCCESS), }; =20 /* Assumes that children, if any, have been already freed */ @@ -1155,8 +1163,7 @@ static void usb_mtp_object_free_one(MTPState *s, MTPO= bject *o) static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans) { MTPObject *iter, *iter2; - bool partial_delete =3D false; - bool success =3D false; + int ret =3D 0; =20 /* * TODO: Add support for Protection Status @@ -1165,34 +1172,28 @@ static int usb_mtp_deletefn(MTPState *s, MTPObject = *o, uint32_t trans) QLIST_FOREACH(iter, &o->children, list) { if (iter->format =3D=3D FMT_ASSOCIATION) { QLIST_FOREACH(iter2, &iter->children, list) { - usb_mtp_deletefn(s, iter2, trans); + ret |=3D usb_mtp_deletefn(s, iter2, trans); } } } =20 if (o->format =3D=3D FMT_UNDEFINED_OBJECT) { if (remove(o->path)) { - partial_delete =3D true; + ret |=3D DELETE_FAILURE; } else { usb_mtp_object_free_one(s, o); - success =3D true; + ret |=3D DELETE_SUCCESS; } } else if (o->format =3D=3D FMT_ASSOCIATION) { if (rmdir(o->path)) { - partial_delete =3D true; + ret |=3D DELETE_FAILURE; } else { usb_mtp_object_free_one(s, o); - success =3D true; + ret |=3D DELETE_SUCCESS; } } =20 - if (success && partial_delete) { - return PARTIAL_DELETE; - } - if (!success && partial_delete) { - return READ_ONLY; - } - return ALL_DELETE; + return ret; } =20 static void usb_mtp_object_delete(MTPState *s, uint32_t handle, @@ -1226,19 +1227,24 @@ static void usb_mtp_object_delete(MTPState *s, uint= 32_t handle, } =20 ret =3D usb_mtp_deletefn(s, o, trans); - if (ret =3D=3D PARTIAL_DELETE) { - usb_mtp_queue_result(s, RES_PARTIAL_DELETE, - trans, 0, 0, 0, 0); - return; - } else if (ret =3D=3D READ_ONLY) { - usb_mtp_queue_result(s, RES_STORE_READ_ONLY, trans, - 0, 0, 0, 0); - return; - } else { + switch (ret) { + case DELETE_SUCCESS: usb_mtp_queue_result(s, RES_OK, trans, 0, 0, 0, 0); - return; + break; + case DELETE_FAILURE: + usb_mtp_queue_result(s, RES_PARTIAL_DELETE, + trans, 0, 0, 0, 0); + break; + case DELETE_PARTIAL: + usb_mtp_queue_result(s, RES_PARTIAL_DELETE, + trans, 0, 0, 0, 0); + break; + default: + g_assert_not_reached(); } + + return; } =20 static void usb_mtp_command(MTPState *s, MTPControl *c) --=20 2.18.1 From nobody Sat May 4 04:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554190465993682.3452604408752; Tue, 2 Apr 2019 00:34:25 -0700 (PDT) Received: from localhost ([127.0.0.1]:47950 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDw0-0006Ed-Er for importer@patchew.org; Tue, 02 Apr 2019 03:34:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:59252) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDtl-0004px-O2 for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:31:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDfY-0007UY-9p for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:17:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53644) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC2-0005Sq-4B for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 63030307D973 for ; Tue, 2 Apr 2019 06:46:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1DC860BE5; Tue, 2 Apr 2019 06:46:40 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 129FCA1E8; Tue, 2 Apr 2019 08:46:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:38 +0200 Message-Id: <20190402064639.27108-5-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 02 Apr 2019 06:46:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 4/5] usb-mtp: remove usb_mtp_object_free_one X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bandan Das , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Bandan Das This function is used in the delete path only and can be replaced by a call to usb_mtp_object_free. Reviewed-by: Peter Maydell Signed-off-by: Bandan Das Message-Id: <20190401211712.19012-3-bsd@redhat.com> Signed-off-by: Gerd Hoffmann --- hw/usb/dev-mtp.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 91b820baafd8..4dc1317e2e49 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1150,16 +1150,6 @@ enum { DELETE_PARTIAL =3D (DELETE_FAILURE | DELETE_SUCCESS), }; =20 -/* Assumes that children, if any, have been already freed */ -static void usb_mtp_object_free_one(MTPState *s, MTPObject *o) -{ - assert(o->nchildren =3D=3D 0); - QTAILQ_REMOVE(&s->objects, o, next); - g_free(o->name); - g_free(o->path); - g_free(o); -} - static int usb_mtp_deletefn(MTPState *s, MTPObject *o, uint32_t trans) { MTPObject *iter, *iter2; @@ -1181,14 +1171,14 @@ static int usb_mtp_deletefn(MTPState *s, MTPObject = *o, uint32_t trans) if (remove(o->path)) { ret |=3D DELETE_FAILURE; } else { - usb_mtp_object_free_one(s, o); + usb_mtp_object_free(s, o); ret |=3D DELETE_SUCCESS; } } else if (o->format =3D=3D FMT_ASSOCIATION) { if (rmdir(o->path)) { ret |=3D DELETE_FAILURE; } else { - usb_mtp_object_free_one(s, o); + usb_mtp_object_free(s, o); ret |=3D DELETE_SUCCESS; } } --=20 2.18.1 From nobody Sat May 4 04:04:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1554188796360991.0363095510743; Tue, 2 Apr 2019 00:06:36 -0700 (PDT) Received: from localhost ([127.0.0.1]:40408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDVB-0003w7-Bw for importer@patchew.org; Tue, 02 Apr 2019 03:06:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hBDT3-0002bL-Um for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:04:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hBDT1-0001Md-6w for qemu-devel@nongnu.org; Tue, 02 Apr 2019 03:04:21 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53646) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hBDC2-0005Su-5r for qemu-devel@nongnu.org; Tue, 02 Apr 2019 02:46:46 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7076B307D976; Tue, 2 Apr 2019 06:46:45 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A18260BEC; Tue, 2 Apr 2019 06:46:44 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 2354AA1E9; Tue, 2 Apr 2019 08:46:40 +0200 (CEST) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 2 Apr 2019 08:46:39 +0200 Message-Id: <20190402064639.27108-6-kraxel@redhat.com> In-Reply-To: <20190402064639.27108-1-kraxel@redhat.com> References: <20190402064639.27108-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 02 Apr 2019 06:46:45 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 5/5] audio: fix audio timer rate conversion bug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Volker=20R=C3=BCmelin?= , Gerd Hoffmann Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" From: Volker R=C3=BCmelin Currently the default audio timer frequency is 10000Hz instead of a period of 10000us. Also the audiodev timer-period property gets converted like a frequency. Only handling of the legacy QEMU_AUDIO_TIMER_PERIOD environment variable is correct because it's actually a frequency. With this patch the property timer-period is really a timer period and QEMU_AUDIO_TIMER_PERIOD remains a frequency. Fixes: 71830221fb "-audiodev command line option basic implementation." Signed-off-by: Volker R=C3=BCmelin Reviewed-by: Zolt=C3=A1n K=C5=91v=C3=A1g=C3=B3 Message-id: 90b95e4f-39ef-2b01-da6a-857ebaee1ec5@t-online.de Signed-off-by: Gerd Hoffmann --- audio/audio.c | 2 +- audio/audio_legacy.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/audio/audio.c b/audio/audio.c index 5fd9a58a808f..2040762feff1 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -1471,7 +1471,7 @@ static int audio_init(Audiodev *dev) if (dev->timer_period <=3D 0) { s->period_ticks =3D 1; } else { - s->period_ticks =3D NANOSECONDS_PER_SECOND / dev->timer_period; + s->period_ticks =3D dev->timer_period * SCALE_US; } =20 e =3D qemu_add_vm_change_state_handler (audio_vm_change_state_handler,= s); diff --git a/audio/audio_legacy.c b/audio/audio_legacy.c index 6d140119d98a..2fd58cb8ef25 100644 --- a/audio/audio_legacy.c +++ b/audio/audio_legacy.c @@ -26,6 +26,7 @@ #include "audio_int.h" #include "qemu-common.h" #include "qemu/cutils.h" +#include "qemu/timer.h" #include "qapi/error.h" #include "qapi/qapi-visit-audio.h" #include "qapi/visitor-impl.h" @@ -338,8 +339,13 @@ static AudiodevListEntry *legacy_opt(const char *drvna= me) handle_per_direction(audio_get_pdo_in(e->dev), "QEMU_AUDIO_ADC_"); handle_per_direction(audio_get_pdo_out(e->dev), "QEMU_AUDIO_DAC_"); =20 + /* Original description: Timer period in HZ (0 - use lowest possible) = */ get_int("QEMU_AUDIO_TIMER_PERIOD", &e->dev->timer_period, &e->dev->has_timer_period); + if (e->dev->has_timer_period && e->dev->timer_period) { + e->dev->timer_period =3D NANOSECONDS_PER_SECOND / 1000 / + e->dev->timer_period; + } =20 switch (e->dev->driver) { case AUDIODEV_DRIVER_ALSA: --=20 2.18.1