[PATCH 3.18 034/120] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-11 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 3.18 034/120] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-11 Thread Greg Kroah-Hartman
3.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.4 025/113] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-08 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.4 025/113] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-08 Thread Greg Kroah-Hartman
4.4-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.18 068/228] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.18 068/228] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.18-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.14 050/137] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.14 050/137] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.14-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.9 30/94] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH 4.9 30/94] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-10-02 Thread Greg Kroah-Hartman
4.9-stable review patch.  If anyone has any objections, please let me know.

--

From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
Signed-off-by: Greg Kroah-Hartman 
---
 drivers/media/platform/s3c-camif/camif-capture.c |2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 




[PATCH AUTOSEL 4.18 071/136] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 9ab8e7ee2e1e..b1d9f3857d3d 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.18 071/136] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 9ab8e7ee2e1e..b1d9f3857d3d 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.14 53/87] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 0f0324a14d51..85d26713cedb 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.14 53/87] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 0f0324a14d51..85d26713cedb 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.9 32/57] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 5c9db0910a76..d9710b5dd375 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.9 32/57] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 5c9db0910a76..d9710b5dd375 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.4 25/43] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index fa6af4a7dae1..f97f4bc22ced 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 4.4 25/43] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index fa6af4a7dae1..f97f4bc22ced 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 3.18 15/29] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 97a52d4574e7..bb4a57e55aed 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH AUTOSEL 3.18 15/29] media: s3c-camif: ignore -ENOIOCTLCMD from v4l2_subdev_call for s_power

2018-09-16 Thread Sasha Levin
From: Akinobu Mita 

[ Upstream commit 30ed2b83343bd1e07884ca7355dac70d25ffc158 ]

When the subdevice doesn't provide s_power core ops callback, the
v4l2_subdev_call for s_power returns -ENOIOCTLCMD.  If the subdevice
doesn't have the special handling for its power saving mode, the s_power
isn't required.  So -ENOIOCTLCMD from the v4l2_subdev_call should be
ignored.

Cc: Hans Verkuil 
Signed-off-by: Akinobu Mita 
Acked-by: Sylwester Nawrocki 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 
Signed-off-by: Sasha Levin 
---
 drivers/media/platform/s3c-camif/camif-capture.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/platform/s3c-camif/camif-capture.c 
b/drivers/media/platform/s3c-camif/camif-capture.c
index 97a52d4574e7..bb4a57e55aed 100644
--- a/drivers/media/platform/s3c-camif/camif-capture.c
+++ b/drivers/media/platform/s3c-camif/camif-capture.c
@@ -117,6 +117,8 @@ static int sensor_set_power(struct camif_dev *camif, int on)
 
if (camif->sensor.power_count == !on)
err = v4l2_subdev_call(sensor->sd, core, s_power, on);
+   if (err == -ENOIOCTLCMD)
+   err = 0;
if (!err)
sensor->power_count += on ? 1 : -1;
 
-- 
2.17.1


