From: Thomas Zimmermann <tzimmermann@suse.de>
To: Rob Clark <robdclark@gmail.com>
Cc: Rob Clark <robdclark@chromium.org>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
David Airlie <airlied@linux.ie>,
linux-arm-msm <linux-arm-msm@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>,
dri-devel <dri-devel@lists.freedesktop.org>,
freedreno <freedreno@lists.freedesktop.org>
Subject: Re: [PATCH v2 1/2] drm: Add DRM_GEM_FOPS
Date: Tue, 7 Jun 2022 19:22:38 +0200 [thread overview]
Message-ID: <26a6ed05-264a-eef6-a0ee-527d6968f8a8@suse.de> (raw)
In-Reply-To: <CAF6AEGuikc8Qh2ixEvJoeN0hQ+VLJNk_jBQm8fqYQAJ=ihpo1g@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 3523 bytes --]
Hi
Am 07.06.22 um 16:58 schrieb Rob Clark:
> On Mon, Jun 6, 2022 at 11:56 PM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>>
>> Hi
>>
>> Am 06.06.22 um 21:54 schrieb Rob Clark:
>>> From: Rob Clark <robdclark@chromium.org>
>>>
>>> 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 <robdclark@chromium.org>
>>> ---
>>> 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_FOPS'.
>>
>>> + */
>>> +#define DRM_GEM_FOPS \
>>> + .open = drm_open,\
>>> + .release = drm_release,\
>>> + .unlocked_ioctl = drm_ioctl,\
>>> + .compat_ioctl = drm_compat_ioctl,\
>>> + .poll = drm_poll,\
>>> + .read = drm_read,\
>>> + .llseek = noop_llseek,\
>>> + .mmap = 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 = {\
>>> .owner = 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
I think you made the right choice. It's cleaner and most drivers will
want to use DEFINE_DRM_GEM_FOPS, which includes the magic.
Best regards
Thomas
>
>> In any case
>>
>> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>
> thx, I'll fixup the other nits in v3.
>
>>
>> Best regards
>> Thomas
>>
>>> - .open = drm_open,\
>>> - .release = drm_release,\
>>> - .unlocked_ioctl = drm_ioctl,\
>>> - .compat_ioctl = drm_compat_ioctl,\
>>> - .poll = drm_poll,\
>>> - .read = drm_read,\
>>> - .llseek = noop_llseek,\
>>> - .mmap = 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ürnberg, Germany
>> (HRB 36809, AG Nürnberg)
>> Geschäftsführer: Ivo Totev
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Maxfeldstr. 5, 90409 Nürnberg, Germany
(HRB 36809, AG Nürnberg)
Geschäftsführer: Ivo Totev
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
prev parent reply other threads:[~2022-06-07 17:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 19:54 [PATCH v2 1/2] drm: Add DRM_GEM_FOPS Rob Clark
2022-06-06 19:54 ` [PATCH v2 2/2] drm/msm: Expose client engine utilization via fdinfo Rob Clark
2022-06-07 6:03 ` kernel test robot
2022-06-07 8:56 ` Tvrtko Ursulin
2022-06-07 16:02 ` Rob Clark
2022-06-07 16:08 ` Rob Clark
2022-06-08 7:19 ` Tvrtko Ursulin
2022-06-07 6:56 ` [PATCH v2 1/2] drm: Add DRM_GEM_FOPS Thomas Zimmermann
2022-06-07 14:58 ` Rob Clark
2022-06-07 17:22 ` Thomas Zimmermann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=26a6ed05-264a-eef6-a0ee-527d6968f8a8@suse.de \
--to=tzimmermann@suse.de \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=freedreno@lists.freedesktop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robdclark@chromium.org \
--cc=robdclark@gmail.com \
--cc=tvrtko.ursulin@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox