打印

驱动程序入口函数write 编译出问题

[复制链接]
1505|3
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
fuzzymy|  楼主 | 2008-12-9 20:01 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
static ssize_t uart_write(struct file *filp,char *buf,size_t count,loff_t *f_pos)
{
    int i;
    char tx_buf[BUFFSIZE];
    unsigned char lsr;
//    size_t tx_buf_count=0;
    struct inode *inode =filp->private_data;
    printk("<1>uart_write MINOR = %d,filp->f_count is %d ",MINOR(inode->i_rdev),filp->f_count);
    copy_from_user(tx_buf,buf,count);
    for(i=0;i<count;i++)
    {
        while(!(lsr=readb(vEXT_COM_BASE_ADDR[MINOR(inode->i_rdev)]+LSR)&(0x1<<5)));
        writeb(tx_buf,vEXT_COM_BASE_ADDR[MINOR(inode->i_rdev)]+THR);
    }    
    return count;
}

static struct file_operations uart_fops=
{
owner:        THIS_MODULE,
read:        uart_read,
write:        uart_write,   //125行
open:        uart_open,
release:             uart_release,
flush:        uart_flush,
ioctl:        uart_ioctl,
};

编译时  125行有警告:warning: initialization from incompatible pointer type 

想了很久  也不知道问题出在哪里  read  和write的函数差不多 为什么read不出问题而write就有呢 
各位大虾帮帮忙   谢谢

相关帖子

沙发
阿南| | 2008-12-10 00:33 | 只看该作者

呵呵,warning没事,能正常使用就行

使用特权

评论回复
板凳
fuzzymy|  楼主 | 2008-12-10 15:34 | 只看该作者

多谢南哥

使用特权

评论回复
地板
fuzzymy|  楼主 | 2008-12-10 21:26 | 只看该作者

解决了 在write的第二个参数加上const

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

5

主题

6

帖子

0

粉丝