mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthias Brugger <matthias.bgg@gmail.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>,
	broonie@kernel.org, gregkh@linuxfoundation.org, neil@brown.name,
	blogic@openwrt.org
Cc: linux-spi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 3/4] spi: mt7621: Use devm_spi_register_controller()
Date: Mon, 29 Aug 2022 13:16:24 +0200	[thread overview]
Message-ID: <8761d5a8-8044-3568-6ec9-30ea2ba30829@gmail.com> (raw)
In-Reply-To: <b7698e198acc998d99e7e7c895a2910f14f89443.1661599671.git.christophe.jaillet@wanadoo.fr>



On 27/08/2022 13:42, Christophe JAILLET wrote:
> Now that clk_disable_unprepare(clk) is handled with a managed resource,
> we can use devm_spi_register_controller() and axe the .remove function.
> 
> The order between spi_unregister_controller() and clk_disable_unprepare()
> is still the same.
> (see commit 46b5c4fb87ce ("spi: mt7621: Don't leak SPI master in probe
> error path") to see why it matters)
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

Reviewed-by: Matthias Brugger <matthias.bgg@gmail.com>

> ---
> I guess that the dev_set_drvdata() in the probe can be removed as-well.
> But it is also harmless to leave it as-is.
> ---
>   drivers/spi/spi-mt7621.c | 16 +---------------
>   1 file changed, 1 insertion(+), 15 deletions(-)
> 
> diff --git a/drivers/spi/spi-mt7621.c b/drivers/spi/spi-mt7621.c
> index 2580b28042be..114f98dcae5e 100644
> --- a/drivers/spi/spi-mt7621.c
> +++ b/drivers/spi/spi-mt7621.c
> @@ -373,20 +373,7 @@ static int mt7621_spi_probe(struct platform_device *pdev)
>   		return ret;
>   	}
>   
> -	ret = spi_register_controller(master);
> -
> -	return ret;
> -}
> -
> -static int mt7621_spi_remove(struct platform_device *pdev)
> -{
> -	struct spi_controller *master;
> -
> -	master = dev_get_drvdata(&pdev->dev);
> -
> -	spi_unregister_controller(master);
> -
> -	return 0;
> +	return devm_spi_register_controller(&pdev->dev, master);
>   }
>   
>   MODULE_ALIAS("platform:" DRIVER_NAME);
> @@ -397,7 +384,6 @@ static struct platform_driver mt7621_spi_driver = {
>   		.of_match_table = mt7621_spi_match,
>   	},
>   	.probe = mt7621_spi_probe,
> -	.remove = mt7621_spi_remove,
>   };
>   
>   module_platform_driver(mt7621_spi_driver);

  reply	other threads:[~2022-08-29 12:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-27 11:41 [PATCH 0/4] spi: mt7621: Fix an erroneous message + clean-ups Christophe JAILLET
2022-08-27 11:42 ` [PATCH 1/4] spi: mt7621: Fix an error message in mt7621_spi_probe() Christophe JAILLET
2022-08-29 11:07   ` Matthias Brugger
2022-08-30  9:46   ` AngeloGioacchino Del Regno
2022-08-27 11:42 ` [PATCH 2/4] spi: mt7621: Use the devm_clk_get_enabled() helper to simplify error handling Christophe JAILLET
2022-08-29 11:14   ` Matthias Brugger
2022-08-30  9:46   ` AngeloGioacchino Del Regno
2022-08-27 11:42 ` [PATCH 3/4] spi: mt7621: Use devm_spi_register_controller() Christophe JAILLET
2022-08-29 11:16   ` Matthias Brugger [this message]
2022-08-27 11:42 ` [PATCH 4/4] spi: mt7621: Remove 'clk' from 'struct mt7621_spi' Christophe JAILLET
2022-08-29 11:18   ` Matthias Brugger
2022-08-29 17:23     ` Christophe JAILLET
2022-08-29 20:54 ` [PATCH 0/4] spi: mt7621: Fix an erroneous message + clean-ups Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8761d5a8-8044-3568-6ec9-30ea2ba30829@gmail.com \
    --to=matthias.bgg@gmail.com \
    --cc=blogic@openwrt.org \
    --cc=broonie@kernel.org \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=neil@brown.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®