From patchwork Mon Oct 16 18:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10009589 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 252B360235 for ; Mon, 16 Oct 2017 18:46:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1239C28689 for ; Mon, 16 Oct 2017 18:46:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 05D7228694; Mon, 16 Oct 2017 18:46:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RCVD_IN_SORBS_SPAM,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6969928689 for ; Mon, 16 Oct 2017 18:45:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7AE6A8928B; Mon, 16 Oct 2017 18:45:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-qt0-x235.google.com (mail-qt0-x235.google.com [IPv6:2607:f8b0:400d:c0d::235]) by gabe.freedesktop.org (Postfix) with ESMTPS id 962626E19D for ; Mon, 16 Oct 2017 18:45:56 +0000 (UTC) Received: by mail-qt0-x235.google.com with SMTP id f15so33794449qtf.7 for ; Mon, 16 Oct 2017 11:45:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=BsOAqMJCdqLR2CyduaLJ4R4yFFon7+4Gu4Lv/tg4c6w=; b=ef7I6ZARsiLmNd7BuN1xhSElXXIc4QPSrid4LEQ1Cv4LQb5HMrBhYFoOlDtOJZOR66 QADgIYMRvZqaJ4QUwqhuP0r152E1PUcc2gF5Ox6Ra+yLHEQsFM6tPwN9o7A8wptL5/st QW5cPhyEWZEaqeEAtUOloQunTH4m+ryE8nsHU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=BsOAqMJCdqLR2CyduaLJ4R4yFFon7+4Gu4Lv/tg4c6w=; b=PJRAiWXeG6eRobhOMYOjj5ynX2/KmPQT4Fz85IbPBrLZ73ihH2Mjg5tnRfekAc4rLb xf8BCKBrfGsLMnfGH3nRSRyaTIHattL6pXFJZK4MPA9uGhcNXvDAN1lWPatKTcUcg1p9 CpUPgUvmHkw7yP1LHeyeqLoiZGJDv71yMovjWy4XmHTBI/VRfkqp0GiUDOd2FarTqtHE SVdyOuZTHyD/Uwxji5c/80LAnOTQs5YxbgpdDQm3H9knHzCX6alS/BuTdjJt0bRqfv83 DQoL8MCTcrucTXl3ObTFpby+eTahGS2PwWQXSR8iILsClzX0wXMKk45K0GCYwfPcLOsy naxw== X-Gm-Message-State: AMCzsaXpsCq9Zhjv2pmIHbd55ErqoUm8IoMhuZNhjx3d+2guKwK9m3LM eEY/pKpgh86hw9Fu56conbjAh+tBedo= X-Received: by 10.13.211.65 with SMTP id v62mr1056467ywd.317.1508179555469; Mon, 16 Oct 2017 11:45:55 -0700 (PDT) Received: from mail-it0-f53.google.com (mail-it0-f53.google.com. [209.85.214.53]) by smtp.gmail.com with ESMTPSA id v38sm6084266ywh.36.2017.10.16.11.45.54 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Oct 2017 11:45:54 -0700 (PDT) Received: by mail-it0-f53.google.com with SMTP id f187so2456920itb.1 for ; Mon, 16 Oct 2017 11:45:54 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Q3TdYRlOV4+w4TKxps167AYqr2cMdk9RPhMjMamP5TjuvnnR+qf8Bebnan6uzzf1azqaa/t0rDnQc/5BBIGCA= X-Received: by 10.36.81.21 with SMTP id s21mr2394422ita.144.1508179554053; Mon, 16 Oct 2017 11:45:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.174.66 with HTTP; Mon, 16 Oct 2017 11:45:33 -0700 (PDT) In-Reply-To: <20171014183644.21990-1-harshasharmaiitr@gmail.com> References: <20171014183644.21990-1-harshasharmaiitr@gmail.com> From: Sean Paul Date: Mon, 16 Oct 2017 14:45:33 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v5] drm/i915: Replace *_reference/unreference() or *_ref/unref with _get/put() To: Harsha Sharma Cc: Daniel Vetter , Intel Graphics Development , Linux Kernel Mailing List , dri-devel , outreachy-kernel X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Sat, Oct 14, 2017 at 2:36 PM, Harsha Sharma wrote: > Replace instances of drm_framebuffer_reference/unreference() with > *_get/put() suffixes and drm_dev_unref with *_put() suffix > because get/put is shorter and consistent with the > kernel use of *_get/put suffixes. > Done with following coccinelle semantic patch > > @@ > expression ex; > @@ > > ( > -drm_framebuffer_unreference(ex); > +drm_framebuffer_put(ex); > | > -drm_dev_unref(ex); > +drm_dev_put(ex); > | > -drm_framebuffer_reference(ex); > +drm_framebuffer_get(ex); > ) > When I run this spatch on drm-tip, I get a bunch more changes than this (below). Are you just running it on i915_pci? Sean > Signed-off-by: Harsha Sharma > --- > Changes in v5: > -rebase drm_dev_put change on drm-tip > Changes in v4: > -change one instance of *_put to *_get > Changes in v3: > -Removed changes in selftests > Changes in v2: > -Added cocinelle patch in log message > -cc to all driver-specific mailing lists > drivers/gpu/drm/i915/i915_pci.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c > index bf467f30c99b..1223961c3700 100644 > --- a/drivers/gpu/drm/i915/i915_pci.c > +++ b/drivers/gpu/drm/i915/i915_pci.c > @@ -645,7 +645,7 @@ static void i915_pci_remove(struct pci_dev *pdev) > struct drm_device *dev = pci_get_drvdata(pdev); > > i915_driver_unload(dev); > - drm_dev_unref(dev); > + drm_dev_put(dev); > } > > static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) > -- > 2.11.0 > diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 09d97e0990b7..2f106cca46b4 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -510,7 +510,7 @@ static void i915_pci_remove(struct pci_dev *pdev) struct drm_device *dev = pci_get_drvdata(pdev); i915_driver_unload(dev); - drm_dev_unref(dev); + drm_dev_put(dev); } static int i915_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c index 5c7828c52d12..db755b9a5efd 100644 --- a/drivers/gpu/drm/i915/intel_display.c +++ b/drivers/gpu/drm/i915/intel_display.c @@ -2856,7 +2856,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, if (intel_plane_ggtt_offset(state) == plane_config->base) { fb = c->primary->fb; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); goto valid_fb; } } @@ -2887,7 +2887,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, intel_crtc->pipe, PTR_ERR(intel_state->vma)); intel_state->vma = NULL; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); return; } @@ -2908,7 +2908,7 @@ intel_find_initial_plane_obj(struct intel_crtc *intel_crtc, if (i915_gem_object_is_tiled(obj)) dev_priv->preserve_bios_swizzle = true; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); primary->fb = primary->state->fb = fb; primary->crtc = primary->state->crtc = &intel_crtc->base; @@ -9847,7 +9847,7 @@ mode_fits_in_fbdev(struct drm_device *dev, if (obj->base.size < mode->vdisplay * fb->pitches[0]) return NULL; - drm_framebuffer_reference(fb); + drm_framebuffer_get(fb); return fb; #else return NULL; @@ -10028,7 +10028,7 @@ int intel_get_load_detect_pipe(struct drm_connector *connector, if (ret) goto fail; - drm_framebuffer_unreference(fb); + drm_framebuffer_put(fb); ret = drm_atomic_set_mode_for_crtc(&crtc_state->base, mode); if (ret) diff --git a/drivers/gpu/drm/i915/intel_fbdev.c b/drivers/gpu/drm/i915/intel_fbdev.c index 262e75c00dd2..e34334a1fbf9 100644 --- a/drivers/gpu/drm/i915/intel_fbdev.c +++ b/drivers/gpu/drm/i915/intel_fbdev.c @@ -189,7 +189,7 @@ static int intelfb_create(struct drm_fb_helper *helper, " releasing it\n", intel_fb->base.width, intel_fb->base.height, sizes->fb_width, sizes->fb_height); - drm_framebuffer_unreference(&intel_fb->base); + drm_framebuffer_put(&intel_fb->base); intel_fb = ifbdev->fb = NULL; } if (!intel_fb || WARN_ON(!intel_fb->obj)) { @@ -624,7 +624,7 @@ static bool intel_fbdev_init_bios(struct drm_device *dev, ifbdev->preferred_bpp = fb->base.format->cpp[0] * 8; ifbdev->fb = fb; - drm_framebuffer_reference(&ifbdev->fb->base); + drm_framebuffer_get(&ifbdev->fb->base); /* Final pass to check if any active pipes don't have fbs */ for_each_crtc(dev, crtc) { diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c index 89dc25a5a53b..a7055b12e53c 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_dmabuf.c @@ -389,7 +389,7 @@ int i915_gem_dmabuf_mock_selftests(void) err = i915_subtests(tests, i915); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c index 5ea373221f49..75764fdb90da 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c @@ -345,6 +345,6 @@ int i915_gem_evict_mock_selftests(void) err = i915_subtests(tests, i915); mutex_unlock(&i915->drm.struct_mutex); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index 6b132caffa18..bc3c4a5776bd 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -1540,7 +1540,7 @@ int i915_gem_gtt_mock_selftests(void) err = i915_subtests(tests, i915); mutex_unlock(&i915->drm.struct_mutex); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_object.c b/drivers/gpu/drm/i915/selftests/i915_gem_object.c index 8f011c447e41..7bfd9900798a 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_object.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_object.c @@ -586,7 +586,7 @@ int i915_gem_object_mock_selftests(void) err = i915_subtests(tests, i915); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_request.c b/drivers/gpu/drm/i915/selftests/i915_gem_request.c index 6664cb2eb0b8..8985578cf8a5 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_request.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_request.c @@ -260,7 +260,7 @@ int i915_gem_request_mock_selftests(void) return -ENOMEM; err = i915_subtests(tests, i915); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/i915_vma.c b/drivers/gpu/drm/i915/selftests/i915_vma.c index 2e86ec136b35..d8cc0a665169 100644 --- a/drivers/gpu/drm/i915/selftests/i915_vma.c +++ b/drivers/gpu/drm/i915/selftests/i915_vma.c @@ -734,7 +734,7 @@ int i915_vma_mock_selftests(void) err = i915_subtests(tests, i915); mutex_unlock(&i915->drm.struct_mutex); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; } diff --git a/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c b/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c index 828904b7d468..3c8bf447b890 100644 --- a/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c +++ b/drivers/gpu/drm/i915/selftests/intel_breadcrumbs.c @@ -475,7 +475,7 @@ int intel_breadcrumbs_mock_selftests(void) return -ENOMEM; err = i915_subtests(tests, i915->engine[RCS]); - drm_dev_unref(&i915->drm); + drm_dev_put(&i915->drm); return err; }