[patch-2.3.43-pre2] small optimization in drivers/cdrom/mcd.c

From: Tigran Aivazian (tigran@ocston.org)
Date: Tue Feb 08 2000 - 11:05:26 EST


Hi Linus,

This patch to drivers/cdrom/mcd.c does:

  a) unifies two sprintf() into one using A ? B : C conditional

  b) sets the info->speed=1 if drive is single-speed (used to be 2)

  c) optimizes intialization of speed=2 away as it is done at
structure initialization level.

 http://www.ocston.org/~tigran/patches/mcd-speed-2.3.43-p2.patch

Regards,
Tigran

--- mcd.c.0 Tue Feb 8 14:19:03 2000
+++ mcd.c Tue Feb 8 15:53:27 2000
@@ -1247,18 +1247,13 @@
 
         if (result[1] == 'D')
         {
- sprintf(msg, " mcd: Mitsumi Double Speed CD-ROM at port=0x%x,"
- " irq=%d\n", mcd_port, mcd_irq);
                 MCMD_DATA_READ = MCMD_2X_READ;
-
- mcd_info.speed = 2;
                 /* Added flag to drop to 1x speed if too many errors */
                 mcdDouble = 1;
- } else {
- sprintf(msg, " mcd: Mitsumi Single Speed CD-ROM at port=0x%x,"
- " irq=%d\n", mcd_port, mcd_irq);
- mcd_info.speed = 2;
- }
+ } else
+ mcd_info.speed = 1;
+ sprintf(msg, " mcd: Mitsumi %s Speed CD-ROM at port=0x%x,"
+ " irq=%d\n", mcd_info.speed == 1 ? "Single" : "Double", mcd_port, mcd_irq);
 
         request_region(mcd_port, 4, "mcd");
 

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Feb 15 2000 - 21:00:12 EST