when to return -EOPNOTSUPP in _ioctl in a driver
Hi all, While going through some code, i have found a place in which we do return, -EOPNOTSUPP in an ioctl and the code of ioctl does just this one. static int drv_ioctl(.. *fops, ...) { return -EOPNOTSUPP; } do we actually need to specify a pointer to the ioctl callback, if the driver doesn't support ioctl?
On Tue, Oct 2, 2012 at 8:26 AM, devendra.aaru <devendra.aaru@gmail.com> wrote:
Hi all,
While going through some code, i have found a place in which we do return, -EOPNOTSUPP in an ioctl and the code of ioctl does just this one.
static int drv_ioctl(.. *fops, ...) { return -EOPNOTSUPP; }
do we actually need to specify a pointer to the ioctl callback, if the driver doesn't support ioctl?
What type of driver? For networking if you do not have ops->ndo_do_ioctl then -EOPNOTSUPP is returned. See dev_ifsioc() and prior to that dev_ioctl() on net/core/dev.c. Luis
On Tue, Oct 2, 2012 at 4:07 PM, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote:
do we actually need to specify a pointer to the ioctl callback, if the driver doesn't support ioctl?
What type of driver? For networking if you do not have ops->ndo_do_ioctl then -EOPNOTSUPP is returned. See dev_ifsioc() and prior to that dev_ioctl() on net/core/dev.c.
Luis
Hi Luis, Thanks for the reply, actually i see it in drivers/staging/csr/ this is in netdev.c here they do the below way csr_xxx_ioctl(....) { int ret; ret = -EOPNOTSUPP; return ret; } if the ioctl just needs to say that i am not going to support ioctl, then why we give the function address in the netdev_ops? as i understood from your reply that the dev_ioctl returns -EOPNOTSUPP when theres' no ioctl pointer registered in netdev_ops am i right? sorry for late reply,
On Thu, Oct 4, 2012 at 12:29 AM, devendra.aaru <devendra.aaru@gmail.com> wrote:
actually i see it in drivers/staging/csr/
this is in netdev.c
here they do the below way
csr_xxx_ioctl(....) { int ret;
ret = -EOPNOTSUPP;
return ret; }
if the ioctl just needs to say that i am not going to support ioctl, then why we give the function address in the netdev_ops?
You're right, you should not have to. This is a staging driver though so the quality is not as good as a sane driver should look like, hence staging. Send a patch :)
as i understood from your reply that the dev_ioctl returns -EOPNOTSUPP when theres' no ioctl pointer registered in netdev_ops
am i right?
Yup. Luis
On Thu, Oct 4, 2012 at 3:38 AM, Luis R. Rodriguez <mcgrof@do-not-panic.com> wrote:
On Thu, Oct 4, 2012 at 12:29 AM, devendra.aaru <devendra.aaru@gmail.com> wrote:
actually i see it in drivers/staging/csr/
this is in netdev.c
here they do the below way
csr_xxx_ioctl(....) { int ret;
ret = -EOPNOTSUPP;
return ret; }
if the ioctl just needs to say that i am not going to support ioctl, then why we give the function address in the netdev_ops?
You're right, you should not have to. This is a staging driver though so the quality is not as good as a sane driver should look like, hence staging. Send a patch :)
Yes, sure right after the merge window gets closed. Thanks a lot,
as i understood from your reply that the dev_ioctl returns -EOPNOTSUPP when theres' no ioctl pointer registered in netdev_ops
am i right?
Yup.
Luis
participants (2)
-
devendra.aaru -
Luis R. Rodriguez