[PATCH v6 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-23 Thread David Daney
From: David Daney 

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney 
Acked-by: Sanjay Lal 
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 3caa006..d934b01 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -195,7 +195,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -401,7 +401,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -475,14 +475,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 #define KVM_REG_MIPS_CP0_INDEX (0x1 + 8 * 0 + 0)
@@ -801,7 +801,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -829,13 +829,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -845,12 +845,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-23 Thread David Daney
From: David Daney david.da...@cavium.com

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney david.da...@cavium.com
Acked-by: Sanjay Lal sanj...@kymasys.com
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 3caa006..d934b01 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -195,7 +195,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -401,7 +401,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -475,14 +475,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 #define KVM_REG_MIPS_CP0_INDEX (0x1 + 8 * 0 + 0)
@@ -801,7 +801,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -829,13 +829,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -845,12 +845,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-22 Thread David Daney
From: David Daney 

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney 
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 5aec4f4..13e9438 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -195,7 +195,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -401,7 +401,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -475,14 +475,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 #define KVM_REG_MIPS_CP0_INDEX (0x1 + 8 * 0 + 0)
@@ -799,7 +799,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -827,13 +827,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -843,12 +843,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-22 Thread David Daney
From: David Daney david.da...@cavium.com

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney david.da...@cavium.com
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index 5aec4f4..13e9438 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -195,7 +195,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -401,7 +401,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -475,14 +475,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 #define KVM_REG_MIPS_CP0_INDEX (0x1 + 8 * 0 + 0)
@@ -799,7 +799,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -827,13 +827,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -843,12 +843,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-21 Thread David Daney
From: David Daney 

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney 
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index bc879bd..8ea4bc5 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -185,7 +185,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -391,7 +391,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -429,14 +429,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 /*
@@ -483,7 +483,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -511,13 +511,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -527,12 +527,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 6/6] mips/kvm: Use ENOIOCTLCMD to indicate unimplemented ioctls.

2013-05-21 Thread David Daney
From: David Daney david.da...@cavium.com

The Linux Way is to return -ENOIOCTLCMD to the vfs when an
unimplemented ioctl is requested.  Do this in kvm_mips instead of a
random mixture of -ENOTSUPP and -EINVAL.

Signed-off-by: David Daney david.da...@cavium.com
---
 arch/mips/kvm/kvm_mips.c | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/mips/kvm/kvm_mips.c b/arch/mips/kvm/kvm_mips.c
index bc879bd..8ea4bc5 100644
--- a/arch/mips/kvm/kvm_mips.c
+++ b/arch/mips/kvm/kvm_mips.c
@@ -185,7 +185,7 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
 long
 kvm_arch_dev_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 void kvm_arch_free_memslot(struct kvm_memory_slot *free,
@@ -391,7 +391,7 @@ int
 kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
struct kvm_guest_debug *dbg)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
@@ -429,14 +429,14 @@ int
 kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
 {
-   return -EINVAL;
+   return -ENOIOCTLCMD;
 }
 
 /*
@@ -483,7 +483,7 @@ long kvm_arch_vm_ioctl(struct file *filp, unsigned int 
ioctl, unsigned long arg)
 
switch (ioctl) {
default:
-   r = -EINVAL;
+   r = -ENOIOCTLCMD;
}
 
return r;
@@ -511,13 +511,13 @@ void kvm_arch_exit(void)
 int
 kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int
 kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
@@ -527,12 +527,12 @@ int kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
 
 int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
 {
-   return -ENOTSUPP;
+   return -ENOIOCTLCMD;
 }
 
 int kvm_arch_vcpu_fault(struct kvm_vcpu *vcpu, struct vm_fault *vmf)
-- 
1.7.11.7

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-09-13 Thread Wanlong Gao
On 09/13/2012 12:03 PM, Laurent Pinchart wrote:
> Hi Wanlong,
> 
> Thanks for the patch.
> 
> On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
>> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
>> translated as ENOTTY to user mode.
>>
>> Cc: Laurent Pinchart 
>> Cc: Mauro Carvalho Chehab 
>> Cc: linux-me...@vger.kernel.org
>> Signed-off-by: Wanlong Gao 
>> ---
>>  drivers/media/video/omap3isp/ispvideo.c | 10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/media/video/omap3isp/ispvideo.c
>> b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
>> --- a/drivers/media/video/omap3isp/ispvideo.c
>> +++ b/drivers/media/video/omap3isp/ispvideo.c
>> @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
>> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>>  ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
>>  if (ret == -ENOIOCTLCMD)
>> -ret = -EINVAL;
>> +ret = -ENOTTY;
> 
> I don't think this location should be changed. __isp_video_get_format() is 
> called by isp_video_check_format() only, which in turn is called by 
> isp_video_streamon() only. A failure to retrieve the format in 
> __isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
> supported.
> 
> I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

Fine, I defer to your great knowledge in this.

Thanks,
Wanlong Gao

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-09-13 Thread Laurent Pinchart
Hi Wanlong,

Thanks for the patch.

On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> 
> Cc: Laurent Pinchart 
> Cc: Mauro Carvalho Chehab 
> Cc: linux-me...@vger.kernel.org
> Signed-off-by: Wanlong Gao 
> ---
>  drivers/media/video/omap3isp/ispvideo.c | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/media/video/omap3isp/ispvideo.c
> b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
> --- a/drivers/media/video/omap3isp/ispvideo.c
> +++ b/drivers/media/video/omap3isp/ispvideo.c
> @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
>   if (ret == -ENOIOCTLCMD)
> - ret = -EINVAL;
> + ret = -ENOTTY;

I don't think this location should be changed. __isp_video_get_format() is 
called by isp_video_check_format() only, which in turn is called by 
isp_video_streamon() only. A failure to retrieve the format in 
__isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
supported.

I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

> 
>   mutex_unlock(>mutex);
> 
> @@ -723,7 +723,7 @@ isp_video_try_format(struct file *file, void *fh, struct
> v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
>   if (ret)
> - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
> 
>   isp_video_mbus_to_pix(video, , >fmt.pix);
>   return 0;
> @@ -744,7 +744,7 @@ isp_video_cropcap(struct file *file, void *fh, struct
> v4l2_cropcap *cropcap) ret = v4l2_subdev_call(subdev, video, cropcap,
> cropcap);
>   mutex_unlock(>mutex);
> 
> - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
>  }
> 
>  static int
> @@ -771,7 +771,7 @@ isp_video_get_crop(struct file *file, void *fh, struct
> v4l2_crop *crop) format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
>   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
>   if (ret < 0)
> - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
> 
>   crop->c.left = 0;
>   crop->c.top = 0;
> @@ -796,7 +796,7 @@ isp_video_set_crop(struct file *file, void *fh, struct
> v4l2_crop *crop) ret = v4l2_subdev_call(subdev, video, s_crop, crop);
>   mutex_unlock(>mutex);
> 
> - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
> + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
>  }
> 
>  static int

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-09-13 Thread Laurent Pinchart
Hi Wanlong,

Thanks for the patch.

On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
 At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
 translated as ENOTTY to user mode.
 
 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: linux-me...@vger.kernel.org
 Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
 ---
  drivers/media/video/omap3isp/ispvideo.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)
 
 diff --git a/drivers/media/video/omap3isp/ispvideo.c
 b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
 --- a/drivers/media/video/omap3isp/ispvideo.c
 +++ b/drivers/media/video/omap3isp/ispvideo.c
 @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
 v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, fmt);
   if (ret == -ENOIOCTLCMD)
 - ret = -EINVAL;
 + ret = -ENOTTY;

I don't think this location should be changed. __isp_video_get_format() is 
called by isp_video_check_format() only, which in turn is called by 
isp_video_streamon() only. A failure to retrieve the format in 
__isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
supported.

I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

 
   mutex_unlock(video-mutex);
 
 @@ -723,7 +723,7 @@ isp_video_try_format(struct file *file, void *fh, struct
 v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, fmt);
   if (ret)
 - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
 + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
   isp_video_mbus_to_pix(video, fmt.format, format-fmt.pix);
   return 0;
 @@ -744,7 +744,7 @@ isp_video_cropcap(struct file *file, void *fh, struct
 v4l2_cropcap *cropcap) ret = v4l2_subdev_call(subdev, video, cropcap,
 cropcap);
   mutex_unlock(video-mutex);
 
 - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
 + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
  }
 
  static int
 @@ -771,7 +771,7 @@ isp_video_get_crop(struct file *file, void *fh, struct
 v4l2_crop *crop) format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
   ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, format);
   if (ret  0)
 - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
 + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
   crop-c.left = 0;
   crop-c.top = 0;
 @@ -796,7 +796,7 @@ isp_video_set_crop(struct file *file, void *fh, struct
 v4l2_crop *crop) ret = v4l2_subdev_call(subdev, video, s_crop, crop);
   mutex_unlock(video-mutex);
 
 - return ret == -ENOIOCTLCMD ? -EINVAL : ret;
 + return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
  }
 
  static int

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-09-13 Thread Wanlong Gao
On 09/13/2012 12:03 PM, Laurent Pinchart wrote:
 Hi Wanlong,
 
 Thanks for the patch.
 
 On Monday 27 August 2012 15:23:15 Wanlong Gao wrote:
 At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
 translated as ENOTTY to user mode.

 Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Cc: Mauro Carvalho Chehab mche...@infradead.org
 Cc: linux-me...@vger.kernel.org
 Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
 ---
  drivers/media/video/omap3isp/ispvideo.c | 10 +-
  1 file changed, 5 insertions(+), 5 deletions(-)

 diff --git a/drivers/media/video/omap3isp/ispvideo.c
 b/drivers/media/video/omap3isp/ispvideo.c index b37379d..2dd982e 100644
 --- a/drivers/media/video/omap3isp/ispvideo.c
 +++ b/drivers/media/video/omap3isp/ispvideo.c
 @@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct
 v4l2_format *format) fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
  ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, fmt);
  if (ret == -ENOIOCTLCMD)
 -ret = -EINVAL;
 +ret = -ENOTTY;
 
 I don't think this location should be changed. __isp_video_get_format() is 
 called by isp_video_check_format() only, which in turn is called by 
 isp_video_streamon() only. A failure to retrieve the format in 
 __isp_video_get_format() does not really mean the VIDIOC_STREAMON is not 
 supported.
 
 I'll apply hunks 2 to 5 and drop hunk 1 if that's fine with you.

Fine, I defer to your great knowledge in this.

Thanks,
Wanlong Gao

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] net:atm:fix up ENOIOCTLCMD error handling

2012-08-31 Thread David Miller
From: Wanlong Gao 
Date: Mon, 27 Aug 2012 15:23:13 +0800

> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> 
> Cc: "David S. Miller" 
> Cc: net...@vger.kernel.org
> Signed-off-by: Wanlong Gao 

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/5] net:atm:fix up ENOIOCTLCMD error handling

2012-08-31 Thread David Miller
From: Wanlong Gao gaowanl...@cn.fujitsu.com
Date: Mon, 27 Aug 2012 15:23:13 +0800

 At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
 translated as ENOTTY to user mode.
 
 Cc: David S. Miller da...@davemloft.net
 Cc: net...@vger.kernel.org
 Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com

Applied to net-next, thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] drivers:tty:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Alan Cox
On Mon, 27 Aug 2012 15:23:12 +0800
Wanlong Gao  wrote:

> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> For example:
>   fd = open("/dev/tty", O_RDWR);
>   ioctl(fd, -1, );
> 
> then the errno should be ENOTTY but not EINVAL.
> 
> Cc: Greg Kroah-Hartman 
> Signed-off-by: Wanlong Gao 

Acked-by: Alan Cox 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Stefan Weinhuber
heica...@linux.vnet.ibm.com wrote on 2012-08-27 11:03:55:

[..]
> 
> Thanks, but you missed the else path. I'm going to commit the patch 
below
> unless Stefan has any objections:
> 
> From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
> From: Heiko Carstens 
> Date: Mon, 27 Aug 2012 10:59:42 +0200
> Subject: [PATCH] s390/dasd: fix ioctl return value
> 
> For unimplemented ioctls the dasd driver should return -ENOTTY.
> 
> Reported-by: Wanlong Gao 
> Signed-off-by: Heiko Carstens 
> ---
>  drivers/s390/block/dasd_eckd.c  | 2 +-
>  drivers/s390/block/dasd_ioctl.c | 7 ++-
>  2 files changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/s390/block/dasd_eckd.c 
b/drivers/s390/block/dasd_eckd.c
> index 40a826a..2fb2b9e 100644
> --- a/drivers/s390/block/dasd_eckd.c
> +++ b/drivers/s390/block/dasd_eckd.c
> @@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, 
> unsigned int cmd, void __user *argp)
> case BIODASDSYMMIO:
>return dasd_symm_io(device, argp);
> default:
> -  return -ENOIOCTLCMD;
> +  return -ENOTTY;
> }
>  }
> 
> diff --git a/drivers/s390/block/dasd_ioctl.c 
b/drivers/s390/block/dasd_ioctl.c
> index cceae70..654c692 100644
> --- a/drivers/s390/block/dasd_ioctl.c
> +++ b/drivers/s390/block/dasd_ioctl.c
> @@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t 
mode,
>break;
> default:
>/* if the discipline has an ioctl method try it. */
> -  if (base->discipline->ioctl) {
> +  rc = -ENOTTY;
> +  if (base->discipline->ioctl)
>   rc = base->discipline->ioctl(block, cmd, argp);
> - if (rc == -ENOIOCTLCMD)
> -rc = -EINVAL;
> -  } else
> - rc = -EINVAL;
> }
> dasd_put_device(base);
> return rc;
> -- 
> 1.7.11.5
> 

