[PATCH v4 05/13] drivers: create binary sysfs for class
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Mon Apr 15 14:47:16 UTC 2019
On Mon, Apr 15, 2019 at 06:11:13PM +0530, Ramalingam C wrote:
> On 2019-04-05 at 14:32:00 +0200, Greg Kroah-Hartman wrote:
> > On Fri, Apr 05, 2019 at 04:06:22PM +0530, Ramalingam C wrote:
> > > On 2019-04-05 at 11:23:00 +0200, Greg Kroah-Hartman wrote:
> > > > On Fri, Apr 05, 2019 at 02:12:54PM +0530, Ramalingam C wrote:
> > > > > Functions to create and remove the binary sysfs for class are added.
> > > > >
> > > > > These are getting introduced as DRM wants to create the common binary
> > > > > sysfs across the drm subsystem to handle hdcp srm.
> > > >
> > > > Why do you need individual files? That's almost always a sign that you
> > > > are going to race with userspace in a bad way. Why not just use an
> > > > attribute group which provides automatic support for this?
> > > Greg,
> > >
> > > Reason behind this move is to have a common srm entry path across all drm
> > > drivers. And the data fed into this is binary blob. So I am creating a
> > > binary sysfs "hdcp_srm" at /sys/class/drm/
> >
> > Ah, you want to have a file in your class directory, not your class
> > device directory.
> >
> > No, please do not do that. There's a reason I got rid of those same
> > types of apis in the past.
> >
> > And "binary blobs" are horrid anyway, they are only to be used as a
> > pass-through to the device itself, from the kernel, no touching the data
> > at all. If you really need/want this, then put it in the device's
> > directory as that is where the data is going to, not the kernel "class"
> > code as it sure as heck better not be doing anything with it.
> Greg,
>
> But here the parsing of the received binary blob is done outside the drm
> device/cards. This will be generic code for all drm cardx(drivers). And
> this will provide the service helper functions to the drm drivers for HDCP SRM checking.
Again, the kernel is NOT to be parsing any binary data that comes
through a sysfs file. If you need such a crazy thing, do it through
your normal drm ioctl.
> So we prefer to have the binary sysfs at /sys/class/drm/ than inside the
> cardx folders, so that it will be generic. Could you please suggest a way to achieve that?
What is a "cardx" driver? Why can you not do it in a device-specific
location? Are suddenly _ALL_ DRM drivers going to need this
information? What is the use case? Who is going to be providing this
blob and where is it going? What in the kernel uses it? What on the
hardware uses it? What is it actually?
I need a lot more information before being able to determine what you
can do here.
thanks,
greg k-h
More information about the dri-devel
mailing list