[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v5 3/4] fdc: rewrite seek and DSKCHG bit handlin
From: |
Kevin Wolf |
Subject: |
Re: [Qemu-devel] [PATCH v5 3/4] fdc: rewrite seek and DSKCHG bit handling |
Date: |
Thu, 14 Jun 2012 16:05:57 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 |
Am 13.06.2012 15:43, schrieb Pavel Hrdina:
> This bit is cleared on every successful seek to a different track (cylinder).
> The seek is also called on revalidate or on read/write/format commands which
> also clear the DSKCHG bit.
>
> Signed-off-by: Pavel Hrdina <address@hidden>
> ---
> hw/fdc.c | 68
> +++++++++++++++++++++++++++++++-------------------------------
> 1 files changed, 34 insertions(+), 34 deletions(-)
Nice cleanup! Looks good generally, but this and patch 4 need test cases
as well before I can apply them.
> @@ -1004,30 +998,39 @@ static int fdctrl_seek_to_next_sect(FDCtrl *fdctrl,
> FDrive *cur_drv)
> fd_sector(cur_drv));
> /* XXX: cur_drv->sect >= cur_drv->last_sect should be an
> error in fact */
> - if (cur_drv->sect >= cur_drv->last_sect ||
> - cur_drv->sect == fdctrl->eot) {
> - cur_drv->sect = 1;
> + uint8_t new_head = cur_drv->head;
> + uint8_t new_track = cur_drv->track;
> + uint8_t new_sect = cur_drv->sect;
> +
> + int ret = 1;
> +
> + if (new_sect >= cur_drv->last_sect ||
> + new_sect == fdctrl->eot) {
> + new_sect = 1;
> if (FD_MULTI_TRACK(fdctrl->data_state)) {
> - if (cur_drv->head == 0 &&
> + if (new_head == 0 &&
> (cur_drv->flags & FDISK_DBL_SIDES) != 0) {
> - cur_drv->head = 1;
> + new_head = 1;
> } else {
> - cur_drv->head = 0;
> - cur_drv->track++;
> + new_head = 0;
> + new_track++;
> if ((cur_drv->flags & FDISK_DBL_SIDES) == 0)
> - return 0;
> + ret = 0;
Please use the chance to add braces here.
Can you also add a small header comment to the function that explains
what the return value means? Initially I read 0 as error, but in fact it
seems only to mean "request completed".
Kevin
- [Qemu-devel] [PATCH v5 0/4] fdc: fix/rewrite seek, media_changed and interrupt handling, Pavel Hrdina, 2012/06/13
- [Qemu-devel] [PATCH v5 2/4] fdc-test: introduced qtest read_without_media, Pavel Hrdina, 2012/06/13
- [Qemu-devel] [PATCH v5 3/4] fdc: rewrite seek and DSKCHG bit handling, Pavel Hrdina, 2012/06/13
- Re: [Qemu-devel] [PATCH v5 3/4] fdc: rewrite seek and DSKCHG bit handling,
Kevin Wolf <=
- [Qemu-devel] [PATCH v5 4/4] fdc: fix interrupt handling, Pavel Hrdina, 2012/06/13
- [Qemu-devel] [PATCH v5 1/4] fdc: fix implied seek while there is no media in drive, Pavel Hrdina, 2012/06/13
- Re: [Qemu-devel] [PATCH v5 0/4] fdc: fix/rewrite seek, media_changed and interrupt handling, Kevin Wolf, 2012/06/14