All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about dev_uevent_filter
@ 2012-09-25 15:13 Lan Tianyu
  2012-09-25 15:20 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Lan Tianyu @ 2012-09-25 15:13 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel


hi Greg:
	I find only devices which has bus_type or class can add uevent callback
and output the uevent information. This is because the dev_uevent_filter just return
true for these devices. But some device may not have class and bus_type.
e.g usb endpoint, if we assigned them to usb_bus_type, device core will
try to create sysfs directory link under /sys/bus/usb. But endpoint sysfs
directory's name are same for each usb devices.e.g ep_00, every usb device will
create the endpoint. So in this situation, we can't assign usb endpoint to
usb_bus_type. So even if uevent callback was added and with some information,
it still couldn't output anything. Can we add dev->type check in the
dev_uevent_filter() and return 1 if type exits?

/drivers/base/core.c
static int dev_uevent_filter(struct kset *kset, struct kobject *kobj)
{
	struct kobj_type *ktype = get_ktype(kobj);

	if (ktype == &device_ktype) {
		struct device *dev = kobj_to_dev(kobj);
		if (dev->bus)
			return 1;
		if (dev->class)
			return 1;
	}
	return 0;
}

Thanks
-- 
Best regards
Tianyu Lan

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Question about dev_uevent_filter
  2012-09-25 15:13 Question about dev_uevent_filter Lan Tianyu
@ 2012-09-25 15:20 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-09-25 15:20 UTC (permalink / raw)
  To: Lan Tianyu; +Cc: linux-kernel, linux-usb

On Tue, Sep 25, 2012 at 11:13:43PM +0800, Lan Tianyu wrote:
> 
> hi Greg:

[linux-usb added as it concerns them as well]

> 	I find only devices which has bus_type or class can add uevent callback
> and output the uevent information. This is because the dev_uevent_filter just return
> true for these devices. But some device may not have class and bus_type.
> e.g usb endpoint, if we assigned them to usb_bus_type, device core will
> try to create sysfs directory link under /sys/bus/usb. But endpoint sysfs
> directory's name are same for each usb devices.e.g ep_00, every usb device will
> create the endpoint. So in this situation, we can't assign usb endpoint to
> usb_bus_type. So even if uevent callback was added and with some information,
> it still couldn't output anything. Can we add dev->type check in the
> dev_uevent_filter() and return 1 if type exits?

Wait, why do you want a uevent for a USB endpoint?  What is the problem
you are trying to solve here?

greg k-h

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-09-25 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 15:13 Question about dev_uevent_filter Lan Tianyu
2012-09-25 15:20 ` Greg KH

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.