Skip to content
  • Markus Armbruster's avatar
    8ec239f2
    hw/arm/aspeed: Replace drive_get_next() by drive_get() · 8ec239f2
    Markus Armbruster authored
    
    
    drive_get_next() is basically a bad idea.  It returns the "next" block
    backend of a certain interface type.  "Next" means bus=0,unit=N, where
    subsequent calls count N up from zero, per interface type.
    
    This lets you define unit numbers implicitly by execution order.  If the
    order changes, or new calls appear "in the middle", unit numbers change.
    ABI break.  Hard to spot in review.
    
    The aspeed machines connects backends with drive_get_next() in several
    counting loops, one of them in a helper function, and a conditional.
    Change it to use drive_get() directly.  This makes the unit numbers
    explicit in the code.
    
    Cc: "Cédric Le Goater" <clg@kaod.org>
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: Andrew Jeffery <andrew@aj.id.au>
    Cc: Joel Stanley <joel@jms.id.au>
    Cc: qemu-arm@nongnu.org
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <20211117163409.3587705-13-armbru@redhat.com>
    Reviewed-by: default avatarCédric Le Goater <clg@kaod.org>
    8ec239f2
    hw/arm/aspeed: Replace drive_get_next() by drive_get()
    Markus Armbruster authored
    
    
    drive_get_next() is basically a bad idea.  It returns the "next" block
    backend of a certain interface type.  "Next" means bus=0,unit=N, where
    subsequent calls count N up from zero, per interface type.
    
    This lets you define unit numbers implicitly by execution order.  If the
    order changes, or new calls appear "in the middle", unit numbers change.
    ABI break.  Hard to spot in review.
    
    The aspeed machines connects backends with drive_get_next() in several
    counting loops, one of them in a helper function, and a conditional.
    Change it to use drive_get() directly.  This makes the unit numbers
    explicit in the code.
    
    Cc: "Cédric Le Goater" <clg@kaod.org>
    Cc: Peter Maydell <peter.maydell@linaro.org>
    Cc: Andrew Jeffery <andrew@aj.id.au>
    Cc: Joel Stanley <joel@jms.id.au>
    Cc: qemu-arm@nongnu.org
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <20211117163409.3587705-13-armbru@redhat.com>
    Reviewed-by: default avatarCédric Le Goater <clg@kaod.org>
Loading