The patch is looking fine to me, thanks.

Mit freundlichen Grüßen / Kind regards
 
Stefan Weinhuber



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Heiko Carstens
On Mon, Aug 27, 2012 at 03:23:16PM +0800, Wanlong Gao wrote:
> At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
> translated as ENOTTY to user mode.
> 
[...]

> Signed-off-by: Wanlong Gao 
> ---
>  drivers/s390/block/dasd_ioctl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
> index cceae70..809a89b 100644
> --- a/drivers/s390/block/dasd_ioctl.c
> +++ b/drivers/s390/block/dasd_ioctl.c
> @@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
>   if (base->discipline->ioctl) {
>   rc = base->discipline->ioctl(block, cmd, argp);
>   if (rc == -ENOIOCTLCMD)
> - rc = -EINVAL;
> + rc = -ENOTTY;
>   } else
>   rc = -EINVAL;
>   }

Thanks, but you missed the else path. I'm going to commit the patch below
unless Stefan has any objections:

>From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
From: Heiko Carstens 
Date: Mon, 27 Aug 2012 10:59:42 +0200
Subject: [PATCH] s390/dasd: fix ioctl return value

For unimplemented ioctls the dasd driver should return -ENOTTY.

Reported-by: Wanlong Gao 
Signed-off-by: Heiko Carstens 
---
 drivers/s390/block/dasd_eckd.c  | 2 +-
 drivers/s390/block/dasd_ioctl.c | 7 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 40a826a..2fb2b9e 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, unsigned int 
cmd, void __user *argp)
case BIODASDSYMMIO:
    return dasd_symm_io(device, argp);
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
 }
 
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..654c692 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
break;
default:
/* if the discipline has an ioctl method try it. */
-   if (base->discipline->ioctl) {
+   rc = -ENOTTY;
+   if (base->discipline->ioctl)
    rc = base->discipline->ioctl(block, cmd, argp);
-   if (rc == -ENOIOCTLCMD)
-   rc = -EINVAL;
-   } else
-   rc = -EINVAL;
}
dasd_put_device(base);
return rc;
-- 
1.7.11.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] drivers:tty:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.
For example:
fd = open("/dev/tty", O_RDWR);
ioctl(fd, -1, );

then the errno should be ENOTTY but not EINVAL.

Cc: Greg Kroah-Hartman 
Signed-off-by: Wanlong Gao 
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index b425c79..720c408f 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2756,7 +2756,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
if (ld->ops->ioctl) {
retval = ld->ops->ioctl(tty, file, cmd, arg);
    if (retval == -ENOIOCTLCMD)
-   retval = -EINVAL;
+   retval = -ENOTTY;
}
tty_ldisc_deref(ld);
return retval;
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] media:dvb:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Mauro Carvalho Chehab 
Cc: linux-me...@vger.kernel.org
Signed-off-by: Wanlong Gao 
---
 drivers/media/dvb/dvb-core/dvbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb/dvb-core/dvbdev.c 
b/drivers/media/dvb/dvb-core/dvbdev.c
index 39eab73..d33101a 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -420,7 +420,7 @@ int dvb_usercopy(struct file *file,
/* call driver */
mutex_lock(_mutex);
if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
-   err = -EINVAL;
+   err = -ENOTTY;
mutex_unlock(_mutex);
 
if (err < 0)
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Laurent Pinchart 
Cc: Mauro Carvalho Chehab 
Cc: linux-me...@vger.kernel.org
Signed-off-by: Wanlong Gao 
---
 drivers/media/video/omap3isp/ispvideo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/omap3isp/ispvideo.c 
b/drivers/media/video/omap3isp/ispvideo.c
index b37379d..2dd982e 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct 
v4l2_format *format)
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
if (ret == -ENOIOCTLCMD)
-   ret = -EINVAL;
+   ret = -ENOTTY;
 
mutex_unlock(>mutex);
 
@@ -723,7 +723,7 @@ isp_video_try_format(struct file *file, void *fh, struct 
v4l2_format *format)
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
if (ret)
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
isp_video_mbus_to_pix(video, , >fmt.pix);
return 0;
@@ -744,7 +744,7 @@ isp_video_cropcap(struct file *file, void *fh, struct 
v4l2_cropcap *cropcap)
ret = v4l2_subdev_call(subdev, video, cropcap, cropcap);
mutex_unlock(>mutex);
 
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int
@@ -771,7 +771,7 @@ isp_video_get_crop(struct file *file, void *fh, struct 
v4l2_crop *crop)
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, );
if (ret < 0)
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
crop->c.left = 0;
crop->c.top = 0;
@@ -796,7 +796,7 @@ isp_video_set_crop(struct file *file, void *fh, struct 
v4l2_crop *crop)
ret = v4l2_subdev_call(subdev, video, s_crop, crop);
mutex_unlock(>mutex);
 
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Martin Schwidefsky 
Cc: Heiko Carstens 
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org (open list:S390)
Signed-off-by: Wanlong Gao 
---
 drivers/s390/block/dasd_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..809a89b 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
if (base->discipline->ioctl) {
rc = base->discipline->ioctl(block, cmd, argp);
    if (rc == -ENOIOCTLCMD)
-   rc = -EINVAL;
+   rc = -ENOTTY;
} else
rc = -EINVAL;
}
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] net:atm:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: "David S. Miller" 
Cc: net...@vger.kernel.org
Signed-off-by: Wanlong Gao 
---
 net/atm/resources.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/atm/resources.c b/net/atm/resources.c
index 23f45ce..0447d5d 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -432,7 +432,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int 
compat)
size = dev->ops->ioctl(dev, cmd, buf);
}
if (size < 0) {
-   error = (size == -ENOIOCTLCMD ? -EINVAL : size);
+   error = (size == -ENOIOCTLCMD ? -ENOTTY : size);
goto done;
}
}
-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] drivers: fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At this commit,

Cc: Linus Torvalds 
commit 07d106d0a33d6063d2061305903deb02489eba20
Author: Linus Torvalds 
Date:   Thu Jan 5 15:40:12 2012 -0800

vfs: fix up ENOIOCTLCMD error handling

