linux V4L FM驱动的问题

flying520520 2010-03-31 09:22:57
FM的驱动中定都定义了很多没有使用过的函数,还是static 的 ,而且函数名都有特殊要求,请问这是为什么呀。为什么要这样做

下面是这些函数

static int __attribute__ ((unused)) vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *v)
{

}

static int __attribute__ ((unused)) vidioc_g_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{
struct si4703_device *chip = video_get_drvdata(video_devdata(file));

}

static int __attribute__ ((unused)) vidioc_s_tuner(struct file *file, void *priv,
struct v4l2_tuner *v)
{

}

static int __attribute__ ((unused)) vidioc_s_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{

return 0;
}

static int __attribute__ ((unused)) vidioc_g_frequency(struct file *file, void *priv,
struct v4l2_frequency *f)
{
}

static int __attribute__ ((unused)) vidioc_queryctrl(struct file *file, void *priv,
struct v4l2_queryctrl *qc)
{

}

static int __attribute__ ((unused)) vidioc_g_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{
struct si4703_device *chip = video_get_drvdata(video_devdata(file));

}

static int __attribute__ ((unused)) vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctrl)
{

}

static int __attribute__ ((unused)) vidioc_g_audio(struct file *file, void *priv,
struct v4l2_audio *a)
{

}

static int __attribute__ ((unused)) vidioc_g_input(struct file *filp, void *priv, unsigned int *i)
{
}

static int __attribute__ ((unused)) vidioc_s_input(struct file *filp, void *priv, unsigned int i)
{

}

static int __attribute__ ((unused)) vidioc_s_audio(struct file *file, void *priv,
struct v4l2_audio *a)
{

}
...全文
312 5 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
spfbc 2010-04-05
  • 打赏
  • 举报
回复
还没研究这么细,先顶了。。。
帅得不敢出门 2010-04-05
  • 打赏
  • 举报
回复
unused:This attribute, attached to a function, means that the function is meant to be possibly unused. GCC will not produce a warning for this function.
Apple_Demo 2010-04-05
  • 打赏
  • 举报
回复
函数名都有特殊要求?什么特殊要求?
为了从函数名上看出函数的功能。
hallowwar 2010-04-04
  • 打赏
  • 举报
回复
学习了,深度专业!!!!!!
deep_pro 2010-03-31
  • 打赏
  • 举报
回复
我看的内核版本里没有__attribute__ ((unused)) ,仅仅代表这个函数可能不会被调用
加了static限定此函数只能在当前c文件起作用

至于名字固定,因为struct video_device 里有同名的函数指针,就是靠这些同名函数填充
不过函数名也没有必要相同,函数原型相同即可,这里名字固定估计是历史原因

4,465

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