implicit declaration of function 这种警告问题的原因及解决方法

最近在改进SD卡的SEP4020驱动时,在改掉所有的warning时老报一个implicit declaration of function 的警告错误,上网查了下原因,原来有两种情况会产生这种情况

1  没有把函数所在的c文件生成.o目标文件
2  在函数所在的c文件中定义了,但是没有在与之相关联的.h文件中声明

[root@mail linux]# make
  CHK     include/linux/version.h
make[1]: “include/asm-arm/mach-types.h”是最新的。
  CHK     include/linux/compile.h
  CHK     usr/initramfs_list
  CC      drivers/mmc/sep_mci.o
drivers/mmc/sep_mci.c: In function `sep4020sdi_probe':
drivers/mmc/sep_mci.c:745: warning: implicit declaration of function `clk_get'
drivers/mmc/sep_mci.c:745: warning: assignment makes pointer from integer without a cast
drivers/mmc/sep_mci.c:754: warning: implicit declaration of function `clk_enable'
drivers/mmc/sep_mci.c:800: warning: implicit declaration of function `clk_put'
drivers/mmc/sep_mci.c: In function `sep4020sdi_remove':
drivers/mmc/sep_mci.c:830: warning: implicit declaration of function `clk_disable'
drivers/mmc/sep_mci.c: In function `sep4020sdi_irq':
drivers/mmc/sep_mci.c:197: warning: 'sdi_cclear' might be used uninitialized in this function
drivers/mmc/sep_mci.c: In function `sep4020sdi_probe':
drivers/mmc/sep_mci.c:673: warning: 'host' might be used uninitialized in this function
drivers/mmc/sep_mci.c: At top level:
drivers/mmc/sep_mci.c:337: warning: 'sep4020sdi_irq_cd' defined but not used
  LD      drivers/mmc/built-in.o
  LD      drivers/built-in.o
  GEN     .version
  CHK     include/linux/compile.h
  UPD     include/linux/compile.h
  CC      init/version.o
  LD      init/built-in.o
  LD      .tmp_vmlinux1
  KSYM    .tmp_kallsyms1.S
  AS      .tmp_kallsyms1.o
  LD      .tmp_vmlinux2
  KSYM    .tmp_kallsyms2.S
  AS      .tmp_kallsyms2.o
  LD      vmlinux
  SYSMAP  System.map
  SYSMAP  .tmp_System.map
  OBJCOPY arch/arm/boot/Image
  Kernel: arch/arm/boot/Image is ready
  GZIP    arch/arm/boot/compressed/piggy.gz
  AS      arch/arm/boot/compressed/piggy.o
  LD      arch/arm/boot/compressed/vmlinux
  OBJCOPY arch/arm/boot/zImage
  Kernel: arch/arm/boot/zImage is ready
  Building modules, stage 2.
  MODPOST
于是我在sep_mci.c的头部将 <linux/clk.h>包含进去就行了

这样就没有任何warning产生了,呵呵

 

  • 0
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值