From: Greg Kroah-Hartman <gregkh@linuxfoundation•org>
To: Christoph Fritz <christoph.fritz@hexdev•de>
Cc: "Ilpo Järvinen" <ilpo.jarvinen@linux•intel.com>,
"Oliver Hartkopp" <socketcan@hartkopp•net>,
"Marc Kleine-Budde" <mkl@pengutronix•de>,
"Jiri Slaby" <jirislaby@kernel•org>,
"Vincent Mailhol" <mailhol.vincent@wanadoo•fr>,
"David S . Miller" <davem@davemloft•net>,
"Eric Dumazet" <edumazet@google•com>,
"Jakub Kicinski" <kuba@kernel•org>,
"Paolo Abeni" <pabeni@redhat•com>,
"Rob Herring" <robh@kernel•org>,
"Krzysztof Kozlowski" <krzk+dt@kernel•org>,
"Conor Dooley" <conor+dt@kernel•org>,
"Jiri Kosina" <jikos@kernel•org>,
"Benjamin Tissoires" <bentiss@kernel•org>,
"Sebastian Reichel" <sre@kernel•org>,
"Linus Walleij" <linus.walleij@linaro•org>,
"Andreas Lauser" <andreas.lauser@mercedes-benz•com>,
"Jonathan Corbet" <corbet@lwn•net>,
"Pavel Pisa" <pisa@cmp•felk.cvut.cz>,
linux-can@vger•kernel.org, Netdev <netdev@vger•kernel.org>,
devicetree@vger•kernel.org, linux-input@vger•kernel.org,
linux-serial <linux-serial@vger•kernel.org>
Subject: Re: [PATCH v3 01/11] can: Add LIN bus as CAN abstraction
Date: Wed, 8 May 2024 19:48:18 +0100 [thread overview]
Message-ID: <2024050852-vixen-arson-cb42@gregkh> (raw)
In-Reply-To: <215d898a0244d717467d44a8e93f186e2f282daa.camel@hexdev.de>
On Wed, May 08, 2024 at 08:20:51PM +0200, Christoph Fritz wrote:
> ...
> > ...
> > > > > +static int lin_create_sysfs_id_files(struct net_device *ndev)
> > > > > +{
> > > > > + struct lin_device *ldev = netdev_priv(ndev);
> > > > > + struct kobj_attribute *attr;
> > > > > + int ret;
> > > > > +
> > > > > + for (int id = 0; id < LIN_NUM_IDS; id++) {
> > > > > + ldev->sysfs_entries[id].ldev = ldev;
> > > > > + attr = &ldev->sysfs_entries[id].attr;
> > > > > + attr->attr.name = kasprintf(GFP_KERNEL, "%02x", id);
> > > > > + if (!attr->attr.name)
> > > > > + return -ENOMEM;
> > > > > + attr->attr.mode = 0644;
> > > > > + attr->show = lin_identifier_show;
> > > > > + attr->store = lin_identifier_store;
> > > > > +
> > > > > + sysfs_attr_init(&attr->attr);
> > > > > + ret = sysfs_create_file(ldev->lin_ids_kobj, &attr->attr);
> > > > > + if (ret) {
> > > > > + kfree(attr->attr.name);
> > > > > + return -ENOMEM;
> > > > > + }
> > > > > + }
> > > > > +
> > > > > + return 0;
> > > > > +}
> > > >
> > > > Can you use .dev_groups instead ?
> > >
> > > I'm not sure where to attach this in this glue code here. Should I do a
> > > class_register() and add the .dev_groups there?
> >
> > I guess struct class would be correct direction but I'm not sure if it's
> > viable in this case. It would avoid the need for custom sysfs setup code
> > if it's workable.
>
> I just tried to find a way, but these are 64 sysfs files and declaring
> them all static looks a bit odd to me. I might be missing something
> here.
>
> For v4 I would stick to the dynamic setup and fix the rollback.
>
> Any objections?
Yes, you race with userspace and loose by trying to do this "by hand".
Make this static please.
thanks,
greg k-h
next prev parent reply other threads:[~2024-05-08 18:48 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-02 18:27 [PATCH v3 00/11] LIN Bus support for Linux Christoph Fritz
2024-05-02 18:27 ` [PATCH v3 01/11] can: Add LIN bus as CAN abstraction Christoph Fritz
2024-05-06 16:24 ` Ilpo Järvinen
2024-05-08 12:47 ` Christoph Fritz
2024-05-08 13:08 ` Ilpo Järvinen
2024-05-08 18:20 ` Christoph Fritz
2024-05-08 18:48 ` Greg Kroah-Hartman [this message]
2024-05-09 17:06 ` Christoph Fritz
2024-05-02 18:27 ` [PATCH v3 02/11] HID: hexLIN: Add support for USB LIN bus adapter Christoph Fritz
2024-05-06 16:53 ` Ilpo Järvinen
2024-05-09 17:06 ` Christoph Fritz
2024-05-10 9:31 ` Ilpo Järvinen
2024-05-02 18:27 ` [PATCH v3 03/11] tty: serdev: Add flag buffer aware receive_buf_fp() Christoph Fritz
2024-05-04 16:00 ` Greg Kroah-Hartman
2024-05-08 8:48 ` Christoph Fritz
2024-05-02 18:27 ` [PATCH v3 04/11] tty: serdev: Add method to enable break flags Christoph Fritz
2024-05-02 18:27 ` [PATCH v3 05/11] dt-bindings: vendor-prefixes: Add hexDEV Christoph Fritz
2024-05-02 18:27 ` [PATCH v3 06/11] dt-bindings: net/can: Add serial (serdev) LIN adapter Christoph Fritz
2024-05-03 17:12 ` Conor Dooley
2024-05-03 18:29 ` Christoph Fritz
2024-05-06 16:16 ` Conor Dooley
2024-05-06 18:50 ` Krzysztof Kozlowski
2024-05-08 11:34 ` Christoph Fritz
2024-05-08 16:16 ` Conor Dooley
2024-05-02 18:28 ` [PATCH v3 07/11] can: Add support for serdev LIN adapters Christoph Fritz
2024-05-06 17:03 ` Ilpo Järvinen
2024-05-09 17:06 ` Christoph Fritz
2024-05-02 18:28 ` [PATCH v3 08/11] can: bcm: Add LIN answer offloading for responder mode Christoph Fritz
2024-05-06 17:08 ` Ilpo Järvinen
2024-05-09 17:06 ` Christoph Fritz
2024-05-02 18:28 ` [PATCH v3 09/11] can: lin: Handle rx offload config frames Christoph Fritz
2024-05-06 17:11 ` Ilpo Järvinen
2024-05-09 17:07 ` Christoph Fritz
2024-05-02 18:28 ` [PATCH v3 10/11] can: lin: Support setting LIN mode Christoph Fritz
2024-05-02 18:28 ` [PATCH v3 11/11] HID: hexLIN: Implement ability to update lin mode Christoph Fritz
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=2024050852-vixen-arson-cb42@gregkh \
--to=gregkh@linuxfoundation$(echo .)org \
--cc=andreas.lauser@mercedes-benz$(echo .)com \
--cc=bentiss@kernel$(echo .)org \
--cc=christoph.fritz@hexdev$(echo .)de \
--cc=conor+dt@kernel$(echo .)org \
--cc=corbet@lwn$(echo .)net \
--cc=davem@davemloft$(echo .)net \
--cc=devicetree@vger$(echo .)kernel.org \
--cc=edumazet@google$(echo .)com \
--cc=ilpo.jarvinen@linux$(echo .)intel.com \
--cc=jikos@kernel$(echo .)org \
--cc=jirislaby@kernel$(echo .)org \
--cc=krzk+dt@kernel$(echo .)org \
--cc=kuba@kernel$(echo .)org \
--cc=linus.walleij@linaro$(echo .)org \
--cc=linux-can@vger$(echo .)kernel.org \
--cc=linux-input@vger$(echo .)kernel.org \
--cc=linux-serial@vger$(echo .)kernel.org \
--cc=mailhol.vincent@wanadoo$(echo .)fr \
--cc=mkl@pengutronix$(echo .)de \
--cc=netdev@vger$(echo .)kernel.org \
--cc=pabeni@redhat$(echo .)com \
--cc=pisa@cmp$(echo .)felk.cvut.cz \
--cc=robh@kernel$(echo .)org \
--cc=socketcan@hartkopp$(echo .)net \
--cc=sre@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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