ppdev: space prohibited between function name and parenthesis
checkpatch was complaining about space between function name and open parenthesis. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
59ea259044
commit
783ea44db7
|
@ -106,13 +106,13 @@ static DEFINE_MUTEX(pp_do_mutex);
|
||||||
#define PPGETTIME64 _IOR(PP_IOCTL, 0x95, s64[2])
|
#define PPGETTIME64 _IOR(PP_IOCTL, 0x95, s64[2])
|
||||||
#define PPSETTIME64 _IOW(PP_IOCTL, 0x96, s64[2])
|
#define PPSETTIME64 _IOW(PP_IOCTL, 0x96, s64[2])
|
||||||
|
|
||||||
static inline void pp_enable_irq (struct pp_struct *pp)
|
static inline void pp_enable_irq(struct pp_struct *pp)
|
||||||
{
|
{
|
||||||
struct parport *port = pp->pdev->port;
|
struct parport *port = pp->pdev->port;
|
||||||
port->ops->enable_irq (port);
|
port->ops->enable_irq(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
|
static ssize_t pp_read(struct file * file, char __user * buf, size_t count,
|
||||||
loff_t * ppos)
|
loff_t * ppos)
|
||||||
{
|
{
|
||||||
unsigned int minor = iminor(file_inode(file));
|
unsigned int minor = iminor(file_inode(file));
|
||||||
|
@ -139,7 +139,7 @@ static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
|
||||||
pport = pp->pdev->port;
|
pport = pp->pdev->port;
|
||||||
mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
|
mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
|
||||||
|
|
||||||
parport_set_timeout (pp->pdev,
|
parport_set_timeout(pp->pdev,
|
||||||
(file->f_flags & O_NONBLOCK) ?
|
(file->f_flags & O_NONBLOCK) ?
|
||||||
PARPORT_INACTIVITY_O_NONBLOCK :
|
PARPORT_INACTIVITY_O_NONBLOCK :
|
||||||
pp->default_inactivity);
|
pp->default_inactivity);
|
||||||
|
@ -165,7 +165,7 @@ static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
|
||||||
}
|
}
|
||||||
bytes_read = (*fn)(pport, kbuffer, need, flags);
|
bytes_read = (*fn)(pport, kbuffer, need, flags);
|
||||||
} else {
|
} else {
|
||||||
bytes_read = parport_read (pport, kbuffer, need);
|
bytes_read = parport_read(pport, kbuffer, need);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bytes_read != 0)
|
if (bytes_read != 0)
|
||||||
|
@ -176,7 +176,7 @@ static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signal_pending (current)) {
|
if (signal_pending(current)) {
|
||||||
bytes_read = -ERESTARTSYS;
|
bytes_read = -ERESTARTSYS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -184,17 +184,17 @@ static ssize_t pp_read (struct file * file, char __user * buf, size_t count,
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
parport_set_timeout (pp->pdev, pp->default_inactivity);
|
parport_set_timeout(pp->pdev, pp->default_inactivity);
|
||||||
|
|
||||||
if (bytes_read > 0 && copy_to_user (buf, kbuffer, bytes_read))
|
if (bytes_read > 0 && copy_to_user(buf, kbuffer, bytes_read))
|
||||||
bytes_read = -EFAULT;
|
bytes_read = -EFAULT;
|
||||||
|
|
||||||
kfree (kbuffer);
|
kfree(kbuffer);
|
||||||
pp_enable_irq (pp);
|
pp_enable_irq(pp);
|
||||||
return bytes_read;
|
return bytes_read;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t pp_write (struct file * file, const char __user * buf,
|
static ssize_t pp_write(struct file * file, const char __user * buf,
|
||||||
size_t count, loff_t * ppos)
|
size_t count, loff_t * ppos)
|
||||||
{
|
{
|
||||||
unsigned int minor = iminor(file_inode(file));
|
unsigned int minor = iminor(file_inode(file));
|
||||||
|
@ -218,7 +218,7 @@ static ssize_t pp_write (struct file * file, const char __user * buf,
|
||||||
pport = pp->pdev->port;
|
pport = pp->pdev->port;
|
||||||
mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
|
mode = pport->ieee1284.mode & ~(IEEE1284_DEVICEID | IEEE1284_ADDR);
|
||||||
|
|
||||||
parport_set_timeout (pp->pdev,
|
parport_set_timeout(pp->pdev,
|
||||||
(file->f_flags & O_NONBLOCK) ?
|
(file->f_flags & O_NONBLOCK) ?
|
||||||
PARPORT_INACTIVITY_O_NONBLOCK :
|
PARPORT_INACTIVITY_O_NONBLOCK :
|
||||||
pp->default_inactivity);
|
pp->default_inactivity);
|
||||||
|
@ -226,7 +226,7 @@ static ssize_t pp_write (struct file * file, const char __user * buf,
|
||||||
while (bytes_written < count) {
|
while (bytes_written < count) {
|
||||||
ssize_t n = min_t(unsigned long, count - bytes_written, PP_BUFFER_SIZE);
|
ssize_t n = min_t(unsigned long, count - bytes_written, PP_BUFFER_SIZE);
|
||||||
|
|
||||||
if (copy_from_user (kbuffer, buf + bytes_written, n)) {
|
if (copy_from_user(kbuffer, buf + bytes_written, n)) {
|
||||||
bytes_written = -EFAULT;
|
bytes_written = -EFAULT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -234,14 +234,14 @@ static ssize_t pp_write (struct file * file, const char __user * buf,
|
||||||
if ((pp->flags & PP_FASTWRITE) && (mode == IEEE1284_MODE_EPP)) {
|
if ((pp->flags & PP_FASTWRITE) && (mode == IEEE1284_MODE_EPP)) {
|
||||||
/* do a fast EPP write */
|
/* do a fast EPP write */
|
||||||
if (pport->ieee1284.mode & IEEE1284_ADDR) {
|
if (pport->ieee1284.mode & IEEE1284_ADDR) {
|
||||||
wrote = pport->ops->epp_write_addr (pport,
|
wrote = pport->ops->epp_write_addr(pport,
|
||||||
kbuffer, n, PARPORT_EPP_FAST);
|
kbuffer, n, PARPORT_EPP_FAST);
|
||||||
} else {
|
} else {
|
||||||
wrote = pport->ops->epp_write_data (pport,
|
wrote = pport->ops->epp_write_data(pport,
|
||||||
kbuffer, n, PARPORT_EPP_FAST);
|
kbuffer, n, PARPORT_EPP_FAST);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
wrote = parport_write (pp->pdev->port, kbuffer, n);
|
wrote = parport_write(pp->pdev->port, kbuffer, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wrote <= 0) {
|
if (wrote <= 0) {
|
||||||
|
@ -259,33 +259,33 @@ static ssize_t pp_write (struct file * file, const char __user * buf,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (signal_pending (current))
|
if (signal_pending(current))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
cond_resched();
|
cond_resched();
|
||||||
}
|
}
|
||||||
|
|
||||||
parport_set_timeout (pp->pdev, pp->default_inactivity);
|
parport_set_timeout(pp->pdev, pp->default_inactivity);
|
||||||
|
|
||||||
kfree (kbuffer);
|
kfree(kbuffer);
|
||||||
pp_enable_irq (pp);
|
pp_enable_irq(pp);
|
||||||
return bytes_written;
|
return bytes_written;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pp_irq (void *private)
|
static void pp_irq(void *private)
|
||||||
{
|
{
|
||||||
struct pp_struct *pp = private;
|
struct pp_struct *pp = private;
|
||||||
|
|
||||||
if (pp->irqresponse) {
|
if (pp->irqresponse) {
|
||||||
parport_write_control (pp->pdev->port, pp->irqctl);
|
parport_write_control(pp->pdev->port, pp->irqctl);
|
||||||
pp->irqresponse = 0;
|
pp->irqresponse = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
atomic_inc (&pp->irqc);
|
atomic_inc(&pp->irqc);
|
||||||
wake_up_interruptible (&pp->irq_wait);
|
wake_up_interruptible(&pp->irq_wait);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int register_device (int minor, struct pp_struct *pp)
|
static int register_device(int minor, struct pp_struct *pp)
|
||||||
{
|
{
|
||||||
struct parport *port;
|
struct parport *port;
|
||||||
struct pardevice * pdev = NULL;
|
struct pardevice * pdev = NULL;
|
||||||
|
@ -296,21 +296,21 @@ static int register_device (int minor, struct pp_struct *pp)
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
port = parport_find_number (minor);
|
port = parport_find_number(minor);
|
||||||
if (!port) {
|
if (!port) {
|
||||||
printk (KERN_WARNING "%s: no associated port!\n", name);
|
printk(KERN_WARNING "%s: no associated port!\n", name);
|
||||||
kfree (name);
|
kfree(name);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
|
fl = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0;
|
||||||
pdev = parport_register_device (port, name, NULL,
|
pdev = parport_register_device(port, name, NULL,
|
||||||
NULL, pp_irq, fl, pp);
|
NULL, pp_irq, fl, pp);
|
||||||
parport_put_port (port);
|
parport_put_port(port);
|
||||||
|
|
||||||
if (!pdev) {
|
if (!pdev) {
|
||||||
printk (KERN_WARNING "%s: failed to register device!\n", name);
|
printk(KERN_WARNING "%s: failed to register device!\n", name);
|
||||||
kfree (name);
|
kfree(name);
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ static int register_device (int minor, struct pp_struct *pp)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum ieee1284_phase init_phase (int mode)
|
static enum ieee1284_phase init_phase(int mode)
|
||||||
{
|
{
|
||||||
switch (mode & ~(IEEE1284_DEVICEID
|
switch (mode & ~(IEEE1284_DEVICEID
|
||||||
| IEEE1284_ADDR)) {
|
| IEEE1284_ADDR)) {
|
||||||
|
@ -367,13 +367,13 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
|
|
||||||
/* Deferred device registration. */
|
/* Deferred device registration. */
|
||||||
if (!pp->pdev) {
|
if (!pp->pdev) {
|
||||||
int err = register_device (minor, pp);
|
int err = register_device(minor, pp);
|
||||||
if (err) {
|
if (err) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = parport_claim_or_block (pp->pdev);
|
ret = parport_claim_or_block(pp->pdev);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
|
|
||||||
/* For interrupt-reporting to work, we need to be
|
/* For interrupt-reporting to work, we need to be
|
||||||
* informed of each interrupt. */
|
* informed of each interrupt. */
|
||||||
pp_enable_irq (pp);
|
pp_enable_irq(pp);
|
||||||
|
|
||||||
/* We may need to fix up the state machine. */
|
/* We may need to fix up the state machine. */
|
||||||
info = &pp->pdev->port->ieee1284;
|
info = &pp->pdev->port->ieee1284;
|
||||||
|
@ -389,8 +389,8 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
pp->saved_state.phase = info->phase;
|
pp->saved_state.phase = info->phase;
|
||||||
info->mode = pp->state.mode;
|
info->mode = pp->state.mode;
|
||||||
info->phase = pp->state.phase;
|
info->phase = pp->state.phase;
|
||||||
pp->default_inactivity = parport_set_timeout (pp->pdev, 0);
|
pp->default_inactivity = parport_set_timeout(pp->pdev, 0);
|
||||||
parport_set_timeout (pp->pdev, pp->default_inactivity);
|
parport_set_timeout(pp->pdev, pp->default_inactivity);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -412,11 +412,11 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
case PPSETMODE:
|
case PPSETMODE:
|
||||||
{
|
{
|
||||||
int mode;
|
int mode;
|
||||||
if (copy_from_user (&mode, argp, sizeof (mode)))
|
if (copy_from_user(&mode, argp, sizeof(mode)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
/* FIXME: validate mode */
|
/* FIXME: validate mode */
|
||||||
pp->state.mode = mode;
|
pp->state.mode = mode;
|
||||||
pp->state.phase = init_phase (mode);
|
pp->state.phase = init_phase(mode);
|
||||||
|
|
||||||
if (pp->flags & PP_CLAIMED) {
|
if (pp->flags & PP_CLAIMED) {
|
||||||
pp->pdev->port->ieee1284.mode = mode;
|
pp->pdev->port->ieee1284.mode = mode;
|
||||||
|
@ -434,7 +434,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
} else {
|
} else {
|
||||||
mode = pp->state.mode;
|
mode = pp->state.mode;
|
||||||
}
|
}
|
||||||
if (copy_to_user (argp, &mode, sizeof (mode))) {
|
if (copy_to_user(argp, &mode, sizeof(mode))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -442,7 +442,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
case PPSETPHASE:
|
case PPSETPHASE:
|
||||||
{
|
{
|
||||||
int phase;
|
int phase;
|
||||||
if (copy_from_user (&phase, argp, sizeof (phase))) {
|
if (copy_from_user(&phase, argp, sizeof(phase))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
/* FIXME: validate phase */
|
/* FIXME: validate phase */
|
||||||
|
@ -463,7 +463,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
} else {
|
} else {
|
||||||
phase = pp->state.phase;
|
phase = pp->state.phase;
|
||||||
}
|
}
|
||||||
if (copy_to_user (argp, &phase, sizeof (phase))) {
|
if (copy_to_user(argp, &phase, sizeof(phase))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -472,13 +472,13 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
unsigned int modes;
|
unsigned int modes;
|
||||||
|
|
||||||
port = parport_find_number (minor);
|
port = parport_find_number(minor);
|
||||||
if (!port)
|
if (!port)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
modes = port->modes;
|
modes = port->modes;
|
||||||
parport_put_port(port);
|
parport_put_port(port);
|
||||||
if (copy_to_user (argp, &modes, sizeof (modes))) {
|
if (copy_to_user(argp, &modes, sizeof(modes))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -487,7 +487,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
{
|
{
|
||||||
int uflags;
|
int uflags;
|
||||||
|
|
||||||
if (copy_from_user (&uflags, argp, sizeof (uflags))) {
|
if (copy_from_user(&uflags, argp, sizeof(uflags))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
pp->flags &= ~PP_FLAGMASK;
|
pp->flags &= ~PP_FLAGMASK;
|
||||||
|
@ -499,7 +499,7 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
int uflags;
|
int uflags;
|
||||||
|
|
||||||
uflags = pp->flags & PP_FLAGMASK;
|
uflags = pp->flags & PP_FLAGMASK;
|
||||||
if (copy_to_user (argp, &uflags, sizeof (uflags))) {
|
if (copy_to_user(argp, &uflags, sizeof(uflags))) {
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -525,22 +525,22 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
case PPRSTATUS:
|
case PPRSTATUS:
|
||||||
reg = parport_read_status (port);
|
reg = parport_read_status(port);
|
||||||
if (copy_to_user (argp, ®, sizeof (reg)))
|
if (copy_to_user(argp, ®, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
case PPRDATA:
|
case PPRDATA:
|
||||||
reg = parport_read_data (port);
|
reg = parport_read_data(port);
|
||||||
if (copy_to_user (argp, ®, sizeof (reg)))
|
if (copy_to_user(argp, ®, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
case PPRCONTROL:
|
case PPRCONTROL:
|
||||||
reg = parport_read_control (port);
|
reg = parport_read_control(port);
|
||||||
if (copy_to_user (argp, ®, sizeof (reg)))
|
if (copy_to_user(argp, ®, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
return 0;
|
return 0;
|
||||||
case PPYIELD:
|
case PPYIELD:
|
||||||
parport_yield_blocking (pp->pdev);
|
parport_yield_blocking(pp->pdev);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPRELEASE:
|
case PPRELEASE:
|
||||||
|
@ -550,45 +550,45 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
pp->state.phase = info->phase;
|
pp->state.phase = info->phase;
|
||||||
info->mode = pp->saved_state.mode;
|
info->mode = pp->saved_state.mode;
|
||||||
info->phase = pp->saved_state.phase;
|
info->phase = pp->saved_state.phase;
|
||||||
parport_release (pp->pdev);
|
parport_release(pp->pdev);
|
||||||
pp->flags &= ~PP_CLAIMED;
|
pp->flags &= ~PP_CLAIMED;
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPWCONTROL:
|
case PPWCONTROL:
|
||||||
if (copy_from_user (®, argp, sizeof (reg)))
|
if (copy_from_user(®, argp, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
parport_write_control (port, reg);
|
parport_write_control(port, reg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPWDATA:
|
case PPWDATA:
|
||||||
if (copy_from_user (®, argp, sizeof (reg)))
|
if (copy_from_user(®, argp, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
parport_write_data (port, reg);
|
parport_write_data(port, reg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPFCONTROL:
|
case PPFCONTROL:
|
||||||
if (copy_from_user (&mask, argp,
|
if (copy_from_user(&mask, argp,
|
||||||
sizeof (mask)))
|
sizeof(mask)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (copy_from_user (®, 1 + (unsigned char __user *) arg,
|
if (copy_from_user(®, 1 + (unsigned char __user *) arg,
|
||||||
sizeof (reg)))
|
sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
parport_frob_control (port, mask, reg);
|
parport_frob_control(port, mask, reg);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPDATADIR:
|
case PPDATADIR:
|
||||||
if (copy_from_user (&mode, argp, sizeof (mode)))
|
if (copy_from_user(&mode, argp, sizeof(mode)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
if (mode)
|
if (mode)
|
||||||
port->ops->data_reverse (port);
|
port->ops->data_reverse(port);
|
||||||
else
|
else
|
||||||
port->ops->data_forward (port);
|
port->ops->data_forward(port);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPNEGOT:
|
case PPNEGOT:
|
||||||
if (copy_from_user (&mode, argp, sizeof (mode)))
|
if (copy_from_user(&mode, argp, sizeof(mode)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
switch ((ret = parport_negotiate (port, mode))) {
|
switch ((ret = parport_negotiate(port, mode))) {
|
||||||
case 0: break;
|
case 0: break;
|
||||||
case -1: /* handshake failed, peripheral not IEEE 1284 */
|
case -1: /* handshake failed, peripheral not IEEE 1284 */
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
@ -597,11 +597,11 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
ret = -ENXIO;
|
ret = -ENXIO;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pp_enable_irq (pp);
|
pp_enable_irq(pp);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case PPWCTLONIRQ:
|
case PPWCTLONIRQ:
|
||||||
if (copy_from_user (®, argp, sizeof (reg)))
|
if (copy_from_user(®, argp, sizeof(reg)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
/* Remember what to set the control lines to, for next
|
/* Remember what to set the control lines to, for next
|
||||||
|
@ -611,10 +611,10 @@ static int pp_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPCLRIRQ:
|
case PPCLRIRQ:
|
||||||
ret = atomic_read (&pp->irqc);
|
ret = atomic_read(&pp->irqc);
|
||||||
if (copy_to_user (argp, &ret, sizeof (ret)))
|
if (copy_to_user(argp, &ret, sizeof(ret)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
atomic_sub (ret, &pp->irqc);
|
atomic_sub(ret, &pp->irqc);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PPSETTIME32:
|
case PPSETTIME32:
|
||||||
|
@ -679,7 +679,7 @@ static long pp_compat_ioctl(struct file *file, unsigned int cmd,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int pp_open (struct inode * inode, struct file * file)
|
static int pp_open(struct inode * inode, struct file * file)
|
||||||
{
|
{
|
||||||
unsigned int minor = iminor(inode);
|
unsigned int minor = iminor(inode);
|
||||||
struct pp_struct *pp;
|
struct pp_struct *pp;
|
||||||
|
@ -687,16 +687,16 @@ static int pp_open (struct inode * inode, struct file * file)
|
||||||
if (minor >= PARPORT_MAX)
|
if (minor >= PARPORT_MAX)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
pp = kmalloc (sizeof (struct pp_struct), GFP_KERNEL);
|
pp = kmalloc(sizeof(struct pp_struct), GFP_KERNEL);
|
||||||
if (!pp)
|
if (!pp)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
pp->state.mode = IEEE1284_MODE_COMPAT;
|
pp->state.mode = IEEE1284_MODE_COMPAT;
|
||||||
pp->state.phase = init_phase (pp->state.mode);
|
pp->state.phase = init_phase(pp->state.mode);
|
||||||
pp->flags = 0;
|
pp->flags = 0;
|
||||||
pp->irqresponse = 0;
|
pp->irqresponse = 0;
|
||||||
atomic_set (&pp->irqc, 0);
|
atomic_set(&pp->irqc, 0);
|
||||||
init_waitqueue_head (&pp->irq_wait);
|
init_waitqueue_head(&pp->irq_wait);
|
||||||
|
|
||||||
/* Defer the actual device registration until the first claim.
|
/* Defer the actual device registration until the first claim.
|
||||||
* That way, we know whether or not the driver wants to have
|
* That way, we know whether or not the driver wants to have
|
||||||
|
@ -708,7 +708,7 @@ static int pp_open (struct inode * inode, struct file * file)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pp_release (struct inode * inode, struct file * file)
|
static int pp_release(struct inode * inode, struct file * file)
|
||||||
{
|
{
|
||||||
unsigned int minor = iminor(inode);
|
unsigned int minor = iminor(inode);
|
||||||
struct pp_struct *pp = file->private_data;
|
struct pp_struct *pp = file->private_data;
|
||||||
|
@ -720,7 +720,7 @@ static int pp_release (struct inode * inode, struct file * file)
|
||||||
struct ieee1284_info *info;
|
struct ieee1284_info *info;
|
||||||
|
|
||||||
/* parport released, but not in compatibility mode */
|
/* parport released, but not in compatibility mode */
|
||||||
parport_claim_or_block (pp->pdev);
|
parport_claim_or_block(pp->pdev);
|
||||||
pp->flags |= PP_CLAIMED;
|
pp->flags |= PP_CLAIMED;
|
||||||
info = &pp->pdev->port->ieee1284;
|
info = &pp->pdev->port->ieee1284;
|
||||||
pp->saved_state.mode = info->mode;
|
pp->saved_state.mode = info->mode;
|
||||||
|
@ -733,7 +733,7 @@ static int pp_release (struct inode * inode, struct file * file)
|
||||||
compat_negot = 2;
|
compat_negot = 2;
|
||||||
}
|
}
|
||||||
if (compat_negot) {
|
if (compat_negot) {
|
||||||
parport_negotiate (pp->pdev->port, IEEE1284_MODE_COMPAT);
|
parport_negotiate(pp->pdev->port, IEEE1284_MODE_COMPAT);
|
||||||
pr_debug(CHRDEV "%x: negotiated back to compatibility "
|
pr_debug(CHRDEV "%x: negotiated back to compatibility "
|
||||||
"mode because user-space forgot\n", minor);
|
"mode because user-space forgot\n", minor);
|
||||||
}
|
}
|
||||||
|
@ -746,7 +746,7 @@ static int pp_release (struct inode * inode, struct file * file)
|
||||||
pp->state.phase = info->phase;
|
pp->state.phase = info->phase;
|
||||||
info->mode = pp->saved_state.mode;
|
info->mode = pp->saved_state.mode;
|
||||||
info->phase = pp->saved_state.phase;
|
info->phase = pp->saved_state.phase;
|
||||||
parport_release (pp->pdev);
|
parport_release(pp->pdev);
|
||||||
if (compat_negot != 1) {
|
if (compat_negot != 1) {
|
||||||
pr_debug(CHRDEV "%x: released pardevice "
|
pr_debug(CHRDEV "%x: released pardevice "
|
||||||
"because user-space forgot\n", minor);
|
"because user-space forgot\n", minor);
|
||||||
|
@ -755,25 +755,25 @@ static int pp_release (struct inode * inode, struct file * file)
|
||||||
|
|
||||||
if (pp->pdev) {
|
if (pp->pdev) {
|
||||||
const char *name = pp->pdev->name;
|
const char *name = pp->pdev->name;
|
||||||
parport_unregister_device (pp->pdev);
|
parport_unregister_device(pp->pdev);
|
||||||
kfree (name);
|
kfree(name);
|
||||||
pp->pdev = NULL;
|
pp->pdev = NULL;
|
||||||
pr_debug(CHRDEV "%x: unregistered pardevice\n", minor);
|
pr_debug(CHRDEV "%x: unregistered pardevice\n", minor);
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree (pp);
|
kfree(pp);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* No kernel lock held - fine */
|
/* No kernel lock held - fine */
|
||||||
static unsigned int pp_poll (struct file * file, poll_table * wait)
|
static unsigned int pp_poll(struct file * file, poll_table * wait)
|
||||||
{
|
{
|
||||||
struct pp_struct *pp = file->private_data;
|
struct pp_struct *pp = file->private_data;
|
||||||
unsigned int mask = 0;
|
unsigned int mask = 0;
|
||||||
|
|
||||||
poll_wait (file, &pp->irq_wait, wait);
|
poll_wait(file, &pp->irq_wait, wait);
|
||||||
if (atomic_read (&pp->irqc))
|
if (atomic_read(&pp->irqc))
|
||||||
mask |= POLLIN | POLLRDNORM;
|
mask |= POLLIN | POLLRDNORM;
|
||||||
|
|
||||||
return mask;
|
return mask;
|
||||||
|
@ -812,12 +812,12 @@ static struct parport_driver pp_driver = {
|
||||||
.detach = pp_detach,
|
.detach = pp_detach,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int __init ppdev_init (void)
|
static int __init ppdev_init(void)
|
||||||
{
|
{
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
if (register_chrdev (PP_MAJOR, CHRDEV, &pp_fops)) {
|
if (register_chrdev(PP_MAJOR, CHRDEV, &pp_fops)) {
|
||||||
printk (KERN_WARNING CHRDEV ": unable to get major %d\n",
|
printk(KERN_WARNING CHRDEV ": unable to get major %d\n",
|
||||||
PP_MAJOR);
|
PP_MAJOR);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
@ -828,11 +828,11 @@ static int __init ppdev_init (void)
|
||||||
}
|
}
|
||||||
err = parport_register_driver(&pp_driver);
|
err = parport_register_driver(&pp_driver);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
printk (KERN_WARNING CHRDEV ": unable to register with parport\n");
|
printk(KERN_WARNING CHRDEV ": unable to register with parport\n");
|
||||||
goto out_class;
|
goto out_class;
|
||||||
}
|
}
|
||||||
|
|
||||||
printk (KERN_INFO PP_VERSION "\n");
|
printk(KERN_INFO PP_VERSION "\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
out_class:
|
out_class:
|
||||||
|
@ -843,12 +843,12 @@ static int __init ppdev_init (void)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit ppdev_cleanup (void)
|
static void __exit ppdev_cleanup(void)
|
||||||
{
|
{
|
||||||
/* Clean up all parport stuff */
|
/* Clean up all parport stuff */
|
||||||
parport_unregister_driver(&pp_driver);
|
parport_unregister_driver(&pp_driver);
|
||||||
class_destroy(ppdev_class);
|
class_destroy(ppdev_class);
|
||||||
unregister_chrdev (PP_MAJOR, CHRDEV);
|
unregister_chrdev(PP_MAJOR, CHRDEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(ppdev_init);
|
module_init(ppdev_init);
|
||||||
|
|
Loading…
Reference in New Issue