• Willy Tarreau's avatar
    floppy: cleanup: do not iterate on current_fdc in do_floppy_init() · 05f5e319
    Willy Tarreau authored
    There's no need to iterate on current_fdc in do_floppy_init() anymore,
    in the first case it's only used as an array index to access fdc_state[],
    so let's get rid of this confusing assignment. The second case is a bit
    trickier because user_reset_fdc() needs to already know current_fdc when
    called with drive==-1 due to this call chain:
    
        user_reset_fdc()
          lock_fdc()
            set_fdc()
               drive<0 ==> new_fdc = current_fdc
    
    Note that current_drive is not used in this code part and may even not
    match a unit belonging to current_fdc. Instead of passing -1 we can
    simply pass the first drive of the FDC being initialized, which is even
    cleaner as it will allow the function chain above to consistently assign
    both variables.
    
    Link: https://lore.kernel.org/r/20200410093023.14499-1-w@1wt.euSigned-off-by: default avatarWilly Tarreau <w@1wt.eu>
    Signed-off-by: default avatarDenis Efremov <efremov@linux.com>
    05f5e319
floppy.c 136 KB