| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* cpwd.c - driver implementation for hardware watchdog |
|---|
| 2 | 3 | * timers found on Sun Microsystems CP1400 and CP1500 boards. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 25 | 26 | #include <linux/interrupt.h> |
|---|
| 26 | 27 | #include <linux/ioport.h> |
|---|
| 27 | 28 | #include <linux/timer.h> |
|---|
| 29 | +#include <linux/compat.h> |
|---|
| 28 | 30 | #include <linux/slab.h> |
|---|
| 29 | 31 | #include <linux/mutex.h> |
|---|
| 30 | 32 | #include <linux/io.h> |
|---|
| .. | .. |
|---|
| 394 | 396 | |
|---|
| 395 | 397 | mutex_unlock(&cpwd_mutex); |
|---|
| 396 | 398 | |
|---|
| 397 | | - return nonseekable_open(inode, f); |
|---|
| 399 | + return stream_open(inode, f); |
|---|
| 398 | 400 | } |
|---|
| 399 | 401 | |
|---|
| 400 | 402 | static int cpwd_release(struct inode *inode, struct file *file) |
|---|
| .. | .. |
|---|
| 472 | 474 | return 0; |
|---|
| 473 | 475 | } |
|---|
| 474 | 476 | |
|---|
| 475 | | -static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, |
|---|
| 476 | | - unsigned long arg) |
|---|
| 477 | +static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
|---|
| 477 | 478 | { |
|---|
| 478 | | - int rval = -ENOIOCTLCMD; |
|---|
| 479 | | - |
|---|
| 480 | | - switch (cmd) { |
|---|
| 481 | | - /* solaris ioctls are specific to this driver */ |
|---|
| 482 | | - case WIOCSTART: |
|---|
| 483 | | - case WIOCSTOP: |
|---|
| 484 | | - case WIOCGSTAT: |
|---|
| 485 | | - mutex_lock(&cpwd_mutex); |
|---|
| 486 | | - rval = cpwd_ioctl(file, cmd, arg); |
|---|
| 487 | | - mutex_unlock(&cpwd_mutex); |
|---|
| 488 | | - break; |
|---|
| 489 | | - |
|---|
| 490 | | - /* everything else is handled by the generic compat layer */ |
|---|
| 491 | | - default: |
|---|
| 492 | | - break; |
|---|
| 493 | | - } |
|---|
| 494 | | - |
|---|
| 495 | | - return rval; |
|---|
| 479 | + return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); |
|---|
| 496 | 480 | } |
|---|
| 497 | 481 | |
|---|
| 498 | 482 | static ssize_t cpwd_write(struct file *file, const char __user *buf, |
|---|
| .. | .. |
|---|
| 570 | 554 | if (str_prop) |
|---|
| 571 | 555 | p->timeout = simple_strtoul(str_prop, NULL, 10); |
|---|
| 572 | 556 | |
|---|
| 557 | + of_node_put(options); |
|---|
| 558 | + |
|---|
| 573 | 559 | /* CP1400s seem to have broken PLD implementations-- the |
|---|
| 574 | 560 | * interrupt_mask register cannot be written, so no timer |
|---|
| 575 | 561 | * interrupts can be masked within the PLD. |
|---|