LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 10-15-2013, 12:14 PM   #1
EschewPanache
LQ Newbie
 
Registered: Jun 2011
Posts: 7

Rep: Reputation: Disabled
How to find platform_device entry from a kernel module


Folks, I have a 3.10.12 kernel and have written a character device driver as a loadable kernel module. From within this driver I want to find a particular device, an LED, that I want to blink as I operate. This LED was registered using "platform_device_reqister". What I would like to do is enumerate all of the devices registered in this manner and find the one I want, but, I have been unable to discover how to start. There is a lot of documentation on the kernel objects, but nothing I can find on how to find a particular one.
I thank any responders in advance!
Peace,
carl.
 
Old 10-21-2013, 05:05 AM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
Quote:
enumerate all of the devices registered in this manner and find the one I want
Did you mean programatically? You can make your device driver output it's major number with printk then just grep through all the devices in /dev to filter them. How are you defining "the one I want"?
 
Old 10-21-2013, 07:07 AM   #3
EschewPanache
LQ Newbie
 
Registered: Jun 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thank you, and yes, I did mean programmatically. The particular "device" is an LED, and appears in /sys/class/leds, which I was hoping to parse from my character driver without needing to search a filesystem. I know the LED's name, and the kernel module that contains the function that will set the LED intensity. That function requires a "struct classled" that I don't know how to find.
 
Old 10-21-2013, 06:45 PM   #4
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,758

Rep: Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643Reputation: 643
I didn't find any reference to 'struct classled' .. only struct led_classdev, could you point me at a reference ?
 
1 members found this post helpful.
Old 10-22-2013, 06:58 AM   #5
EschewPanache
LQ Newbie
 
Registered: Jun 2011
Posts: 7

Original Poster
Rep: Reputation: Disabled
Smile oops. Spelling

KBP, thank you, you are correct, that is struct led_classdev. This is openwrt source, leds.h, in the "...drivers/leds" directory. The inline _led_set_brightness function is called by led_set_brightness() defined in led-core.c, and THAT function is also helpfully exported, making me think someone would like me to use it!
 
  


Reply

Tags
device, driver, kernel, module, platform


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] After upgrading to kernel 3.8 module-assistant can't find kernel headers (Debian Sid) odiseo77 Debian 9 05-16-2013 07:59 PM
how to find kernel for distro to create grub entry msc8127 Linux - Newbie 13 03-15-2009 05:00 AM
cannot find entry.S file in Ubuntu kernel kernelchase Linux - Newbie 2 01-21-2008 03:02 PM
How can I find out a Kernel Parameter Name by having the corresponding module name? baikonur Debian 6 08-02-2006 04:56 AM
How to read from /proc entry in another kernel module? linux_lover2005 Programming 0 01-14-2005 05:44 AM


All times are GMT -5. The time now is 01:49 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration