From 3a1e341c5687b4e8fe51ca1c933b1f23ab3304c1 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Jul 2021 09:59:41 +0200 Subject: ALSA: pcsp: Allocate resources with device-managed APIs Use the new snd_devm_card_new() for the card object allocation and the devres version for the input device, and clean up the superfluous remove callback. Link: https://lore.kernel.org/r/20210715075941.23332-80-tiwai@suse.de Signed-off-by: Takashi Iwai --- sound/drivers/pcsp/pcsp_input.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'sound/drivers/pcsp/pcsp_input.c') diff --git a/sound/drivers/pcsp/pcsp_input.c b/sound/drivers/pcsp/pcsp_input.c index e79603fe743d..5a799f7f00a2 100644 --- a/sound/drivers/pcsp/pcsp_input.c +++ b/sound/drivers/pcsp/pcsp_input.c @@ -78,7 +78,7 @@ int pcspkr_input_init(struct input_dev **rdev, struct device *dev) { int err; - struct input_dev *input_dev = input_allocate_device(); + struct input_dev *input_dev = devm_input_allocate_device(dev); if (!input_dev) return -ENOMEM; @@ -95,19 +95,9 @@ int pcspkr_input_init(struct input_dev **rdev, struct device *dev) input_dev->event = pcspkr_input_event; err = input_register_device(input_dev); - if (err) { - input_free_device(input_dev); + if (err) return err; - } *rdev = input_dev; return 0; } - -int pcspkr_input_remove(struct input_dev *dev) -{ - pcspkr_stop_sound(); - input_unregister_device(dev); /* this also does kfree() */ - - return 0; -} -- cgit v1.2.3