Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp775417ybb; Sat, 28 Mar 2020 09:46:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsm5h5mMhWt21clfBq6eRSSkZxd/GrixiEhwgGPu2k90ZOPfqX/5OE5ZmoQHgSpmOVMdcND X-Received: by 2002:a9d:c61:: with SMTP id 88mr3360888otr.144.1585414009054; Sat, 28 Mar 2020 09:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585414009; cv=none; d=google.com; s=arc-20160816; b=kbYTtiM3jPdrJRNIaxr8q9unclSNt5taZ0zzU7HG9zVLMTKFueTj/Nnh8T7Pki8m/s LauxG+Wiey2hPAKtajVXvoAI+JfOx8RWCLpX1HL5e1YbaRU++axIvbY4uxU78e7ddrva I9EGjBs0f2HwGtOq9ZxsVkZ3blIgJx+BkAyVgvQhcaET+9icib6u3PyHeEaec2QXE6gp vCmuWJpWtN/QZ2KhYW63GIy1lAI7Mh5UVlBRnYz43Qlxig9vPikIvURy3IEcITOxRi12 R2J6oxAwpx9TQkOmOsC7PHGradna+NrUENrKD/k99/Xp24n8HR3VtomlRlH86pjKlog2 xbXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:date:from:message-id; bh=EO5BYCWxoBsLIj8UOXFVgMc6iXZwo+gExIfCCq0zVQY=; b=CV5pTQpyeR4Ob7GrHNXekYJXhqWnPUUuqUMjjuaS8BqVtSpquzeGazwKfmhBHlYhWE XI86xKg8DNXUqyYFcTYoAhAJ1Wn6QHUe2ytdT7FefoxsR1renL+/M8yzJRCBsqwXzWhh oQHjOfGUqRZAdHxUXFNP/TTm3JopKfanlv95AjKZ3juhhKsRwOKNpb+jt4vqcTDVM/5w RZsAokEn9aV23j4ybsoeQmAd8wMha6qh0DPEEz25MrCUsIU4xGYlGAOs+xsAiUjPX+Ud lyb7HM3sPoRR2kvGIWcTt/NUwPe/9KhV752wRsaTaOMT6HNuQg6QV+2K8fpiCFRjc+cN IDNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m25si3768727oic.230.2020.03.28.09.46.36; Sat, 28 Mar 2020 09:46:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727720AbgC1Qnb (ORCPT + 99 others); Sat, 28 Mar 2020 12:43:31 -0400 Received: from mx.sdf.org ([205.166.94.20]:50199 "EHLO mx.sdf.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727461AbgC1QnV (ORCPT ); Sat, 28 Mar 2020 12:43:21 -0400 Received: from sdf.org (IDENT:lkml@sdf.lonestar.org [205.166.94.16]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 02SGhHan022954 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Sat, 28 Mar 2020 16:43:17 GMT Received: (from lkml@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 02SGhHN7015213; Sat, 28 Mar 2020 16:43:17 GMT Message-Id: <202003281643.02SGhHN7015213@sdf.org> From: George Spelvin Date: Fri, 29 Nov 2019 15:39:41 -0500 Subject: [RFC PATCH v1 27/50] drivers/s390/scsi/zcsp_fc.c: Use prandom_u32_max() for backoff To: linux-kernel@vger.kernel.org, lkml@sdf.org Cc: Heiko Carstens , Vasily Gorbik , Christian Borntraeger , linux-s390@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We don't need crypto-grade random numbers for randomized backoffs. (We could skip the if() if we wanted to rely on the undocumented fact that prandom_u32_max(0) always returns 0. That would be a net time saving it port_scan_backoff == 0 is rare; if it's common, the if() is false often enough to pay for itself. Not sure which applies here.) Signed-off-by: George Spelvin Cc: Heiko Carstens Cc: Vasily Gorbik Cc: Christian Borntraeger Cc: linux-s390@vger.kernel.org --- drivers/s390/scsi/zfcp_fc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index b018b61bd168e..d24cafe02708f 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -48,7 +48,7 @@ unsigned int zfcp_fc_port_scan_backoff(void) { if (!port_scan_backoff) return 0; - return get_random_int() % port_scan_backoff; + return prandom_u32_max(port_scan_backoff); } static void zfcp_fc_port_scan_time(struct zfcp_adapter *adapter) -- 2.26.0