From patchwork Fri Mar 24 13:58:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Lei X-Patchwork-Id: 74567 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp657827vqo; Fri, 24 Mar 2023 07:13:59 -0700 (PDT) X-Google-Smtp-Source: AKy350ZMDpg98zUl3yoLFU/ux3MeYrqjapcISxkJhlMIAMADHAgdaO5/L1vZKZ2ltWgTDfB4WZfJ X-Received: by 2002:a50:fe98:0:b0:4fe:ddf:8d8b with SMTP id d24-20020a50fe98000000b004fe0ddf8d8bmr3235067edt.15.1679667239323; Fri, 24 Mar 2023 07:13:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679667239; cv=none; d=google.com; s=arc-20160816; b=l8gpE4LBd+dk4XbBqTblrqjDHCGIkTA8XzBEtep/37svtv+C6NcOHQDbyQo18Wm1Hs TfUVhM/xHZSHSyYucKxN1YioSBXDP6xEduutShZouFALUn15h13fV0ClBmIM9E8u+KKj x4NrssUvffQps/EA8wXzwcunghNEA/MN9PuTX2JwFi9E3G1tQHUoi0mS1k1DuCPdcf+6 KZvAEbt4DO73q+ctAbRIYaL5M3ZAblFOQPCTgcbvd6cNPy+ujES9BxqDIHr+7AZVo11a BD8Ppn+h3Fs3MIEfCot3eLRrff2x1/5rokbA3NnGWt9D5hu7nBONHa64Y4H29rigY/Pm z3CA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=48AKVP9yTkY1ambTnk0VYH59I7XP/ONXFtXKzcPT0nk=; b=a/27CFVNj0n9p4H1SkhgQdCvBdfeIQA1GGslfzaNxSF/mEWKV/QM8H1JChfHoXoZ35 OLBqt839GpJzj7f1s2Ps9pREFFoUlhjBl3xcaDN+79nW0aR1RbYeMPDDgbk4XOgoz8Sj 9Ekw2gj/QAZvnSHFqQxUmiJU400qahjc4aAv+cMMrgFv9znNp5Ui7E/WeGPO0b2tg0rF i5OZkZpxxwI5NxTxNtJ3xvZTZD+bEsiz6ttwFeW1EhlsAHzB262kbAXvlGCzjTEH1nGu Pjr/BYiAP++XmRdfKFbD59ahKSKrkiCQqf47cg43v4yPwXrRFrDo/25vBUZihgFNGR/4 DDDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="GVX8EB/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020aa7da08000000b004c007c7905asi22138862eds.484.2023.03.24.07.13.34; Fri, 24 Mar 2023 07:13:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="GVX8EB/g"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231774AbjCXOAe (ORCPT + 99 others); Fri, 24 Mar 2023 10:00:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229551AbjCXOAJ (ORCPT ); Fri, 24 Mar 2023 10:00:09 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 684F51B327 for ; Fri, 24 Mar 2023 06:59:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1679666340; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=48AKVP9yTkY1ambTnk0VYH59I7XP/ONXFtXKzcPT0nk=; b=GVX8EB/gkxYTzRli00L4O9gUli/7GKMH49AW2T8vvNjiZheBPhcglODgd6XeemY7JA4JX7 3b3Xfqb6UXazaYXorvDxqOfaritJx6JYGskTObvZC81wfYxrTt+3O/88aFAnqKrqOiubF/ nTIwRZcbiL4YUfJdFvfX/x5bHfdwgTA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-197-CNqsnyGUN0CmZTTtEOvAmA-1; Fri, 24 Mar 2023 09:58:57 -0400 X-MC-Unique: CNqsnyGUN0CmZTTtEOvAmA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8FF27802C15; Fri, 24 Mar 2023 13:58:56 +0000 (UTC) Received: from localhost (ovpn-8-20.pek2.redhat.com [10.72.8.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id B60331121314; Fri, 24 Mar 2023 13:58:55 +0000 (UTC) From: Ming Lei To: Jens Axboe , io-uring@vger.kernel.org, linux-block@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Miklos Szeredi , ZiyangZhang , Xiaoguang Wang , Bernd Schubert , Pavel Begunkov , Stefan Hajnoczi , Ming Lei Subject: [PATCH V4 10/17] block: ublk_drv: clean up several helpers Date: Fri, 24 Mar 2023 21:58:01 +0800 Message-Id: <20230324135808.855245-11-ming.lei@redhat.com> In-Reply-To: <20230324135808.855245-1-ming.lei@redhat.com> References: <20230324135808.855245-1-ming.lei@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761258754807886370?= X-GMAIL-MSGID: =?utf-8?q?1761258754807886370?= Convert the following pattern in several helpers if (Z) return true return false into: return Z; Reviewed-by: Ziyang Zhang Signed-off-by: Ming Lei --- drivers/block/ublk_drv.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 43c0b1247924..c35922f9a066 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -298,9 +298,7 @@ static inline bool ublk_can_use_task_work(const struct ublk_queue *ubq) static inline bool ublk_need_get_data(const struct ublk_queue *ubq) { - if (ubq->flags & UBLK_F_NEED_GET_DATA) - return true; - return false; + return ubq->flags & UBLK_F_NEED_GET_DATA; } static struct ublk_device *ublk_get_device(struct ublk_device *ub) @@ -349,25 +347,19 @@ static inline int ublk_queue_cmd_buf_size(struct ublk_device *ub, int q_id) static inline bool ublk_queue_can_use_recovery_reissue( struct ublk_queue *ubq) { - if ((ubq->flags & UBLK_F_USER_RECOVERY) && - (ubq->flags & UBLK_F_USER_RECOVERY_REISSUE)) - return true; - return false; + return (ubq->flags & UBLK_F_USER_RECOVERY) && + (ubq->flags & UBLK_F_USER_RECOVERY_REISSUE); } static inline bool ublk_queue_can_use_recovery( struct ublk_queue *ubq) { - if (ubq->flags & UBLK_F_USER_RECOVERY) - return true; - return false; + return ubq->flags & UBLK_F_USER_RECOVERY; } static inline bool ublk_can_use_recovery(struct ublk_device *ub) { - if (ub->dev_info.flags & UBLK_F_USER_RECOVERY) - return true; - return false; + return ub->dev_info.flags & UBLK_F_USER_RECOVERY; } static void ublk_free_disk(struct gendisk *disk)