linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
To: Borislav Petkov <bbpetkov@yahoo.de>
Cc: linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it
Date: Fri, 4 Jan 2008 23:49:09 +0100	[thread overview]
Message-ID: <200801042349.09964.bzolnier@gmail.com> (raw)
In-Reply-To: <1199366409-26016-3-git-send-email-bbpetkov@yahoo.de>


Hi,

Hmm, contrary to ide-cd.c case there doesn't seem to be a need currently for
moving code out of ide-floppy.c (and this patch series doesn't change that).

Besides it would be better to just remove some structs like it has been done
with i.e. struct atapi_capabilities_page in ide-cd.c case [1] because:

* it is easier to audit/debug the code if you don't have to look at typedefs
  all the time just to see which bytes/bits the code is really accessing

* not using typedefs will make the source code significantly smaller

* documentation is publically available

* these structs are not memory mapped

[1] http://www.mail-archive.com/linux-kernel@vger.kernel.org/msg242747.html

On Thursday 03 January 2008, Borislav Petkov wrote:
> - do a white-space cleanup
> - remove old crufty code untouched since at least 2005

Please try to not mix things like moving code around and doing actual
changes because it makes patch review difficult (i.e. it took me quite a
while to find "old crufty code" that has been removed)...

Sometimes having more "trivial" patches is better...

> - shorten lines longer than 80ish columns
> - shorten some LAAARGE typenames.

typedefs are evil (exceptions are rare) and should die :)

> There should be no functional changes resulting from this patch.
> 
> Signed-off-by: Borislav Petkov <bbpetkov@yahoo.de>
> ---
>  drivers/ide/ide-floppy.c |  763 ++++++++++++----------------------------------
>  drivers/ide/ide-floppy.h |  382 +++++++++++++++++++++++
>  2 files changed, 581 insertions(+), 564 deletions(-)
> 
> diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
> index 785fbde..52d09c1 100644
> --- a/drivers/ide/ide-floppy.c
> +++ b/drivers/ide/ide-floppy.c

[...]

> -} idefloppy_capabilities_page_t;

[...]

> -} idefloppy_flexible_disk_page_t;

[...]

> -} idefloppy_capacity_descriptor_t;

as mentioned earlier it would be best to just remove these structs/typedefs

[ respective structures are described in SFF-8070i spec, it is useful to audit
  the final code against the spec to catch potential coding mistakes early ]

[...]

> -#if 0
> -/*
> - *	Special requests for our block device strategy routine.
> - */
> -#define	IDEFLOPPY_FIRST_RQ	90
> -
> -/*
> - * 	IDEFLOPPY_PC_RQ is used to queue a packet command in the request queue.
> - */
> -#define	IDEFLOPPY_PC_RQ		90
> -
> -#define IDEFLOPPY_LAST_RQ	90
> -
> -/*
> - *	A macro which can be used to check if a given request command
> - *	originated in the driver or in the buffer cache layer.
> - */
> -#define IDEFLOPPY_RQ_CMD(cmd) 	((cmd >= IDEFLOPPY_FIRST_RQ) && (cmd <= IDEFLOPPY_LAST_RQ))
> -
> -#endif

Well, it was already removed, the patch is in IDE tree (and thus in -mm).

http://kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.24-rc6/2.6.24-rc6-mm1/broken-out/ide-mm-ide-floppy-remove-dead-code.patch

If possible please base your patches against IDE tree or the latest -mm patch.

[...]

> -} idefloppy_inquiry_result_t;

[...]

> -} idefloppy_request_sense_result_t;

[...]

> -} idefloppy_mode_parameter_header_t;

more structs/typedefs heading for /dev/null

[...]

> @@ -1689,9 +1304,12 @@ static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id)
>  	printk(KERN_INFO "Write buffer size(?): %d bytes\n",id->buf_size*512);
>  	printk(KERN_INFO "DMA: %s",id->capability & 0x01 ? "Yes\n":"No\n");
>  	printk(KERN_INFO "LBA: %s",id->capability & 0x02 ? "Yes\n":"No\n");
> -	printk(KERN_INFO "IORDY can be disabled: %s",id->capability & 0x04 ? "Yes\n":"No\n");
> -	printk(KERN_INFO "IORDY supported: %s",id->capability & 0x08 ? "Yes\n":"Unknown\n");
> -	printk(KERN_INFO "ATAPI overlap supported: %s",id->capability & 0x20 ? "Yes\n":"No\n");
> +	printk(KERN_INFO "IORDY can be disabled: %s",
> +			id->capability & 0x04 ? "Yes\n":"No\n");
> +	printk(KERN_INFO "IORDY supported: %s",
> +			id->capability & 0x08 ? "Yes\n":"Unknown\n");
> +	printk(KERN_INFO "ATAPI overlap supported: %s",
> +			id->capability & 0x20 ? "Yes\n":"No\n");
>  	printk(KERN_INFO "PIO Cycle Timing Category: %d\n",id->tPIO);
>  	printk(KERN_INFO "DMA Cycle Timing Category: %d\n",id->tDMA);
>  	printk(KERN_INFO "Single Word DMA supported modes:\n");
> @@ -1713,12 +1331,16 @@ static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id)
>  			sprintf(buffer, "Not supported");
>  		else
>  			sprintf(buffer, "%d ns",id->eide_dma_min);
> -		printk(KERN_INFO "Minimum Multi-word DMA cycle per word: %s\n", buffer);
> +		printk(KERN_INFO "Minimum Multi-word DMA cycle per word: %s\n",
> +				buffer);
> +
>  		if (id->eide_dma_time == 0)
>  			sprintf(buffer, "Not supported");
>  		else
>  			sprintf(buffer, "%d ns",id->eide_dma_time);
> -		printk(KERN_INFO "Manufacturer\'s Recommended Multi-word cycle: %s\n", buffer);
> +		printk(KERN_INFO "Manufacturer\'s Recommended Multi-word"
> +				" cycle: %s\n", buffer);
> +
>  		if (id->eide_pio == 0)
>  			sprintf(buffer, "Not supported");
>  		else
> @@ -1731,7 +1353,8 @@ static int idefloppy_identify_device (ide_drive_t *drive,struct hd_driveid *id)
>  			sprintf(buffer, "%d ns",id->eide_pio_iordy);
>  		printk(KERN_INFO "Minimum PIO cycle with IORDY: %s\n", buffer);
>  	} else
> -		printk(KERN_INFO "According to the device, fields 64-70 are not valid.\n");
> +		printk(KERN_INFO "According to the device, fields 64-70 are not"
> +				" valid.\n");
>  #endif /* IDEFLOPPY_DEBUG_INFO */
>  
>  	if (gcw.protocol != 2)

