linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] use ARRAY_SIZE in ide-cd.c
@ 2007-07-27 18:10 Mark Hindley
  2007-07-28 11:51 ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Hindley @ 2007-07-27 18:10 UTC (permalink / raw)
  To: linux-ide; +Cc: alan

Hi,

ARY_LEN in ide-cd.{c,h} is an unnecessary duplication. Replace with generic ARRAY_SIZE from
kernel.h.

Mark


commit 195695d6135fcc4615b70883c8c1c3cc82c5633c
Author: Mark Hindley <mark@hindley.org.uk>
Date:   Fri Jul 27 18:55:33 2007 +0100

    Replace ARY_LEN with ARRAY_SIZE in drivers/ide/ide-cd.{c,h}.
    
    Signed-off-by: Mark Hindley <mark@hindley.org.uk>

diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 252ab82..79ee92a 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -481,7 +481,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 		else
 			printk("  Unknown Error Type: ");
 
-		if (sense->sense_key < ARY_LEN(sense_key_texts))
+		if (sense->sense_key < ARRAY_SIZE(sense_key_texts))
 			s = sense_key_texts[sense->sense_key];
 
 		printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
@@ -491,7 +491,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 				 sense->ascq);
 			s = buf;
 		} else {
-			int lo = 0, mid, hi = ARY_LEN(sense_data_texts);
+			int lo = 0, mid, hi = ARRAY_SIZE(sense_data_texts);
 			unsigned long key = (sense->sense_key << 16);
 			key |= (sense->asc << 8);
 			if (!(sense->ascq >= 0x80 && sense->ascq <= 0xdd))
@@ -524,7 +524,7 @@ void cdrom_analyze_sense_data(ide_drive_t *drive,
 
 		if (failed_command != NULL) {
 
-			int lo=0, mid, hi= ARY_LEN (packet_command_texts);
+			int lo=0, mid, hi= ARRAY_SIZE (packet_command_texts);
 			s = NULL;
 
 			while (hi > lo) {
diff --git a/drivers/ide/ide-cd.h b/drivers/ide/ide-cd.h
index ad1f2ed..228b29c 100644
--- a/drivers/ide/ide-cd.h
+++ b/drivers/ide/ide-cd.h
@@ -498,8 +498,6 @@ struct cdrom_info {
  * Descriptions of ATAPI error codes.
  */
 
-#define ARY_LEN(a) ((sizeof(a) / sizeof(a[0])))
-
 /* This stuff should be in cdrom.h, since it is now generic... */
 
 /* ATAPI sense keys (from table 140 of ATAPI 2.6) */

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] use ARRAY_SIZE in ide-cd.c
  2007-07-27 18:10 [PATCH] use ARRAY_SIZE in ide-cd.c Mark Hindley
@ 2007-07-28 11:51 ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 2+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2007-07-28 11:51 UTC (permalink / raw)
  To: Mark Hindley; +Cc: linux-ide, alan


Hi,

On Friday 27 July 2007, Mark Hindley wrote:
> Hi,
> 
> ARY_LEN in ide-cd.{c,h} is an unnecessary duplication. Replace with generic ARRAY_SIZE from
> kernel.h.

Seems to be already fixed by:

commit 74c8f97a6c2d12fb144ad34076e969e8a01dc4b3
Author: Robert P. J. Day <rpjday@mindspring.com>
Date:   Mon Jul 9 23:17:57 2007 +0200

    ide-cd: replace C code with call to ARRAY_SIZE() macro

    Delete the unnecessary macro ARY_LEN and use ARRAY_SIZE directly.

    Signed-off-by: Robert P. J. Day <rpjday@mindspring.com>
    Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

Please always make sure that you are working on the current git tree
or such unfortunate situation is likely to happen... ;)

Thanks,
Bart

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-07-28 11:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-27 18:10 [PATCH] use ARRAY_SIZE in ide-cd.c Mark Hindley
2007-07-28 11:51 ` Bartlomiej Zolnierkiewicz

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).