From patchwork Thu Jul 14 08:57:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Lin X-Patchwork-Id: 9229803 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D161608A1 for ; Thu, 14 Jul 2016 13:20:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E9DF27FB6 for ; Thu, 14 Jul 2016 13:20:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 335A4281A7; Thu, 14 Jul 2016 13:20:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48BDF27FB6 for ; Thu, 14 Jul 2016 13:20:57 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 546B3265885; Thu, 14 Jul 2016 15:20:56 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E2E542666D9; Thu, 14 Jul 2016 13:24:59 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 82F922666D9; Thu, 14 Jul 2016 13:24:58 +0200 (CEST) Received: from mail-pa0-f65.google.com (mail-pa0-f65.google.com [209.85.220.65]) by alsa0.perex.cz (Postfix) with ESMTP id C18D1266EEB for ; Thu, 14 Jul 2016 10:57:12 +0200 (CEST) Received: by mail-pa0-f65.google.com with SMTP id q2so4323714pap.0 for ; Thu, 14 Jul 2016 01:57:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=o848qCR2aVDrGUUukjSazRf0w7sLVx1rqKUVTLfCMKc=; b=RU74A353y2eJzZOVldKqYTfbaDI9Wj4TesYyvohmh/usdzg6aZ28N1AkGGUfiAwqmm gGjcIT3ZimHhG3/jyTHPz+IPnmlI9coKBXd1iSslCceVToTEtFDY1dnAw+YxuoujYEQs ov72H2s+twtGd0IA4A2Bu8Hl5+JYurHvsVDtzx3xFlhxoIeRbbgziqapDA7oO0+V8LcZ zeKUWCF7VHsFb+8RJC31k4Sj/BShr/7qIKtHsX7Sl4UxKB/d47w19CzCsF8m2mwdtXGy YfkBxJCqrh/BBSEiRHxa7cwjzi/NYfGZ77KDFXdSV/vQB6MHOKYiNw71Ju+oHvYHscvc YI+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:mime-version :content-transfer-encoding; bh=o848qCR2aVDrGUUukjSazRf0w7sLVx1rqKUVTLfCMKc=; b=BDQD8S2VJslUZYV8mned3pK6BYpf9VI5ny2yJ0/cylG+AnOExuIxLxVernBKBr23p5 FVHvZefmJEpEK1anjpjXUMNtE1BdNzHsChfG9QQxbgzbVu9Pr0baWlLw/wa+ilQ9Eg/z bwVE4oQBR5EorRhA2mA/XtOiXDs1jBFlgFSI+hb9lgIJRlkj8zy32scUPobkklNE+mPq s0TZPUYDfVoqAURMIbc6dzCbjiy5GR+cel9NU2QW9lkAMiaQ/vNg+ogbTwl4Gg5dZzZo tsZpL0PEcyHkothT8j0/UCVwQ48ZkkX7sJhhaJTiCkXzhP9rpKafba47ouS0jPrx6LiX h7+A== X-Gm-Message-State: ALyK8tLIz4PhzGRtwvLDkVx/S/rl1pLYfSLc8KGdAWeA6yPD7/PQTjKxsw+PHh4Ls8vihA== X-Received: by 10.66.135.40 with SMTP id pp8mr21050529pab.113.1468486630802; Thu, 14 Jul 2016 01:57:10 -0700 (PDT) Received: from [192.168.1.168] (59-115-244-3.dynamic.hinet.net. [59.115.244.3]) by smtp.gmail.com with ESMTPSA id j8sm2807501paj.22.2016.07.14.01.57.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Jul 2016 01:57:09 -0700 (PDT) Message-ID: <1468486625.10067.1.camel@ingics.com> From: Axel Lin To: Mark Brown Date: Thu, 14 Jul 2016 16:57:05 +0800 X-Mailer: Evolution 3.16.5-1ubuntu3.1 Mime-Version: 1.0 Cc: Oder Chiou , Bard Liao , alsa-devel@alsa-project.org, Liam Girdwood Subject: [alsa-devel] [PATCH RESEND] ASoC: rt5514-spi: Convert to use devm_* API X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Use devm_* API to simplify the code. This patch also fixes the return value in probe error paths. Signed-off-by: Axel Lin --- sound/soc/codecs/rt5514-spi.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 8a9382e..e1b326d 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -409,33 +409,21 @@ static int rt5514_spi_probe(struct spi_device *spi) rt5514_spi = spi; - ret = snd_soc_register_platform(&spi->dev, &rt5514_spi_platform); + ret = devm_snd_soc_register_platform(&spi->dev, &rt5514_spi_platform); if (ret < 0) { dev_err(&spi->dev, "Failed to register platform.\n"); - goto err_plat; + return ret; } - ret = snd_soc_register_component(&spi->dev, &rt5514_spi_dai_component, - &rt5514_spi_dai, 1); + ret = devm_snd_soc_register_component(&spi->dev, + &rt5514_spi_dai_component, + &rt5514_spi_dai, 1); if (ret < 0) { dev_err(&spi->dev, "Failed to register component.\n"); - goto err_comp; + return ret; } return 0; -err_comp: - snd_soc_unregister_platform(&spi->dev); -err_plat: - - return 0; -} - -static int rt5514_spi_remove(struct spi_device *spi) -{ - snd_soc_unregister_component(&spi->dev); - snd_soc_unregister_platform(&spi->dev); - - return 0; } static const struct of_device_id rt5514_of_match[] = { @@ -450,7 +438,6 @@ static struct spi_driver rt5514_spi_driver = { .of_match_table = of_match_ptr(rt5514_of_match), }, .probe = rt5514_spi_probe, - .remove = rt5514_spi_remove, }; module_spi_driver(rt5514_spi_driver);