All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
@ 2021-05-18 15:50 Andy Shevchenko
  2021-05-18 15:50 ` [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper Andy Shevchenko
  2021-05-18 23:24 ` [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Kent Gibson
  0 siblings, 2 replies; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-18 15:50 UTC (permalink / raw)
  To: Kent Gibson, Bartosz Golaszewski, Andy Shevchenko, linux-gpio,
	linux-kernel
  Cc: Linus Walleij, Suresh Balakrishnan

Currently it's possible that character device interface may return
the error codes which are not supposed to be seen by user space.
In this case it's EPROBE_DEFER.

Wrap it to return -ENODEV instead as sysfs does.

Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
Reported-by: Suresh Balakrishnan <suresh.balakrishnan@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-cdev.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 1631727bf0da..1d8f66880d63 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -331,8 +331,11 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
 		}
 
 		ret = gpiod_request(desc, lh->label);
-		if (ret)
+		if (ret) {
+			if (ret == -EPROBE_DEFER)
+				ret = -ENODEV;
 			goto out_free_lh;
+		}
 		lh->descs[i] = desc;
 		linehandle_flags_to_desc_flags(handlereq.flags, &desc->flags);
 
@@ -1379,8 +1382,11 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
 		}
 
 		ret = gpiod_request(desc, lr->label);
-		if (ret)
+		if (ret) {
+			if (ret == -EPROBE_DEFER)
+				ret = -ENODEV;
 			goto out_free_linereq;
+		}
 
 		lr->lines[i].desc = desc;
 		flags = gpio_v2_line_config_flags(lc, i);
@@ -1765,8 +1771,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
 	}
 
 	ret = gpiod_request(desc, le->label);
-	if (ret)
+	if (ret) {
+		if (ret == -EPROBE_DEFER)
+			ret = -ENODEV;
 		goto out_free_le;
+	}
 	le->desc = desc;
 	le->eflags = eflags;
 
-- 
2.30.2


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

