diff options
author | Markus Armbruster <armbru@redhat.com> | 2012-07-11 15:08:37 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-07-17 16:48:32 +0200 |
commit | 911525dba9ecc21f97b05c0f09bf9319a9de3a7d (patch) | |
tree | 5d82736bd710e29d590d841bd2636d4247085eff /hw/ide | |
parent | 31e404f4ffb6adadea0b35de08e0a6b640e81a02 (diff) |
hw/block-common: Factor out fall back to legacy -drive serial=...
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/ide')
-rw-r--r-- | hw/ide/qdev.c | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/hw/ide/qdev.c b/hw/ide/qdev.c index de9db3bf9f..7fe803c85f 100644 --- a/hw/ide/qdev.c +++ b/hw/ide/qdev.c @@ -142,7 +142,6 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) { IDEBus *bus = DO_UPCAST(IDEBus, qbus, dev->qdev.parent_bus); IDEState *s = bus->ifs + dev->unit; - const char *serial; DriveInfo *dinfo; if (dev->conf.discard_granularity && dev->conf.discard_granularity != 512) { @@ -150,14 +149,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) return -1; } - serial = dev->serial; - if (!serial) { - /* try to fall back to value set with legacy -drive serial=... */ - dinfo = drive_get_by_blockdev(dev->conf.bs); - if (*dinfo->serial) { - serial = dinfo->serial; - } - } + blkconf_serial(&dev->conf, &dev->serial); if (!dev->conf.cyls && !dev->conf.heads && !dev->conf.secs) { /* try to fall back to value set with legacy -drive cyls=... */ @@ -177,7 +169,7 @@ static int ide_dev_initfn(IDEDevice *dev, IDEDriveKind kind) } if (ide_init_drive(s, dev->conf.bs, kind, - dev->version, serial, dev->model, dev->wwn, + dev->version, dev->serial, dev->model, dev->wwn, dev->conf.cyls, dev->conf.heads, dev->conf.secs, dev->chs_trans) < 0) { return -1; |