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: <CAMRc=Mcr_yM8Z4bg3EqvxBrRsEqNjigfNoxZAd-5zNeXzG8yeQ@mail.gmail.com>
Date:   Wed, 8 Mar 2023 11:29:47 +0100
From:   Bartosz Golaszewski <brgl@...ev.pl>
To:     Andrew Davis <afd@...com>
Cc:     Peter Tyser <ptyser@...-inc.com>,
        Andy Shevchenko <andy@...nel.org>,
        Linus Walleij <linus.walleij@...aro.org>,
        linux-gpio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 6/6] gpio: tps65086: Use devm_gpiochip_add_data() to
 simplify remove path

On Tue, Mar 7, 2023 at 5:54 PM Andrew Davis <afd@...com> wrote:
>
> Use devm version of gpiochip add function to handle removal for us.
>
> While here update copyright and module author.
>
> Signed-off-by: Andrew Davis <afd@...com>
> ---
>  drivers/gpio/gpio-tps65086.c | 20 ++++----------------
>  1 file changed, 4 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tps65086.c b/drivers/gpio/gpio-tps65086.c
> index 1e9d8262d0ff..0b8b631441ae 100644
> --- a/drivers/gpio/gpio-tps65086.c
> +++ b/drivers/gpio/gpio-tps65086.c
> @@ -1,7 +1,7 @@
>  // SPDX-License-Identifier: GPL-2.0
>  /*
> - * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com/
> - *     Andrew F. Davis <afd@...com>
> + * Copyright (C) 2015-2023 Texas Instruments Incorporated - https://www.ti.com/
> + *     Andrew Davis <afd@...com>
>   *
>   * Based on the TPS65912 driver
>   */
> @@ -86,13 +86,11 @@ static int tps65086_gpio_probe(struct platform_device *pdev)
>         if (!gpio)
>                 return -ENOMEM;
>
> -       platform_set_drvdata(pdev, gpio);
> -
>         gpio->tps = dev_get_drvdata(pdev->dev.parent);
>         gpio->chip = template_chip;
>         gpio->chip.parent = gpio->tps->dev;
>
> -       ret = gpiochip_add_data(&gpio->chip, gpio);
> +       ret = devm_gpiochip_add_data(&pdev->dev, &gpio->chip, gpio);
>         if (ret < 0) {
>                 dev_err(&pdev->dev, "Could not register gpiochip, %d\n", ret);

Drop this log and just return directly the result of
devm_gpiochip_add_data() to save a couple more lines.

Bart

>                 return ret;
> @@ -101,15 +99,6 @@ static int tps65086_gpio_probe(struct platform_device *pdev)
>         return 0;
>  }
>
> -static int tps65086_gpio_remove(struct platform_device *pdev)
> -{
> -       struct tps65086_gpio *gpio = platform_get_drvdata(pdev);
> -
> -       gpiochip_remove(&gpio->chip);
> -
> -       return 0;
> -}
> -
>  static const struct platform_device_id tps65086_gpio_id_table[] = {
>         { "tps65086-gpio", },
>         { /* sentinel */ }
> @@ -121,11 +110,10 @@ static struct platform_driver tps65086_gpio_driver = {
>                 .name = "tps65086-gpio",
>         },
>         .probe = tps65086_gpio_probe,
> -       .remove = tps65086_gpio_remove,
>         .id_table = tps65086_gpio_id_table,
>  };
>  module_platform_driver(tps65086_gpio_driver);
>
> -MODULE_AUTHOR("Andrew F. Davis <afd@...com>");
> +MODULE_AUTHOR("Andrew Davis <afd@...com>");
>  MODULE_DESCRIPTION("TPS65086 GPIO driver");
>  MODULE_LICENSE("GPL v2");
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