Print this page
5255 uts shouldn't open-code ISP2

@@ -999,11 +999,11 @@
         /*
          * The cache attributes are mutually exclusive. Any combination of
          * the attributes leads to a failure.
          */
         uint_t cache_attr = IOMEM_CACHE_ATTR(flags);
-        if ((cache_attr != 0) && ((cache_attr & (cache_attr - 1)) != 0))
+        if ((cache_attr != 0) && !ISP2(cache_attr))
                 return (B_FALSE);
 
         /*
          * On the sparc architecture, only IOMEM_DATA_CACHED is meaningful,
          * but others lead to a failure.

@@ -1141,18 +1141,18 @@
         int r;
 
         /*
          * Make sure that the initial value is sane
          */
-        if (i & (i - 1))
+        if (!ISP2(i))
                 return (0);
         if (i == 0)
                 i = (stream) ? 4 : 1;
 
         r = ddi_ctlops(a, a,
             DDI_CTLOPS_IOMIN, (void *)(uintptr_t)stream, (void *)&i);
-        if (r != DDI_SUCCESS || (i & (i - 1)))
+        if (r != DDI_SUCCESS || !ISP2(i))
                 return (0);
         return (i);
 }
 
 int

@@ -1175,12 +1175,11 @@
         if (length == 0 || kaddrp == NULL || attr == NULL) {
                 return (DDI_FAILURE);
         }
 
         if (attr->dma_attr_minxfer == 0 || attr->dma_attr_align == 0 ||
-            (attr->dma_attr_align & (attr->dma_attr_align - 1)) ||
-            (attr->dma_attr_minxfer & (attr->dma_attr_minxfer - 1))) {
+            !ISP2(attr->dma_attr_align) || !ISP2(attr->dma_attr_minxfer)) {
                 return (DDI_FAILURE);
         }
 
         /*
          * check if a streaming sequential xfer is requested.