Skip to contentSkip to conversation

misc: xilinx_sdfec: add compat_ptr_ioctl()

PATCH In review Harshal Chaudhari 3 participants 5 messages Oct 26, 2020 – Nov 9, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 misc: xilinx_sdfec: add compat_ptr_ioctl()

Driver has a trivial helper function to convert
the pointer argument and then call the native ioctl handler. But now we have a generic implementation for that, so we can use it.

---
 drivers/misc/xilinx_sdfec.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/misc/xilinx_sdfec.c +1 -11
index 92291292756a..6f252793dceb 100644
@@ -1016,14 +1016,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd,
 	return rval;
 }
 
-#ifdef CONFIG_COMPAT
-static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
-				    unsigned long data)
-{
-	return xsdfec_dev_ioctl(file, cmd, (unsigned long)compat_ptr(data));
-}
-#endif
-
 static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
 {
 	__poll_t mask = 0;
@@ -1054,9 +1046,7 @@ static const struct file_operations xsdfec_fops = {
 	.release = xsdfec_dev_release,
 	.unlocked_ioctl = xsdfec_dev_ioctl,
 	.poll = xsdfec_poll,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = xsdfec_dev_compat_ioctl,
-#endif
+	.compat_ioctl = compat_ptr_ioctl,
 };
 
 static int xsdfec_parse_of(struct xsdfec_dev *xsdfec)
Signature · 1 line
2.17.1
#1 lore raw

Hi Harshal,

The code change is fine, no comment,
but testing will be done at the beginning of the next week. Sorry for the late reply,

Regards
Dragan

Quoted 49 lines

-----Original Message-----
From: Harshal Chaudhari <[email protected]>
Sent: Monday 26 October 2020 15:58
To: [email protected]
Cc: Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Michal Simek <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] misc: xilinx_sdfec: add compat_ptr_ioctl()

Driver has a trivial helper function to convert
the pointer argument and then call the native ioctl handler. But now we have a generic implementation for that, so we can use it.

---
 drivers/misc/xilinx_sdfec.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/misc/xilinx_sdfec.c +1 -12
index 92291292756a..6f252793dceb 100644
@@ -1016,14 +1016,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd,
 	return rval;
 }
 
-#ifdef CONFIG_COMPAT
-static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
-				    unsigned long data)
-{
-	return xsdfec_dev_ioctl(file, cmd, (unsigned long)compat_ptr(data));
-}
-#endif
-
 static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
 {
 	__poll_t mask = 0;
@@ -1054,9 +1046,7 @@ static const struct file_operations xsdfec_fops = {
 	.release = xsdfec_dev_release,
 	.unlocked_ioctl = xsdfec_dev_ioctl,
 	.poll = xsdfec_poll,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = xsdfec_dev_compat_ioctl,
-#endif
+	.compat_ioctl = compat_ptr_ioctl,
 };
 
 static int xsdfec_parse_of(struct xsdfec_dev *xsdfec)
--

2.17.1

#2 lore raw
Quoted 6 lines · Dragan Cvetic

Hi Harshal,

The code change is fine, no comment,
but testing will be done at the beginning of the next week. Sorry for the late reply,

Thanks for your attention Dragan. i have send the another patch for
to remove argument and command checks, so i request you to please
look into this patch and kindly confirm if anything needs to change or any possibility.
Thanks once again.

Quoted 54 lines

Regards
Dragan

Quoted 49 lines

-----Original Message-----
From: Harshal Chaudhari <[email protected]>
Sent: Monday 26 October 2020 15:58
To: [email protected]
Cc: Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Michal Simek <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] misc: xilinx_sdfec: add compat_ptr_ioctl()

Driver has a trivial helper function to convert
the pointer argument and then call the native ioctl handler. But now we have a generic implementation for that, so we can use it.

---
 drivers/misc/xilinx_sdfec.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/misc/xilinx_sdfec.c +1 -12
index 92291292756a..6f252793dceb 100644
@@ -1016,14 +1016,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd,
      return rval;
 }
 
-#ifdef CONFIG_COMPAT
-static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
-                                 unsigned long data)
-{
-     return xsdfec_dev_ioctl(file, cmd, (unsigned long)compat_ptr(data));
-}
-#endif
-
 static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
 {
      __poll_t mask = 0;
@@ -1054,9 +1046,7 @@ static const struct file_operations xsdfec_fops = {
      .release = xsdfec_dev_release,
      .unlocked_ioctl = xsdfec_dev_ioctl,
      .poll = xsdfec_poll,
-#ifdef CONFIG_COMPAT
-     .compat_ioctl = xsdfec_dev_compat_ioctl,
-#endif
+     .compat_ioctl = compat_ptr_ioctl,
 };
 
 static int xsdfec_parse_of(struct xsdfec_dev *xsdfec)
--

2.17.1

Acked-by on v1 1/1
#4 lore raw
In reply to Harshal Chaudhari
Quoted 48 lines

-----Original Message-----
From: Harshal Chaudhari <[email protected]>
Sent: Monday 26 October 2020 15:58
To: [email protected]
Cc: Derek Kiernan <[email protected]>; Dragan Cvetic <[email protected]>; [email protected]; Michal Simek <[email protected]>; [email protected]; [email protected]
Subject: [PATCH] misc: xilinx_sdfec: add compat_ptr_ioctl()

Driver has a trivial helper function to convert
the pointer argument and then call the native ioctl handler. But now we have a generic implementation for that, so we can use it.

---
 drivers/misc/xilinx_sdfec.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/misc/xilinx_sdfec.c +1 -12
index 92291292756a..6f252793dceb 100644
@@ -1016,14 +1016,6 @@ static long xsdfec_dev_ioctl(struct file *fptr, unsigned int cmd,
 	return rval;
 }
 
-#ifdef CONFIG_COMPAT
-static long xsdfec_dev_compat_ioctl(struct file *file, unsigned int cmd,
-				    unsigned long data)
-{
-	return xsdfec_dev_ioctl(file, cmd, (unsigned long)compat_ptr(data));
-}
-#endif
-
 static __poll_t xsdfec_poll(struct file *file, poll_table *wait)
 {
 	__poll_t mask = 0;
@@ -1054,9 +1046,7 @@ static const struct file_operations xsdfec_fops = {
 	.release = xsdfec_dev_release,
 	.unlocked_ioctl = xsdfec_dev_ioctl,
 	.poll = xsdfec_poll,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = xsdfec_dev_compat_ioctl,
-#endif
+	.compat_ioctl = compat_ptr_ioctl,
 };
 
 static int xsdfec_parse_of(struct xsdfec_dev *xsdfec)
--
Quoted 1 line

2.17.1