From: Greg KH <gregkh@linuxfoundation.org>
To: Jason Ekstrand <jason.ekstrand@collabora.com>
Cc: "Christian König" <christian.koenig@amd.com>,
dri-devel@lists.freedesktop.org,
"Daniel Vetter" <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH v3] dma-buf: Add a capabilities directory
Date: Tue, 31 May 2022 20:37:37 +0200 [thread overview]
Message-ID: <YpZgcbor2ZmbMDZq@kroah.com> (raw)
In-Reply-To: <35f5f6228207da2f91aa6930772a43c3cf7db979.camel@collabora.com>
On Tue, May 31, 2022 at 07:53:50AM -0500, Jason Ekstrand wrote:
> On Mon, 2022-05-30 at 10:26 +0200, Greg KH wrote:
> > On Mon, May 30, 2022 at 08:15:04AM +0000, Simon Ser wrote:
> > > On Monday, May 30th, 2022 at 09:20, Greg KH
> > > <gregkh@linuxfoundation.org> wrote:
> > >
> > > > > > +static struct attribute *dma_buf_caps_attrs[] = {
> > > > > > + &dma_buf_sync_file_import_export_attr.attr,
> > > > > > + NULL,
> > > > > > +};
> > > > > > +
> > > > > > +static const struct attribute_group dma_buf_caps_attr_group
> > > > > > = {
> > > > > > + .attrs = dma_buf_caps_attrs,
> > > > > > +};
> > > > >
> > > > > Didn't we had macros for those? I think I have seen something
> > > > > for that.
> > > >
> > > > Yes, please use ATTRIBUTE_GROUPS()
> > >
> > > This doesn't allow the user to set a group name, and creates an
> > > unused
> > > "_groups" variable, causing warnings.
> >
> > Then set a group name.
> >
> > But you really want to almost always be using lists of groups, which
> > is
> > why that macro works that way.
>
> I think I see the confusion here. The ATTRIBUTE_GROUPS() macro is
> intended for device drivers and to be used with add_device(). However,
> this is dma-buf so there is no device and no add_device() call to hook.
> Unless there are other magic macros to use in this case, I think we're
> stuck doing it manually.
Have a list of attribute groups and add it to the kobject when you
create it so they all get created at the same time.
Don't do piece-meal "add one, and then another, and then another" as
that just gets messy and complex and impossible to unwind the error
conditions from.
sysfs_create_groups() is what you need to use here. I need to drop
sysfs_create_group() one day...
thanks,
greg k-h
next prev parent reply other threads:[~2022-05-31 18:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-27 7:34 [PATCH v3] dma-buf: Add a capabilities directory Simon Ser
2022-05-30 7:09 ` Christian König
2022-05-30 7:20 ` Greg KH
2022-05-30 8:15 ` Simon Ser
2022-05-30 8:26 ` Greg KH
2022-05-31 12:53 ` Jason Ekstrand
2022-05-31 18:37 ` Greg KH [this message]
2022-05-30 7:55 ` Simon Ser
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=YpZgcbor2ZmbMDZq@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=christian.koenig@amd.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jason.ekstrand@collabora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.