linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: wm97xx: Simplify resource management
@ 2022-01-30  8:06 Christophe JAILLET
  2022-01-31 10:22 ` Charles Keepax
  2022-01-31 15:19 ` Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2022-01-30  8:06 UTC (permalink / raw)
  To: Dmitry Torokhov, Charles Keepax, Robert Jarzmik, Mark Brown
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, patches, linux-input

Since the commit in the Fixes tag below, 'wm->input_dev' is a managed
resource that doesn't need to be explicitly unregistered or freed (see
devm_input_allocate_device() documentation)

So, remove some unless line of code to slightly simplify it.

Fixes: c72f61e74073 ("Input: wm97xx: split out touchscreen registering")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Compile tested only
---
 drivers/input/touchscreen/wm97xx-core.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index 78d2ee99f37a..1b58611c8084 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
@@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm)
 	 * extensions)
 	 */
 	wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
-	if (!wm->touch_dev) {
-		ret = -ENOMEM;
-		goto touch_err;
-	}
+	if (!wm->touch_dev)
+		return -ENOMEM;
+
 	platform_set_drvdata(wm->touch_dev, wm);
 	wm->touch_dev->dev.parent = wm->dev;
 	wm->touch_dev->dev.platform_data = pdata;
@@ -629,9 +628,6 @@ static int wm97xx_register_touch(struct wm97xx *wm)
 	return 0;
 touch_reg_err:
 	platform_device_put(wm->touch_dev);
-touch_err:
-	input_unregister_device(wm->input_dev);
-	wm->input_dev = NULL;
 
 	return ret;
 }
@@ -639,8 +635,6 @@ static int wm97xx_register_touch(struct wm97xx *wm)
 static void wm97xx_unregister_touch(struct wm97xx *wm)
 {
 	platform_device_unregister(wm->touch_dev);
-	input_unregister_device(wm->input_dev);
-	wm->input_dev = NULL;
 }
 
 static int _wm97xx_probe(struct wm97xx *wm)
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: wm97xx: Simplify resource management
  2022-01-30  8:06 [PATCH] Input: wm97xx: Simplify resource management Christophe JAILLET
@ 2022-01-31 10:22 ` Charles Keepax
  2022-01-31 15:19 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Charles Keepax @ 2022-01-31 10:22 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Dmitry Torokhov, Charles Keepax, Robert Jarzmik, Mark Brown,
	linux-kernel, kernel-janitors, patches, linux-input

On Sun, Jan 30, 2022 at 09:06:36AM +0100, Christophe JAILLET wrote:
> Since the commit in the Fixes tag below, 'wm->input_dev' is a managed
> resource that doesn't need to be explicitly unregistered or freed (see
> devm_input_allocate_device() documentation)
> 
> So, remove some unless line of code to slightly simplify it.
> 
> Fixes: c72f61e74073 ("Input: wm97xx: split out touchscreen registering")
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---

Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>

Thanks,
Charles

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Input: wm97xx: Simplify resource management
  2022-01-30  8:06 [PATCH] Input: wm97xx: Simplify resource management Christophe JAILLET
  2022-01-31 10:22 ` Charles Keepax
@ 2022-01-31 15:19 ` Mark Brown
  1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2022-01-31 15:19 UTC (permalink / raw)
  To: Dmitry Torokhov, Charles Keepax, Robert Jarzmik, Christophe JAILLET
  Cc: linux-input, linux-kernel, kernel-janitors, patches

On Sun, 30 Jan 2022 09:06:36 +0100, Christophe JAILLET wrote:
> Since the commit in the Fixes tag below, 'wm->input_dev' is a managed
> resource that doesn't need to be explicitly unregistered or freed (see
> devm_input_allocate_device() documentation)
> 
> So, remove some unless line of code to slightly simplify it.
> 
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-linus

Thanks!

[1/1] Input: wm97xx: Simplify resource management
      commit: a4f399a1416f645ac701064a55b0cb5203707ac9

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-31 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-30  8:06 [PATCH] Input: wm97xx: Simplify resource management Christophe JAILLET
2022-01-31 10:22 ` Charles Keepax
2022-01-31 15:19 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).