We're doing some odd things there, which already messes up various users
(see the net/socket.c code that this removes), and it was going to add
yet more crud to the block layer because of the incorrect error code
translation.

ENOIOCTLCMD is not an error return that should be returned to user mode
from the "ioctl()" system call, but it should *not* be translated as
EINVAL ("Invalid argument").  It should be translated as ENOTTY
("Inappropriate ioctl for device").

That EINVAL confusion has apparently so permeated some code that the
block layer actually checks for it, which is sad.  We continue to do so
for now, but add a big comment about how wrong that is, and we should
remove it entirely eventually.  In the meantime, this tries to keep the
changes localized to just the EINVAL -> ENOTTY fix, and removing code
that makes it harder to do the right thing.

Signed-off-by: Linus Torvalds 


Linus pointed out that ENOIOCTLCMD should be translated as ENOTTY to user
mode, and we should fix up the broken drivers then.

Wanlong Gao (5):
  drivers:tty:fix up ENOIOCTLCMD error handling
  net:atm:fix up ENOIOCTLCMD error handling
  media:dvb:fix up ENOIOCTLCMD error handling
  video:omap3isp:fix up ENOIOCTLCMD error handling
  s390:block:fix up ENOIOCTLCMD error handling

 drivers/media/dvb/dvb-core/dvbdev.c |  2 +-
 drivers/media/video/omap3isp/ispvideo.c | 10 +-
 drivers/s390/block/dasd_ioctl.c |  2 +-
 drivers/tty/tty_io.c|  2 +-
 net/atm/resources.c |  2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.7.12

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 0/5] drivers: fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At this commit,

Cc: Linus Torvalds torva...@linux-foundation.org
commit 07d106d0a33d6063d2061305903deb02489eba20
Author: Linus Torvalds torva...@linux-foundation.org
Date:   Thu Jan 5 15:40:12 2012 -0800

vfs: fix up ENOIOCTLCMD error handling

We're doing some odd things there, which already messes up various users
(see the net/socket.c code that this removes), and it was going to add
yet more crud to the block layer because of the incorrect error code
translation.

ENOIOCTLCMD is not an error return that should be returned to user mode
from the ioctl() system call, but it should *not* be translated as
EINVAL (Invalid argument).  It should be translated as ENOTTY
(Inappropriate ioctl for device).

That EINVAL confusion has apparently so permeated some code that the
block layer actually checks for it, which is sad.  We continue to do so
for now, but add a big comment about how wrong that is, and we should
remove it entirely eventually.  In the meantime, this tries to keep the
changes localized to just the EINVAL - ENOTTY fix, and removing code
that makes it harder to do the right thing.

Signed-off-by: Linus Torvalds torva...@linux-foundation.org


Linus pointed out that ENOIOCTLCMD should be translated as ENOTTY to user
mode, and we should fix up the broken drivers then.

Wanlong Gao (5):
  drivers:tty:fix up ENOIOCTLCMD error handling
  net:atm:fix up ENOIOCTLCMD error handling
  media:dvb:fix up ENOIOCTLCMD error handling
  video:omap3isp:fix up ENOIOCTLCMD error handling
  s390:block:fix up ENOIOCTLCMD error handling

 drivers/media/dvb/dvb-core/dvbdev.c |  2 +-
 drivers/media/video/omap3isp/ispvideo.c | 10 +-
 drivers/s390/block/dasd_ioctl.c |  2 +-
 drivers/tty/tty_io.c|  2 +-
 net/atm/resources.c |  2 +-
 5 files changed, 9 insertions(+), 9 deletions(-)

-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/5] net:atm:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: David S. Miller da...@davemloft.net
Cc: net...@vger.kernel.org
Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
---
 net/atm/resources.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/atm/resources.c b/net/atm/resources.c
index 23f45ce..0447d5d 100644
--- a/net/atm/resources.c
+++ b/net/atm/resources.c
@@ -432,7 +432,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int 
compat)
size = dev-ops-ioctl(dev, cmd, buf);
}
if (size  0) {
-   error = (size == -ENOIOCTLCMD ? -EINVAL : size);
+   error = (size == -ENOIOCTLCMD ? -ENOTTY : size);
goto done;
}
}
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Martin Schwidefsky schwidef...@de.ibm.com
Cc: Heiko Carstens heiko.carst...@de.ibm.com
Cc: linux...@de.ibm.com
Cc: linux-s...@vger.kernel.org (open list:S390)
Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
---
 drivers/s390/block/dasd_ioctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..809a89b 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
if (base-discipline-ioctl) {
rc = base-discipline-ioctl(block, cmd, argp);
if (rc == -ENOIOCTLCMD)
-   rc = -EINVAL;
+   rc = -ENOTTY;
} else
rc = -EINVAL;
}
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 4/5] video:omap3isp:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Laurent Pinchart laurent.pinch...@ideasonboard.com
Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: linux-me...@vger.kernel.org
Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
---
 drivers/media/video/omap3isp/ispvideo.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/video/omap3isp/ispvideo.c 
b/drivers/media/video/omap3isp/ispvideo.c
index b37379d..2dd982e 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -337,7 +337,7 @@ __isp_video_get_format(struct isp_video *video, struct 
v4l2_format *format)
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, fmt);
if (ret == -ENOIOCTLCMD)
-   ret = -EINVAL;
+   ret = -ENOTTY;
 
mutex_unlock(video-mutex);
 
@@ -723,7 +723,7 @@ isp_video_try_format(struct file *file, void *fh, struct 
v4l2_format *format)
fmt.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, fmt);
if (ret)
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
isp_video_mbus_to_pix(video, fmt.format, format-fmt.pix);
return 0;
@@ -744,7 +744,7 @@ isp_video_cropcap(struct file *file, void *fh, struct 
v4l2_cropcap *cropcap)
ret = v4l2_subdev_call(subdev, video, cropcap, cropcap);
mutex_unlock(video-mutex);
 
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int
@@ -771,7 +771,7 @@ isp_video_get_crop(struct file *file, void *fh, struct 
v4l2_crop *crop)
format.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, format);
if (ret  0)
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 
crop-c.left = 0;
crop-c.top = 0;
@@ -796,7 +796,7 @@ isp_video_set_crop(struct file *file, void *fh, struct 
v4l2_crop *crop)
ret = v4l2_subdev_call(subdev, video, s_crop, crop);
mutex_unlock(video-mutex);
 
-   return ret == -ENOIOCTLCMD ? -EINVAL : ret;
+   return ret == -ENOIOCTLCMD ? -ENOTTY : ret;
 }
 
 static int
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 3/5] media:dvb:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.

Cc: Mauro Carvalho Chehab mche...@infradead.org
Cc: linux-me...@vger.kernel.org
Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
---
 drivers/media/dvb/dvb-core/dvbdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/dvb/dvb-core/dvbdev.c 
b/drivers/media/dvb/dvb-core/dvbdev.c
index 39eab73..d33101a 100644
--- a/drivers/media/dvb/dvb-core/dvbdev.c
+++ b/drivers/media/dvb/dvb-core/dvbdev.c
@@ -420,7 +420,7 @@ int dvb_usercopy(struct file *file,
/* call driver */
mutex_lock(dvbdev_mutex);
if ((err = func(file, cmd, parg)) == -ENOIOCTLCMD)
-   err = -EINVAL;
+   err = -ENOTTY;
mutex_unlock(dvbdev_mutex);
 
if (err  0)
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 1/5] drivers:tty:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Wanlong Gao
At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
translated as ENOTTY to user mode.
For example:
fd = open(/dev/tty, O_RDWR);
ioctl(fd, -1, argp);

