From: "Andreas Färber" <afaerber@suse.de>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Andreas Färber" <afaerber@suse.de>,
"Anthony Liguori" <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 08/22] m48t59: Rename "type" property to "model"
Date: Mon, 18 Jun 2012 15:59:00 +0200 [thread overview]
Message-ID: <1340027954-19045-9-git-send-email-afaerber@suse.de> (raw)
In-Reply-To: <1340027954-19045-1-git-send-email-afaerber@suse.de>
From: Paolo Bonzini <pbonzini@redhat.com>
This resolves a name conflict with the qdev "type" property that is
about to move into Object.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Add braces missing in original code.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
hw/m48t59.c | 40 ++++++++++++++++++++++------------------
1 files changed, 22 insertions(+), 18 deletions(-)
diff --git a/hw/m48t59.c b/hw/m48t59.c
index 0c50f45..dd6cb37 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -65,7 +65,7 @@ struct M48t59State {
/* NVRAM storage */
uint8_t *buffer;
/* Model parameters */
- uint32_t type; /* 2 = m48t02, 8 = m48t08, 59 = m48t59 */
+ uint32_t model; /* 2 = m48t02, 8 = m48t08, 59 = m48t59 */
/* NVRAM storage */
uint16_t addr;
uint8_t lock;
@@ -197,10 +197,11 @@ void m48t59_write (void *opaque, uint32_t addr, uint32_t val)
NVRAM_PRINTF("%s: 0x%08x => 0x%08x\n", __func__, addr, val);
/* check for NVRAM access */
- if ((NVRAM->type == 2 && addr < 0x7f8) ||
- (NVRAM->type == 8 && addr < 0x1ff8) ||
- (NVRAM->type == 59 && addr < 0x1ff0))
+ if ((NVRAM->model == 2 && addr < 0x7f8) ||
+ (NVRAM->model == 8 && addr < 0x1ff8) ||
+ (NVRAM->model == 59 && addr < 0x1ff0)) {
goto do_write;
+ }
/* TOD access */
switch (addr) {
@@ -334,10 +335,11 @@ void m48t59_write (void *opaque, uint32_t addr, uint32_t val)
tmp = from_bcd(val);
if (tmp >= 0 && tmp <= 99) {
get_time(NVRAM, &tm);
- if (NVRAM->type == 8)
+ if (NVRAM->model == 8) {
tm.tm_year = from_bcd(val) + 68; // Base year is 1968
- else
+ } else {
tm.tm_year = from_bcd(val);
+ }
set_time(NVRAM, &tm);
}
break;
@@ -362,10 +364,11 @@ uint32_t m48t59_read (void *opaque, uint32_t addr)
uint32_t retval = 0xFF;
/* check for NVRAM access */
- if ((NVRAM->type == 2 && addr < 0x078f) ||
- (NVRAM->type == 8 && addr < 0x1ff8) ||
- (NVRAM->type == 59 && addr < 0x1ff0))
+ if ((NVRAM->model == 2 && addr < 0x078f) ||
+ (NVRAM->model == 8 && addr < 0x1ff8) ||
+ (NVRAM->model == 59 && addr < 0x1ff0)) {
goto do_read;
+ }
/* TOD access */
switch (addr) {
@@ -439,10 +442,11 @@ uint32_t m48t59_read (void *opaque, uint32_t addr)
case 0x07FF:
/* year */
get_time(NVRAM, &tm);
- if (NVRAM->type == 8)
+ if (NVRAM->model == 8) {
retval = to_bcd(tm.tm_year - 68); // Base year is 1968
- else
+ } else {
retval = to_bcd(tm.tm_year);
+ }
break;
default:
/* Check lock registers state */
@@ -633,7 +637,7 @@ static const MemoryRegionOps m48t59_io_ops = {
/* Initialisation routine */
M48t59State *m48t59_init(qemu_irq IRQ, target_phys_addr_t mem_base,
- uint32_t io_base, uint16_t size, int type)
+ uint32_t io_base, uint16_t size, int model)
{
DeviceState *dev;
SysBusDevice *s;
@@ -641,7 +645,7 @@ M48t59State *m48t59_init(qemu_irq IRQ, target_phys_addr_t mem_base,
M48t59State *state;
dev = qdev_create(NULL, "m48t59");
- qdev_prop_set_uint32(dev, "type", type);
+ qdev_prop_set_uint32(dev, "model", model);
qdev_prop_set_uint32(dev, "size", size);
qdev_prop_set_uint32(dev, "io_base", io_base);
qdev_init_nofail(dev);
@@ -661,14 +665,14 @@ M48t59State *m48t59_init(qemu_irq IRQ, target_phys_addr_t mem_base,
}
M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
- int type)
+ int model)
{
M48t59ISAState *d;
ISADevice *dev;
M48t59State *s;
dev = isa_create(bus, "m48t59_isa");
- qdev_prop_set_uint32(&dev->qdev, "type", type);
+ qdev_prop_set_uint32(&dev->qdev, "model", model);
qdev_prop_set_uint32(&dev->qdev, "size", size);
qdev_prop_set_uint32(&dev->qdev, "io_base", io_base);
qdev_init_nofail(&dev->qdev);
@@ -686,7 +690,7 @@ M48t59State *m48t59_init_isa(ISABus *bus, uint32_t io_base, uint16_t size,
static void m48t59_init_common(M48t59State *s)
{
s->buffer = g_malloc0(s->size);
- if (s->type == 59) {
+ if (s->model == 59) {
s->alrm_timer = qemu_new_timer_ns(rtc_clock, &alarm_cb, s);
s->wd_timer = qemu_new_timer_ns(vm_clock, &watchdog_cb, s);
}
@@ -722,7 +726,7 @@ static int m48t59_init1(SysBusDevice *dev)
static Property m48t59_isa_properties[] = {
DEFINE_PROP_UINT32("size", M48t59ISAState, state.size, -1),
- DEFINE_PROP_UINT32("type", M48t59ISAState, state.type, -1),
+ DEFINE_PROP_UINT32("model", M48t59ISAState, state.model, -1),
DEFINE_PROP_HEX32( "io_base", M48t59ISAState, state.io_base, 0),
DEFINE_PROP_END_OF_LIST(),
};
@@ -746,7 +750,7 @@ static TypeInfo m48t59_isa_info = {
static Property m48t59_properties[] = {
DEFINE_PROP_UINT32("size", M48t59SysBusState, state.size, -1),
- DEFINE_PROP_UINT32("type", M48t59SysBusState, state.type, -1),
+ DEFINE_PROP_UINT32("model", M48t59SysBusState, state.model, -1),
DEFINE_PROP_HEX32( "io_base", M48t59SysBusState, state.io_base, 0),
DEFINE_PROP_END_OF_LIST(),
};
--
1.7.7
next prev parent reply other threads:[~2012-06-18 14:00 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-18 13:58 [Qemu-devel] [PULL] qom-next queue, second batch: QBus, API additions and cleanups Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 01/22] qom: Add object_class_get_parent() Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 02/22] qom: Introduce object_property_is_{child, link}() Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 03/22] qom: Add object_child_foreach() Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 04/22] qom: Add class_base_init Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 05/22] qom: Make Object a type Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 06/22] qom: Drop type_register_static_alias() macro Andreas Färber
2012-06-18 13:58 ` [Qemu-devel] [PATCH 07/22] qom: Assert that public types have a non-NULL parent field Andreas Färber
2012-06-18 13:59 ` Andreas Färber [this message]
2012-06-18 13:59 ` [Qemu-devel] [PATCH 09/22] arm_l2x0: Rename "type" property to "cache-type" Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 10/22] qdev: Push "type" property up to Object Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 11/22] qdev: Move bus properties to a separate global Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 12/22] qdev: Move bus properties to abstract superclasses Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 13/22] qdev: Clean up global properties Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 14/22] qdev: Remove qdev_prop_set_defaults Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 15/22] qdev: Use wrapper for qdev_get_path Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 16/22] qdev: Move SysBus initialization to sysbus.c Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 17/22] qdev: Convert busses to QEMU Object Model Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 18/22] qdev: Connect busses with their parent devices Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 19/22] qbus: Make child devices links Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 20/22] qbus: Initialize in standard way Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 21/22] qdev: Remove qdev_prop_exists() Andreas Färber
2012-06-18 13:59 ` [Qemu-devel] [PATCH 22/22] qom: Push error reporting to object_property_find() Andreas Färber
2012-06-20 13:09 ` [Qemu-devel] [PULL] qom-next queue, second batch: QBus, API additions and cleanups Anthony Liguori
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=1340027954-19045-9-git-send-email-afaerber@suse.de \
--to=afaerber@suse.de \
--cc=anthony@codemonkey.ws \
--cc=pbonzini@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).