linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] watchdog: cpwd: fix build regression
@ 2019-10-08  7:36 Arnd Bergmann
  2019-10-08 15:14 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Arnd Bergmann @ 2019-10-08  7:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck
  Cc: Arnd Bergmann, linux-watchdog, linux-kernel

The compat_ptr_ioctl() infrastructure did not make it into
linux-5.4, so cpwd now fails to build.

Fix it by using an open-coded version.

Fixes: 68f28b01fb9e ("watchdog: cpwd: use generic compat_ptr_ioctl")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/watchdog/cpwd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
index 9393be584e72..808eeb4779e4 100644
--- a/drivers/watchdog/cpwd.c
+++ b/drivers/watchdog/cpwd.c
@@ -26,6 +26,7 @@
 #include <linux/interrupt.h>
 #include <linux/ioport.h>
 #include <linux/timer.h>
+#include <linux/compat.h>
 #include <linux/slab.h>
 #include <linux/mutex.h>
 #include <linux/io.h>
@@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 	return 0;
 }
 
+static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
+{
+	return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
+}
+
 static ssize_t cpwd_write(struct file *file, const char __user *buf,
 			  size_t count, loff_t *ppos)
 {
@@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer,
 static const struct file_operations cpwd_fops = {
 	.owner =		THIS_MODULE,
 	.unlocked_ioctl =	cpwd_ioctl,
-	.compat_ioctl =		compat_ptr_ioctl,
+	.compat_ioctl =		cpwd_compat_ioctl,
 	.open =			cpwd_open,
 	.write =		cpwd_write,
 	.read =			cpwd_read,
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] watchdog: cpwd: fix build regression
  2019-10-08  7:36 [PATCH] watchdog: cpwd: fix build regression Arnd Bergmann
@ 2019-10-08 15:14 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-10-08 15:14 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

On Tue, Oct 08, 2019 at 09:36:16AM +0200, Arnd Bergmann wrote:
> The compat_ptr_ioctl() infrastructure did not make it into
> linux-5.4, so cpwd now fails to build.
> 
> Fix it by using an open-coded version.
> 
> Fixes: 68f28b01fb9e ("watchdog: cpwd: use generic compat_ptr_ioctl")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> ---
>  drivers/watchdog/cpwd.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/cpwd.c b/drivers/watchdog/cpwd.c
> index 9393be584e72..808eeb4779e4 100644
> --- a/drivers/watchdog/cpwd.c
> +++ b/drivers/watchdog/cpwd.c
> @@ -26,6 +26,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/ioport.h>
>  #include <linux/timer.h>
> +#include <linux/compat.h>
>  #include <linux/slab.h>
>  #include <linux/mutex.h>
>  #include <linux/io.h>
> @@ -473,6 +474,11 @@ static long cpwd_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
>  	return 0;
>  }
>  
> +static long cpwd_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
> +{
> +	return cpwd_ioctl(file, cmd, (unsigned long)compat_ptr(arg));
> +}
> +
>  static ssize_t cpwd_write(struct file *file, const char __user *buf,
>  			  size_t count, loff_t *ppos)
>  {
> @@ -497,7 +503,7 @@ static ssize_t cpwd_read(struct file *file, char __user *buffer,
>  static const struct file_operations cpwd_fops = {
>  	.owner =		THIS_MODULE,
>  	.unlocked_ioctl =	cpwd_ioctl,
> -	.compat_ioctl =		compat_ptr_ioctl,
> +	.compat_ioctl =		cpwd_compat_ioctl,
>  	.open =			cpwd_open,
>  	.write =		cpwd_write,
>  	.read =			cpwd_read,
> -- 
> 2.20.0
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-08 15:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08  7:36 [PATCH] watchdog: cpwd: fix build regression Arnd Bergmann
2019-10-08 15:14 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).