then the errno should be ENOTTY but not EINVAL.

Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
---
 drivers/tty/tty_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index b425c79..720c408f 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2756,7 +2756,7 @@ long tty_ioctl(struct file *file, unsigned int cmd, 
unsigned long arg)
if (ld-ops-ioctl) {
retval = ld-ops-ioctl(tty, file, cmd, arg);
if (retval == -ENOIOCTLCMD)
-   retval = -EINVAL;
+   retval = -ENOTTY;
}
tty_ldisc_deref(ld);
return retval;
-- 
1.7.12

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Heiko Carstens
On Mon, Aug 27, 2012 at 03:23:16PM +0800, Wanlong Gao wrote:
 At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
 translated as ENOTTY to user mode.
 
[...]

 Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com
 ---
  drivers/s390/block/dasd_ioctl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
 index cceae70..809a89b 100644
 --- a/drivers/s390/block/dasd_ioctl.c
 +++ b/drivers/s390/block/dasd_ioctl.c
 @@ -501,7 +501,7 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
   if (base-discipline-ioctl) {
   rc = base-discipline-ioctl(block, cmd, argp);
   if (rc == -ENOIOCTLCMD)
 - rc = -EINVAL;
 + rc = -ENOTTY;
   } else
   rc = -EINVAL;
   }

Thanks, but you missed the else path. I'm going to commit the patch below
unless Stefan has any objections:

From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
From: Heiko Carstens heiko.carst...@de.ibm.com
Date: Mon, 27 Aug 2012 10:59:42 +0200
Subject: [PATCH] s390/dasd: fix ioctl return value

For unimplemented ioctls the dasd driver should return -ENOTTY.

Reported-by: Wanlong Gao gaowanl...@cn.fujitsu.com
Signed-off-by: Heiko Carstens heiko.carst...@de.ibm.com
---
 drivers/s390/block/dasd_eckd.c  | 2 +-
 drivers/s390/block/dasd_ioctl.c | 7 ++-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c
index 40a826a..2fb2b9e 100644
--- a/drivers/s390/block/dasd_eckd.c
+++ b/drivers/s390/block/dasd_eckd.c
@@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, unsigned int 
cmd, void __user *argp)
case BIODASDSYMMIO:
return dasd_symm_io(device, argp);
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
 }
 
diff --git a/drivers/s390/block/dasd_ioctl.c b/drivers/s390/block/dasd_ioctl.c
index cceae70..654c692 100644
--- a/drivers/s390/block/dasd_ioctl.c
+++ b/drivers/s390/block/dasd_ioctl.c
@@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t mode,
break;
default:
/* if the discipline has an ioctl method try it. */
-   if (base-discipline-ioctl) {
+   rc = -ENOTTY;
+   if (base-discipline-ioctl)
rc = base-discipline-ioctl(block, cmd, argp);
-   if (rc == -ENOIOCTLCMD)
-   rc = -EINVAL;
-   } else
-   rc = -EINVAL;
}
dasd_put_device(base);
return rc;
-- 
1.7.11.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 5/5] s390:block:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Stefan Weinhuber
heica...@linux.vnet.ibm.com wrote on 2012-08-27 11:03:55:

[..]
 
 Thanks, but you missed the else path. I'm going to commit the patch 
below
 unless Stefan has any objections:
 
 From dac16bd8b314dc6f3f4e6815feab199fdfc8cddd Mon Sep 17 00:00:00 2001
 From: Heiko Carstens heiko.carst...@de.ibm.com
 Date: Mon, 27 Aug 2012 10:59:42 +0200
 Subject: [PATCH] s390/dasd: fix ioctl return value
 
 For unimplemented ioctls the dasd driver should return -ENOTTY.
 
 Reported-by: Wanlong Gao gaowanl...@cn.fujitsu.com
 Signed-off-by: Heiko Carstens heiko.carst...@de.ibm.com
 ---
  drivers/s390/block/dasd_eckd.c  | 2 +-
  drivers/s390/block/dasd_ioctl.c | 7 ++-
  2 files changed, 3 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/s390/block/dasd_eckd.c 
b/drivers/s390/block/dasd_eckd.c
 index 40a826a..2fb2b9e 100644
 --- a/drivers/s390/block/dasd_eckd.c
 +++ b/drivers/s390/block/dasd_eckd.c
 @@ -3804,7 +3804,7 @@ dasd_eckd_ioctl(struct dasd_block *block, 
 unsigned int cmd, void __user *argp)
 case BIODASDSYMMIO:
return dasd_symm_io(device, argp);
 default:
 -  return -ENOIOCTLCMD;
 +  return -ENOTTY;
 }
  }
 
 diff --git a/drivers/s390/block/dasd_ioctl.c 
b/drivers/s390/block/dasd_ioctl.c
 index cceae70..654c692 100644
 --- a/drivers/s390/block/dasd_ioctl.c
 +++ b/drivers/s390/block/dasd_ioctl.c
 @@ -498,12 +498,9 @@ int dasd_ioctl(struct block_device *bdev, fmode_t 
mode,
break;
 default:
/* if the discipline has an ioctl method try it. */
 -  if (base-discipline-ioctl) {
 +  rc = -ENOTTY;
 +  if (base-discipline-ioctl)
   rc = base-discipline-ioctl(block, cmd, argp);
 - if (rc == -ENOIOCTLCMD)
 -rc = -EINVAL;
 -  } else
 - rc = -EINVAL;
 }
 dasd_put_device(base);
 return rc;
 -- 
 1.7.11.5
 

The patch is looking fine to me, thanks.

Mit freundlichen Grüßen / Kind regards
 
Stefan Weinhuber



--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/5] drivers:tty:fix up ENOIOCTLCMD error handling

2012-08-27 Thread Alan Cox
On Mon, 27 Aug 2012 15:23:12 +0800
Wanlong Gao gaowanl...@cn.fujitsu.com wrote:

 At commit 07d106d0, Linus pointed out that ENOIOCTLCMD should be
 translated as ENOTTY to user mode.
 For example:
   fd = open(/dev/tty, O_RDWR);
   ioctl(fd, -1, argp);
 
 then the errno should be ENOTTY but not EINVAL.
 
 Cc: Greg Kroah-Hartman gre...@linuxfoundation.org
 Signed-off-by: Wanlong Gao gaowanl...@cn.fujitsu.com

Acked-by: Alan Cox a...@linux.intel.com
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 5:45 PM +0100 2001-05-13, Alan Cox wrote:
>  > What I was arguing (conceptually) is that something like
>>  #define ENOIOCTLCMD ENOTTY
>>  or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)
>>
>>  would result in no loss of function. I assert that ENOIOCTLCMD is
>>  redundant, pending a specific counterexample.
>
>On the contrary. I can now no longer force an unsupported response when there
>is a generic routine I dont wish to use

That makes sense. Thanks.
-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Alan Cox

> What I was arguing (conceptually) is that something like
> #define ENOIOCTLCMD ENOTTY
> or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)
> 
> would result in no loss of function. I assert that ENOIOCTLCMD is 
> redundant, pending a specific counterexample.

On the contrary. I can now no longer force an unsupported response when there
is a generic routine I dont wish to use

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 5:43 PM +0100 2001-05-12, Alan Cox wrote:
>  > That's what's confusing me: why the distinction? It's true that the
>>  current scheme allows the dev->ioctlfunc() call below to force ENOTTY
>>  to be returned, bypassing the switch, but presumably that's not what
>>  one wants.
>
>It allows driver specific code to override generic code, including 
>by reporting
>that a given feature is not available/appropriate.
>
>Alan

What I was arguing (conceptually) is that something like

#define ENOIOCTLCMD ENOTTY

