Thanks Anish ..<br>I got your point .<br>I was using <br>struct inode *inode = file->f_dentry->d_inode;<br> min = iminor(inode);<br><br>to see which node has been opened,<br>I wanted to make sure myself the correct/best way of<br>
getting this information.<br><br>Praveen<br><br><br><div class="gmail_quote">On Wed, Nov 16, 2011 at 8:02 PM, anish kumar <span dir="ltr"><<a href="mailto:anish198519851985@gmail.com">anish198519851985@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><div class="HOEnZb"><div class="h5">On Wed, 2011-11-16 at 18:00 +0530, Praveen kumar wrote:<br>
> Hi All,<br>
> I have a I2C chip driver,and there are two identical chips on<br>
> two different i2c bus.<br>
> I have registered the driver and initialized it and created two<br>
> nodes /dev/chip_0 and /dev/chip_1<br>
><br>
> If I open the node from user how will I make driver identify which<br>
> device to access .ie in the ioctl.<br>
<br>
</div></div>So in your ioctl call you want to get the device structure right?<br>
If yes then have a look at scull/main.c file in scull folder at below<br>
location.<br>
git://<a href="http://github.com/martinezjavier/ldd3.git" target="_blank">github.com/martinezjavier/ldd3.git</a><br>
<br>
Basically you need to set private_data of filp at open time with device<br>
information and get the private_data from filp in ioctl.<br>
If you don't understand then just have a look at the file I mentioned.<br>
<div class="im">><br>
> Am I clear ???<br>
><br>
> Praveen<br>
><br>
><br>
</div>> _______________________________________________<br>
> Kernelnewbies mailing list<br>
> <a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
> <a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
<br>
<br>
</blockquote></div><br>