* [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper
  2021-05-18 15:50 [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Andy Shevchenko
@ 2021-05-18 15:50 ` Andy Shevchenko
  2021-05-25  0:27   ` Linus Walleij
  2021-05-18 23:24 ` [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Kent Gibson
  1 sibling, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-18 15:50 UTC (permalink / raw)
  To: Kent Gibson, Bartosz Golaszewski, Andy Shevchenko, linux-gpio,
	linux-kernel
  Cc: Linus Walleij

The gpiod_request_user() is a special helper to avoid propagating stuff
to user space that should not be propagated, e.g. internal error codes.

For now, hide EPROBE_DEFER with ENODEV.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpiolib-cdev.c  | 21 ++++++---------------
 drivers/gpio/gpiolib-sysfs.c |  7 ++-----
 drivers/gpio/gpiolib.h       | 12 ++++++++++++
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
index 1d8f66880d63..8a934914f93a 100644
--- a/drivers/gpio/gpiolib-cdev.c
+++ b/drivers/gpio/gpiolib-cdev.c
@@ -330,12 +330,9 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
 			goto out_free_lh;
 		}
 
-		ret = gpiod_request(desc, lh->label);
-		if (ret) {
-			if (ret == -EPROBE_DEFER)
-				ret = -ENODEV;
+		ret = gpiod_request_user(desc, lh->label);
+		if (ret)
 			goto out_free_lh;
-		}
 		lh->descs[i] = desc;
 		linehandle_flags_to_desc_flags(handlereq.flags, &desc->flags);
 
@@ -1381,12 +1378,9 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
 			goto out_free_linereq;
 		}
 
-		ret = gpiod_request(desc, lr->label);
-		if (ret) {
-			if (ret == -EPROBE_DEFER)
-				ret = -ENODEV;
+		ret = gpiod_request_user(desc, lr->label);
+		if (ret)
 			goto out_free_linereq;
-		}
 
 		lr->lines[i].desc = desc;
 		flags = gpio_v2_line_config_flags(lc, i);
@@ -1770,12 +1764,9 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
 		}
 	}
 
-	ret = gpiod_request(desc, le->label);
-	if (ret) {
-		if (ret == -EPROBE_DEFER)
-			ret = -ENODEV;
+	ret = gpiod_request_user(desc, le->label);
+	if (ret)
 		goto out_free_le;
-	}
 	le->desc = desc;
 	le->eflags = eflags;
 
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index d836aba91d3c..22a9ad1a2978 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -473,12 +473,9 @@ static ssize_t export_store(struct class *class,
 	 * they may be undone on its behalf too.
 	 */
 
-	status = gpiod_request(desc, "sysfs");
-	if (status) {
-		if (status == -EPROBE_DEFER)
-			status = -ENODEV;
+	status = gpiod_request_user(desc, "sysfs");
+	if (status)
 		goto done;
-	}
 
 	status = gpiod_set_transitory(desc, false);
 	if (!status) {
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h
index 69c96a4276de..7f760745c457 100644
--- a/drivers/gpio/gpiolib.h
+++ b/drivers/gpio/gpiolib.h
@@ -142,6 +142,18 @@ struct gpio_desc {
 
 int gpiod_request(struct gpio_desc *desc, const char *label);
 void gpiod_free(struct gpio_desc *desc);
+
+static inline int gpiod_request_user(struct gpio_desc *desc, const char *label)
+{
+	int ret;
+
+	ret = gpiod_request(desc, label);
+	if (ret == -EPROBE_DEFER)
+		ret = -ENODEV;
+
+	return ret;
+}
+
 int gpiod_configure_flags(struct gpio_desc *desc, const char *con_id,
 		unsigned long lflags, enum gpiod_flags dflags);
 int gpio_set_debounce_timeout(struct gpio_desc *desc, unsigned int debounce);
-- 
2.30.2


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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-18 15:50 [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Andy Shevchenko
  2021-05-18 15:50 ` [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper Andy Shevchenko
@ 2021-05-18 23:24 ` Kent Gibson
  2021-05-19  7:45   ` Andy Shevchenko
  1 sibling, 1 reply; 12+ messages in thread
From: Kent Gibson @ 2021-05-18 23:24 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
	Suresh Balakrishnan

On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> Currently it's possible that character device interface may return
> the error codes which are not supposed to be seen by user space.
> In this case it's EPROBE_DEFER.
> 
> Wrap it to return -ENODEV instead as sysfs does.
> 
> Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> Reported-by: Suresh Balakrishnan <suresh.balakrishnan@intel.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpiolib-cdev.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> index 1631727bf0da..1d8f66880d63 100644
> --- a/drivers/gpio/gpiolib-cdev.c
> +++ b/drivers/gpio/gpiolib-cdev.c
> @@ -331,8 +331,11 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
>  		}
>  
>  		ret = gpiod_request(desc, lh->label);
> -		if (ret)
> +		if (ret) {
> +			if (ret == -EPROBE_DEFER)
> +				ret = -ENODEV;
>  			goto out_free_lh;
> +		}
>  		lh->descs[i] = desc;
>  		linehandle_flags_to_desc_flags(handlereq.flags, &desc->flags);
>  
> @@ -1379,8 +1382,11 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
>  		}
>  
>  		ret = gpiod_request(desc, lr->label);
> -		if (ret)
> +		if (ret) {
> +			if (ret == -EPROBE_DEFER)
> +				ret = -ENODEV;
>  			goto out_free_linereq;
> +		}
>  
>  		lr->lines[i].desc = desc;
>  		flags = gpio_v2_line_config_flags(lc, i);
> @@ -1765,8 +1771,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
>  	}
>  
>  	ret = gpiod_request(desc, le->label);
> -	if (ret)
> +	if (ret) {
> +		if (ret == -EPROBE_DEFER)
> +			ret = -ENODEV;
>  		goto out_free_le;
> +	}
>  	le->desc = desc;
>  	le->eflags = eflags;
>  

