On 04/26/16 22:25, Douglas Gilbert wrote:
On 2016-04-26 06:14 PM, Bart Van Assche wrote:
On 04/25/2016 09:16 AM, Douglas Gilbert wrote:
-    if ((SDEBUG_OPT_MEDIUM_ERR & sdebug_opts) &&
-        (lba <= (OPT_MEDIUM_ERR_ADDR + OPT_MEDIUM_ERR_NUM - 1)) &&
-        ((lba + num) > OPT_MEDIUM_ERR_ADDR)) {
+    if (unlikely((SDEBUG_OPT_MEDIUM_ERR & sdebug_opts) &&
+             (lba <= (OPT_MEDIUM_ERR_ADDR + OPT_MEDIUM_ERR_NUM - 1)) &&
+             ((lba + num) > OPT_MEDIUM_ERR_ADDR))) {
 > [ ... ]
-    if ((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE)) {
+    if (unlikely((qa_indx < 0) || (qa_indx >= SCSI_DEBUG_CANQUEUE))) {
 > [ ... ]
-    if ((qdepth > 0) && (num_in_q >= qdepth)) {
+    if (unlikely((qdepth > 0) && (num_in_q >= qdepth))) {
 > [ ... ]
-    } else if ((sdebug_every_nth != 0) &&
-           (SDEBUG_OPT_RARE_TSF & sdebug_opts) &&
-           (scsi_result == 0)) {
+    } else if (unlikely((sdebug_every_nth != 0) &&
+                (SDEBUG_OPT_RARE_TSF & sdebug_opts) &&
+                (scsi_result == 0))) {

Since you are modifying this code, please remove the superfluous
parentheses.

I can find no reference to "superfluous parentheses" in
Documentation/CodingStyle . As for the improved readability of:

            else if (unlikely(sdebug_every_nth != 0 &&
                       SDEBUG_OPT_RARE_TSF & sdebug_opts &&
                       scsi_result == 0)) {
I have my doubts.

Hello Doug,

With my comment I wanted to refer to the parentheses around comparisons only and not to the parentheses around bitwise operations. Leaving out these parentheses is the most common style in the Linux kernel. But this is a stylistic issue only and hence not that important to me.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to