On Wed, 17 Jun 2009, Thomas Gleixner wrote:
Errm, and how does udev figure out which device node to create for which device ? /sys/devices/pci0000:00/0000:00:1d.7/usb1/dev
Thanks for the hint. I wasn't aware of the need to call device_create() etc in my driver, and had been creating device files by hand. Having now remedied this omission, I have taken the opportunity to add an irq attribute file under each of my device entries in sysfs. Next I would like to add an attribute that indicates the corresponding thread PID. To do that, I need a kernel function that can be called to determine the IRQ thread ID. I have just written and tested the following function for doing this: #ifdef CONFIG_PREEMPT_HARDIRQS pid_t get_irq_thread_pid(unsigned int irq, struct pid_namespace *ns) { struct irq_desc *desc = irq_to_desc(irq); pid_t pid = 0; if(desc) { unsigned long flags; spin_lock_irqsave(&desc->lock, flags); if(desc->thread) pid = task_pid_nr_ns(desc->thread, ns); spin_unlock_irqrestore(&desc->lock, flags); } return pid; } EXPORT_SYMBOL(get_irq_thread_pid); #endif This would most frequently be called like: pid = get_irq_thread_pid(irq, current->nsproxy->pid_ns); if(pid) { ... } Would this function be acceptible for inclusion in the preempt-rt kernel, or do you have something else in mind? Martin -- To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html