Message ID | 20240502211425.8678-1-hdegoede@redhat.com |
---|---|
Headers | show |
Series | KTD2026 indicator LED for X86 Xiaomi Pad2 | expand |
On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@redhat.com> wrote: > > The mutex must be initialized before the LED class device is registered > otherwise there is a race where it may get used before it is initialized: > > DEBUG_LOCKS_WARN_ON(lock->magic != lock) > WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock > ... > RIP: 0010:__mutex_lock+0x7db/0xc10 > ... > set_brightness_delayed_set_brightness.part.0+0x17/0x60 > set_brightness_delayed+0xf1/0x100 > process_one_work+0x222/0x5a0 ... > + mutex_init(&chip->mutex); devm_mutex_init() ? ... There is an immutable branch (in case of this series going behind LED subsystem): https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git/log/?h=ib-leds-locking-6.10
On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@redhat.com> wrote: > > Hi All, > > Here is v8 of Kate's series to add support for Xiaomi Pad2 indicator LED. > > I believe this is ready for merging now. Patch 6/7 has an Acked-by from > Sebastien for merging this patch through the leds tree since it depends > on the earlier patches. LEDs tree maintainers please merge patches 1-6, > then patch 7 can be merged through the pdx86 tree indepdently. independently > > This work includes: > 1. Added the KTD2026 swnode description to describe the LED controller. > 2. Migrated the original driver to fwnode to support x86 platform. > 3. Support for multi-color LED trigger event. for a / events > 4. The LED shows orange when charging and the LED shows green when the > battery is full. > > Moreover, the LED trigger is set to the new trigger, called > "bq27520-0-charging-orange-full-green" for Xiaomi Pad2 so the LED shows > orange when charging and the LED shows green when the battery is full. Reviewed-by: Andy Shevchenko <andy@kernel.org> One comment regarding use of devm_mutex_init() instead.
Hi, On 5/3/24 5:43 AM, Andy Shevchenko wrote: > On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@redhat.com> wrote: >> >> The mutex must be initialized before the LED class device is registered >> otherwise there is a race where it may get used before it is initialized: >> >> DEBUG_LOCKS_WARN_ON(lock->magic != lock) >> WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock >> ... >> RIP: 0010:__mutex_lock+0x7db/0xc10 >> ... >> set_brightness_delayed_set_brightness.part.0+0x17/0x60 >> set_brightness_delayed+0xf1/0x100 >> process_one_work+0x222/0x5a0 > > ... > >> + mutex_init(&chip->mutex); > > devm_mutex_init() ? That is not in Torvald's tree yet. Regards, Hans
On Fri, 03 May 2024, Hans de Goede wrote: > Hi, > > On 5/3/24 5:43 AM, Andy Shevchenko wrote: > > On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@redhat.com> wrote: > >> > >> The mutex must be initialized before the LED class device is registered > >> otherwise there is a race where it may get used before it is initialized: > >> > >> DEBUG_LOCKS_WARN_ON(lock->magic != lock) > >> WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock > >> ... > >> RIP: 0010:__mutex_lock+0x7db/0xc10 > >> ... > >> set_brightness_delayed_set_brightness.part.0+0x17/0x60 > >> set_brightness_delayed+0xf1/0x100 > >> process_one_work+0x222/0x5a0 > > > > ... > > > >> + mutex_init(&chip->mutex); > > > > devm_mutex_init() ? > > That is not in Torvald's tree yet. Neither is this. :) Since we're nearly at -rc7, I think it's safe to say you have time.
Hi, On 5/3/24 9:03 AM, Lee Jones wrote: > On Fri, 03 May 2024, Hans de Goede wrote: > >> Hi, >> >> On 5/3/24 5:43 AM, Andy Shevchenko wrote: >>> On Fri, May 3, 2024 at 12:14 AM Hans de Goede <hdegoede@redhat.com> wrote: >>>> >>>> The mutex must be initialized before the LED class device is registered >>>> otherwise there is a race where it may get used before it is initialized: >>>> >>>> DEBUG_LOCKS_WARN_ON(lock->magic != lock) >>>> WARNING: CPU: 2 PID: 2045 at kernel/locking/mutex.c:587 __mutex_lock >>>> ... >>>> RIP: 0010:__mutex_lock+0x7db/0xc10 >>>> ... >>>> set_brightness_delayed_set_brightness.part.0+0x17/0x60 >>>> set_brightness_delayed+0xf1/0x100 >>>> process_one_work+0x222/0x5a0 >>> >>> ... >>> >>>> + mutex_init(&chip->mutex); >>> >>> devm_mutex_init() ? >> >> That is not in Torvald's tree yet. > > Neither is this. :) > > Since we're nearly at -rc7, I think it's safe to say you have time. Ok I'll prepare a v9 with this addressed and Andy's Reviewed-by added. Regards, Hans