identify dumping has been removed by:

http://kernel.org/pub/linux/kernel/people/bart/pata-2.6/patches/ide-floppy-tape-remove-debug-code-for-dumping-identify-data.patch

[ not in -mm yet ]

Please rework/resubmit this patch (preferably splitted on few smaller ones).

Thanks,
Bart

PS please also check your patches with scripts/checkpatch.pl before posting

  parent reply	other threads:[~2008-01-04 22:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-03 13:19 [RESEND PATCH 0/10] ide-floppy redux p1 Borislav Petkov
2008-01-03 13:20 ` [RESEND PATCH 01/10] move ide-floppy historical changelog to Documentation/ide/ChangeLog.ide-floppy.1996-2002; Borislav Petkov
2008-01-03 13:20   ` [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it Borislav Petkov
2008-01-03 13:20     ` [RESEND PATCH 03/10] ide-floppy: convert to generic packet commands Borislav Petkov
2008-01-03 13:20       ` [RESEND PATCH 04/10] ide-floppy: cleanup debugging macros Borislav Petkov
2008-01-03 13:20         ` [RESEND PATCH 05/10] ide-floppy: factor out ioctl handlers from idefloppy_ioctl() Borislav Petkov
2008-01-03 13:20           ` [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly Borislav Petkov
2008-01-03 13:20             ` [RESEND PATCH 07/10] ide-floppy: remove unnecessary ->handler != NULL check Borislav Petkov
2008-01-03 13:20               ` [RESEND PATCH 08/10] ide-floppy: mv idefloppy_{should_,}report_error Borislav Petkov
2008-01-03 13:20                 ` [RESEND PATCH 09/10] ide-floppy: use test_bit wrappers for testing flags Borislav Petkov
2008-01-03 13:20                   ` [RESEND PATCH 10/10] ide-floppy: replace ntoh{s,l} and hton{s,l} calls with the generic byteorder macros Borislav Petkov
2008-01-04  1:29                     ` Bartlomiej Zolnierkiewicz
2008-01-05 16:10                   ` [RESEND PATCH 09/10] ide-floppy: use test_bit wrappers for testing flags Bartlomiej Zolnierkiewicz
2008-01-05 15:54                 ` [RESEND PATCH 08/10] ide-floppy: mv idefloppy_{should_,}report_error Bartlomiej Zolnierkiewicz
2008-01-04  1:24               ` [RESEND PATCH 07/10] ide-floppy: remove unnecessary ->handler != NULL check Bartlomiej Zolnierkiewicz
2008-01-05 15:46             ` [RESEND PATCH 06/10] ide-floppy: report DMA handling in idefloppy_pc_intr() properly Bartlomiej Zolnierkiewicz
2008-01-05 21:45               ` Borislav Petkov
2008-01-06 15:21                 ` Bartlomiej Zolnierkiewicz
2008-01-05 15:12           ` [RESEND PATCH 05/10] ide-floppy: factor out ioctl handlers from idefloppy_ioctl() Bartlomiej Zolnierkiewicz
2008-01-04  1:19         ` [RESEND PATCH 04/10] ide-floppy: cleanup debugging macros Bartlomiej Zolnierkiewicz
2008-01-04  1:04       ` [RESEND PATCH 03/10] ide-floppy: convert to generic packet commands Bartlomiej Zolnierkiewicz
2008-01-04 22:49     ` Bartlomiej Zolnierkiewicz [this message]
2008-01-05 12:45       ` [RESEND PATCH 02/10] ide-floppy: move ide-floppy struct and macro defs into its own header. While at it Borislav Petkov
2008-01-05 13:15         ` Bartlomiej Zolnierkiewicz
2008-01-04  0:36   ` [RESEND PATCH 01/10] move ide-floppy historical changelog to Documentation/ide/ChangeLog.ide-floppy.1996-2002; Bartlomiej Zolnierkiewicz
2008-01-04  0:14 ` [RESEND PATCH 0/10] ide-floppy redux p1 Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200801042349.09964.bzolnier@gmail.com \
    --to=bzolnier@gmail.com \
    --cc=bbpetkov@yahoo.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).