qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Miroslav Rezanina <mrezanin@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Make usb-bt-dongle configurable
Date: Mon, 19 Aug 2013 14:55:09 +0200	[thread overview]
Message-ID: <521215AD.4030400@redhat.com> (raw)
In-Reply-To: <52081254.597343.1376909324949.JavaMail.root@redhat.com>

Il 19/08/2013 12:48, Miroslav Rezanina ha scritto:
> usb-bt-dongle device can't be disabled as there's dependency in vl.c file. This patch add preprocesor condition to be able to disable it.
> 
> Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
> ---
>  hw/usb/Makefile.objs |  1 -
>  vl.c                 | 18 ++++++++++++++----
>  2 files changed, 14 insertions(+), 5 deletions(-)
> 
> diff --git a/hw/usb/Makefile.objs b/hw/usb/Makefile.objs
> index f9695e7..8892ffd 100644
> --- a/hw/usb/Makefile.objs
> +++ b/hw/usb/Makefile.objs
> @@ -20,7 +20,6 @@ common-obj-$(CONFIG_USB_SERIAL)       += dev-serial.o
>  common-obj-$(CONFIG_USB_NETWORK)      += dev-network.o
>  
>  # FIXME: make configurable too
> -CONFIG_USB_BLUETOOTH := y
>  common-obj-$(CONFIG_USB_BLUETOOTH)    += dev-bluetooth.o
>  
>  ifeq ($(CONFIG_USB_SMARTCARD),y)
> diff --git a/vl.c b/vl.c
> index f422a1c..4330b6d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1526,8 +1526,10 @@ static void configure_msg(QemuOpts *opts)
>  
>  static int usb_device_add(const char *devname)
>  {
> -    const char *p;
>      USBDevice *dev = NULL;
> +#if  defined(CONFIG_USB_BLUETOOTH) || !defined(CONFIG_LINUX)
> +    const char *p;
> +#endif
>  
>      if (!usb_enabled(false)) {
>          return -1;
> @@ -1543,15 +1545,23 @@ static int usb_device_add(const char *devname)
>      /* only the linux version is qdev-ified, usb-bsd still needs this */
>      if (strstart(devname, "host:", &p)) {
>          dev = usb_host_device_open(usb_bus_find(-1), p);
> -    } else
> +        goto devtest;
> +    } 

No need for the goto, since the following "if"s will fail...

>  #endif
> +#ifdef CONFIG_USB_BLUETOOTH
>      if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) {
>          dev = usb_bt_init(usb_bus_find(-1),
>                            devname[2] ? hci_init(p)
>                                       : bt_new_hci(qemu_find_bt_vlan(0)));
> -    } else {
> -        return -1;
> +        goto devtest;

... same here...

>      }
> +#endif
> +
> +    return -1;

... and no need for this return either: if you get here, dev will be
NULL and the "if" just below will fail.

Paolo

> +#if  defined(CONFIG_USB_BLUETOOTH) || !defined(CONFIG_LINUX)
> +devtest:
> +#endif
>      if (!dev)
>          return -1;
>  
> 

      parent reply	other threads:[~2013-08-19 12:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-19 10:48 [Qemu-devel] [PATCH] Make usb-bt-dongle configurable Miroslav Rezanina
2013-08-19 12:31 ` Andreas Färber
2013-08-19 13:30   ` Laszlo Ersek
2013-08-19 13:41     ` Andreas Färber
2013-08-19 13:58       ` Paolo Bonzini
2013-08-19 14:19         ` Gerd Hoffmann
2013-08-19 12:55 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=521215AD.4030400@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=mrezanin@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).