From: "Andreas Färber" <afaerber@suse.de>
To: Markus Armbruster <armbru@redhat.com>
Cc: kwolf@redhat.com, peter.maydell@linaro.org,
benoit.canet@gmail.com, Igor Mitsyanko <i.mitsyanko@samsung.com>,
stefanha@linux.vnet.ibm.com, e.voevodin@samsung.com,
qemu-devel@nongnu.org, andrew.zaborowski@intel.com,
kyungmin.park@samsung.com, pbonzini@redhat.com,
wdongxu@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH V4 11/12] SD card: introduce "spi" property for SD card objects
Date: Tue, 31 Jul 2012 14:19:44 +0200 [thread overview]
Message-ID: <5017CD60.4060705@suse.de> (raw)
In-Reply-To: <87y5m0gssn.fsf@blackfin.pond.sub.org>
Am 31.07.2012 11:54, schrieb Markus Armbruster:
> Igor Mitsyanko <i.mitsyanko@samsung.com> writes:
>
>> And drop passing is_spi argument to SDCardClass::init function.
>> "spi" property could be set only while SD card object is not
>> attached to any BlockDriverState.
>> It defaults to "false".
>>
>> Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
>> Cc: Paul Brook <paul@codesourcery.com>
>> ---
>> hw/sd.c | 33 +++++++++++++++++++++++++++++++--
>> hw/sd.h | 8 ++++++--
>> 2 files changed, 37 insertions(+), 4 deletions(-)
>>
>> diff --git a/hw/sd.c b/hw/sd.c
>> index fe2c138..611e1f3 100644
>> --- a/hw/sd.c
>> +++ b/hw/sd.c
>> @@ -491,10 +491,9 @@ static const VMStateDescription sd_vmstate = {
>> whether card should be in SSI or MMC/SD mode. It is also up to the
>> board to ensure that ssi transfers only occur when the chip select
>> is asserted. */
>> -static void sd_init_card(SDState *sd, BlockDriverState *bs, bool is_spi)
>> +static void sd_init_card(SDState *sd, BlockDriverState *bs)
>> {
>> sd->buf = qemu_blockalign(bs, 512);
>> - sd->spi = is_spi;
>> sd->enable = true;
>> sd_reset(sd, bs);
>> if (sd->bdrv) {
>> @@ -1766,10 +1765,40 @@ static void sd_class_init(ObjectClass *klass, void *data)
>> k->enable = sd_enable_card;
>> }
>>
>> +static void sd_is_spi(Object *obj, Visitor *v, void *opaque,
>> + const char *name, Error **errp)
>> +{
>> + SDState *sd = SD_CARD(obj);
>> +
>> + visit_type_bool(v, &sd->spi, name, errp);
>> +}
>> +
>> +static void sd_set_spimode(Object *obj, Visitor *v, void *opaque,
>> + const char *name, Error **errp)
>> +{
>> + SDState *sd = SD_CARD(obj);
>> +
>> + if (sd->bdrv) {
>> + error_set(errp, QERR_DEVICE_IN_USE, bdrv_get_device_name(sd->bdrv));
>> + } else {
>> + visit_type_bool(v, &sd->spi, name, errp);
>> + }
>> +}
>> +
>> +static void sd_initfn(Object *obj)
>> +{
>> + SDState *sd = SD_CARD(obj);
>> +
>> + sd->spi = false;
>> + object_property_add(obj, "spi", "boolean", sd_is_spi, sd_set_spimode,
>> + NULL, NULL, NULL);
>> +}
>> +
>> static const TypeInfo sd_type_info = {
>> .name = TYPE_SD_CARD,
>> .parent = TYPE_OBJECT,
>> .instance_size = sizeof(SDState),
>> + .instance_init = sd_initfn,
>> .class_init = sd_class_init,
>> .class_size = sizeof(SDClass)
>> };
>
> I suspect this would be much simpler the declarative way qdevs normally
> use. For an example, check out scsi_hd_properties[] and its use in
> hw/scsi-disk.c.
[snip]
For static properties bool support was missing some time ago...
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2012-07-31 12:20 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-27 19:29 [Qemu-devel] [PATCH V4 00/12] SD save/load support, SD qomification and bug fixes Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 01/12] hw/sd.c: convert wp_groups in SDState to bitfield Igor Mitsyanko
2012-07-31 14:25 ` Peter Maydell
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 02/12] hw/sd.c: make sd_wp_addr() accept 64 bit address argument Igor Mitsyanko
2012-07-31 14:25 ` Peter Maydell
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 03/12] hw/sd.c: introduce wrapper for conversion address to wp group Igor Mitsyanko
2012-07-31 14:27 ` Peter Maydell
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 04/12] hw/sd.c: favour SD card type (SDSC or SDHC) when performing erase Igor Mitsyanko
2012-07-31 9:29 ` Markus Armbruster
2012-07-31 10:19 ` Igor Mitsyanko
2012-07-31 14:34 ` Peter Maydell
2012-07-31 15:13 ` Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 05/12] hw/sd.c: convert binary variables to bool Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 06/12] hw/sd.c: make sd_dataready() return bool Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 07/12] hw/sd.c: make sd_wp_addr() " Igor Mitsyanko
2012-07-31 14:39 ` Peter Maydell
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 08/12] hw/sd.c: add SD card save/load support Igor Mitsyanko
2012-07-31 9:33 ` Markus Armbruster
2012-07-31 10:27 ` Igor Mitsyanko
2012-07-31 14:56 ` Peter Maydell
2012-07-31 18:18 ` Igor Mitsyanko
2012-08-08 15:56 ` Peter Maydell
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 09/12] hw/sd.c: convert SD state to QOM object Igor Mitsyanko
2012-07-31 9:45 ` Markus Armbruster
2012-07-31 9:59 ` Peter Maydell
2012-07-31 14:48 ` Igor Mitsyanko
2012-07-31 15:29 ` Markus Armbruster
2012-07-31 16:17 ` Peter Maydell
2012-07-31 17:09 ` Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 10/12] SD card users: optimize access to SDClass methods Igor Mitsyanko
2012-07-31 15:43 ` Peter Maydell
2012-07-31 17:33 ` Igor Mitsyanko
2012-07-31 17:47 ` Peter Maydell
2012-07-31 18:03 ` Igor Mitsyanko
2012-07-31 18:15 ` Anthony Liguori
2012-07-31 18:33 ` Igor Mitsyanko
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 11/12] SD card: introduce "spi" property for SD card objects Igor Mitsyanko
2012-07-31 9:54 ` Markus Armbruster
2012-07-31 12:19 ` Andreas Färber [this message]
2012-07-31 12:53 ` Paolo Bonzini
2012-07-27 19:29 ` [Qemu-devel] [PATCH V4 12/12] hw/sd.c: introduce SD card "drive" property Igor Mitsyanko
2012-08-10 15:06 ` [Qemu-devel] [PATCH V4 00/12] SD save/load support, SD qomification and bug fixes Peter Maydell
2012-08-10 16:23 ` Igor Mitsyanko
2012-10-25 15:47 ` Peter Maydell
2012-10-25 18:46 ` Igor Mitsyanko
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=5017CD60.4060705@suse.de \
--to=afaerber@suse.de \
--cc=andrew.zaborowski@intel.com \
--cc=armbru@redhat.com \
--cc=benoit.canet@gmail.com \
--cc=e.voevodin@samsung.com \
--cc=i.mitsyanko@samsung.com \
--cc=kwolf@redhat.com \
--cc=kyungmin.park@samsung.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=wdongxu@linux.vnet.ibm.com \
/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).