Re: [PATCH v2 2/3] floppy: add defines for sizes of cmd & reply buffers of floppy_raw_cmd

From: Denis Efremov
Date: Sun Apr 26 2020 - 16:45:22 EST




On 4/26/20 11:28 PM, Joe Perches wrote:
> On Sun, 2020-04-26 at 16:07 +0300, Denis Efremov wrote:
>> Use FD_RAW_CMD_SIZE, FD_RAW_REPLY_SIZE defines instead of magic numbers
>> for cmd & reply buffers of struct floppy_raw_cmd. Remove local to
>> floppy.c MAX_REPLIES define, as it is now FD_RAW_REPLY_SIZE.
>> FD_RAW_CMD_FULLSIZE added as we allow command to also fill reply_count
>> and reply fields.
> []
>> diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
> []
>> @@ -1847,7 +1846,7 @@ static void show_floppy(int fdc)
>> output_log[(i + output_log_pos) % OLOGSIZE].jiffies);
>> pr_info("last result at %lu\n", resultjiffies);
>> pr_info("last redo_fd_request at %lu\n", lastredo);
>> - print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, 16, 1,
>> + print_hex_dump(KERN_INFO, "", DUMP_PREFIX_NONE, FD_RAW_REPLY_SIZE, 1,
>> reply_buffer, resultsize, true);
>
> FD_RAW_REPLY_SIZE happens to be 16, but it's misleading
> to use it here.
>
> This use of 16 is not for FD_RAW_REPLY_SIZE, but the
> width of the line
> being dumped, and this value must be
> either 16 or 32.
>

Yes, you are right. Thanks for catching. I will resend the patches.

Denis