or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)

would result in no loss of function. I assert that ENOIOCTLCMD is 
redundant, pending a specific counterexample.
-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 3:27 PM -0700 2001-05-12, Shane Wegner wrote:
>  >int err = dev->ioctlfunc(dev, op, arg);
>>      if( err != -ENOIOCTLCMD)
>>  return err;
>>
>>  /* Driver specific code does not support this ioctl */
>
>I noticed this return coming out of the watchdog driver a
>while ago when I was playing with it.  I have taken a quick
>look and it seems a few drivers do return this directly to
>userspace.  I'm not sure if this is complete but ...

Can't this be handled in sys_ioctl()? At the very end, replace

out:
return error;

with

out:
return (error == -ENOIOCTLCMD) ? -ENOTTY : error;


>diff -ur linux-2.4.4-ac8/drivers/block/swim3.c linux/drivers/block/swim3.c
>--- linux-2.4.4-ac8/drivers/block/swim3.c  Sat May 12 14:59:44 2001
>+++ linux/drivers/block/swim3.cSat May 12 15:22:30 2001
>@@ -848,7 +848,7 @@
>  sizeof(struct floppy_struct));
>   return err;
>   }
>-  return -ENOIOCTLCMD;
>+  return -ENOTTY;
>  }


-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 3:27 PM -0700 2001-05-12, Shane Wegner wrote:
  int err = dev-ioctlfunc(dev, op, arg);
  if( err != -ENOIOCTLCMD)
  return err;

  /* Driver specific code does not support this ioctl */

I noticed this return coming out of the watchdog driver a
while ago when I was playing with it.  I have taken a quick
look and it seems a few drivers do return this directly to
userspace.  I'm not sure if this is complete but ...

Can't this be handled in sys_ioctl()? At the very end, replace

out:
return error;

with

out:
return (error == -ENOIOCTLCMD) ? -ENOTTY : error;


diff -ur linux-2.4.4-ac8/drivers/block/swim3.c linux/drivers/block/swim3.c
--- linux-2.4.4-ac8/drivers/block/swim3.c  Sat May 12 14:59:44 2001
+++ linux/drivers/block/swim3.cSat May 12 15:22:30 2001
@@ -848,7 +848,7 @@
  sizeof(struct floppy_struct));
   return err;
   }
-  return -ENOIOCTLCMD;
+  return -ENOTTY;
  }


-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 5:43 PM +0100 2001-05-12, Alan Cox wrote:
   That's what's confusing me: why the distinction? It's true that the
  current scheme allows the dev-ioctlfunc() call below to force ENOTTY
  to be returned, bypassing the switch, but presumably that's not what
  one wants.

It allows driver specific code to override generic code, including 
by reporting
that a given feature is not available/appropriate.

Alan

What I was arguing (conceptually) is that something like

#define ENOIOCTLCMD ENOTTY

or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)

would result in no loss of function. I assert that ENOIOCTLCMD is 
redundant, pending a specific counterexample.
-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Alan Cox

 What I was arguing (conceptually) is that something like
 #define ENOIOCTLCMD ENOTTY
 or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)
 
 would result in no loss of function. I assert that ENOIOCTLCMD is 
 redundant, pending a specific counterexample.

On the contrary. I can now no longer force an unsupported response when there
is a generic routine I dont wish to use

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-13 Thread Jonathan Lundell

At 5:45 PM +0100 2001-05-13, Alan Cox wrote:
   What I was arguing (conceptually) is that something like
  #define ENOIOCTLCMD ENOTTY
  or preferably but more invasively s/ENOIOCTLCMD/ENOTTY/ (mutatis mutandis)

  would result in no loss of function. I assert that ENOIOCTLCMD is
  redundant, pending a specific counterexample.

On the contrary. I can now no longer force an unsupported response when there
is a generic routine I dont wish to use

That makes sense. Thanks.
-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Shane Wegner

On Sat, May 12, 2001 at 12:16:09PM +0100, Alan Cox wrote:
> > Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
> > uses in the kernel, but I don't see any guidelines for that use (nor 
> > what prevents it from being seen by user programs).
> 
> It should never be seen by apps. If it can be then it is wrong code.
> Basically you use it in things like
> 
> 
> 
>   int err = dev->ioctlfunc(dev, op, arg);
>   if( err != -ENOIOCTLCMD)
>   return err;
> 
>   /* Driver specific code does not support this ioctl */

I noticed this return coming out of the watchdog driver a
while ago when I was playing with it.  I have taken a quick
look and it seems a few drivers do return this directly to
userspace.  I'm not sure if this is complete but ...

diff -ur linux-2.4.4-ac8/drivers/block/swim3.c linux/drivers/block/swim3.c
--- linux-2.4.4-ac8/drivers/block/swim3.c   Sat May 12 14:59:44 2001
+++ linux/drivers/block/swim3.c Sat May 12 15:22:30 2001
@@ -848,7 +848,7 @@
   sizeof(struct floppy_struct));
    return err;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 static int floppy_open(struct inode *inode, struct file *filp)
diff -ur linux-2.4.4-ac8/drivers/block/swim_iop.c linux/drivers/block/swim_iop.c
--- linux-2.4.4-ac8/drivers/block/swim_iop.cWed Feb 16 10:56:45 2000
+++ linux/drivers/block/swim_iop.c  Sat May 12 15:23:12 2001
@@ -363,7 +363,7 @@
   sizeof(struct floppy_struct));
    return err;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 static int floppy_open(struct inode *inode, struct file *filp)
diff -ur linux-2.4.4-ac8/drivers/char/acquirewdt.c linux/drivers/char/acquirewdt.c
--- linux-2.4.4-ac8/drivers/char/acquirewdt.c   Fri Feb  9 11:30:22 2001
+++ linux/drivers/char/acquirewdt.c Sat May 12 15:14:49 2001
@@ -110,7 +110,7 @@
  break;
 
default:
- return -ENOIOCTLCMD;
+ return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/advantechwdt.c linux/drivers/char/advantechwdt.c
--- linux-2.4.4-ac8/drivers/char/advantechwdt.c Tue Mar  6 19:44:34 2001
+++ linux/drivers/char/advantechwdt.c   Sat May 12 15:15:58 2001
@@ -120,7 +120,7 @@
  break;
 
