Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2134709iof; Tue, 7 Jun 2022 20:54:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOo0+UbcwbcSYcjjy4BvcfJaTUhqzFYkbG8R15pWvylUNaoZl/SSu5dKNML/HkU+UXPf/5 X-Received: by 2002:a17:903:11c6:b0:167:90e5:59ac with SMTP id q6-20020a17090311c600b0016790e559acmr7325075plh.143.1654660493750; Tue, 07 Jun 2022 20:54:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654660493; cv=none; d=google.com; s=arc-20160816; b=D0XDRahGwrpWucayZD701qXPoeolIJ0cq6Kse8J5xoWfniLPhnUH4eXey5yMG8N7ej ashQ+TUmT5ulUFk0SpKTbnPMiVe2CAQco3p5IQc68aU8UYxM9MjpqvpKURkDyqryqvi+ SqsuGXROK3elrD37Hlg25iGyU85PlilJdDaOEJfr5Qx8to+t+MESIWyo8WktWZ7LeNCv bclGarkWM3vg8fggzWz2wrQsk9Dzcu1u9WyAP+S2JKabBMca7TJJ7VVO56vffnxv9Dk2 HWsqwWB0XSKJ9sx5Z7xLknTTjM8TCQ0S25PfGTYtYZidVjx9KtXqg4IASZa4eCH3vZta WVzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=w/x0GYJIyglYGzsLMtcs2N+UdxoGHu5iQjLjq7gDOa8=; b=oPf4xncfhMuniYccU8YiV2h0rZMtPF7jZVUr4/aYa15VDUSziIAPbQ7RXQhtpNP+1E r74dR85+1GxB0R/jiaqS5bdh4jqHmf0NL0pYHJ9U9sr2z4jTWRR2yTHnVRDRNpIysoOC DRqvlrnFU8vQmSwg7oPV+2PL8gLKnUlw93Q5PjO1FZ9MP03NoAN3e94nHNmYT40plnTz 717rfsptzb4WPUXMfCWhgB4y2vriVBLurd/CQvNQORb1qnJoVWzaQFeUTRF1Dp51jJ7a XD3rUWrYoGGL92eSKJBlAGeLBDalwOyA69bes20kNMFXiFyAnqYtpvvKdCC4XMHQXOot SGPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mnolo5fL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z16-20020a170902d55000b0016781796321si8312385plf.49.2022.06.07.20.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 20:54:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mnolo5fL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C84363F465D; Tue, 7 Jun 2022 20:23:04 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242795AbiFGO6t (ORCPT + 99 others); Tue, 7 Jun 2022 10:58:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343800AbiFGO6h (ORCPT ); Tue, 7 Jun 2022 10:58:37 -0400 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8C63F68B2; Tue, 7 Jun 2022 07:58:34 -0700 (PDT) Received: by mail-wr1-x432.google.com with SMTP id a15so16031432wrh.2; Tue, 07 Jun 2022 07:58:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=w/x0GYJIyglYGzsLMtcs2N+UdxoGHu5iQjLjq7gDOa8=; b=mnolo5fLNDdBuBMvlwaCPryzz8RBix8JR7j5txmuj3HpmexQIJcKZ0WRj2TDLOGlKV eYi7+7ZJHGeQve1+oBuw+oLFq7T9Yr+xLFozhFvuSZar1J0XmxxdFE5aozzgXRt3P06K Y2sq5jwvUjX6GibC1NrppLGFBqwd2rXJYZ3XqJGbNXxvgsrR2sWENE1FYtj0ajqZ9MMR bfyL9nr4gBdbp4Vq4N5lVOffSCj0v+rbe8am4yZYbkvuBfvwtorzMCXREQkALIJ5+6Tb FnnWBEbeTqOOWnNdVWaaWKsWZbdpeuN/wJ15uIQBpt6yQh9S0tU0fPdBqwh43ZFLKx3h h1Aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=w/x0GYJIyglYGzsLMtcs2N+UdxoGHu5iQjLjq7gDOa8=; b=2aQqKC4RQDE6fn7OXBE3a9Epg95KqSdpcHTGCTZAgE6/NvqKJZH5SeMzBw0JUxaY9s TTltrvmNXultivnuKgBd1nnqZ7CbvWiKTRl7F/yJGP9aCgGVHvi1XGx1ErDcd1zilZlA uARPG4VBjmDM5rCbhlQuMQNWVdsf6Mpmx3iaLOdtFzIAzfGLlzhHYAx6iqeqk0TNWPJx Qtqw5YXMwairt+oqAmOescwTij+FPjvVywAFdfoa7nDT2koDVjVmZ8D45Pb7mmMMgpPY 8Rlb9pmzvH6Z5qDLTXdJsvsIcZQP41iEHmnzdFSEG93Fn9vI1t0IAeo4yMOJlFqwae9g e0Ig== X-Gm-Message-State: AOAM532qjRWmeoWiBiQvBrMHQ5fq2b7PuwcUwWbOod5rX+QRx+iET9DR RJoDbAg7Hr2c2Q/uPsI37k0k8ptxbu5q4dJfv8M= X-Received: by 2002:adf:fb0d:0:b0:20d:97e:17ce with SMTP id c13-20020adffb0d000000b0020d097e17cemr28428199wrr.585.1654613913189; Tue, 07 Jun 2022 07:58:33 -0700 (PDT) MIME-Version: 1.0 References: <20220606195432.1888346-1-robdclark@gmail.com> <34aacfa3-9eb9-d3d5-07b7-805fd1408bb7@suse.de> In-Reply-To: <34aacfa3-9eb9-d3d5-07b7-805fd1408bb7@suse.de> From: Rob Clark Date: Tue, 7 Jun 2022 07:58:36 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] drm: Add DRM_GEM_FOPS To: Thomas Zimmermann Cc: dri-devel , freedreno , linux-arm-msm , Tvrtko Ursulin , Rob Clark , Maarten Lankhorst , Maxime Ripard , David Airlie , Daniel Vetter , open list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, Jun 6, 2022 at 11:56 PM Thomas Zimmermann wro= te: > > Hi > > Am 06.06.22 um 21:54 schrieb Rob Clark: > > From: Rob Clark > > > > The DEFINE_DRM_GEM_FOPS() helper is a bit limiting if a driver wants to > > provide additional file ops, like show_fdinfo(). > > > > Signed-off-by: Rob Clark > > --- > > include/drm/drm_gem.h | 26 ++++++++++++++++++-------- > > 1 file changed, 18 insertions(+), 8 deletions(-) > > > > diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h > > index 9d7c61a122dc..dc88d4a2cdf6 100644 > > --- a/include/drm/drm_gem.h > > +++ b/include/drm/drm_gem.h > > @@ -314,6 +314,23 @@ struct drm_gem_object { > > const struct drm_gem_object_funcs *funcs; > > }; > > > > +/** > > + * DRM_GEM_FOPS - Default drm GEM file operations > > + * > > + * This macro provides a shorthand for setting the GEM file ops in the > > + * &file_operations structure. > > I would appreciate a reference to DEFINE_DRM_GEM_FOPS. Something along > the lines of 'if all you need are the default ops, use DEFINE_DRM_GEM_FOP= S'. > > > + */ > > +#define DRM_GEM_FOPS \ > > + .open =3D drm_open,\ > > + .release =3D drm_release,\ > > + .unlocked_ioctl =3D drm_ioctl,\ > > + .compat_ioctl =3D drm_compat_ioctl,\ > > + .poll =3D drm_poll,\ > > + .read =3D drm_read,\ > > + .llseek =3D noop_llseek,\ > > + .mmap =3D drm_gem_mmap > > + > > + > > Only one empty line please. > > > /** > > * DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM = drivers > > * @name: name for the generated structure > > @@ -330,14 +347,7 @@ struct drm_gem_object { > > #define DEFINE_DRM_GEM_FOPS(name) \ > > static const struct file_operations name =3D {\ > > .owner =3D THIS_MODULE,\ > > Is there a specific reason why .owner is still set here? I suspect that > DRM_GEM_FOPS is strictly for callback functions? I was on the fence about that one, but it seemed better to not mix "magic" and the callbacks.. but I could be convinced in either direction > In any case > > Acked-by: Thomas Zimmermann thx, I'll fixup the other nits in v3. > > Best regards > Thomas > > > - .open =3D drm_open,\ > > - .release =3D drm_release,\ > > - .unlocked_ioctl =3D drm_ioctl,\ > > - .compat_ioctl =3D drm_compat_ioctl,\ > > - .poll =3D drm_poll,\ > > - .read =3D drm_read,\ > > - .llseek =3D noop_llseek,\ > > - .mmap =3D drm_gem_mmap,\ > > + DRM_GEM_FOPS,\ > > } > > > > void drm_gem_object_release(struct drm_gem_object *obj); > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany > (HRB 36809, AG N=C3=BCrnberg) > Gesch=C3=A4ftsf=C3=BChrer: Ivo Totev