Re: devfs_register and private data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 20 Jan 2004, Liberty Young wrote:

>
> so, i have a private structure in my driver file,
> struct my_privfile_s {
> 	int data1;
> 	int data2;
> } my_privinfo ;
>
> my_privinfo.data1 = 5;
> my_privinfo.data2 = 25;
>
> and in the devfs_register call, i set the last argument to &my_privinfo;
>
> and in the open call of my driver, i have
>
> static int fop_open (struct inode * inode, struct file * filep){
> 	struct my_privfile_s *info = (struct my_privfile_s *) filep;

Looks to me like this should be:

	struct my_privfile_s *info = (struct my_privfile_s *)
						filep->private_data

> 	printk ("testing: data1 is %d, data2 is %d\n", info->data1, info->data2);
> 	<more code follows>
> };
>


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux