Query about creating sysfs directory under device driver


 
Thread Tools Search this Thread
Operating Systems Linux Query about creating sysfs directory under device driver
# 1  
Old 02-18-2009
CPU & Memory Query about creating sysfs directory under device driver

Hi all,

Currently i am involved in developing a device driver for a custom hardware.

My linux stack already has the sysfs directory structure

/sys/class/hwmon/

My need is that, while loading my device driver i need to create a "xyz" sysfs directory inside hwmon sysfs directory as shown below

/sys/class/hwmon/xyz/

I came across a function called class_create_file call using which we can able to create a sysfs file. But, I don't know about a way to create sysfs directory. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. What is on Your Mind?

Device driver programming

I want to work one day as a device driver programmer, OS I'm in love is Solaris :D I am learning C in my free time which I don't have because college took my life and I need to study to pass. In college we work in C++ / Java. These languages aren't inteded for device driver programming , saying... (0 Replies)
Discussion started by: solaris_user
0 Replies

2. Programming

regarding device driver

Hi All, I have a device driver that uses UARTserial port to write/read to-from a device. That device driver is working fine on FC3 machine( kernel version 2.6.12)... Now I am switching to FC9 (kernel version 2.6.25.11-97).I have changed the interrupt flag SA_INTERRUPT to IRQF_DISABLED... (0 Replies)
Discussion started by: rajuprade
0 Replies

3. UNIX for Advanced & Expert Users

help regarding device driver

Hi All, I have a device driver that uses UARTserial port to write/read to-from a device. That device driver is working fine on FC3 machine( kernel version 2.6.12)... Now I am switching to FC9 (kernel version 2.6.25.11-97).I have changed the interrupt flag SA_INTERRUPT to IRQF_DISABLED... (0 Replies)
Discussion started by: rajuprade
0 Replies

4. Programming

Network device driver

HI, I am writing a network device driver for RTL8139c card on 2.6.18 kernel ... I am facing few queries listed below 1. Can i able to at all write a driver for RTL8139C or Realtek had designed new chip for 2.6 series kernel? 2. If no then which driver file 2.6.18 uses .. Is it 8139too.c or... (1 Reply)
Discussion started by: niketan
1 Replies

5. Solaris

SUNWglmr -- rasctrl environment monitoring driver for i2c or SCSI device driver ?

I've been researching minimizeing Solaris 8 and found that on the web page http://www.sun.com/bigadmin/content/packagelist/s8u7PkgList/p2.html the package SUNWglmr is listed as "rasctrl environment monitoring driver for i2c, (Root) (32-bit)" while in the document "Solaris 8 minimize-updt1.pdf"... (1 Reply)
Discussion started by: roygoodwin
1 Replies
Login or Register to Ask a Question
DEVICE_CREATE_WITH_G(9) 				   Device drivers infrastructure				   DEVICE_CREATE_WITH_G(9)

NAME
device_create_with_groups - creates a device and registers it with sysfs SYNOPSIS
struct device * device_create_with_groups(struct class * class, struct device * parent, dev_t devt, void * drvdata, const struct attribute_group ** groups, const char * fmt, ...); ARGUMENTS
class pointer to the struct class that this device should be registered to parent pointer to the parent struct device of this new device, if any devt the dev_t for the char device to be added drvdata the data to be added to the device for callbacks groups NULL-terminated list of attribute groups to be created fmt string for the device's name ... variable arguments DESCRIPTION
This function can be used by char device classes. A struct device will be created in sysfs, registered to the specified class. Additional attributes specified in the groups parameter will also be created automatically. A "dev" file will be created, showing the dev_t for the device, if the dev_t is not 0,0. If a pointer to a parent struct device is passed in, the newly created struct device will be a child of that device in sysfs. The pointer to the struct device will be returned from the call. Any further sysfs files that might be required can be created using this pointer. Returns struct device pointer on success, or ERR_PTR on error. NOTE
the struct class passed to this function must have previously been created with a call to class_create. COPYRIGHT
Kernel Hackers Manual 3.10 June 2014 DEVICE_CREATE_WITH_G(9)