linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order
@ 2023-03-09 18:46 Andy Shevchenko
  2023-03-09 18:46 ` [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer Andy Shevchenko
  2023-03-10 15:54 ` [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Bartosz Golaszewski
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2023-03-09 18:46 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

Run the steps to deactivate device in the reserved order to what
it has been done in gpio_sim_device_activate_unlocked().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index e5dfd636c63c..a1c8702f362c 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -953,9 +953,9 @@ static void gpio_sim_device_deactivate_unlocked(struct gpio_sim_device *dev)
 
 	swnode = dev_fwnode(&dev->pdev->dev);
 	platform_device_unregister(dev->pdev);
+	gpio_sim_remove_hogs(dev);
 	gpio_sim_remove_swnode_recursive(swnode);
 	dev->pdev = NULL;
-	gpio_sim_remove_hogs(dev);
 }
 
 static ssize_t
-- 
2.39.1


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

* [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer
  2023-03-09 18:46 [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Andy Shevchenko
@ 2023-03-09 18:46 ` Andy Shevchenko
  2023-03-10 15:56   ` Bartosz Golaszewski
  2023-03-10 15:54 ` [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Bartosz Golaszewski
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2023-03-09 18:46 UTC (permalink / raw)
  To: Bartosz Golaszewski, Andy Shevchenko, linux-gpio, linux-kernel
  Cc: Linus Walleij, Bartosz Golaszewski

Print boolean as unsigned integer instead of using %c and manually
converting to a character.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/gpio/gpio-sim.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
index a1c8702f362c..5ac1de5db751 100644
--- a/drivers/gpio/gpio-sim.c
+++ b/drivers/gpio/gpio-sim.c
@@ -684,7 +684,7 @@ gpio_sim_device_config_live_show(struct config_item *item, char *page)
 	live = gpio_sim_device_is_live_unlocked(dev);
 	mutex_unlock(&dev->lock);
 
-	return sprintf(page, "%c\n", live ? '1' : '0');
+	return sprintf(page, "%u\n", live);
 }
 
 static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
-- 
2.39.1


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

* Re: [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order
  2023-03-09 18:46 [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Andy Shevchenko
  2023-03-09 18:46 ` [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer Andy Shevchenko
@ 2023-03-10 15:54 ` Bartosz Golaszewski
  1 sibling, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-03-10 15:54 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Thu, Mar 9, 2023 at 7:46 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Run the steps to deactivate device in the reserved order to what
> it has been done in gpio_sim_device_activate_unlocked().
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-sim.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index e5dfd636c63c..a1c8702f362c 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -953,9 +953,9 @@ static void gpio_sim_device_deactivate_unlocked(struct gpio_sim_device *dev)
>
>         swnode = dev_fwnode(&dev->pdev->dev);
>         platform_device_unregister(dev->pdev);
> +       gpio_sim_remove_hogs(dev);
>         gpio_sim_remove_swnode_recursive(swnode);
>         dev->pdev = NULL;
> -       gpio_sim_remove_hogs(dev);
>  }
>
>  static ssize_t
> --
> 2.39.1
>

Meh, doesn't really fix any problem but applied anyway for consistency.

Thanks,
Bart

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

* Re: [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer
  2023-03-09 18:46 ` [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer Andy Shevchenko
@ 2023-03-10 15:56   ` Bartosz Golaszewski
  0 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2023-03-10 15:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Bartosz Golaszewski, linux-gpio, linux-kernel, Linus Walleij

On Thu, Mar 9, 2023 at 7:46 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Print boolean as unsigned integer instead of using %c and manually
> converting to a character.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/gpio/gpio-sim.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-sim.c b/drivers/gpio/gpio-sim.c
> index a1c8702f362c..5ac1de5db751 100644
> --- a/drivers/gpio/gpio-sim.c
> +++ b/drivers/gpio/gpio-sim.c
> @@ -684,7 +684,7 @@ gpio_sim_device_config_live_show(struct config_item *item, char *page)
>         live = gpio_sim_device_is_live_unlocked(dev);
>         mutex_unlock(&dev->lock);
>
> -       return sprintf(page, "%c\n", live ? '1' : '0');
> +       return sprintf(page, "%u\n", live);
>  }
>
>  static char **gpio_sim_make_line_names(struct gpio_sim_bank *bank,
> --
> 2.39.1
>

Sorry but NACK. At first glance the current version is more readable.
With the one you're proposing, I need to look at the type of "live" to
understand what it will print.

Bart

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

end of thread, other threads:[~2023-03-10 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-09 18:46 [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Andy Shevchenko
2023-03-09 18:46 ` [PATCH v1 2/2] gpio: sim: Print boolean as unsigned integer Andy Shevchenko
2023-03-10 15:56   ` Bartosz Golaszewski
2023-03-10 15:54 ` [PATCH v1 1/2] gpio: sim: Deactivate device in reversed order Bartosz Golaszewski

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