You immediately revert this patch in patch 2.
My understanding is that is not allowed within a patch set.
Why split the patches instead of going direct to the new helper?

Cheers,
Kent.

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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-18 23:24 ` [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Kent Gibson
@ 2021-05-19  7:45   ` Andy Shevchenko
  2021-05-19  8:04     ` Kent Gibson
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-19  7:45 UTC (permalink / raw)
  To: Kent Gibson
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
	Suresh Balakrishnan

On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> > Currently it's possible that character device interface may return
> > the error codes which are not supposed to be seen by user space.
> > In this case it's EPROBE_DEFER.
> > 
> > Wrap it to return -ENODEV instead as sysfs does.

> > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")

...

> You immediately revert this patch in patch 2.
> My understanding is that is not allowed within a patch set.

> Why split the patches instead of going direct to the new helper?

It's for backporting to make it easier. (I deliberately left the context above)

I can fold them if maintainers think it's okay to do.


-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-19  7:45   ` Andy Shevchenko
@ 2021-05-19  8:04     ` Kent Gibson
  2021-05-19  8:30       ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Kent Gibson @ 2021-05-19  8:04 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
	Suresh Balakrishnan

On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> > > Currently it's possible that character device interface may return
> > > the error codes which are not supposed to be seen by user space.
> > > In this case it's EPROBE_DEFER.
> > > 
> > > Wrap it to return -ENODEV instead as sysfs does.
> 
> > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> 
> ...
> 
> > You immediately revert this patch in patch 2.
> > My understanding is that is not allowed within a patch set.
> 
> > Why split the patches instead of going direct to the new helper?
> 
> It's for backporting to make it easier. (I deliberately left the context above)
> 
> I can fold them if maintainers think it's okay to do.
> 

Not sure what the constraints are on backporting, but wouldn't it be
simpler and cleaner to backport the new helper?

But, as you say, it is the maintainers' call.

Cheers,
Kent.


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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-19  8:04     ` Kent Gibson
@ 2021-05-19  8:30       ` Andy Shevchenko
  2021-05-20 13:02         ` Bartosz Golaszewski
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-19  8:30 UTC (permalink / raw)
  To: Kent Gibson
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij,
	Suresh Balakrishnan

On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> > > > Currently it's possible that character device interface may return
> > > > the error codes which are not supposed to be seen by user space.
> > > > In this case it's EPROBE_DEFER.
> > > > 
> > > > Wrap it to return -ENODEV instead as sysfs does.
> > 
> > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> > 
> > ...
> > 
> > > You immediately revert this patch in patch 2.
> > > My understanding is that is not allowed within a patch set.
> > 
> > > Why split the patches instead of going direct to the new helper?
> > 
> > It's for backporting to make it easier. (I deliberately left the context above)
> > 
> > I can fold them if maintainers think it's okay to do.
> > 
> 
> Not sure what the constraints are on backporting, but wouldn't it be
> simpler and cleaner to backport the new helper?

Logically (and ideally) it would be three different patches:
 1) introduce helper
 2) use helper
 3) fix places where it's needed to be done

But the above scheme doesn't fit backporting idea (we don't backport new
features and APIs without really necessity). So, the options left are:

Option a: One patch (feels a bit like above)
Option b: Two patches like in this series (yes, you are correct about
          disadvantages)