default:
- return -ENOIOCTLCMD;
+ return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/i810-tco.c linux/drivers/char/i810-tco.c
--- linux-2.4.4-ac8/drivers/char/i810-tco.c Fri Dec 29 14:35:47 2000
+++ linux/drivers/char/i810-tco.c   Sat May 12 15:02:47 2001
@@ -213,7 +213,7 @@
};
switch (cmd) {
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
case WDIOC_GETSUPPORT:
if (copy_to_user
((struct watchdog_info *) arg, , sizeof (ident)))
diff -ur linux-2.4.4-ac8/drivers/char/machzwd.c linux/drivers/char/machzwd.c
--- linux-2.4.4-ac8/drivers/char/machzwd.c  Thu Apr 12 12:16:35 2001
+++ linux/drivers/char/machzwd.cSat May 12 15:09:42 2001
@@ -357,7 +357,7 @@
break;
 
        default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
 
return 0;
diff -ur linux-2.4.4-ac8/drivers/char/mixcomwd.c linux/drivers/char/mixcomwd.c
--- linux-2.4.4-ac8/drivers/char/mixcomwd.c Sun Dec  3 17:45:21 2000
+++ linux/drivers/char/mixcomwd.c   Sat May 12 15:15:18 2001
@@ -165,7 +165,7 @@
mixcomwd_ping();
break;
        default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/pc110pad.c linux/drivers/char/pc110pad.c
--- linux-2.4.4-ac8/drivers/char/pc110pad.c Sun Feb  4 10:05:29 2001
+++ linux/drivers/char/pc110pad.c   Sat May 12 15:13:26 2001
@@ -766,7 +766,7 @@
current_params.tap_interval = new.tap_interval;
    return 0;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 
diff -ur linux-2.4.4-ac8/drivers/char/pcwd.c linux/drivers/char/pcwd.c
--- linux-2.4.4-ac8/drivers/char/pcwd.c Fri Apr  6 10:42:55 2001
+++ linux/drivers/char/pcwd.c   Sat May 12 15:03:07 2001
@@ -247,7 +247,7 @@
 
switch(cmd) {
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 
case WDIOC_GETSUPPORT:
i = copy_to_user((void*)arg, , sizeof(ident));
diff -ur linux-2.4.4-ac8/drivers/char/sbc60xxwdt.c linux/drivers/char/sbc60xxwdt.c
--- linux-2.4.4-ac8/drivers/char/sbc60xxwdt.c   Fri Feb  9 11:30:22 2001
+++ linux/drivers/char/sbc60xxwdt.c Sat May 12 15:10:46 2001
@@ -241,7 +241,7 @@
switch(cmd)
{
        default:
-   retur

Re: ENOIOCTLCMD?

2001-05-12 Thread Alan Cox

> That's what's confusing me: why the distinction? It's true that the 
> current scheme allows the dev->ioctlfunc() call below to force ENOTTY 
> to be returned, bypassing the switch, but presumably that's not what 
> one wants.

It allows driver specific code to override generic code, including by reporting
that a given feature is not available/appropriate.

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Jonathan Lundell

At 12:16 PM +0100 2001-05-12, Alan Cox wrote:
>  > Can somebody explain the use of ENOIOCTLCMD? There are order of 170
>>  uses in the kernel, but I don't see any guidelines for that use (nor
>>  what prevents it from being seen by user programs).
>
>It should never be seen by apps. If it can be then it is wrong code.
>Basically you use it in things like

I was surmising something like that, but in that case aren't 
ENOIOCTLCMD and ENOTTY redundant? That is, could not every occurrence 
of ENOIOCTLCMD be replaced by ENOTTY with no change in function? 
That's what's confusing me: why the distinction? It's true that the 
current scheme allows the dev->ioctlfunc() call below to force ENOTTY 
to be returned, bypassing the switch, but presumably that's not what 
one wants.

>   int err = dev->ioctlfunc(dev, op, arg);
>   if( err != -ENOIOCTLCMD)
>   return err;
>
>   /* Driver specific code does not support this ioctl */
>
>   switch(op)
>   {
>
>   ...
>   default:
>   return -ENOTTY;
>   }
>
>Its a way of passing back 'you handle it'
>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to [EMAIL PROTECTED]
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/


-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Mark H. Wood

On Sat, 12 May 2001, Alan Cox wrote:
> > Can somebody explain the use of ENOIOCTLCMD? There are order of 170
> > uses in the kernel, but I don't see any guidelines for that use (nor
> > what prevents it from being seen by user programs).
>
> It should never be seen by apps. If it can be then it is wrong code.
> Basically you use it in things like
>
>
>
>   int err = dev->ioctlfunc(dev, op, arg);
>   if( err != -ENOIOCTLCMD)
>   return err;
>
>   /* Driver specific code does not support this ioctl */
>
>   switch(op)
>   {
>
>   ...
>   default:
>   return -ENOTTY;
>   }
>
> Its a way of passing back 'you handle it'

Okay, but another way of looking at it is as an instance of the classic
joke:

Husband:  What have I done wrong this time?
Wife: If you don't know, I'm not going to tell you!

IOW instead of getting back "this file doesn't know what that IOCTL
means", you get "error somewhere".  It certainly would be nice to know
*which* parameter was invalid and *why* it was invalid.  Changing this
would be against the lore, but I would rather throw away excess
information than never have received it in the first place. *sigh*

-- 
Mark H. Wood, Lead System Programmer   [EMAIL PROTECTED]
Make a good day.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Alan Cox

> Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
> uses in the kernel, but I don't see any guidelines for that use (nor 
> what prevents it from being seen by user programs).

It should never be seen by apps. If it can be then it is wrong code.
Basically you use it in things like



int err = dev->ioctlfunc(dev, op, arg);
if( err != -ENOIOCTLCMD)
return err;

/* Driver specific code does not support this ioctl */

switch(op)
{

...
default:
return -ENOTTY;
}

Its a way of passing back 'you handle it' 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Andi Kleen

On Fri, May 11, 2001 at 10:01:50PM -0700, Jonathan Lundell wrote:
> Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
> uses in the kernel, but I don't see any guidelines for that use (nor 
> what prevents it from being seen by user programs).

The idea with ENOIOCTLCMD is that when you have multiple subsystem 
callbacks (e.g. to low level drivers) the higher levels can pass the ioctls
down and they return ENOIOCTLCMD when they don't know the ioctl number,
so other subsystems can be tried.
This is nicer than using EINVAL, because EINVAL is a terminal condition.
The higher layer should always convert it into EINVAL if there is not
another callback to call, but if it leaks it is probably a bug.


-Andi
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Andi Kleen

On Fri, May 11, 2001 at 10:01:50PM -0700, Jonathan Lundell wrote:
 Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
 uses in the kernel, but I don't see any guidelines for that use (nor 
 what prevents it from being seen by user programs).

The idea with ENOIOCTLCMD is that when you have multiple subsystem 
callbacks (e.g. to low level drivers) the higher levels can pass the ioctls
down and they return ENOIOCTLCMD when they don't know the ioctl number,
so other subsystems can be tried.
This is nicer than using EINVAL, because EINVAL is a terminal condition.
The higher layer should always convert it into EINVAL if there is not
another callback to call, but if it leaks it is probably a bug.


-Andi
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Alan Cox

 Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
 uses in the kernel, but I don't see any guidelines for that use (nor 
 what prevents it from being seen by user programs).

It should never be seen by apps. If it can be then it is wrong code.
Basically you use it in things like



int err = dev-ioctlfunc(dev, op, arg);
if( err != -ENOIOCTLCMD)
return err;

/* Driver specific code does not support this ioctl */

switch(op)
{

...
default:
return -ENOTTY;
}

Its a way of passing back 'you handle it' 
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Mark H. Wood

On Sat, 12 May 2001, Alan Cox wrote:
  Can somebody explain the use of ENOIOCTLCMD? There are order of 170
  uses in the kernel, but I don't see any guidelines for that use (nor
  what prevents it from being seen by user programs).

 It should never be seen by apps. If it can be then it is wrong code.
 Basically you use it in things like



   int err = dev-ioctlfunc(dev, op, arg);
   if( err != -ENOIOCTLCMD)
   return err;

   /* Driver specific code does not support this ioctl */

   switch(op)
   {

   ...
   default:
   return -ENOTTY;
   }

 Its a way of passing back 'you handle it'

Okay, but another way of looking at it is as an instance of the classic
joke:

Husband:  What have I done wrong this time?
Wife: If you don't know, I'm not going to tell you!

IOW instead of getting back this file doesn't know what that IOCTL
means, you get error somewhere.  It certainly would be nice to know
*which* parameter was invalid and *why* it was invalid.  Changing this
would be against the lore, but I would rather throw away excess
information than never have received it in the first place. *sigh*

-- 
Mark H. Wood, Lead System Programmer   [EMAIL PROTECTED]
Make a good day.

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Jonathan Lundell

