linux-3.6.38内核关于/proc挂载例子

内核源代码位置:

linux-3.6.38/drivers/tty/serial/samsung.c

+1550

#if defined(RS485_PORT3) || defined(RS485_PORT2)
static struct proc_dir_entry *gpn12_inode = NULL;
static char msg[10];

static int write_gpn12(struct file *file, const char __user *buffer, unsigned long count, void *data)
{
    int status = 0;

    if (copy_from_user((void *)msg, (const void __user *)buffer, count))
        return -EFAULT;

    status = simple_strtoul(msg, NULL, 0);

    gpio_direction_output(S3C64XX_GPN(12), status);

    return count;
}
#endif



你可能感兴趣的:(驱动)