Re: your mail (tipar)

Romain Liévin (rlievin@free.fr)
Thu, 14 Mar 2002 19:51:31 +0100 (MET)


> > +static int tipar_open(struct inode *inode, struct file *file)
> > +{
> > + unsigned int minor = minor(inode->i_rdev) - TIPAR_MINOR_0;
> > +
> > + if (minor >= PP_NO)
> > + return -ENXIO;
> > +
> > + if(table[minor].opened)
> > + return -EBUSY;
> > +
> > + table[minor].opened++;
> > +
>
> I think <asm/bitops.h> operations on one unsigned long for all devices
> would be better, and at least non-racy.

Well, but I have never seen a such use in any kernrl modules. Is it the right
way to use ?

>
> > + case TIPAR_DELAY:
> > + delay = arg;
>
> Needs get_user/copy_from_user

In the modules tree, they use copy_to_user. They use the same construction
rather than using get_user. More informations ?

Romain

---
Romain Liévin (aka roms)
http://lpg.ticalc.org/prj_tilp, prj_usb, prj_tidev, prj_gtktiemu
mail: roms@lpg.ticalc.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/