At 12:16 PM +0100 2001-05-12, Alan Cox wrote:
   Can somebody explain the use of ENOIOCTLCMD? There are order of 170
  uses in the kernel, but I don't see any guidelines for that use (nor
  what prevents it from being seen by user programs).

It should never be seen by apps. If it can be then it is wrong code.
Basically you use it in things like

I was surmising something like that, but in that case aren't 
ENOIOCTLCMD and ENOTTY redundant? That is, could not every occurrence 
of ENOIOCTLCMD be replaced by ENOTTY with no change in function? 
That's what's confusing me: why the distinction? It's true that the 
current scheme allows the dev-ioctlfunc() call below to force ENOTTY 
to be returned, bypassing the switch, but presumably that's not what 
one wants.

   int err = dev-ioctlfunc(dev, op, arg);
   if( err != -ENOIOCTLCMD)
   return err;

   /* Driver specific code does not support this ioctl */

   switch(op)
   {

   ...
   default:
   return -ENOTTY;
   }

Its a way of passing back 'you handle it'
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Alan Cox

 That's what's confusing me: why the distinction? It's true that the 
 current scheme allows the dev-ioctlfunc() call below to force ENOTTY 
 to be returned, bypassing the switch, but presumably that's not what 
 one wants.

It allows driver specific code to override generic code, including by reporting
that a given feature is not available/appropriate.

Alan

-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



Re: ENOIOCTLCMD?

2001-05-12 Thread Shane Wegner

On Sat, May 12, 2001 at 12:16:09PM +0100, Alan Cox wrote:
  Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
  uses in the kernel, but I don't see any guidelines for that use (nor 
  what prevents it from being seen by user programs).
 
 It should never be seen by apps. If it can be then it is wrong code.
 Basically you use it in things like
 
 
 
   int err = dev-ioctlfunc(dev, op, arg);
   if( err != -ENOIOCTLCMD)
   return err;
 
   /* Driver specific code does not support this ioctl */

I noticed this return coming out of the watchdog driver a
while ago when I was playing with it.  I have taken a quick
look and it seems a few drivers do return this directly to
userspace.  I'm not sure if this is complete but ...

diff -ur linux-2.4.4-ac8/drivers/block/swim3.c linux/drivers/block/swim3.c
--- linux-2.4.4-ac8/drivers/block/swim3.c   Sat May 12 14:59:44 2001
+++ linux/drivers/block/swim3.c Sat May 12 15:22:30 2001
@@ -848,7 +848,7 @@
   sizeof(struct floppy_struct));
return err;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 static int floppy_open(struct inode *inode, struct file *filp)
diff -ur linux-2.4.4-ac8/drivers/block/swim_iop.c linux/drivers/block/swim_iop.c
--- linux-2.4.4-ac8/drivers/block/swim_iop.cWed Feb 16 10:56:45 2000
+++ linux/drivers/block/swim_iop.c  Sat May 12 15:23:12 2001
@@ -363,7 +363,7 @@
   sizeof(struct floppy_struct));
return err;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 static int floppy_open(struct inode *inode, struct file *filp)
diff -ur linux-2.4.4-ac8/drivers/char/acquirewdt.c linux/drivers/char/acquirewdt.c
--- linux-2.4.4-ac8/drivers/char/acquirewdt.c   Fri Feb  9 11:30:22 2001
+++ linux/drivers/char/acquirewdt.c Sat May 12 15:14:49 2001
@@ -110,7 +110,7 @@
  break;
 
default:
- return -ENOIOCTLCMD;
+ return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/advantechwdt.c linux/drivers/char/advantechwdt.c
--- linux-2.4.4-ac8/drivers/char/advantechwdt.c Tue Mar  6 19:44:34 2001
+++ linux/drivers/char/advantechwdt.c   Sat May 12 15:15:58 2001
@@ -120,7 +120,7 @@
  break;
 
default:
- return -ENOIOCTLCMD;
+ return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/i810-tco.c linux/drivers/char/i810-tco.c
--- linux-2.4.4-ac8/drivers/char/i810-tco.c Fri Dec 29 14:35:47 2000
+++ linux/drivers/char/i810-tco.c   Sat May 12 15:02:47 2001
@@ -213,7 +213,7 @@
};
switch (cmd) {
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
case WDIOC_GETSUPPORT:
if (copy_to_user
((struct watchdog_info *) arg, ident, sizeof (ident)))
diff -ur linux-2.4.4-ac8/drivers/char/machzwd.c linux/drivers/char/machzwd.c
--- linux-2.4.4-ac8/drivers/char/machzwd.c  Thu Apr 12 12:16:35 2001
+++ linux/drivers/char/machzwd.cSat May 12 15:09:42 2001
@@ -357,7 +357,7 @@
break;
 
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
 
return 0;
diff -ur linux-2.4.4-ac8/drivers/char/mixcomwd.c linux/drivers/char/mixcomwd.c
--- linux-2.4.4-ac8/drivers/char/mixcomwd.c Sun Dec  3 17:45:21 2000
+++ linux/drivers/char/mixcomwd.c   Sat May 12 15:15:18 2001
@@ -165,7 +165,7 @@
mixcomwd_ping();
break;
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
}
return 0;
 }
diff -ur linux-2.4.4-ac8/drivers/char/pc110pad.c linux/drivers/char/pc110pad.c
--- linux-2.4.4-ac8/drivers/char/pc110pad.c Sun Feb  4 10:05:29 2001
+++ linux/drivers/char/pc110pad.c   Sat May 12 15:13:26 2001
@@ -766,7 +766,7 @@
current_params.tap_interval = new.tap_interval;
return 0;
}
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 }
 
 
diff -ur linux-2.4.4-ac8/drivers/char/pcwd.c linux/drivers/char/pcwd.c
--- linux-2.4.4-ac8/drivers/char/pcwd.c Fri Apr  6 10:42:55 2001
+++ linux/drivers/char/pcwd.c   Sat May 12 15:03:07 2001
@@ -247,7 +247,7 @@
 
switch(cmd) {
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY;
 
case WDIOC_GETSUPPORT:
i = copy_to_user((void*)arg, ident, sizeof(ident));
diff -ur linux-2.4.4-ac8/drivers/char/sbc60xxwdt.c linux/drivers/char/sbc60xxwdt.c
--- linux-2.4.4-ac8/drivers/char/sbc60xxwdt.c   Fri Feb  9 11:30:22 2001
+++ linux/drivers/char/sbc60xxwdt.c Sat May 12 15:10:46 2001
@@ -241,7 +241,7 @@
switch(cmd)
{
default:
-   return -ENOIOCTLCMD;
+   return -ENOTTY

ENOIOCTLCMD?

2001-05-11 Thread Jonathan Lundell

Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
uses in the kernel, but I don't see any guidelines for that use (nor 
what prevents it from being seen by user programs).

Thanks.

errno.h:

>/* Should never be seen by user programs */
>#define ERESTARTSYS512
>#define ERESTARTNOINTR 513
>#define ERESTARTNOHAND 514 /* restart if no handler.. */
>#define ENOIOCTLCMD515 /* No ioctl command */

-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



ENOIOCTLCMD?

2001-05-11 Thread Jonathan Lundell

Can somebody explain the use of ENOIOCTLCMD? There are order of 170 
uses in the kernel, but I don't see any guidelines for that use (nor 
what prevents it from being seen by user programs).

Thanks.

errno.h:

/* Should never be seen by user programs */
#define ERESTARTSYS512
#define ERESTARTNOINTR 513
#define ERESTARTNOHAND 514 /* restart if no handler.. */
#define ENOIOCTLCMD515 /* No ioctl command */

-- 
/Jonathan Lundell.
-
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/