lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210329155201.24e59897@jic23-huawei>
Date:   Mon, 29 Mar 2021 15:52:01 +0100
From:   Jonathan Cameron <jic23@...nel.org>
To:     Alexandru Ardelean <aardelean@...iqon.com>
Cc:     platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-iio@...r.kernel.org, coproscefalo@...il.com,
        hdegoede@...hat.com, mgross@...ux.intel.com, linux@...iqon.com
Subject: Re: [PATCH 06/10] platform/x86: toshiba_acpi: use
 devm_led_classdev_register() for LEDs

On Wed, 24 Mar 2021 14:55:44 +0200
Alexandru Ardelean <aardelean@...iqon.com> wrote:

> With this change the deregistration of the LED objects is made symmetrical
> (and in reverse) with the registration. We also can get rid of the calls
> to led_classdev_unregister(), because the LED objects will be cleaned up
> when the reference to the parent device object goes to zero.
> 
> This change also unifies the reference to the parent object from
> '&acpi_dev->dev' and '&dev->acpi_dev->dev' to 'parent', since it's the same
> reference, and makes the code-lines a bit shorter.
> 
> Signed-off-by: Alexandru Ardelean <aardelean@...iqon.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>

> ---
>  drivers/platform/x86/toshiba_acpi.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index ada2a2d8c913..e787c140eec2 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -3001,10 +3001,6 @@ static int toshiba_acpi_remove(struct acpi_device *acpi_dev)
>  		sysfs_remove_group(&dev->acpi_dev->dev.kobj,
>  				   &toshiba_attr_group);
>  
> -	led_classdev_unregister(&dev->led_dev);
> -	led_classdev_unregister(&dev->kbd_led);
> -	led_classdev_unregister(&dev->eco_led);
> -
>  	if (dev->wwan_rfk) {
>  		rfkill_unregister(dev->wwan_rfk);
>  		rfkill_destroy(dev->wwan_rfk);
> @@ -3114,7 +3110,9 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
>  		dev->led_dev.max_brightness = 1;
>  		dev->led_dev.brightness_set = toshiba_illumination_set;
>  		dev->led_dev.brightness_get = toshiba_illumination_get;
> -		led_classdev_register(&acpi_dev->dev, &dev->led_dev);
> +		ret = devm_led_classdev_register(parent, &dev->led_dev);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	toshiba_eco_mode_available(dev);
> @@ -3123,7 +3121,9 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
>  		dev->eco_led.max_brightness = 1;
>  		dev->eco_led.brightness_set = toshiba_eco_mode_set_status;
>  		dev->eco_led.brightness_get = toshiba_eco_mode_get_status;
> -		led_classdev_register(&dev->acpi_dev->dev, &dev->eco_led);
> +		ret = devm_led_classdev_register(parent, &dev->eco_led);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	toshiba_kbd_illum_available(dev);
> @@ -3139,7 +3139,9 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev)
>  		dev->kbd_led.max_brightness = 1;
>  		dev->kbd_led.brightness_set = toshiba_kbd_backlight_set;
>  		dev->kbd_led.brightness_get = toshiba_kbd_backlight_get;
> -		led_classdev_register(&dev->acpi_dev->dev, &dev->kbd_led);
> +		ret = devm_led_classdev_register(parent, &dev->kbd_led);
> +		if (ret)
> +			return ret;
>  	}
>  
>  	ret = toshiba_touchpad_get(dev, &dummy);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