Index: trunk/src/os2ahci/ioctl.c
===================================================================
--- trunk/src/os2ahci/ioctl.c	(revision 128)
+++ trunk/src/os2ahci/ioctl.c	(revision 129)
@@ -59,5 +59,6 @@
 /* -------------------------- function prototypes -------------------------- */
 
-static USHORT do_smart  (BYTE unit, BYTE sub_func, BYTE parm, void _far *buf);
+static USHORT do_smart  (BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l,
+                         void _far *buf);
 static int    map_unit  (BYTE unit, USHORT _far *a, USHORT _far *p,
                          USHORT _far *d);
@@ -498,42 +499,40 @@
 
   case DSKSP_SMART_ONOFF:
-    ret = do_smart(unit,
-                   (BYTE) ((parm) ? ATA_SMART_ENABLE
-                                  : ATA_SMART_DISABLE),
-                   0, NULL);
+    ret = do_smart(unit, (BYTE) ((parm) ? ATA_SMART_ENABLE
+                                        : ATA_SMART_DISABLE),
+                   0, 0, NULL);
     break;
 
   case DSKSP_SMART_AUTOSAVE_ONOFF:
     ret = do_smart(unit, ATA_SMART_AUTOSAVE,
-                   (BYTE) ((parm) ? (BYTE) 0xf1 : 0),
-                   NULL);
+                   (BYTE) ((parm) ? (BYTE) 0xf1 : 0), 0, NULL);
     break;
 
   case DSKSP_SMART_AUTO_OFFLINE:
-    ret = do_smart(unit, ATA_SMART_AUTO_OFFLINE, parm, NULL);
+    ret = do_smart(unit, ATA_SMART_AUTO_OFFLINE, parm, 0, NULL);
     break;
 
   case DSKSP_SMART_EXEC_OFFLINE:
-    ret = do_smart(unit, ATA_SMART_IMMEDIATE_OFFLINE, parm, NULL);
+    ret = do_smart(unit, ATA_SMART_IMMEDIATE_OFFLINE, 0, parm, NULL);
     break;
 
   case DSKSP_SMART_SAVE:
-    ret = do_smart(unit, ATA_SMART_SAVE, 0, NULL);
+    ret = do_smart(unit, ATA_SMART_SAVE, 0, 0, NULL);
     break;
 
   case DSKSP_SMART_GETSTATUS:
-    ret = do_smart(unit, ATA_SMART_STATUS, 0, ioctl->DataPacket);
+    ret = do_smart(unit, ATA_SMART_STATUS, 0, 0, ioctl->DataPacket);
     break;
 
   case DSKSP_SMART_GET_ATTRIBUTES:
-    ret = do_smart(unit, ATA_SMART_READ_VALUES, 0, ioctl->DataPacket);
+    ret = do_smart(unit, ATA_SMART_READ_VALUES, 0, 0, ioctl->DataPacket);
     break;
 
   case DSKSP_SMART_GET_THRESHOLDS:
-    ret = do_smart(unit, ATA_SMART_READ_THRESHOLDS, 0, ioctl->DataPacket);
+    ret = do_smart(unit, ATA_SMART_READ_THRESHOLDS, 0, 0, ioctl->DataPacket);
     break;
 
   case DSKSP_SMART_GET_LOG:
-    ret = do_smart(unit, ATA_SMART_READ_LOG, parm, ioctl->DataPacket);
+    ret = do_smart(unit, ATA_SMART_READ_LOG, 1, parm, ioctl->DataPacket);
     break;
 
@@ -548,5 +547,6 @@
  * Perform SMART request. The code has been more or less copied from DANIS506.
  */
-static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE parm, void _far *buf)
+static USHORT do_smart(BYTE unit, BYTE sub_func, BYTE cnt, BYTE lba_l,
+                       void _far *buf)
 {
   OS2AHCI_PASSTHROUGH pt;
@@ -575,6 +575,6 @@
   pt.cmdlen           = sizeof(pt.cmd.ata);
   pt.cmd.ata.features = sub_func;
-  pt.cmd.ata.count    = parm;
-  pt.cmd.ata.lba_l    = (0xc24fL << 8) | parm;
+  pt.cmd.ata.count    = cnt;
+  pt.cmd.ata.lba_l    = (0xc24fL << 8) | lba_l;
   pt.cmd.ata.cmd      = ATA_CMD_SMART;
 
@@ -623,5 +623,5 @@
       for (_d = 0; _d <= pi->dev_max; _d++) {
         if (pi->devs[_d].present) {
-          if (--unit == 0) {
+          if (unit-- == 0) {
             /* found the device */
             *a = _a;
Index: trunk/src/os2ahci/ioctl.h
===================================================================
--- trunk/src/os2ahci/ioctl.h	(revision 128)
+++ trunk/src/os2ahci/ioctl.h	(revision 129)
@@ -179,5 +179,5 @@
   USHORT      SeekErrors[2];
   USHORT      SATAErrors;
-} DeviceCountersData, NEAR *NPDeviceCountersData, FAR *PDeviceCountersData;
+} DeviceCountersData;
 
 /******************************************************************************
@@ -200,5 +200,5 @@
   ULONG       UnitFlags1;
   USHORT      UnitFlags2;
-} UnitInformationData, NEAR *NPUnitInformationData, FAR *PUnitInformationData;
+} UnitInformationData;
 
 
