[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fa53fa80-4c0e-44d1-a62d-da219831526c@web.de>
Date: Thu, 27 Jun 2024 07:52:28 +0200
From: Markus Elfring <Markus.Elfring@....de>
To: Christian Marangi <ansuelsmth@...il.com>, linux-leds@...r.kernel.org,
Lee Jones <lee@...nel.org>, Pavel Machek <pavel@....cz>
Cc: LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] leds: leds-lp55xx: Convert mutex lock/unlock to guard
API
> Convert any entry of mutex lock/unlock to guard API and simplify code.
Thanks that you would like to support another bit of collateral evolution.
* Would you get into the mood to benefit any more from applications
of scope-based resource management?
* Will development interests accordingly grow to adjust further source code places
according to known pairs of function calls?
> With the use of guard API, handling for selttest functions can be
selftest?
> greatly simplified.
I find cover letters helpful for patch series.
…
> +++ b/drivers/leds/leds-lp5521.c
> @@ -9,6 +9,7 @@
> * Milo(Woogyom) Kim <milo.kim@...com>
> */
>
> +#include <linux/cleanup.h>
> #include <linux/delay.h>
> #include <linux/firmware.h>
…
I guess that this proposed addition is not directly needed here (and related places)
because the header file is included for the macro call “DEFINE_GUARD(mutex, …)” already.
https://elixir.bootlin.com/linux/v6.10-rc5/source/include/linux/mutex.h#L22
…
> @@ -185,9 +186,9 @@ static ssize_t lp5521_selftest(struct device *dev,
> struct lp55xx_chip *chip = led->chip;
> int ret;
>
> - mutex_lock(&chip->lock);
> + guard(mutex, &chip->lock);
> +
> ret = lp5521_run_selftest(chip, buf);
> - mutex_unlock(&chip->lock);
>
> return sysfs_emit(buf, "%s\n", ret ? "FAIL" : "OK");
> }
…
How do you think about to omit any blank lines (also at similar places)?
Regards,
Markus
Powered by blists - more mailing lists