> But, as you say, it is the maintainers' call.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-19  8:30       ` Andy Shevchenko
@ 2021-05-20 13:02         ` Bartosz Golaszewski
  2021-05-20 13:14           ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Bartosz Golaszewski @ 2021-05-20 13:02 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kent Gibson, linux-gpio, LKML, Linus Walleij, Suresh Balakrishnan

On Wed, May 19, 2021 at 10:30 AM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> > On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> > > > > Currently it's possible that character device interface may return
> > > > > the error codes which are not supposed to be seen by user space.
> > > > > In this case it's EPROBE_DEFER.
> > > > >
> > > > > Wrap it to return -ENODEV instead as sysfs does.
> > >
> > > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> > >
> > > ...
> > >
> > > > You immediately revert this patch in patch 2.
> > > > My understanding is that is not allowed within a patch set.
> > >
> > > > Why split the patches instead of going direct to the new helper?
> > >
> > > It's for backporting to make it easier. (I deliberately left the context above)
> > >
> > > I can fold them if maintainers think it's okay to do.
> > >
> >
> > Not sure what the constraints are on backporting, but wouldn't it be
> > simpler and cleaner to backport the new helper?
>
> Logically (and ideally) it would be three different patches:
>  1) introduce helper
>  2) use helper
>  3) fix places where it's needed to be done
>
> But the above scheme doesn't fit backporting idea (we don't backport new
> features and APIs without really necessity). So, the options left are:
>
> Option a: One patch (feels a bit like above)
> Option b: Two patches like in this series (yes, you are correct about
>           disadvantages)
>
> > But, as you say, it is the maintainers' call.
>
> --
> With Best Regards,
> Andy Shevchenko
>
>

Third option is to backport this patch but apply the helper
immediately to master.

Bart

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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-20 13:02         ` Bartosz Golaszewski
@ 2021-05-20 13:14           ` Andy Shevchenko
  2021-05-20 14:39             ` Bartosz Golaszewski
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-20 13:14 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Andy Shevchenko, Kent Gibson, linux-gpio, LKML, Linus Walleij,
	Suresh Balakrishnan

On Thu, May 20, 2021 at 4:08 PM Bartosz Golaszewski
<bgolaszewski@baylibre.com> wrote:
> On Wed, May 19, 2021 at 10:30 AM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> > > On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > > > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:

...

> > > > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")

...

> > > > > You immediately revert this patch in patch 2.
> > > > > My understanding is that is not allowed within a patch set.
> > > >
> > > > > Why split the patches instead of going direct to the new helper?
> > > >
> > > > It's for backporting to make it easier. (I deliberately left the context above)
> > > >
> > > > I can fold them if maintainers think it's okay to do.
> > > >
> > >
> > > Not sure what the constraints are on backporting, but wouldn't it be
> > > simpler and cleaner to backport the new helper?
> >
> > Logically (and ideally) it would be three different patches:
> >  1) introduce helper
> >  2) use helper
> >  3) fix places where it's needed to be done
> >
> > But the above scheme doesn't fit backporting idea (we don't backport new
> > features and APIs without really necessity). So, the options left are:
> >
> > Option a: One patch (feels a bit like above)
> > Option b: Two patches like in this series (yes, you are correct about
> >           disadvantages)
> >
> > > But, as you say, it is the maintainers' call.

> Third option is to backport this patch but apply the helper
> immediately to master.

