All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alistair Francis <alistair.francis@xilinx.com>
To: Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	Alistair Francis <alistair.francis@xilinx.com>
Subject: Re: [Qemu-devel] [PATCH v5 4/6] qdev: Add a function to rename busses
Date: Wed, 16 Dec 2015 16:55:30 -0800	[thread overview]
Message-ID: <CAKmqyKN3W5zsMBByU4NXK2_V-iAFEvGUUEzW+hbPbuSM6zUt8w@mail.gmail.com> (raw)
In-Reply-To: <CAPokK=rskq3iZokfLbha=F5ipehqh+gvkZ3Nxvoo6RUmurodww@mail.gmail.com>

On Wed, Dec 16, 2015 at 2:36 PM, Peter Crosthwaite
<crosthwaitepeter@gmail.com> wrote:
> On Wed, Dec 16, 2015 at 1:45 PM, Alistair Francis
> <alistair.francis@xilinx.com> wrote:
>> Add a function which can be used to rename busses.
>>
>> Signed-off-by: Alistair Francis <alistair.francis@xilinx.com>
>> ---
>>
>>  hw/core/qdev.c         | 5 +++++
>>  include/hw/qdev-core.h | 2 ++
>>  2 files changed, 7 insertions(+)
>>
>> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
>> index b3ad467..29a3e9d 100644
>> --- a/hw/core/qdev.c
>> +++ b/hw/core/qdev.c
>> @@ -590,6 +590,11 @@ BusState *qdev_get_child_bus(DeviceState *dev, const char *name)
>>      return NULL;
>>  }
>>
>> +void qdev_bus_rename(BusState *bus, const char *name)
>> +{
>> +        memcpy((char *) bus->name, name, strlen(name) * sizeof(char));
>
> sizeof(char) not needed, but wont this assume the current name is long
> enough to hold the new name? Should name just be strduped and the old
> name freed?

You are right, that is better.

I will update it to use strdup() and I will also move the function
inside xlnx-zynqmp.c as requested by Paolo.

I'll give it a day to see if there are any other comments before
sending it out again.

Thanks,

Alistair

>
> Regards,
> Peter
>
>> +}
>> +
>>  int qbus_walk_children(BusState *bus,
>>                         qdev_walkerfn *pre_devfn, qbus_walkerfn *pre_busfn,
>>                         qdev_walkerfn *post_devfn, qbus_walkerfn *post_busfn,
>> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
>> index c537969..9653f4d 100644
>> --- a/include/hw/qdev-core.h
>> +++ b/include/hw/qdev-core.h
>> @@ -297,6 +297,8 @@ qemu_irq qdev_intercept_gpio_out(DeviceState *dev, qemu_irq icpt,
>>
>>  BusState *qdev_get_child_bus(DeviceState *dev, const char *name);
>>
>> +void qdev_bus_rename(BusState *bus, const char *name);
>> +
>>  /*** Device API.  ***/
>>
>>  /* Register device properties.  */
>> --
>> 2.5.0
>>
>

  reply	other threads:[~2015-12-17  0:56 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-16 21:44 [Qemu-devel] [PATCH v5 0/6] Connect the SPI devices to ZynqMP Alistair Francis
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 1/6] m25p80.c: Add sst25wf080 SPI flash device Alistair Francis
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 2/6] ssi: Move ssi.h into a separate directory Alistair Francis
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 3/6] xilinx_spips: Separate the state struct into a header Alistair Francis
2015-12-19 22:06   ` Peter Crosthwaite
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 4/6] qdev: Add a function to rename busses Alistair Francis
2015-12-16 22:36   ` Peter Crosthwaite
2015-12-17  0:55     ` Alistair Francis [this message]
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 5/6] xlnx-zynqmp: Connect the SPI devices Alistair Francis
2015-12-16 23:24   ` Paolo Bonzini
2015-12-17  0:45     ` Alistair Francis
2015-12-17  8:26     ` Peter Maydell
2015-12-17 10:28       ` Paolo Bonzini
2015-12-17 11:11         ` Peter Maydell
2015-12-17 11:12           ` Paolo Bonzini
2015-12-18 17:17             ` Alistair Francis
2015-12-18 17:55               ` Paolo Bonzini
2015-12-19 21:59                 ` Peter Crosthwaite
2015-12-16 21:45 ` [Qemu-devel] [PATCH v5 6/6] xlnx-ep108: Connect the SPI Flash Alistair Francis
2015-12-19 22:09   ` Peter Crosthwaite

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=CAKmqyKN3W5zsMBByU4NXK2_V-iAFEvGUUEzW+hbPbuSM6zUt8w@mail.gmail.com \
    --to=alistair.francis@xilinx.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.