Re: ktypes vs. devices classes (struct class)

2023-10-02 Thread Greg KH
On Sun, Oct 01, 2023 at 11:15:12PM +0200, Richard wrote: > > > I've seen struct class defines **class_groups, but (contrary to struct > > > kobj_type) not the corresponding struct sysfs_ops, why? Where is it then? > > > > groups are used to define attributes (i.e. sysfs files). sysfs_ops is > >

Re: ktypes vs. devices classes (struct class)

2023-10-01 Thread Richard
Is it possible that one device belongs to several classes? No. Oops, well yes. Depends on what you are thinking is a "device" here. In the kernel, yes, a 'struct device' on a bus can then register itself with multiple subsystems that handle different classes, and then individual

Re: ktypes vs. devices classes (struct class)

2023-10-01 Thread Richard
Close. "struct class" represents how userspace interacts with a device (tty / input / block / etc.) "struct kobj_type" is needed to describe what "type" of struct kobject a specific kobject is. It defines a number of operations that handle the lifespan of the kobject. Oki My digging

Re: ktypes vs. devices classes (struct class)

2023-10-01 Thread Greg KH
On Sun, Oct 01, 2023 at 11:50:46AM +0200, Greg KH wrote: > On Sat, Sep 30, 2023 at 08:17:26PM +0200, Richard wrote: > > Hi, > > > > I appreciate your answer, thank you for your time. > > > > > > > > Look closer. Tell me what "struct class" is for vs. what "struct > > > kobj_type" is for and

Re: ktypes vs. devices classes (struct class)

2023-10-01 Thread Greg KH
On Sat, Sep 30, 2023 at 08:17:26PM +0200, Richard wrote: > Hi, > > I appreciate your answer, thank you for your time. > > > > > Look closer. Tell me what "struct class" is for vs. what "struct > > kobj_type" is for and see if they both could be used for the same thing? > > I've looked at the

Re: ktypes vs. devices classes (struct class)

2023-09-30 Thread Richard
Hi, I appreciate your answer, thank you for your time. Look closer. Tell me what "struct class" is for vs. what "struct kobj_type" is for and see if they both could be used for the same thing? I've looked at the definitions in include/linux and thought a bit about the semantics. struct

Re: ktypes vs. devices classes (struct class)

2023-09-30 Thread Greg KH
On Sat, Sep 30, 2023 at 02:12:41AM +0200, Richard wrote: > Hi all, > > Why do we have ktypes (struct kobj_type) AND device classes (struct class)? Because they are two totally different things. > Don't they serve the same purpose (more or less) and it would be simpler, > clearer and more KISS

ktypes vs. devices classes (struct class)

2023-09-29 Thread Richard
Hi all, Why do we have ktypes (struct kobj_type) AND device classes (struct class)? Don't they serve the same purpose (more or less) and it would be simpler, clearer and more KISS to only have one? Is this a historically grown thing or by design? Thanks, -- Richard