If I got you correctly, you want to have two patches, one for
backporting and one for current, correct? But how can we backport
something which has never been upstreamed?

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-20 13:14           ` Andy Shevchenko
@ 2021-05-20 14:39             ` Bartosz Golaszewski
  2021-11-23 19:15               ` Andy Shevchenko
  0 siblings, 1 reply; 12+ messages in thread
From: Bartosz Golaszewski @ 2021-05-20 14:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Kent Gibson, linux-gpio, LKML, Linus Walleij,
	Suresh Balakrishnan

On Thu, May 20, 2021 at 3:15 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Thu, May 20, 2021 at 4:08 PM Bartosz Golaszewski
> <bgolaszewski@baylibre.com> wrote:
> > On Wed, May 19, 2021 at 10:30 AM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> > > > On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > > > > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > > > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
>
> ...
>
> > > > > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
>
> ...
>
> > > > > > You immediately revert this patch in patch 2.
> > > > > > My understanding is that is not allowed within a patch set.
> > > > >
> > > > > > Why split the patches instead of going direct to the new helper?
> > > > >
> > > > > It's for backporting to make it easier. (I deliberately left the context above)
> > > > >
> > > > > I can fold them if maintainers think it's okay to do.
> > > > >
> > > >
> > > > Not sure what the constraints are on backporting, but wouldn't it be
> > > > simpler and cleaner to backport the new helper?
> > >
> > > Logically (and ideally) it would be three different patches:
> > >  1) introduce helper
> > >  2) use helper
> > >  3) fix places where it's needed to be done
> > >
> > > But the above scheme doesn't fit backporting idea (we don't backport new
> > > features and APIs without really necessity). So, the options left are:
> > >
> > > Option a: One patch (feels a bit like above)
> > > Option b: Two patches like in this series (yes, you are correct about
> > >           disadvantages)
> > >
> > > > But, as you say, it is the maintainers' call.
>
> > Third option is to backport this patch but apply the helper
> > immediately to master.
>
> If I got you correctly, you want to have two patches, one for
> backporting and one for current, correct? But how can we backport
> something which has never been upstreamed?
>

Well we would not technically backport anything - there would be one
patch for mainline and a separate fix for stable.

Bart

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

* Re: [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper
  2021-05-18 15:50 ` [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper Andy Shevchenko
@ 2021-05-25  0:27   ` Linus Walleij
  0 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-25  0:27 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kent Gibson, Bartosz Golaszewski, open list:GPIO SUBSYSTEM, linux-kernel

On Tue, May 18, 2021 at 5:50 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:

> The gpiod_request_user() is a special helper to avoid propagating stuff
> to user space that should not be propagated, e.g. internal error codes.
>
> For now, hide EPROBE_DEFER with ENODEV.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

This looks like a good solution.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-05-20 14:39             ` Bartosz Golaszewski
@ 2021-11-23 19:15               ` Andy Shevchenko
  2021-11-24 12:46                 ` Bartosz Golaszewski
  0 siblings, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-11-23 19:15 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Kent Gibson, linux-gpio, LKML, Linus Walleij, Suresh Balakrishnan

On Thu, May 20, 2021 at 04:39:50PM +0200, Bartosz Golaszewski wrote:
> On Thu, May 20, 2021 at 3:15 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > On Thu, May 20, 2021 at 4:08 PM Bartosz Golaszewski
> > <bgolaszewski@baylibre.com> wrote:
> > > On Wed, May 19, 2021 at 10:30 AM Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> > > > > On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > > > > > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > > > > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> >
> > ...
> >
> > > > > > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > > > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > > > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> >
> > ...
> >
> > > > > > > You immediately revert this patch in patch 2.
> > > > > > > My understanding is that is not allowed within a patch set.
> > > > > >
> > > > > > > Why split the patches instead of going direct to the new helper?
> > > > > >
> > > > > > It's for backporting to make it easier. (I deliberately left the context above)
> > > > > >
> > > > > > I can fold them if maintainers think it's okay to do.
> > > > > >
> > > > >
> > > > > Not sure what the constraints are on backporting, but wouldn't it be
> > > > > simpler and cleaner to backport the new helper?
> > > >
> > > > Logically (and ideally) it would be three different patches:
> > > >  1) introduce helper
> > > >  2) use helper
> > > >  3) fix places where it's needed to be done
> > > >
> > > > But the above scheme doesn't fit backporting idea (we don't backport new
> > > > features and APIs without really necessity). So, the options left are:
> > > >
> > > > Option a: One patch (feels a bit like above)
> > > > Option b: Two patches like in this series (yes, you are correct about
> > > >           disadvantages)
> > > >
> > > > > But, as you say, it is the maintainers' call.
> >
> > > Third option is to backport this patch but apply the helper
> > > immediately to master.
> >
> > If I got you correctly, you want to have two patches, one for
> > backporting and one for current, correct? But how can we backport
> > something which has never been upstreamed?
> >
> 
> Well we would not technically backport anything - there would be one
> patch for mainline and a separate fix for stable.

