From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C469FC4321E for ; Fri, 17 Sep 2021 15:28:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A837B611C4 for ; Fri, 17 Sep 2021 15:28:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235932AbhIQPaI (ORCPT ); Fri, 17 Sep 2021 11:30:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231820AbhIQPaH (ORCPT ); Fri, 17 Sep 2021 11:30:07 -0400 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D4603C061766 for ; Fri, 17 Sep 2021 08:28:44 -0700 (PDT) Received: by mail-qt1-x836.google.com with SMTP id r21so9035545qtw.11 for ; Fri, 17 Sep 2021 08:28:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=poorly.run; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=FuUl9aOPg9QPdrIHV0biXxlqCjl1iKxoc7c2hM70or8=; b=EP6dopb5uZ6xB7hk7smmHCo5rwSq/qA3gjv1iMAmKJMLQsW6PnAFBunN/1xmi1hXu6 2GML45WWK+Qy4uu/0tuA8sliENLT25yh//O1S3sl0FUEBZsX81zfA5koKK94JNQnFHH1 uz3yvspNzd7So2lSSZQVZt9Wr8Jlirf92luhT2KUG6Z6wKYAibqX193EJntyfbxgsA/v WfM3db9CQdmLuWmo5lrr7gjzVjxTDrN42OVTS1cpGd82NpyAn46eVqVhuI0PSNNvgC0B R8oBexpwsV8NVpFPts3OtNTB38vP5ToFW1dyoMM0N/XyctmB0nORrD44BWtEGhK79E9J 2N5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=FuUl9aOPg9QPdrIHV0biXxlqCjl1iKxoc7c2hM70or8=; b=Aasv+gf/na1/hIRrDDFO3WhRDUbLpRxGm1geqLeTkPnyQ6zvOOITKoERomA3I4H97K GadrOQv7g51m3s9Pwkm3OFxVSfa55SNzdCuH+zRKvlYxtm6ruDc899MA3rC1JPcNw+5d IsMQz7fkgpRZirV0bp5Rmo77ZP3ZTS4pbhk0kbemnytxnbPKIOe56G70deH6o0jZwTMq sUJ1fYFZhirBAdoUJQ9l4ekNs4Nm2hAET+M7qnkCNCjvU7gu5YgDYkZKBDbH2VSkl14j 82JAyldwQd83Q4/HBt+m9JcU+nOni1LoqB517KSNcX9K5/W8Dkm34kzEJnE286nRUkrs Icww== X-Gm-Message-State: AOAM5318++bgiESHziNMqi9Olptow8Fi8Uog1aX5e9gLbEHgsa8tHmFe wAPBH64x24Yjzmqxkbuy/37hrA== X-Google-Smtp-Source: ABdhPJz+1IlUibrmV063aG8RG51cYbX7TCpqGdEoZMmlxd6qClcPIVgP6f5A94RrfNPtSYy6ER/Jeg== X-Received: by 2002:a05:622a:1347:: with SMTP id w7mr10705287qtk.325.1631892523996; Fri, 17 Sep 2021 08:28:43 -0700 (PDT) Received: from localhost ([167.100.64.199]) by smtp.gmail.com with ESMTPSA id l1sm1746827qkj.65.2021.09.17.08.28.43 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 17 Sep 2021 08:28:43 -0700 (PDT) Date: Fri, 17 Sep 2021 11:28:42 -0400 From: Sean Paul To: Fernando Ramos Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, sean@poorly.run, linux-doc@vger.kernel.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-renesas-soc@vger.kernel.org, linux-tegra@vger.kernel.org Subject: Re: [PATCH 01/15] dmr: cleanup: drm_modeset_lock_all_ctx() --> DRM_MODESET_LOCK_ALL_BEGIN() Message-ID: <20210917152842.GA2515@art_vandelay> References: <20210916211552.33490-1-greenfoo@u92.eu> <20210916211552.33490-2-greenfoo@u92.eu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210916211552.33490-2-greenfoo@u92.eu> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On Thu, Sep 16, 2021 at 11:15:38PM +0200, Fernando Ramos wrote: > As requested in Documentation/gpu/todo.rst, replace the boilerplate code > surrounding drm_modeset_lock_all_ctx() with DRM_MODESET_LOCK_ALL_BEGIN() > and DRM_MODESET_LOCK_ALL_END() > Hi Fernando, Thank you for your patch. Could you please fix the subject, changing dmr to drm? > Signed-off-by: Fernando Ramos > --- > drivers/gpu/drm/drm_client_modeset.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c > index ced09c7c06f9..5f5184f071ed 100644 > --- a/drivers/gpu/drm/drm_client_modeset.c > +++ b/drivers/gpu/drm/drm_client_modeset.c > @@ -574,6 +574,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, > int num_connectors_detected = 0; > int num_tiled_conns = 0; > struct drm_modeset_acquire_ctx ctx; > + int err; I think you can just reuse 'ret' instead of creating a new variable. That ensures if the lock fails we return the error from the macros. Sean > > if (!drm_drv_uses_atomic_modeset(dev)) > return false; > @@ -585,10 +586,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, > if (!save_enabled) > return false; > > - drm_modeset_acquire_init(&ctx, 0); > - > - while (drm_modeset_lock_all_ctx(dev, &ctx) != 0) > - drm_modeset_backoff(&ctx); > + DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, err); > > memcpy(save_enabled, enabled, count); > mask = GENMASK(count - 1, 0); > @@ -743,8 +741,7 @@ static bool drm_client_firmware_config(struct drm_client_dev *client, > ret = false; > } > > - drm_modeset_drop_locks(&ctx); > - drm_modeset_acquire_fini(&ctx); > + DRM_MODESET_LOCK_ALL_END(dev, ctx, err); > > kfree(save_enabled); > return ret; > -- > 2.33.0 > -- Sean Paul, Software Engineer, Google / Chromium OS