So, what should I do here?

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
  2021-11-23 19:15               ` Andy Shevchenko
@ 2021-11-24 12:46                 ` Bartosz Golaszewski
  0 siblings, 0 replies; 12+ messages in thread
From: Bartosz Golaszewski @ 2021-11-24 12:46 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, Kent Gibson, linux-gpio, LKML,
	Linus Walleij, Suresh Balakrishnan

On Tue, Nov 23, 2021 at 8:16 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
>
> On Thu, May 20, 2021 at 04:39:50PM +0200, Bartosz Golaszewski wrote:
> > On Thu, May 20, 2021 at 3:15 PM Andy Shevchenko
> > <andy.shevchenko@gmail.com> wrote:
> > >
> > > On Thu, May 20, 2021 at 4:08 PM Bartosz Golaszewski
> > > <bgolaszewski@baylibre.com> wrote:
> > > > On Wed, May 19, 2021 at 10:30 AM Andy Shevchenko
> > > > <andriy.shevchenko@linux.intel.com> wrote:
> > > > > On Wed, May 19, 2021 at 04:04:34PM +0800, Kent Gibson wrote:
> > > > > > On Wed, May 19, 2021 at 10:45:16AM +0300, Andy Shevchenko wrote:
> > > > > > > On Wed, May 19, 2021 at 07:24:51AM +0800, Kent Gibson wrote:
> > > > > > > > On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> > >
> > > ...
> > >
> > > > > > > > > Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
> > > > > > > > > Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
> > > > > > > > > Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
> > >
> > > ...
> > >
> > > > > > > > You immediately revert this patch in patch 2.
> > > > > > > > My understanding is that is not allowed within a patch set.
> > > > > > >
> > > > > > > > Why split the patches instead of going direct to the new helper?
> > > > > > >
> > > > > > > It's for backporting to make it easier. (I deliberately left the context above)
> > > > > > >
> > > > > > > I can fold them if maintainers think it's okay to do.
> > > > > > >
> > > > > >
> > > > > > Not sure what the constraints are on backporting, but wouldn't it be
> > > > > > simpler and cleaner to backport the new helper?
> > > > >
> > > > > Logically (and ideally) it would be three different patches:
> > > > >  1) introduce helper
> > > > >  2) use helper
> > > > >  3) fix places where it's needed to be done
> > > > >
> > > > > But the above scheme doesn't fit backporting idea (we don't backport new
> > > > > features and APIs without really necessity). So, the options left are:
> > > > >
> > > > > Option a: One patch (feels a bit like above)
> > > > > Option b: Two patches like in this series (yes, you are correct about
> > > > >           disadvantages)
> > > > >
> > > > > > But, as you say, it is the maintainers' call.
> > >
> > > > Third option is to backport this patch but apply the helper
> > > > immediately to master.
> > >
> > > If I got you correctly, you want to have two patches, one for
> > > backporting and one for current, correct? But how can we backport
> > > something which has never been upstreamed?
> > >
> >
> > Well we would not technically backport anything - there would be one
> > patch for mainline and a separate fix for stable.
>
> So, what should I do here?

Send a separate patch for stable branches that fixes the issue and
fold this patch into the next one in the series for master.

Bart

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

end of thread, other threads:[~2021-11-24 14:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 15:50 [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Andy Shevchenko
2021-05-18 15:50 ` [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper Andy Shevchenko
2021-05-25  0:27   ` Linus Walleij
2021-05-18 23:24 ` [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Kent Gibson
2021-05-19  7:45   ` Andy Shevchenko
2021-05-19  8:04     ` Kent Gibson
2021-05-19  8:30       ` Andy Shevchenko
2021-05-20 13:02         ` Bartosz Golaszewski
2021-05-20 13:14           ` Andy Shevchenko
2021-05-20 14:39             ` Bartosz Golaszewski
2021-11-23 19:15               ` Andy Shevchenko
2021-11-24 12:46                 ` Bartosz Golaszewski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.